picolisp&imagemagick: Minor bumpsg
[termux-packages] / packages / picolisp / build.sh
CommitLineData
026f3b8b
FF
1TERMUX_PKG_HOMEPAGE=http://picolisp.com
2TERMUX_PKG_DESCRIPTION="Lisp interpreter and application server framework"
edea1f16 3TERMUX_PKG_DEPENDS="libcrypt, openssl"
bb27a0ec 4_PICOLISP_YEAR=16
3dd02387 5_PICOLISP_MONTH=6
035a2a67 6_PICOLISP_DAY=4
bb27a0ec 7TERMUX_PKG_VERSION=${_PICOLISP_YEAR}.${_PICOLISP_MONTH}.${_PICOLISP_DAY}
89f5e911 8TERMUX_PKG_SRCURL=http://software-lab.de/picoLisp.tgz
3dd02387 9TERMUX_PKG_NO_SRC_CACHE=yes
026f3b8b
FF
10TERMUX_PKG_FOLDERNAME=picoLisp
11TERMUX_PKG_BUILD_IN_SRC=true
026f3b8b 12
303fbc96 13termux_step_pre_configure() {
f9bd2f09 14 # Validate that we have the right version:
bb27a0ec 15 grep -q "$_PICOLISP_YEAR $_PICOLISP_MONTH $_PICOLISP_DAY" src64/version.l
f9bd2f09 16
b605215d 17 if [ $TERMUX_ARCH_BITS = 64 ]; then
3dd02387 18 cd $TERMUX_PKG_SRCDIR
b605215d
FF
19 if [ $TERMUX_ARCH = "aarch64" ]; then
20 export TERMUX_PKG_EXTRA_MAKE_ARGS=arm64.linux
3dd02387
FF
21 termux_download http://software-lab.de/arm64.linux.tgz $TERMUX_PKG_TMPDIR/arm64.linux.tgz
22 tar xf $TERMUX_PKG_TMPDIR/arm64.linux.tgz
b605215d
FF
23 elif [ $TERMUX_ARCH = "x86_64" ]; then
24 export TERMUX_PKG_EXTRA_MAKE_ARGS=x86-64.linux
3dd02387
FF
25 termux_download http://software-lab.de/x86-64.linux.tgz $TERMUX_PKG_TMPDIR/x86-64.linux.tgz
26 tar xf $TERMUX_PKG_TMPDIR/x86-64.linux.tgz
b605215d
FF
27 else
28 echo "Error: Unsupported arch: $TERMUX_ARCH"
29 exit 1
30 fi
3dd02387
FF
31 TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/src64
32 else
33 TERMUX_PKG_SRCDIR=$TERMUX_PKG_SRCDIR/src
b605215d 34 fi
303fbc96 35 TERMUX_PKG_BUILDDIR=$TERMUX_PKG_SRCDIR
edea1f16 36 ORIG_CFLAGS="$CFLAGS"
303fbc96
FF
37 CFLAGS+=" -c $LDFLAGS $CPPFLAGS"
38}
39
40termux_step_make_install () {
edea1f16
FF
41 cd $TERMUX_PKG_SRCDIR/
42
0db46e54 43 if [ $TERMUX_ARCH_BITS = "64" ]; then
bb5cfa8c 44 $AS -pie -o ../bin/picolisp -rdynamic ${TERMUX_PKG_EXTRA_MAKE_ARGS}.base.s -lc -lm -ldl
0db46e54 45 chmod +x ../bin/picolisp
bb5cfa8c 46 $AS -pie -o ../lib/ext -shared -export-dynamic ${TERMUX_PKG_EXTRA_MAKE_ARGS}.ext.s
3dd02387 47 $AS -pie -o ../lib/ht -shared -export-dynamic ${TERMUX_PKG_EXTRA_MAKE_ARGS}.ht.s
0db46e54
FF
48 fi
49
b605215d 50 mkdir -p $TERMUX_PREFIX/share/man/man1
303fbc96
FF
51 cp $TERMUX_PKG_SRCDIR/../man/man1/{pil,picolisp}.1 $TERMUX_PREFIX/share/man/man1/
52
53 rm -Rf $TERMUX_PREFIX/lib/picolisp
54 mkdir -p $TERMUX_PREFIX/lib/picolisp
55
56 cp -Rf $TERMUX_PKG_SRCDIR/../* $TERMUX_PREFIX/lib/picolisp/
57 rm -Rf $TERMUX_PREFIX/lib/picolisp/{src,src64,man,java,ersatz}
58
59 # Replace first line "#!/usr/bin/picolisp /usr/lib/picolisp/lib.l":
60 sed -i "1 s|^.*$|#!$TERMUX_PREFIX/bin/picolisp $TERMUX_PREFIX/lib/picolisp/lib.l|g" $TERMUX_PREFIX/lib/picolisp/bin/pil
61
62 ( cd $TERMUX_PREFIX/bin && ln -f -s ../lib/picolisp/bin/picolisp picolisp && ln -f -s ../lib/picolisp/bin/pil pil )
edea1f16 63
1b1bdbf8 64 # Bundled tools:
a47b5f19
FF
65 $CC $ORIG_CFLAGS $CPPFLAGS $LDFLAGS -o $TERMUX_PREFIX/lib/picolisp/bin/ssl ../src/ssl.c -lssl -lcrypto
66 $CC $ORIG_CFLAGS $CPPFLAGS $LDFLAGS -o $TERMUX_PREFIX/lib/picolisp/bin/httpGate ../src/httpGate.c -lssl -lcrypto
1b1bdbf8
FF
67
68 # Man pages:
a0443f31 69 cp $TERMUX_PKG_SRCDIR/../man/man1/{pil,picolisp}.1 $TERMUX_PREFIX/share/man/man1/
026f3b8b 70}