From 6867fb152ee9759744f3f07503abeb54946ff04e Mon Sep 17 00:00:00 2001 From: Ronald Y Date: Mon, 26 Feb 2024 16:32:18 +0000 Subject: [PATCH] new package: astrometry.net --- .../0001-gsl-an-configure-cross-compile.patch | 13 ++++++++ .../0002-solver-landroid-glob.patch | 13 ++++++++ tur/astrometry.net/0003-ioutils-TMPDIR.patch | 16 ++++++++++ .../0004-bypass-netpbm-test.patch | 31 +++++++++++++++++++ tur/astrometry.net/build.sh | 24 ++++++++++++++ 5 files changed, 97 insertions(+) create mode 100644 tur/astrometry.net/0001-gsl-an-configure-cross-compile.patch create mode 100644 tur/astrometry.net/0002-solver-landroid-glob.patch create mode 100644 tur/astrometry.net/0003-ioutils-TMPDIR.patch create mode 100644 tur/astrometry.net/0004-bypass-netpbm-test.patch create mode 100644 tur/astrometry.net/build.sh diff --git a/tur/astrometry.net/0001-gsl-an-configure-cross-compile.patch b/tur/astrometry.net/0001-gsl-an-configure-cross-compile.patch new file mode 100644 index 000000000..3c1e72716 --- /dev/null +++ b/tur/astrometry.net/0001-gsl-an-configure-cross-compile.patch @@ -0,0 +1,13 @@ +diff --git a/gsl-an/Makefile b/gsl-an/Makefile +index 8b9ced0..cf1995f 100644 +--- a/gsl-an/Makefile ++++ b/gsl-an/Makefile +@@ -201,7 +201,7 @@ $(GSL_LIB): config.h $(GSL_OBJS) + $(RANLIB) $@ + + config.h: configure config.h.in +- ./configure --enable-shared=no --prefix=`pwd`/stage ++ ./configure --disable-rpath --disable-rpath-hack --enable-shared=no --host=x86_64-linux-android --prefix=`pwd`/stage + touch $@ + + config.h.in: ; diff --git a/tur/astrometry.net/0002-solver-landroid-glob.patch b/tur/astrometry.net/0002-solver-landroid-glob.patch new file mode 100644 index 000000000..bb61eb6d4 --- /dev/null +++ b/tur/astrometry.net/0002-solver-landroid-glob.patch @@ -0,0 +1,13 @@ +diff --git a/solver/Makefile b/solver/Makefile +index f225256..d5dfbcd 100644 +--- a/solver/Makefile ++++ b/solver/Makefile +@@ -315,7 +315,7 @@ unpermute-stars: unpermute-stars-main.o $(SLIB) + ALL_OBJ += unpermute-stars-main.o + + astrometry-engine: engine-main.o $(SLIB) +- $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) ++ $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -landroid-glob + + solve-field: solve-field.o augment-xylist.o image2xy-files.o $(SLIB) $(CFITS_SLIB) + $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^ $(CFITS_LIB) $(LDLIBS) diff --git a/tur/astrometry.net/0003-ioutils-TMPDIR.patch b/tur/astrometry.net/0003-ioutils-TMPDIR.patch new file mode 100644 index 000000000..d587b5639 --- /dev/null +++ b/tur/astrometry.net/0003-ioutils-TMPDIR.patch @@ -0,0 +1,16 @@ +diff --git a/util/ioutils.c b/util/ioutils.c +index 3a9bd48..91b8832 100644 +--- a/util/ioutils.c ++++ b/util/ioutils.c +@@ -638,7 +638,11 @@ char* shell_escape(const char* str) { + } + + static char* get_temp_dir() { ++#ifdef __TERMUX__ ++ char* dir = getenv("TMPDIR"); ++#else + char* dir = getenv("TMP"); ++#endif + if (!dir) { + dir = "/tmp"; + } diff --git a/tur/astrometry.net/0004-bypass-netpbm-test.patch b/tur/astrometry.net/0004-bypass-netpbm-test.patch new file mode 100644 index 000000000..ef7922188 --- /dev/null +++ b/tur/astrometry.net/0004-bypass-netpbm-test.patch @@ -0,0 +1,31 @@ +diff --git a/util/Makefile b/util/Makefile +index c35a8da..0338b8f 100644 +--- a/util/Makefile ++++ b/util/Makefile +@@ -267,11 +267,7 @@ $(INCLUDE_DIR)/os-features-config.h: os-features-test.c + @echo " NETPBM_INC is $(NETPBM_INC_ORIG)" + @echo " NETPBM_LIB is $(NETPBM_LIB_ORIG)" + @echo "Testing netpbm..." >> os-features.log +- (($(CC) -o os-features-test-netpbm \ +- $(CPPFLAGS) $(CFLAGS) $(NETPBM_INC_ORIG) $^ $(LDFLAGS) $(NETPBM_LIB_ORIG) >> os-features.log && \ +- ./os-features-test-netpbm >> os-features.log && \ +- echo "#define HAVE_NETPBM 1") \ +- || echo "#define HAVE_NETPBM 0") >> $@.tmp ++ echo "#define HAVE_NETPBM 1" >> $@.tmp + @echo "--------------- End of expected error messages -----------------" + @echo + mv $@.tmp $@ +@@ -297,12 +293,4 @@ makefile.os-features: os-features-test.c +- (($(CC) -o os-features-test-netpbm-make \ +- $(CPPFLAGS) $(CFLAGS) $(NETPBM_INC_ORIG) $^ $(LDFLAGS) $(NETPBM_LIB_ORIG) >> os-features-makefile.log && \ +- ./os-features-test-netpbm-make >> os-features-makefile.log && \ +- echo "HAVE_NETPBM := yes") \ +- || (echo "# Astrometry.net didn't find netpbm; not setting HAVE_NETPBM."; \ +- echo "# See os-features-makefile.log for details."; \ +- echo "# To re-run this test, do 'make reconfig; make makefile.os-features' (in the 'util' directory)"; \ +- echo "# Or to do it yourself, just uncomment this line:"; \ +- echo "# HAVE_NETPBM := yes")) \ ++ echo "HAVE_NETPBM := yes" \ + ; \ + echo) > $@.tmp + @echo "--------------- End of expected error messages -----------------" diff --git a/tur/astrometry.net/build.sh b/tur/astrometry.net/build.sh new file mode 100644 index 000000000..576361e45 --- /dev/null +++ b/tur/astrometry.net/build.sh @@ -0,0 +1,24 @@ +TERMUX_PKG_HOMEPAGE=https://astrometry.net/ +TERMUX_PKG_DESCRIPTION="automatic recognition of astronomical images" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="LICENSE" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="0.94" +TERMUX_PKG_SRCURL=https://github.com/dstndstn/astrometry.net/releases/download/${TERMUX_PKG_VERSION}/astrometry.net-${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=38c0d04171ecae42033ce5c9cd0757d8c5fc1418f2004d85e858f29aee383c5f +TERMUX_PKG_DEPENDS="cfitsio, curl, file, libandroid-glob, libbz2, libcairo, libjpeg-turbo, libpng, netpbm, python, python-numpy, python-fitsio, swig, wcslib, zlib" +TERMUX_PKG_SUGGESTS="astrometry.net-data-basic" +TERMUX_PKG_PYTHON_COMMON_DEPS="wheel, setuptools, numpy" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_BLACKLISTED_ARCHES="arm" # FIXME: arm cross-compile C compiler fails for unknown reason + +termux_step_make () { + make TERMUX_HOST_PLATFORM="$TERMUX_HOST_PLATFORM" + make py CAIRO_INC=-I"$TERMUX_PREFIX"/include/cairo + make extra CAIRO_INC=-I"$TERMUX_PREFIX"/include/cairo +} + +termux_step_make_install () { + make install INSTALL_DIR="$TERMUX_PREFIX" CAIRO_INC=-I"$TERMUX_PREFIX"/include/cairo +}