diff --git a/tur-on-device/gprbuild-bootstrap/0001-fix-lib-dir.patch b/tur-on-device/gprbuild-bootstrap/0001-fix-lib-dir.patch new file mode 100644 index 0000000000..8a110a92f0 --- /dev/null +++ b/tur-on-device/gprbuild-bootstrap/0001-fix-lib-dir.patch @@ -0,0 +1,14 @@ +--- a/gpr/src/gpr_imports.c ++++ b/gpr/src/gpr_imports.c +@@ -69,6 +69,11 @@ + char __gnat_shared_libgcc_default = SHARED; + const char *__gnat_default_libgcc_subdir = "lib"; + ++#elif defined(__ANDROID__) ++int __gnat_link_max = 8192; ++char __gnat_shared_libgcc_default = STATIC; ++const char *__gnat_default_libgcc_subdir = "lib"; ++ + #elif defined (linux) || defined(__GLIBC__) + int __gnat_link_max = 8192; + char __gnat_shared_libgcc_default = STATIC; diff --git a/tur-on-device/gprbuild-bootstrap/0002-do-not-use-versioned-gnat-libs.patch b/tur-on-device/gprbuild-bootstrap/0002-do-not-use-versioned-gnat-libs.patch new file mode 100644 index 0000000000..30831b88d1 --- /dev/null +++ b/tur-on-device/gprbuild-bootstrap/0002-do-not-use-versioned-gnat-libs.patch @@ -0,0 +1,21 @@ +--- a/src/gprlib.adb ++++ b/src/gprlib.adb +@@ -2211,17 +2211,7 @@ + "no toolchain version for language " & Line (1 .. Last)); + + elsif Line (1 .. Last) = "ada" then +- Get_Line (IO_File, Line, Last); +- +- if Last > 5 and then Line (1 .. 5) = GNAT_And_Space then +- GNAT_Version := new String'(Line (6 .. Last)); +- GNAT_Version_Set := True; +- +- Free (Libgnat); +- Free (Libgnarl); +- Libgnat := new String'("-lgnat-" & Line (6 .. Last)); +- Libgnarl := new String'("-lgnarl-" & Line (6 .. Last)); +- end if; ++ Skip_Line (IO_File); + + else + Skip_Line (IO_File); diff --git a/tur-on-device/gprbuild-bootstrap/0003-do-not-use-which.patch b/tur-on-device/gprbuild-bootstrap/0003-do-not-use-which.patch new file mode 100644 index 0000000000..8a93bb3d35 --- /dev/null +++ b/tur-on-device/gprbuild-bootstrap/0003-do-not-use-which.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ + HOST = $(shell gcc -dumpmachine) + TARGET := $(shell gcc -dumpmachine) + +-prefix := $(dir $(shell which gnatls)).. ++prefix := $(dir $(shell command -v gnatls)).. + BUILD = production + PROCESSORS = 0 + BUILD_DIR = diff --git a/tur-on-device/gprbuild-bootstrap/build.sh b/tur-on-device/gprbuild-bootstrap/build.sh new file mode 100644 index 0000000000..a80620d326 --- /dev/null +++ b/tur-on-device/gprbuild-bootstrap/build.sh @@ -0,0 +1,72 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/AdaCore/gprbuild +TERMUX_PKG_DESCRIPTION="An advanced build system designed to help automate the construction of multi-language systems (Bootstrap Version)" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="COPYING3, COPYING.RUNTIME" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="25.0.0" +TERMUX_PKG_SRCURL=https://github.com/AdaCore/gprbuild/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=d12f94c1ec0b6e219f6b162f71f57129d22426e7798092f5f85b9ec2cc818bf1 +TERMUX_PKG_BUILD_DEPENDS="gcc-11" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true + +termux_step_post_get_source() { + local _xmlada_srcurl="https://github.com/AdaCore/xmlada/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz" + local _xmlada_sha256="dbb5984a0931311c7a787a679ef4cfaeeedd357474a585dc170140ef2251dcca" + local _xmlada_path="$TERMUX_PKG_CACHEDIR/xmlada-$(basename $_xmlada_srcurl)" + local _gprconfig_kb_srcurl="https://github.com/AdaCore/gprconfig_kb/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz" + local _gprconfig_kb_sha256="802e6d38a3b110897924a9c16e143cb86360f2dde94bb5b9144c7c391e37b121" + local _gprconfig_kb_path="$TERMUX_PKG_CACHEDIR/gprconfig_kb-$(basename $_xmlada_srcurl)" + + termux_download $_xmlada_srcurl $_xmlada_path $_xmlada_sha256 + termux_download $_gprconfig_kb_srcurl $_gprconfig_kb_path $_gprconfig_kb_sha256 + + mkdir -p $TERMUX_PKG_SRCDIR/xmlada-src + tar -xf $_xmlada_path -C $TERMUX_PKG_SRCDIR/xmlada-src --strip-components=1 + + mkdir -p $TERMUX_PKG_SRCDIR/gprconfig_kb-src + tar -xf $_gprconfig_kb_path -C $TERMUX_PKG_SRCDIR/gprconfig_kb-src --strip-components=1 +} + +termux_step_pre_configure() { + if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then + termux_error_exit "This package doesn't support cross-compiling." + fi +} + +termux_step_configure() { + export GNATMAKE="gnatmake-11" + + CFLAGS="${CFLAGS/-Oz/-Os}" + CXXFLAGS="${CXXFLAGS/-Oz/-Os}" + LDFLAGS="${LDFLAGS/-static-openmp/''}" + + CFLAGS="-fPIC $CFLAGS" + + CROSS_PREFIX=$TERMUX_ARCH-linux-android + if [ "$TERMUX_ARCH" == "arm" ]; then + CROSS_PREFIX=arm-linux-androideabi + fi + + export AR=$CROSS_PREFIX-ar + export AS=$CROSS_PREFIX-as + export LD=$CROSS_PREFIX-ld + export NM=$CROSS_PREFIX-nm + export CC=$CROSS_PREFIX-gcc-11 + export FC=$CROSS_PREFIX-gfortran-11 + export CXX=$CROSS_PREFIX-g++-11 + unset CPP CXXCPP STRINGS + export STRIP=$CROSS_PREFIX-strip + export RANLIB=$CROSS_PREFIX-ranlib +} + +termux_step_make() { + : +} + +termux_step_make_install() { + ./bootstrap.sh \ + --with-xmlada=$TERMUX_PKG_SRCDIR/xmlada-src \ + --with-kb=$TERMUX_PKG_SRCDIR/gprconfig_kb-src \ + --prefix=$PREFIX/opt/gprbuild-bootstrap +} diff --git a/tur-on-device/gprbuild/0001-fix-lib-dir.patch b/tur-on-device/gprbuild/0001-fix-lib-dir.patch new file mode 100644 index 0000000000..8a110a92f0 --- /dev/null +++ b/tur-on-device/gprbuild/0001-fix-lib-dir.patch @@ -0,0 +1,14 @@ +--- a/gpr/src/gpr_imports.c ++++ b/gpr/src/gpr_imports.c +@@ -69,6 +69,11 @@ + char __gnat_shared_libgcc_default = SHARED; + const char *__gnat_default_libgcc_subdir = "lib"; + ++#elif defined(__ANDROID__) ++int __gnat_link_max = 8192; ++char __gnat_shared_libgcc_default = STATIC; ++const char *__gnat_default_libgcc_subdir = "lib"; ++ + #elif defined (linux) || defined(__GLIBC__) + int __gnat_link_max = 8192; + char __gnat_shared_libgcc_default = STATIC; diff --git a/tur-on-device/gprbuild/0002-do-not-use-versioned-gnat-libs.patch b/tur-on-device/gprbuild/0002-do-not-use-versioned-gnat-libs.patch new file mode 100644 index 0000000000..30831b88d1 --- /dev/null +++ b/tur-on-device/gprbuild/0002-do-not-use-versioned-gnat-libs.patch @@ -0,0 +1,21 @@ +--- a/src/gprlib.adb ++++ b/src/gprlib.adb +@@ -2211,17 +2211,7 @@ + "no toolchain version for language " & Line (1 .. Last)); + + elsif Line (1 .. Last) = "ada" then +- Get_Line (IO_File, Line, Last); +- +- if Last > 5 and then Line (1 .. 5) = GNAT_And_Space then +- GNAT_Version := new String'(Line (6 .. Last)); +- GNAT_Version_Set := True; +- +- Free (Libgnat); +- Free (Libgnarl); +- Libgnat := new String'("-lgnat-" & Line (6 .. Last)); +- Libgnarl := new String'("-lgnarl-" & Line (6 .. Last)); +- end if; ++ Skip_Line (IO_File); + + else + Skip_Line (IO_File); diff --git a/tur-on-device/gprbuild/0003-do-not-use-which.patch b/tur-on-device/gprbuild/0003-do-not-use-which.patch new file mode 100644 index 0000000000..8a93bb3d35 --- /dev/null +++ b/tur-on-device/gprbuild/0003-do-not-use-which.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ + HOST = $(shell gcc -dumpmachine) + TARGET := $(shell gcc -dumpmachine) + +-prefix := $(dir $(shell which gnatls)).. ++prefix := $(dir $(shell command -v gnatls)).. + BUILD = production + PROCESSORS = 0 + BUILD_DIR = diff --git a/tur-on-device/gprbuild/build.sh b/tur-on-device/gprbuild/build.sh new file mode 100644 index 0000000000..7552d2804f --- /dev/null +++ b/tur-on-device/gprbuild/build.sh @@ -0,0 +1,63 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/AdaCore/gprbuild +TERMUX_PKG_DESCRIPTION="An advanced build system designed to help automate the construction of multi-language systems" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="COPYING3, COPYING.RUNTIME" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="25.0.0" +TERMUX_PKG_SRCURL=https://github.com/AdaCore/gprbuild/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=d12f94c1ec0b6e219f6b162f71f57129d22426e7798092f5f85b9ec2cc818bf1 +TERMUX_PKG_DEPENDS="gcc-11, gcc-default-11, gnat, gprconfig-kb" +TERMUX_PKG_BUILD_DEPENDS="gprbuild-bootstrap, xmlada" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true + +termux_step_pre_configure() { + if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then + termux_error_exit "This package doesn't support cross-compiling." + fi +} + +termux_step_configure() { + export GNATMAKE="gnatmake-11" + + CFLAGS="${CFLAGS/-Oz/-Os}" + CXXFLAGS="${CXXFLAGS/-Oz/-Os}" + LDFLAGS="${LDFLAGS/-static-openmp/''}" + + CROSS_PREFIX=$TERMUX_ARCH-linux-android + if [ "$TERMUX_ARCH" == "arm" ]; then + CROSS_PREFIX=arm-linux-androideabi + fi + + export AR=$CROSS_PREFIX-ar + export AS=$CROSS_PREFIX-as + export LD=$CROSS_PREFIX-ld + export NM=$CROSS_PREFIX-nm + export CC=$CROSS_PREFIX-gcc-11 + export FC=$CROSS_PREFIX-gfortran-11 + export CXX=$CROSS_PREFIX-g++-11 + unset CPP CXXCPP STRINGS + export STRIP=$CROSS_PREFIX-strip + export RANLIB=$CROSS_PREFIX-ranlib + + export PATH="$PREFIX/opt/gprbuild-bootstrap/bin:$PATH" + + # FIXME: Build machine is not properly guessed? + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" +--build=$TERMUX_HOST_PLATFORM +--host=$TERMUX_HOST_PLATFORM +--target=$TERMUX_HOST_PLATFORM +" +} + +termux_step_make() { + make LIBRARY_TYPE=relocatable all +} + +termux_step_make_install() { + make LIBRARY_TYPE=relocatable install +} + +termux_step_post_make_install() { + rm -f $TERMUX_PREFIX/doinstall +} diff --git a/tur-on-device/gprconfig-kb/build.sh b/tur-on-device/gprconfig-kb/build.sh new file mode 100644 index 0000000000..452fe2aecc --- /dev/null +++ b/tur-on-device/gprconfig-kb/build.sh @@ -0,0 +1,30 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/AdaCore/gprconfig_kb +TERMUX_PKG_DESCRIPTION="GPR configuration knowledge base" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="COPYING3, COPYING.RUNTIME" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="25.0.0" +TERMUX_PKG_SRCURL=https://github.com/AdaCore/gprconfig_kb/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=802e6d38a3b110897924a9c16e143cb86360f2dde94bb5b9144c7c391e37b121 +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true + +termux_step_pre_configure() { + if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then + termux_error_exit "This package doesn't support cross-compiling." + fi +} + +termux_step_configure() { + : +} + +termux_step_make() { + : +} + +termux_step_make_install() { + mkdir -p "$TERMUX_PREFIX"/share/gprconfig + rm -rf "$TERMUX_PREFIX"/share/gprconfig + cp -r "$TERMUX_PKG_SRCDIR"/db "$TERMUX_PREFIX"/share/gprconfig +} diff --git a/tur-on-device/libgpr/0001-fix-lib-dir.patch b/tur-on-device/libgpr/0001-fix-lib-dir.patch new file mode 100644 index 0000000000..8a110a92f0 --- /dev/null +++ b/tur-on-device/libgpr/0001-fix-lib-dir.patch @@ -0,0 +1,14 @@ +--- a/gpr/src/gpr_imports.c ++++ b/gpr/src/gpr_imports.c +@@ -69,6 +69,11 @@ + char __gnat_shared_libgcc_default = SHARED; + const char *__gnat_default_libgcc_subdir = "lib"; + ++#elif defined(__ANDROID__) ++int __gnat_link_max = 8192; ++char __gnat_shared_libgcc_default = STATIC; ++const char *__gnat_default_libgcc_subdir = "lib"; ++ + #elif defined (linux) || defined(__GLIBC__) + int __gnat_link_max = 8192; + char __gnat_shared_libgcc_default = STATIC; diff --git a/tur-on-device/libgpr/0002-do-not-use-versioned-gnat-libs.patch b/tur-on-device/libgpr/0002-do-not-use-versioned-gnat-libs.patch new file mode 100644 index 0000000000..30831b88d1 --- /dev/null +++ b/tur-on-device/libgpr/0002-do-not-use-versioned-gnat-libs.patch @@ -0,0 +1,21 @@ +--- a/src/gprlib.adb ++++ b/src/gprlib.adb +@@ -2211,17 +2211,7 @@ + "no toolchain version for language " & Line (1 .. Last)); + + elsif Line (1 .. Last) = "ada" then +- Get_Line (IO_File, Line, Last); +- +- if Last > 5 and then Line (1 .. 5) = GNAT_And_Space then +- GNAT_Version := new String'(Line (6 .. Last)); +- GNAT_Version_Set := True; +- +- Free (Libgnat); +- Free (Libgnarl); +- Libgnat := new String'("-lgnat-" & Line (6 .. Last)); +- Libgnarl := new String'("-lgnarl-" & Line (6 .. Last)); +- end if; ++ Skip_Line (IO_File); + + else + Skip_Line (IO_File); diff --git a/tur-on-device/libgpr/0003-do-not-use-which.patch b/tur-on-device/libgpr/0003-do-not-use-which.patch new file mode 100644 index 0000000000..8a93bb3d35 --- /dev/null +++ b/tur-on-device/libgpr/0003-do-not-use-which.patch @@ -0,0 +1,11 @@ +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ + HOST = $(shell gcc -dumpmachine) + TARGET := $(shell gcc -dumpmachine) + +-prefix := $(dir $(shell which gnatls)).. ++prefix := $(dir $(shell command -v gnatls)).. + BUILD = production + PROCESSORS = 0 + BUILD_DIR = diff --git a/tur-on-device/libgpr/build.sh b/tur-on-device/libgpr/build.sh new file mode 100644 index 0000000000..59a240cf6f --- /dev/null +++ b/tur-on-device/libgpr/build.sh @@ -0,0 +1,64 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/AdaCore/gprbuild +TERMUX_PKG_DESCRIPTION="Ada library to handle GPRbuild project files" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="COPYING3, COPYING.RUNTIME" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="25.0.0" +TERMUX_PKG_SRCURL=https://github.com/AdaCore/gprbuild/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=d12f94c1ec0b6e219f6b162f71f57129d22426e7798092f5f85b9ec2cc818bf1 +TERMUX_PKG_DEPENDS="xmlada" +TERMUX_PKG_BUILD_DEPENDS="gcc-11, gcc-default-11, gnat, gprbuild-bootstrap" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_NO_STATICSPLIT=true + +termux_step_pre_configure() { + if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then + termux_error_exit "This package doesn't support cross-compiling." + fi +} + +termux_step_configure() { + export GNATMAKE="gnatmake-11" + + CFLAGS="${CFLAGS/-Oz/-Os}" + CXXFLAGS="${CXXFLAGS/-Oz/-Os}" + LDFLAGS="${LDFLAGS/-static-openmp/''}" + + CROSS_PREFIX=$TERMUX_ARCH-linux-android + if [ "$TERMUX_ARCH" == "arm" ]; then + CROSS_PREFIX=arm-linux-androideabi + fi + + export AR=$CROSS_PREFIX-ar + export AS=$CROSS_PREFIX-as + export LD=$CROSS_PREFIX-ld + export NM=$CROSS_PREFIX-nm + export CC=$CROSS_PREFIX-gcc-11 + export FC=$CROSS_PREFIX-gfortran-11 + export CXX=$CROSS_PREFIX-g++-11 + unset CPP CXXCPP STRINGS + export STRIP=$CROSS_PREFIX-strip + export RANLIB=$CROSS_PREFIX-ranlib + + export PATH="$PREFIX/opt/gprbuild-bootstrap/bin:$PATH" + + # FIXME: Build machine is not properly guessed? + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" +--build=$TERMUX_HOST_PLATFORM +--host=$TERMUX_HOST_PLATFORM +--target=$TERMUX_HOST_PLATFORM +" +} + +termux_step_make() { + make LIBRARY_TYPE=relocatable libgpr.build +} + +termux_step_make_install() { + make LIBRARY_TYPE=relocatable libgpr.install +} + +termux_step_post_make_install() { + rm -f $TERMUX_PREFIX/doinstall +} diff --git a/tur-on-device/xmlada/build.sh b/tur-on-device/xmlada/build.sh new file mode 100644 index 0000000000..872b58c2f6 --- /dev/null +++ b/tur-on-device/xmlada/build.sh @@ -0,0 +1,56 @@ +TERMUX_PKG_HOMEPAGE=https://github.com/AdaCore/xmlada +TERMUX_PKG_DESCRIPTION="The XML/Ada toolkit" +TERMUX_PKG_LICENSE="custom" +TERMUX_PKG_LICENSE_FILE="COPYING3, COPYING.RUNTIME" +TERMUX_PKG_MAINTAINER="@termux-user-repository" +TERMUX_PKG_VERSION="23.0.0" +TERMUX_PKG_SRCURL=https://github.com/AdaCore/xmlada/archive/refs/tags/v$TERMUX_PKG_VERSION.tar.gz +TERMUX_PKG_SHA256=66245a68f2e391c8dc8dc50d6d5f109eb3b371e261d095d2002dff3927dd5253 +TERMUX_PKG_BUILD_DEPENDS="gcc-11, gcc-default-11, gprbuild-bootstrap, gnat" +TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_NO_STATICSPLIT=true +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +--enable-shared=yes +" + +termux_step_pre_configure() { + if [ "${TERMUX_ON_DEVICE_BUILD}" = false ]; then + termux_error_exit "This package doesn't support cross-compiling." + fi + + export GNATMAKE="gnatmake-11" + + CFLAGS="${CFLAGS/-Oz/-Os}" + CXXFLAGS="${CXXFLAGS/-Oz/-Os}" + LDFLAGS="${LDFLAGS/-static-openmp/''}" + + CROSS_PREFIX=$TERMUX_ARCH-linux-android + if [ "$TERMUX_ARCH" == "arm" ]; then + CROSS_PREFIX=arm-linux-androideabi + fi + + export AR=$CROSS_PREFIX-ar + export AS=$CROSS_PREFIX-as + export LD=$CROSS_PREFIX-ld + export NM=$CROSS_PREFIX-nm + export CC=$CROSS_PREFIX-gcc-11 + export FC=$CROSS_PREFIX-gfortran-11 + export CXX=$CROSS_PREFIX-g++-11 + unset CPP CXXCPP STRINGS + export STRIP=$CROSS_PREFIX-strip + export RANLIB=$CROSS_PREFIX-ranlib + + export PATH="$PREFIX/opt/gprbuild-bootstrap/bin:$PATH" + + # FIXME: Build machine is not properly guessed? + TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" +--build=$TERMUX_HOST_PLATFORM +--host=$TERMUX_HOST_PLATFORM +--target=$TERMUX_HOST_PLATFORM +" +} + +termux_step_make() { + make GPRBUILD_OPTIONS=-vh +}