6 pkgdesc='Fast Universal Lexical Analyzer Generator'
8 url='http://quex.sourceforge.net/'
11 optdepends=('pkg-config: to get include path by calling `pkg-config quex --cflags`')
12 source=("http://netcologne.dl.sourceforge.net/project/quex/DOWNLOAD/quex-${pkgver}.tar.gz")
14 md5sums=('c3b16f1558b3751d22c6ae210f2a52d7')
19 local dst=${pkgdir}/${prefix}
21 cp -r $srcdir/$pkgname-$pkgver $dst
23 # set python2 for the sha-bang line
24 sed -i 's/^\#! \/usr\/bin\/env python$/\#! \/usr\/bin\/env python2/' $dst/$pkgname-$pkgver/quex-exe.py
26 # default QUEX_PATH to the installation directory (to make the environment variable optional)
27 # inside the python source
28 find $pkgdir -iname "*.py" -exec sed -i "s/os.environ\[\"QUEX_PATH\"\]/os.getenv(\"QUEX_PATH\", \"\/usr\/bin\/$pkgname-$pkgver\/\")/" {} \;
29 # and also inside the Makefiles
30 find $pkgdir/$prefix/$pkgname-$pkgver/demo -iname "Makefile" -exec sed -i "s/\$(error The environment variable QUEX_PATH is not defined!)/QUEX_PATH=\/usr\/bin\/$pkgname-$pkgver\//" {} \;
33 # link "quex" to the main script
34 ln -s ./$pkgname-$pkgver/quex-exe.py $pkgdir/usr/bin/quex
37 # create metadata file for pkg-config
38 mkdir -p $pkgdir/usr/lib/pkgconfig
39 x=$pkgdir/usr/lib/pkgconfig/quex.pc
40 echo "quexpath=$prefix/$pkgname-$pkgver" >> $x
41 echo "Name: Quex" >> $x
42 echo "Description: $pkgdesc" >> $x
43 echo "Version: $pkgver" >> $x
44 echo "URL: $url" >> $x
45 echo "Cflags: -I\${quexpath}" >> $x