maxima: Adapt for cross build

This commit is contained in:
Tee KOBAYASHI 2021-12-23 22:29:13 +09:00 committed by Henrik Grimler
parent d4aca773b9
commit 3b6d0dfe81
No known key found for this signature in database
GPG Key ID: B0076E490B71616B
2 changed files with 86 additions and 3 deletions

View File

@ -2,9 +2,81 @@ TERMUX_PKG_HOMEPAGE="https://maxima.sourceforge.io/"
TERMUX_PKG_DESCRIPTION="A Computer Algebra System"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="Marlin Sööse <marlin.soose@laro.se>"
TERMUX_PKG_VERSION="5.45.1"
TERMUX_PKG_SRCURL="https://downloads.sourceforge.net/sourceforge/maxima/Maxima-source/$TERMUX_PKG_VERSION-source/maxima-$TERMUX_PKG_VERSION.tar.gz"
TERMUX_PKG_SHA256="fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc"
TERMUX_PKG_VERSION=()
TERMUX_PKG_VERSION+=(5.45.1)
TERMUX_PKG_VERSION+=(21.2.1) # ECL version
TERMUX_PKG_SRCURL=(https://downloads.sourceforge.net/sourceforge/maxima/Maxima-source/$TERMUX_PKG_VERSION-source/maxima-$TERMUX_PKG_VERSION.tar.gz
https://common-lisp.net/project/ecl/static/files/release/ecl-${TERMUX_PKG_VERSION[1]}.tgz)
TERMUX_PKG_SHA256=(fe9016276970bef214a1a244348558644514d7fdfaa4fc8b9d0e87afcbb4e7dc
b15a75dcf84b8f62e68720ccab1393f9611c078fcd3afdd639a1086cad010900)
TERMUX_PKG_DEPENDS="ecl"
TERMUX_PKG_BUILD_IN_SRC="true"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--enable-ecl"
TERMUX_PKG_HOSTBUILD=true
termux_step_post_get_source() {
mv ecl-${TERMUX_PKG_VERSION[1]} ecl
}
termux_step_host_build() {
_PREFIX_FOR_BUILD=$TERMUX_PKG_HOSTBUILD_DIR/prefix
mkdir -p $_PREFIX_FOR_BUILD
mkdir ecl
pushd ecl
local ecl_srcdir=$TERMUX_PKG_SRCDIR/ecl/src
autoreconf -fi $ecl_srcdir/gmp
$ecl_srcdir/configure ABI=${TERMUX_ARCH_BITS} \
CFLAGS=-m${TERMUX_ARCH_BITS} LDFLAGS=-m${TERMUX_ARCH_BITS} \
--prefix=$_PREFIX_FOR_BUILD --srcdir=$ecl_srcdir --disable-c99complex
make -j $TERMUX_MAKE_PROCESSES
make install
popd
PATH=$_PREFIX_FOR_BUILD/bin:$PATH
mkdir maxima
pushd maxima
find $TERMUX_PKG_SRCDIR -mindepth 1 -maxdepth 1 ! -name ecl -exec cp -a \{\} ./ \;
./configure --prefix=$_PREFIX_FOR_BUILD $TERMUX_PKG_EXTRA_CONFIGURE_ARGS
make -j $TERMUX_MAKE_PROCESSES
popd
}
termux_step_pre_configure() {
_NEED_DUMMY_LIBPTHREAD_A=
_LIBPTHREAD_A=$TERMUX_PREFIX/lib/libpthread.a
if [ ! -e $_LIBPTHREAD_A ]; then
_NEED_DUMMY_LIBPTHREAD_A=true
echo '!<arch>' > $_LIBPTHREAD_A
fi
}
termux_step_make() {
cat > $_PREFIX_FOR_BUILD/bin/gcc <<-EOF
#!/bin/sh
exec \$CC \$CFLAGS \$CPPFLAGS \$LDFLAGS "\$@" -Wno-unused-command-line-argument
EOF
chmod 0700 $_PREFIX_FOR_BUILD/bin/gcc
local loop_max=1000
local f
local i=0
while [ ! -e src/binary-ecl/maxima ]; do
make -C src
for f in $(find src/binary-ecl -type f -name '*.fas'); do
cp $TERMUX_PKG_HOSTBUILD_DIR/maxima/$f $f
done
i=$(( $i + 1 ))
if [ $i -gt $loop_max ]; then
return 1
fi
done
make
rm -f $_PREFIX_FOR_BUILD/bin/gcc
}
termux_step_post_make_install() {
if [ $_NEED_DUMMY_LIBPTHREAD_A ]; then
rm -f $_LIBPTHREAD_A
fi
}

View File

@ -0,0 +1,11 @@
--- a/ecl/src/gmp/acinclude.m4
+++ b/ecl/src/gmp/acinclude.m4
@@ -594,7 +594,7 @@
#ifdef __GNUC__
typedef unsigned long long t1;typedef t1*t2;
-__inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
+static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}