# Maintainer: Von Random <von@vdrandom.org>
# Contributor: Adriaan Zonnenberg <amz@adriaan.xyz>
# Contributor: Florian Bruhin (The-Compiler) <archlinux.org@the-compiler.org>
# Contributor: Daniel Micay <danielmicay@gmail.com>
# Contributor: Sébastien Luttringer
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: tobias <tobias@archlinux.org>
# Contributor: dibblethewrecker dibblethewrecker.at.jiwe.dot.org

_pkgname=rxvt-unicode
pkgname=rxvt-unicode-cvs-opt
pkgver=20181211
pkgrel=1
pkgdesc='A unicode enabled rxvt-clone terminal emulator (urxvt) - latest cvs revision'
arch=('i686' 'x86_64')
url='http://software.schmorp.de/pkg/rxvt-unicode.html'
license=('GPL')
depends=('libxft' 'perl' 'startup-notification' 'rxvt-unicode-terminfo')
makedepends=('cvs')
optdepends=('gtk2-perl: to use the urxvt-tabbed')
source=(
    'font-width-fix.patch'
    'line-spacing-fix.patch'
    'urxvt-sgr.patch'
)
sha256sums=(
    '686770fe4e8d6bb0ba497ad2e1f217d17515f2544d80abe76496c63ead2bfaa4'
    '546a388d0595404a59c71c3eaeba331031032a75f96c57e9a860f27bbd7ebfcc'
    'f36110dce2dce4d6e275410de820f314b72a02dbad08f637c64b0da769c0c8f4'
)
prefix='/opt/rxvt-unicode'

prepare() {
  cvs -z3 -d :pserver:anonymous@cvs.schmorp.de/schmorpforge co ${_pkgname}
  cd ${_pkgname}

  patch -p0 -i ../font-width-fix.patch
  patch -p0 -i ../line-spacing-fix.patch
  patch -p0 -i ../urxvt-sgr.patch
}

build() {
  cd ${_pkgname}
  # do not specify --with-terminfo (FS#46424)
  ./configure \
    --prefix=${prefix} \
    --enable-256-color \
    --enable-combining \
    --enable-fading \
    --enable-font-styles \
    --enable-iso14755 \
    --enable-keepscrolling \
    --enable-lastlog \
    --enable-mousewheel \
    --enable-next-scroll \
    --enable-perl \
    --enable-pointer-blank \
    --enable-rxvt-scroll \
    --enable-selectionscrolling \
    --enable-slipwheeling \
    --enable-smart-resize \
    --enable-startup-notification \
    --enable-transparency \
    --enable-unicode3 \
    --enable-utmp \
    --enable-wtmp \
    --enable-xft \
    --enable-xim \
    --enable-xterm-scroll \
    --disable-frills
  make
}

package() {
  cd $_pkgname

  make DESTDIR="$pkgdir" install
}