# $Id: PKGBUILD 128984 2015-03-09 16:49:01Z arodseth $
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Thomas S Hatch <thatch45@gmail.com>
# Contributor: Corrado 'bardo' Primier <corrado.primier@mail.polimi.it>
# Contributor: Jochem Kossen <j.kossen@home.nl>
# Contributor: Daniel J Griffiths <ghost1227@archlinux.us>

pkgname=scite
pkgver=3.5.4
pkgrel=1
pkgdesc='Editor with facilities for building and running programs'
arch=('x86_64' 'i686')
url='http://www.scintilla.org/SciTE.html'
license=('custom:scite')
depends=('desktop-file-utils' 'gtk2')
makedepends=('setconf')
backup=('usr/share/scite/SciTEGlobal.properties')
install="$pkgname.install"
source=("http://downloads.sourceforge.net/sourceforge/scintilla/${pkgname}${pkgver//./}.tgz")
sha256sums=('96041bb6a3aed321e353db7c8fcde720b99cab98cbfa2ef62a5e07dd523e1495')

prepare() {
  if [ $?CXXBASEFLAGS == 1 ]; then
    sed '0,/CXXTFLAGS=/s//nop=/' -i scite/gtk/makefile
    setconf scite/gtk/makefile CXXTFLAGS "-DNDEBUG ${CXXFLAGS} $(CXXBASEFLAGS)"
  fi
  sed '0,/CXXFLAGS=/s//nop=/' -i scintilla/gtk/makefile
  setconf scintilla/gtk/makefile CXXFLAGS \
    "-DNDEBUG ${CXXFLAGS} \$(CXXBASEFLAGS) \$(THREADFLAGS)"
  setconf scintilla/gtk/makefile CXXBASEFLAGS \
    "-Wno-missing-braces -Wno-char-subscripts ${CXXFLAGS} -DGTK -DSCI_LEXER \$(INCLUDEDIRS)"
}

build() {
  make -C "scintilla/gtk"
  make -C "$pkgname/gtk"
}

package() {
  make -C "$pkgname/gtk" DESTDIR="$pkgdir" install
  install -Dm644 "$pkgname/License.txt" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE-scite"
  install -Dm644 "scintilla/License.txt" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE-scintilla"
  ln -sf "/usr/bin/SciTE" "$pkgdir/usr/bin/scite"
}

# vim:set ts=2 sw=2 et:
