Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tur-on-device/gprbuild-bootstrap/0001-fix-lib-dir.patch
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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);
11 changes: 11 additions & 0 deletions tur-on-device/gprbuild-bootstrap/0003-do-not-use-which.patch
Original file line number Diff line number Diff line change
@@ -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 =
72 changes: 72 additions & 0 deletions tur-on-device/gprbuild-bootstrap/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
14 changes: 14 additions & 0 deletions tur-on-device/gprbuild/0001-fix-lib-dir.patch
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions tur-on-device/gprbuild/0002-do-not-use-versioned-gnat-libs.patch
Original file line number Diff line number Diff line change
@@ -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);
11 changes: 11 additions & 0 deletions tur-on-device/gprbuild/0003-do-not-use-which.patch
Original file line number Diff line number Diff line change
@@ -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 =
63 changes: 63 additions & 0 deletions tur-on-device/gprbuild/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
30 changes: 30 additions & 0 deletions tur-on-device/gprconfig-kb/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
14 changes: 14 additions & 0 deletions tur-on-device/libgpr/0001-fix-lib-dir.patch
Original file line number Diff line number Diff line change
@@ -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;
21 changes: 21 additions & 0 deletions tur-on-device/libgpr/0002-do-not-use-versioned-gnat-libs.patch
Original file line number Diff line number Diff line change
@@ -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);
11 changes: 11 additions & 0 deletions tur-on-device/libgpr/0003-do-not-use-which.patch
Original file line number Diff line number Diff line change
@@ -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 =
64 changes: 64 additions & 0 deletions tur-on-device/libgpr/build.sh
Original file line number Diff line number Diff line change
@@ -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
}
Loading
Loading