| 1 | TERMUX_PKG_HOMEPAGE=http://www.swi-prolog.org/ |
| 2 | TERMUX_PKG_DESCRIPTION="Comprehensive free Prolog environment" |
| 3 | TERMUX_PKG_VERSION=7.3.6 |
| 4 | TERMUX_PKG_SRCURL=http://www.swi-prolog.org/download/devel/src/swipl-${TERMUX_PKG_VERSION}.tar.gz |
| 5 | TERMUX_PKG_BUILD_IN_SRC=true |
| 6 | TERMUX_PKG_HOSTBUILD=true |
| 7 | TERMUX_PKG_DEPENDS="readline, libgmp" |
| 8 | |
| 9 | termux_step_host_build () { |
| 10 | cp -Rf $TERMUX_PKG_SRCDIR/* . |
| 11 | |
| 12 | # apt install libgmp-dev:i386 libncurses5-dev:i386 |
| 13 | ./configure --host=i386-linux --disable-readline #--disable-gmp |
| 14 | |
| 15 | if [ $TERMUX_ARCH_BITS = 32 ]; then |
| 16 | # "Make sure that the native swipl has the same word-length (32/64 bits) |
| 17 | # and use the native swipl for creating the boot file" |
| 18 | # https://groups.google.com/forum/#!topic/swi-prolog/8lBcjb9cxuk |
| 19 | find . -name Makefile | xargs perl -p -i -e 's/CFLAGS=/CFLAGS=-m32 /' |
| 20 | find . -name Makefile | xargs perl -p -i -e 's/LDFLAGS=/LDFLAGS=-m32 /' |
| 21 | fi |
| 22 | make |
| 23 | } |
| 24 | |
| 25 | |
| 26 | termux_step_post_configure () { |
| 27 | cp $TERMUX_PKG_HOSTBUILD_DIR/src/defatom src/ |
| 28 | $TERMUX_TOUCH -d "next hour" $TERMUX_PKG_BUILDDIR/src/defatom |
| 29 | #cp $TERMUX_PKG_HOSTBUILD_DIR/{defatom,swipl} $TERMUX_PKG_BUILDDIR/src/ |
| 30 | |
| 31 | #bdir=/home/fornwall/termux/swi-prolog/src/src |
| 32 | #PLARCH=arm-linux |
| 33 | perl -p -i -e "s|bdir=|bdir=$TERMUX_PKG_HOSTBUILD_DIR/src/ # |" */swipl.sh |
| 34 | perl -p -i -e "s|PLARCH=|PLARCH=i386-linux # |" */swipl.sh |
| 35 | perl -p -i -e "s|${TERMUX_ARCH}-linux|i386-linux|" */swipl.sh |
| 36 | } |
| 37 | |
| 38 | termux_step_post_make_install () { |
| 39 | mv $TERMUX_PREFIX/lib/swipl-$TERMUX_PKG_VERSION/lib/${TERMUX_ARCH}-linux/libswipl.so* $TERMUX_PREFIX/lib/ |
| 40 | } |