From 7825e45554c1ff76a50bd5f8586f87abe59e2062 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 2 Aug 2026 21:33:36 +0530 Subject: [PATCH 01/16] fix(build): enable 16 KB ELF page-size alignment on NDK r27 Inject Google's max/common-page-size=16384 linker flags into the pinned termux_setup_toolchain_27 setup so bootstrap shared objects link with 16 KB LOAD alignment without bumping NDK, packages, or patches. Idempotent; no-ops if flags already present. --- build-bootstraps.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/build-bootstraps.sh b/build-bootstraps.sh index c535a1c..e1f92ef 100755 --- a/build-bootstraps.sh +++ b/build-bootstraps.sh @@ -17,6 +17,24 @@ set -e TERMUX_SCRIPTDIR=$(realpath "$(dirname "$0")/../") . $(dirname "$(realpath "$0")")/properties.sh +# NDK r27 16 KB ELF align: https://developer.android.com/guide/practices/page-sizes +enable_16kb_page_size_alignment() { + local toolchain_file="${TERMUX_SCRIPTDIR}/scripts/build/toolchain/termux_setup_toolchain_${TERMUX_NDK_VERSION_NUM}.sh" + if [ ! -f "$toolchain_file" ]; then + echo "[!] Missing toolchain setup: $toolchain_file" 1>&2 + return 1 + fi + if grep -q 'max-page-size=16384' "$toolchain_file"; then + return 0 + fi + if ! grep -q 'LDFLAGS+=" -Wl,-z,relro,-z,now"' "$toolchain_file"; then + echo "[!] Unexpected toolchain setup (no relro LDFLAGS line): $toolchain_file" 1>&2 + return 1 + fi + sed -i '/LDFLAGS+=" -Wl,-z,relro,-z,now"/a LDFLAGS+=" -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384"' "$toolchain_file" + echo "[*] Applied 16 KB page-size linker flags (NDK r${TERMUX_NDK_VERSION_NUM})" +} + BOOTSTRAP_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/ruby-tmp.XXXXXXXX") # By default, bootstrap archives are compatible with Android >=7.0 @@ -356,6 +374,8 @@ main() { set_build_bootstrap_traps + enable_16kb_page_size_alignment || return 1 + for package_arch in "${TERMUX_ARCHITECTURES[@]}"; do if [[ " ${TERMUX_DEFAULT_ARCHITECTURES[*]} " != *" $package_arch "* ]]; then echo "Unsupported architecture '$package_arch' for in architectures list: '${TERMUX_ARCHITECTURES[*]}'" 1>&2 From cee8cc7fc5f00394f1199a7ce7cd0927fae34afe Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 2 Aug 2026 21:42:32 +0530 Subject: [PATCH 02/16] feat(build): align bootstrap builds with Termux NDK r29 Move off the frozen acf1df1e / NDK r27 stack to current termux-packages (NDK r29, toolchain_29, 16 KB ELF alignment by default). - Pin termux-packages @ 23d530425344 (TERMUX_PACKAGES_REF) - Keep upstream properties; apply xyz.jekyllex via apply-jekyllex-identity.sh - Rebase build-bootstraps on upstream (JekyllEx package set, ruby-*.zip, --android10, no second-stage) - CI uses Termux package-builder docker (run-docker.sh) like Termux - Keep patches/ for JekyllEx ruby 3.3.x and Android 10 package fixes - Post-build readelf check for 4 KB LOAD aligns on arm64/x86_64 --- .github/workflows/build-bootstraps.yml | 82 ++++++--- README.md | 36 +++- apply-jekyllex-identity.sh | 31 ++++ build-bootstraps.sh | 235 ++++++++----------------- properties.sh | 63 ++----- 5 files changed, 207 insertions(+), 240 deletions(-) create mode 100755 apply-jekyllex-identity.sh diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 71a177f..9d68459 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -10,6 +10,11 @@ on: type: string description: "Tag for the release" +# termux-packages @ NDK r29 (16 KB ELF align by default). +# Bump when intentionally rebasing the package tree. +env: + TERMUX_PACKAGES_REF: "23d530425344010b73b0392ab66b041e8f65e34b" + jobs: bootstraps: runs-on: ubuntu-latest @@ -20,53 +25,77 @@ jobs: target_arch: [aarch64, arm, i686, x86_64] steps: - - name: Install requirements + - name: Free disk space run: | - sudo apt-get update - sudo apt-get install -y autopoint + sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost || true + df -h - name: Clone repository uses: actions/checkout@v4 with: fetch-depth: 1 + path: jekyllex - name: Get packages from termux-packages uses: actions/checkout@v4 with: path: termux-packages repository: termux/termux-packages - ref: 'acf1df1e90034ce0100ac54726ae56792bf56859' - - - name: Setup java - uses: actions/setup-java@v1 - with: - java-version: 17 + ref: ${{ env.TERMUX_PACKAGES_REF }} - - name: Setup environment + - name: Overlay JekyllEx scripts and patches run: | - sudo mkdir -p /data - sudo chown $USER:$USER /data - mv *.sh termux-packages/scripts/ - mv termux-packages/* . - for package in patches/*; do - cp -r $package packages; + set -euo pipefail + cp jekyllex/build-bootstraps.sh termux-packages/scripts/ + chmod +x termux-packages/scripts/build-bootstraps.sh jekyllex/apply-jekyllex-identity.sh + jekyllex/apply-jekyllex-identity.sh termux-packages/scripts/properties.sh + + for package in jekyllex/patches/*; do + cp -r "$package" termux-packages/packages/ done - find packages/git -type f -name "*subpackage*" -exec rm {} + - find packages/libxml2 -type f -name "*python*" -exec rm {} + - sudo mkdir -p /home/builder && mv ./* /home/builder + find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + + find termux-packages/packages/libxml2 -type f -name "*python*" -exec rm {} + - - name: Create bootstrap archive - working-directory: /home/builder + - name: Create bootstrap archive (Termux docker builder) + working-directory: termux-packages + env: + CI: "true" run: | - ./clean.sh - ./scripts/setup-android-sdk.sh - ./scripts/build-bootstraps.sh --android10 --architectures ${{ matrix.target_arch }} + set -euo pipefail + # Same builder image / layout Termux uses (NDK r29, host toolchains). + ./scripts/run-docker.sh ./scripts/setup-android-sdk.sh + ./scripts/run-docker.sh ./scripts/build-bootstraps.sh \ + --android10 -f --architectures ${{ matrix.target_arch }} + + - name: Verify 16 KB ELF alignment (arm64/x86_64) + if: matrix.target_arch == 'aarch64' || matrix.target_arch == 'x86_64' + working-directory: termux-packages + run: | + set -euo pipefail + zip="ruby-${{ matrix.target_arch }}.zip" + test -f "$zip" + tmp=$(mktemp -d) + unzip -q -d "$tmp" "$zip" + mapfile -t files < <(find "$tmp" -type f -exec file -b {} + | paste -d '|' <(find "$tmp" -type f) - | awk -F'|' '/ELF/ {print $1}' | head -30) + test "${#files[@]}" -gt 0 + failed=0 + for f in "${files[@]}"; do + out=$(readelf -lW "$f" 2>/dev/null || llvm-readelf -lW "$f" 2>/dev/null || true) + [ -n "$out" ] || continue + echo "== $f ==" + echo "$out" | awk '/LOAD/ {print}' + if echo "$out" | awk '/LOAD/ {print $NF}' | grep -qE '0x1000$'; then + echo "FAIL: 4 KB LOAD align in $f" + failed=1 + fi + done + exit "$failed" - name: Store bootstrap uses: actions/upload-artifact@v4 with: name: ruby-${{ matrix.target_arch }} - path: "/home/builder/*.zip" + path: termux-packages/ruby-*.zip release: needs: bootstraps @@ -114,8 +143,9 @@ jobs: path: ./ - name: Setup java - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: temurin java-version: 17 - name: Build apk diff --git a/README.md b/README.md index 91612ee..9a90891 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,20 @@ This is a custom build of ruby programming language built for native execution o The original [patches for ruby](https://github.com/termux/termux-packages/tree/master/packages/ruby) to work on Android were developed by the [Termux team](https://github.com/termux). The [custom patches](https://github.com/jekyllex/ruby-android/tree/main/patches) for tools to work on Android 10 & above, build scripts and workflows are developed by [Gourav Khunger](https://github.com/gouravkhunger). +## Build system (aligned with Termux) + +Bootstraps are built with a pinned [termux-packages](https://github.com/termux/termux-packages) tree: + +| Piece | Source | +|-------|--------| +| Package recipes / NDK toolchain | termux-packages @ pin in `.github/workflows/build-bootstraps.yml` (`TERMUX_PACKAGES_REF`) | +| NDK | **r29** (upstream default; 16 KB ELF `LOAD` alignment by default) | +| App id / install prefix | `xyz.jekyllex` via `apply-jekyllex-identity.sh` | +| Bootstrap package set + `ruby-*.zip` | `build-bootstraps.sh` (JekyllEx) | +| Ruby / git / libxml2 / gems | `patches/` overlay (keeps JekyllEx ruby 3.3.x and Android 10 fixes) | + +Do **not** replace upstream `scripts/properties.sh` with a fork; only run `apply-jekyllex-identity.sh` on it. + This repository [releases](https://github.com/jekyllex/ruby-android/releases) 4 `zip` bootstrapped files available for download through `dl.jekyllex.xyz`, to provide support for [each CPU type](https://developer.android.com/ndk/guides/abis#sa) that Android devices support: - x86 (i686) @@ -18,4 +32,24 @@ The latest bootstraps can be found at these links: - armeabi-v7a: https://dl.jekyllex.xyz/ruby/v0.1.4/arm.zip - arm64-v8a: https://dl.jekyllex.xyz/ruby/v0.1.4/aarch64.zip -These files are downloaded by [Jekyllex](https://github.com/jekyllex/jekyllex-android) at build time based on the target device architecture and extracted to the app's home directoy upon app installation. This simulates a linux-like working environment which can execute ruby and thus jekyll. +These files are downloaded by [Jekyllex](https://github.com/jekyllex/jekyllex-android) at build time based on the target device architecture and extracted to the app's home directory upon app installation. This simulates a linux-like working environment which can execute ruby and thus jekyll. + +## Local / CI shape + +```text +termux-packages @ TERMUX_PACKAGES_REF + + apply-jekyllex-identity.sh → properties (package name xyz.jekyllex) + + build-bootstraps.sh → --android10 → ruby-$arch.zip + + patches/* → packages/ + + scripts/run-docker.sh → ghcr.io/termux/package-builder (NDK r29) +``` + +Workflow: **Actions → Build bootstraps** (Termux docker builder, `-f` force rebuild). + +Local (same as Termux): + +```bash +# in a termux-packages checkout with overlays applied +./scripts/run-docker.sh ./scripts/setup-android-sdk.sh +./scripts/run-docker.sh ./scripts/build-bootstraps.sh --android10 -f --architectures aarch64 +``` diff --git a/apply-jekyllex-identity.sh b/apply-jekyllex-identity.sh new file mode 100755 index 0000000..083d181 --- /dev/null +++ b/apply-jekyllex-identity.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# Point termux-packages properties at the JekyllEx app id so prefixes land under +# /data/data/xyz.jekyllex/... Upstream properties stay otherwise untouched +# (NDK r29, build-tools, path layout). Run after checkout, before builds. +set -euo pipefail + +PROPERTIES_FILE="${1:-scripts/properties.sh}" + +if [ ! -f "$PROPERTIES_FILE" ]; then + echo "[!] properties file not found: $PROPERTIES_FILE" 1>&2 + exit 1 +fi + +if grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' "$PROPERTIES_FILE"; then + echo "[*] JekyllEx identity already applied in $PROPERTIES_FILE" + exit 0 +fi + +tmp="$(mktemp)" +sed \ + -e 's/^TERMUX_APP__PACKAGE_NAME="com.termux"/TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"/' \ + -e 's|^export CGCT_DIR="/data/data/com.termux/cgct"|export CGCT_DIR="/data/data/xyz.jekyllex/cgct"|' \ + "$PROPERTIES_FILE" > "$tmp" +mv "$tmp" "$PROPERTIES_FILE" + +if ! grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' "$PROPERTIES_FILE"; then + echo "[!] Failed to set TERMUX_APP__PACKAGE_NAME in $PROPERTIES_FILE" 1>&2 + exit 1 +fi + +echo "[*] Applied JekyllEx identity (xyz.jekyllex) to $PROPERTIES_FILE" diff --git a/build-bootstraps.sh b/build-bootstraps.sh index e1f92ef..cee80bf 100755 --- a/build-bootstraps.sh +++ b/build-bootstraps.sh @@ -2,73 +2,52 @@ # shellcheck disable=SC2039,SC2059 # Title: build-bootstrap.sh -# Description: A script to build bootstrap archives for the termux-app -# from local package sources instead of debs published in -# apt repo like done by generate-bootstrap.sh. It allows -# bootstrap archives to be easily built for (forked) termux -# apps without having to publish an apt repo first. -# Usage: run "build-bootstrap.sh --help" +# Description: Build bootstrap archives for JekyllEx from local package +# sources (termux-packages tree). Based on termux-packages +# scripts/build-bootstraps.sh (NDK r29 / 16 KB default). +# Usage: run "build-bootstraps.sh --help" # -# Adapted from: https://github.com/termux/termux-packages/blob/acf1df1e90034ce0100ac54726ae56792bf56859/scripts/build-bootstraps.sh -version=0.1.0 +# JekyllEx deltas vs upstream: +# - Package set: coreutils, libxslt, libxml2, unzip, ruby, git, zip (+deps) +# - Output name: ruby-${arch}.zip (jekyllex-android / dl.jekyllex.xyz contract) +# - Layout: TERMUX_PACKAGES_DIRECTORY defaults to Termux docker path +# /home/builder/termux-packages (override with env if flattening locally) +# - No termux second-stage bootstrap (app installs zip as libN.so itself) +# - --android10 for APK packaging / Android 10+ exec model +# +# Adapted from: https://github.com/termux/termux-packages/blob/23d530425344010b73b0392ab66b041e8f65e34b/scripts/build-bootstraps.sh +version=0.2.0 set -e -TERMUX_SCRIPTDIR=$(realpath "$(dirname "$0")/../") -. $(dirname "$(realpath "$0")")/properties.sh - -# NDK r27 16 KB ELF align: https://developer.android.com/guide/practices/page-sizes -enable_16kb_page_size_alignment() { - local toolchain_file="${TERMUX_SCRIPTDIR}/scripts/build/toolchain/termux_setup_toolchain_${TERMUX_NDK_VERSION_NUM}.sh" - if [ ! -f "$toolchain_file" ]; then - echo "[!] Missing toolchain setup: $toolchain_file" 1>&2 - return 1 - fi - if grep -q 'max-page-size=16384' "$toolchain_file"; then - return 0 - fi - if ! grep -q 'LDFLAGS+=" -Wl,-z,relro,-z,now"' "$toolchain_file"; then - echo "[!] Unexpected toolchain setup (no relro LDFLAGS line): $toolchain_file" 1>&2 - return 1 - fi - sed -i '/LDFLAGS+=" -Wl,-z,relro,-z,now"/a LDFLAGS+=" -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384"' "$toolchain_file" - echo "[*] Applied 16 KB page-size linker flags (NDK r${TERMUX_NDK_VERSION_NUM})" -} +export TERMUX_SCRIPTDIR +TERMUX_SCRIPTDIR=$(realpath "$(dirname "$(realpath "$0")")/../") +: "${TERMUX_TOPDIR:="$HOME/.termux-build"}" +# shellcheck source=/dev/null +. "${TERMUX_SCRIPTDIR}/scripts/properties.sh" +# shellcheck source=/dev/null +. "${TERMUX_SCRIPTDIR}/scripts/build/termux_step_handle_buildarch.sh" BOOTSTRAP_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/ruby-tmp.XXXXXXXX") -# By default, bootstrap archives are compatible with Android >=7.0 -# and <10. BOOTSTRAP_ANDROID10_COMPATIBLE=false -# By default, bootstrap archives will be built for all architectures -# supported by Termux application. -# Override with option '--architectures'. TERMUX_DEFAULT_ARCHITECTURES=("aarch64" "arm" "i686" "x86_64") TERMUX_ARCHITECTURES=("${TERMUX_DEFAULT_ARCHITECTURES[@]}") -TERMUX_PACKAGES_DIRECTORY="/home/builder" +# Match termux-packages docker mount (run-docker.sh → /home/builder/termux-packages). +: "${TERMUX_PACKAGES_DIRECTORY:="/home/builder/termux-packages"}" TERMUX_BUILT_DEBS_DIRECTORY="$TERMUX_PACKAGES_DIRECTORY/output" TERMUX_BUILT_PACKAGES_DIRECTORY="/data/data/.built-packages" IGNORE_BUILD_SCRIPT_NOT_FOUND_ERROR=1 FORCE_BUILD_PACKAGES=0 -# A list of packages to build declare -a PACKAGES=() - -# A list of non-essential packages to build. -# By default it is empty, but can be filled with option '--add'. declare -a ADDITIONAL_PACKAGES=() - -# A list of already extracted packages declare -a EXTRACTED_PACKAGES=() - -# A list of options to pass to build-package.sh declare -a BUILD_PACKAGE_OPTIONS=() -# Check for some important utilities that may not be available for -# some reason. for cmd in ar awk curl grep gzip find sed tar xargs xz zip; do if [ -z "$(command -v $cmd)" ]; then echo "[!] Utility '$cmd' is not available in PATH." @@ -76,45 +55,33 @@ for cmd in ar awk curl grep gzip find sed tar xargs xz zip; do fi done -# Build deb files for package and its dependencies deb from source for arch build_package() { - local return_value - - local package_arch="$1" + local TERMUX_ARCH="$1" local package_name="$2" - local build_output - # Build package from source - # stderr will be redirected to stdout and both will be captured into variable and printed on screen cd "$TERMUX_PACKAGES_DIRECTORY" echo $'\n\n\n'"[*] Building '$package_name'..." exec 99>&1 - build_output="$("$TERMUX_PACKAGES_DIRECTORY"/build-package.sh "${BUILD_PACKAGE_OPTIONS[@]}" -a "$package_arch" "$package_name" 2>&1 | tee >(cat - >&99); exit ${PIPESTATUS[0]})"; + build_output="$("$TERMUX_PACKAGES_DIRECTORY"/build-package.sh "${BUILD_PACKAGE_OPTIONS[@]}" -a "$TERMUX_ARCH" "$package_name" 2>&1 | tee >(cat - >&99); exit ${PIPESTATUS[0]})" return_value=$? echo "[*] Building '$package_name' exited with exit code $return_value" exec 99>&- if [ $return_value -ne 0 ]; then - echo "Failed to build package '$package_name' for arch '$package_arch'" 1>&2 - - # Dependency packages may not have a build.sh, so we ignore the error. - # A better way should be implemented to validate if its actually a dependency - # and not a required package itself, by removing dependencies from PACKAGES array. + echo "Failed to build package '$package_name' for arch '$TERMUX_ARCH'" 1>&2 if [[ $IGNORE_BUILD_SCRIPT_NOT_FOUND_ERROR == "1" ]] && [[ "$build_output" == *"No build.sh script at package dir"* ]]; then echo "Ignoring error 'No build.sh script at package dir'" 1>&2 return 0 fi fi - return $return_value - } -# Extract *.deb files to the bootstrap root. extract_debs() { - + local package_arch="$1" local current_package_name + local current_package_arch local data_archive local control_archive local package_tmpdir @@ -134,9 +101,15 @@ extract_debs() { fi for deb in *.deb; do - - current_package_name="$(echo "$deb" | sed -E 's/^([^_]+).*/\1/' )" + current_package_name="$(echo "$deb" | sed -E 's/^([^_]+).*/\1/')" + current_package_arch="$(echo "$deb" | sed -E 's/.*_(aarch64|all|arm|i686|x86_64)\.deb$/\1/')" echo "current_package_name: '$current_package_name'" + echo "current_package_arch: '$current_package_arch'" + + if [[ "$current_package_arch" != "$package_arch" ]] && [[ "$current_package_arch" != "all" ]]; then + echo "[*] Skipping incompatible package '$deb' for target '$package_arch'..." + continue + fi if [[ "$current_package_name" == *"-static" ]]; then echo "[*] Skipping static package '$deb'..." @@ -155,10 +128,10 @@ extract_debs() { rm -rf "$package_tmpdir"/* echo "[*] Extracting '$deb'..." - (cd "$package_tmpdir" + ( + cd "$package_tmpdir" ar x "$TERMUX_BUILT_DEBS_DIRECTORY/$deb" - # data.tar may have extension different from .xz if [ -f "./data.tar.xz" ]; then data_archive="data.tar.xz" elif [ -f "./data.tar.gz" ]; then @@ -168,7 +141,6 @@ extract_debs() { return 1 fi - # Do same for control.tar. if [ -f "./control.tar.xz" ]; then control_archive="control.tar.xz" elif [ -f "./control.tar.gz" ]; then @@ -178,18 +150,14 @@ extract_debs() { return 1 fi - # Extract files. tar xf "$data_archive" -C "$BOOTSTRAP_ROOTFS" if ! ${BOOTSTRAP_ANDROID10_COMPATIBLE}; then - # Register extracted files. tar tf "$data_archive" | sed -E -e 's@^\./@/@' -e 's@^/$@/.@' -e 's@^([^./])@/\1@' > "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/var/lib/dpkg/info/${current_package_name}.list" - # Generate checksums (md5). tar xf "$data_archive" find data -type f -print0 | xargs -0 -r md5sum | sed 's@^\.$@@g' > "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/var/lib/dpkg/info/${current_package_name}.md5sums" - # Extract metadata. tar xf "$control_archive" { cat control @@ -197,7 +165,6 @@ extract_debs() { echo } >> "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/var/lib/dpkg/status" - # Additional data: conffiles & scripts for file in conffiles postinst postrm preinst prerm; do if [ -f "${PWD}/${file}" ]; then cp "$file" "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/var/lib/dpkg/info/${current_package_name}.${file}" @@ -206,16 +173,13 @@ extract_debs() { fi ) done - } -# Final stage: generate bootstrap archive and place it to current -# working directory. -# Information about symlinks is stored in file SYMLINKS.txt. create_bootstrap_archive() { - echo $'\n\n\n'"[*] Creating 'ruby-${1}.zip'..." - (cd "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}" + ( + cd "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}" + # Keep size down (same as historical jekyllex bootstraps). rm -rf ./share/man rm -rf ./share/doc rm -rf ./share/info @@ -225,8 +189,6 @@ create_bootstrap_archive() { rm -rf ./share/aclocal rm -rf ./share/terminfo - # Do not store symlinks in bootstrap archive. - # Instead, put all information to SYMLINKS.txt while read -r -d '' link; do echo "$(readlink "$link")←${link}" >> SYMLINKS.txt rm -f "$link" @@ -236,93 +198,56 @@ create_bootstrap_archive() { ) mv -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$TERMUX_PACKAGES_DIRECTORY/" - echo "[*] Finished successfully (${1})." - } set_build_bootstrap_traps() { - - #set traps for the build_bootstrap_trap itself trap 'build_bootstrap_trap' EXIT trap 'build_bootstrap_trap TERM' TERM trap 'build_bootstrap_trap INT' INT trap 'build_bootstrap_trap HUP' HUP trap 'build_bootstrap_trap QUIT' QUIT - return 0 - } build_bootstrap_trap() { - local build_bootstrap_trap_exit_code=$? trap - EXIT - [ -h "$TERMUX_BUILT_PACKAGES_DIRECTORY" ] && rm -f "$TERMUX_BUILT_PACKAGES_DIRECTORY" [ -d "$BOOTSTRAP_TMPDIR" ] && rm -rf "$BOOTSTRAP_TMPDIR" - - [ -n "$1" ] && trap - "$1"; exit $build_bootstrap_trap_exit_code - + [ -n "$1" ] && trap - "$1" + exit $build_bootstrap_trap_exit_code } show_usage() { - - cat <<'HELP_EOF' - -build-bootstraps.sh is a script to build bootstrap archives for the -termux-app from local package sources instead of debs published in -apt repo like done by generate-bootstrap.sh. It allows bootstrap archives -to be easily built for (forked) termux apps without having to publish -an apt repo first. - + cat <<'HELP_EOF' +build-bootstraps.sh builds JekyllEx ruby bootstraps from a termux-packages tree. Usage: build-bootstraps.sh [command_options] +Options: + [ -h | --help ] Display this help + [ -f ] Force rebuild packages + [ --android10 ] Android 10+ / APK packaging layout + [ -a | --add ] Extra packages (comma-separated) + [ --architectures ] Architectures (comma-separated) -Available command_options: - [ -h | --help ] Display this help screen - [ -f ] Force build even if packages have already been built. - [ --android10 ] - Generate bootstrap archives for Android 10+ for - apk packaging system. - [ -a | --add ] - Additional packages to include into bootstrap archive. - Multiple packages should be passed as comma-separated list. - [ --architectures ] - Override default list of architectures for which bootstrap - archives will be created. Multiple architectures should be - passed as comma-separated list. - - -The package name/prefix that the bootstrap is built for is defined by -TERMUX_APP_PACKAGE in 'scrips/properties.sh'. It defaults to 'com.termux'. -If package name is changed, make sure to run -`./scripts/run-docker.sh ./clean.sh` or pass '-f' to force rebuild of packages. +TERMUX_APP_PACKAGE must be xyz.jekyllex (applied via apply-jekyllex-identity.sh). +NDK r29+ links 16 KB-aligned ELFs by default (Termux toolchain_29). -### Examples - -Build default bootstrap archives for all supported archs: -./scripts/run-docker.sh ./scripts/build-bootstraps.sh &> build.log - -Build default bootstrap archive for aarch64 arch only: -./scripts/run-docker.sh ./scripts/build-bootstraps.sh --architectures aarch64 &> build.log - -Build bootstrap archive with additionall openssh package for aarch64 arch only: -./scripts/run-docker.sh ./scripts/build-bootstraps.sh --architectures aarch64 --add openssh &> build.log +Examples: + ./scripts/build-bootstraps.sh --android10 --architectures aarch64 + ./scripts/build-bootstraps.sh --android10 -f HELP_EOF -echo $'\n'"TERMUX_APP_PACKAGE: \"$TERMUX_APP_PACKAGE\"" -echo "TERMUX_PREFIX: \"${TERMUX_PREFIX[*]}\"" -echo "TERMUX_ARCHITECTURES: \"${TERMUX_ARCHITECTURES[*]}\"" - + echo $'\n'"TERMUX_APP_PACKAGE: \"${TERMUX_APP_PACKAGE:-}\"" + echo "TERMUX_PREFIX: \"${TERMUX_PREFIX:-}\"" + echo "TERMUX_NDK_VERSION: \"${TERMUX_NDK_VERSION:-}\"" + echo "TERMUX_ARCHITECTURES: \"${TERMUX_ARCHITECTURES[*]}\"" } main() { - - local return_value - while (($# > 0)); do case "$1" in -h|--help) @@ -374,29 +299,25 @@ main() { set_build_bootstrap_traps - enable_16kb_page_size_alignment || return 1 - - for package_arch in "${TERMUX_ARCHITECTURES[@]}"; do - if [[ " ${TERMUX_DEFAULT_ARCHITECTURES[*]} " != *" $package_arch "* ]]; then - echo "Unsupported architecture '$package_arch' for in architectures list: '${TERMUX_ARCHITECTURES[*]}'" 1>&2 + for TERMUX_ARCH in "${TERMUX_ARCHITECTURES[@]}"; do + if [[ " ${TERMUX_DEFAULT_ARCHITECTURES[*]} " != *" $TERMUX_ARCH "* ]]; then + echo "Unsupported architecture '$TERMUX_ARCH' for in architectures list: '${TERMUX_ARCHITECTURES[*]}'" 1>&2 echo "Supported architectures: '${TERMUX_DEFAULT_ARCHITECTURES[*]}'" 1>&2 return 1 fi done - for package_arch in "${TERMUX_ARCHITECTURES[@]}"; do + echo "[*] NDK ${TERMUX_NDK_VERSION} (16 KB page-size alignment is NDK r28+ default)" + + for TERMUX_ARCH in "${TERMUX_ARCHITECTURES[@]}"; do + termux_step_handle_buildarch - # The termux_step_finish_build stores package version in .built-packages directory, but - # its not arch independent. So instead we create an arch specific one and symlink it - # to the .built-packages directory so that users can easily switch arches without having - # to rebuild packages - TERMUX_BUILT_PACKAGES_DIRECTORY_FOR_ARCH="$TERMUX_BUILT_PACKAGES_DIRECTORY-$package_arch" + TERMUX_BUILT_PACKAGES_DIRECTORY_FOR_ARCH="$TERMUX_BUILT_PACKAGES_DIRECTORY-$TERMUX_ARCH" mkdir -p "$TERMUX_BUILT_PACKAGES_DIRECTORY_FOR_ARCH" if [ -f "$TERMUX_BUILT_PACKAGES_DIRECTORY" ] || [ -d "$TERMUX_BUILT_PACKAGES_DIRECTORY" ]; then rm -rf "$TERMUX_BUILT_PACKAGES_DIRECTORY" fi - ln -sf "$TERMUX_BUILT_PACKAGES_DIRECTORY_FOR_ARCH" "$TERMUX_BUILT_PACKAGES_DIRECTORY" if [[ $FORCE_BUILD_PACKAGES == "1" ]]; then @@ -404,10 +325,9 @@ main() { rm -f "$TERMUX_BUILT_DEBS_DIRECTORY"/* fi - BOOTSTRAP_ROOTFS="$BOOTSTRAP_TMPDIR/rootfs-${package_arch}" - BOOTSTRAP_PKGDIR="$BOOTSTRAP_TMPDIR/packages-${package_arch}" + BOOTSTRAP_ROOTFS="$BOOTSTRAP_TMPDIR/rootfs-${TERMUX_ARCH}" + BOOTSTRAP_PKGDIR="$BOOTSTRAP_TMPDIR/packages-${TERMUX_ARCH}" - # Create initial directories for $TERMUX_PREFIX if ! ${BOOTSTRAP_ANDROID10_COMPATIBLE}; then mkdir -p "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/etc/apt/apt.conf.d" mkdir -p "${BOOTSTRAP_ROOTFS}/${TERMUX_PREFIX}/etc/apt/preferences.d" @@ -423,7 +343,7 @@ main() { PACKAGES=() EXTRACTED_PACKAGES=() - # Core JekyllEx utilities. + # JekyllEx bootstrap packages (same set as prior releases). PACKAGES+=("coreutils") PACKAGES+=("libxslt") PACKAGES+=("libxml2") @@ -432,7 +352,6 @@ main() { PACKAGES+=("git") PACKAGES+=("zip") - # Handle additional packages. for add_pkg in "${ADDITIONAL_PACKAGES[@]}"; do if [[ " ${PACKAGES[*]} " != *" $add_pkg "* ]]; then PACKAGES+=("$add_pkg") @@ -440,21 +359,15 @@ main() { done unset add_pkg - # Build packages. for package_name in "${PACKAGES[@]}"; do set +e - build_package "$package_arch" "$package_name" || return $? + build_package "$TERMUX_ARCH" "$package_name" || return $? set -e done - # Extract all debs. - extract_debs || return $? - - # Create bootstrap archive. - create_bootstrap_archive "$package_arch" || return $? - + extract_debs "$TERMUX_ARCH" || return $? + create_bootstrap_archive "$TERMUX_ARCH" || return $? done - } main "$@" diff --git a/properties.sh b/properties.sh index bb64bcb..9602ee4 100755 --- a/properties.sh +++ b/properties.sh @@ -1,52 +1,11 @@ -# Adapted from: https://github.com/termux/termux-packages/blob/acf1df1e90034ce0100ac54726ae56792bf56859/scripts/properties.sh -TERMUX_SDK_REVISION=9123335 -TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1 - -: "${TERMUX_NDK_VERSION_NUM:="27"}" -: "${TERMUX_NDK_REVISION:=""}" -TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION - -if [ -n "${JAVA_HOME+x}" ]; then - : "${TERMUX_JAVA_HOME:="${JAVA_HOME}"}" -else - : "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-17-openjdk-amd64}" - export JAVA_HOME="${TERMUX_JAVA_HOME}" -fi - -if [ -z "${ANDROID_HOME+x}" ]; then - : "${ANDROID_HOME:="${HOME}/lib/android-sdk-$TERMUX_SDK_REVISION"}" -fi - -if [ -z "${NDK+x}" ]; then - : "${NDK:="${HOME}/lib/android-ndk-r${TERMUX_NDK_VERSION}"}" -fi - -# Termux packages configuration. -TERMUX_APP_PACKAGE="xyz.jekyllex" -TERMUX_REPO_PACKAGE="xyz.jekyllex" -TERMUX_BASE_DIR="/data/data/${TERMUX_APP_PACKAGE}/files" -TERMUX_CACHE_DIR="/data/data/${TERMUX_APP_PACKAGE}/cache" -TERMUX_ANDROID_HOME="${TERMUX_BASE_DIR}/home" -TERMUX_APPS_DIR="${TERMUX_BASE_DIR}/apps" -TERMUX_PREFIX_CLASSICAL="${TERMUX_BASE_DIR}/usr" -TERMUX_PREFIX="${TERMUX_PREFIX_CLASSICAL}" -TERMUX_ETC_PREFIX_DIR_PATH="${TERMUX_PREFIX}/etc" -TERMUX_PROFILE_D_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/profile.d" -TERMUX_CONFIG_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/termux" -TERMUX_BOOTSTRAP_CONFIG_DIR_PATH="${TERMUX_CONFIG_PREFIX_DIR_PATH}/bootstrap" - -# Path to CGCT tools -CGCT_DEFAULT_PREFIX="/data/data/${TERMUX_APP_PACKAGE}/files/usr/glibc" -export CGCT_DIR="/data/data/${TERMUX_APP_PACKAGE}/cgct" - -export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'del(.pkg_format) | keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json) - -# Allow to override setup. -for f in "${HOME}/.config/termux/termuxrc.sh" "${HOME}/.termux/termuxrc.sh" "${HOME}/.termuxrc"; do - if [ -f "$f" ]; then - echo "Using builder configuration from '$f'..." - . "$f" - break - fi -done -unset f +#!/usr/bin/env bash +# Intentionally not a full properties.sh. +# +# Termux NDK r29 / path layout / validators live in upstream +# termux-packages scripts/properties.sh (pinned in CI). +# Apply JekyllEx package identity with: +# ./apply-jekyllex-identity.sh path/to/scripts/properties.sh +# +# Do not copy this file over upstream properties.sh. +echo "Use apply-jekyllex-identity.sh against upstream scripts/properties.sh" 1>&2 +exit 1 From 18d3390a2357a62c7c72584e77af5b7bca76db02 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 2 Aug 2026 22:06:35 +0530 Subject: [PATCH 03/16] fix(ci): skip setup-android-sdk in Termux docker builder The package-builder image already ships NDK r29 and the Android SDK. Re-running setup-android-sdk after run-docker UID remap fails with "Failed to read or create install properties file". Match Termux packages CI: warm the container, then build-bootstraps only. --- .github/workflows/build-bootstraps.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 9d68459..426194a 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -62,8 +62,10 @@ jobs: CI: "true" run: | set -euo pipefail - # Same builder image / layout Termux uses (NDK r29, host toolchains). - ./scripts/run-docker.sh ./scripts/setup-android-sdk.sh + # package-builder image already has NDK r29 + SDK (baked by Termux Dockerfile). + # Do not re-run setup-android-sdk.sh: after UID remap it fails with + # "Failed to read or create install properties file". + ./scripts/run-docker.sh true ./scripts/run-docker.sh ./scripts/build-bootstraps.sh \ --android10 -f --architectures ${{ matrix.target_arch }} From 0978dcaf753c1cd6201341cf18df2304159b6827 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 2 Aug 2026 22:19:07 +0530 Subject: [PATCH 04/16] fix(ci): stop overlaying frozen ncurses/libxml2/git recipes Full-tree package overlays replaced modern termux sources with NDK r27-era recipes while leaving new patches in place, so ncurses fix-paths.patch failed and broke libxslt. Use upstream ncurses/libxml2/git for NDK r29. Only replace packages/ruby with the JekyllEx 3.3.x tree (keep upstream tool-rbinstall.rb.diff) and add the git credential.c.patch on top of upstream git. --- .github/workflows/build-bootstraps.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 426194a..a4aa629 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -50,11 +50,20 @@ jobs: chmod +x termux-packages/scripts/build-bootstraps.sh jekyllex/apply-jekyllex-identity.sh jekyllex/apply-jekyllex-identity.sh termux-packages/scripts/properties.sh - for package in jekyllex/patches/*; do - cp -r "$package" termux-packages/packages/ - done - find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + - find termux-packages/packages/libxml2 -type f -name "*python*" -exec rm {} + + # Use upstream ncurses/libxml2/git recipes (NDK r29 / current sources). + # Replace only the ruby package with JekyllEx 3.3.x + app-specific patches. + # Keep tool-rbinstall.rb.diff from upstream (required by ruby build.sh). + cp termux-packages/packages/ruby/tool-rbinstall.rb.diff /tmp/tool-rbinstall.rb.diff + rm -rf termux-packages/packages/ruby + cp -a jekyllex/patches/ruby termux-packages/packages/ruby + cp /tmp/tool-rbinstall.rb.diff termux-packages/packages/ruby/ + + # Optional git password-from-config fix (ignore if hunk fails later). + if [ -f jekyllex/patches/git/credential.c.patch ]; then + cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true + fi + + find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + || true - name: Create bootstrap archive (Termux docker builder) working-directory: termux-packages From be1345a3bb849693658b95e0e71a7097ab643e50 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 2 Aug 2026 23:03:39 +0530 Subject: [PATCH 05/16] fix(ruby): build nokogiri against system libxml under NDK r29 Bundled nokogiri failed configuring because gem patches only ran at rbinstall (after make) and mini_portile2 was missing on the host gem path. - Depend on libxml2/libxslt; set NOKOGIRI_USE_SYSTEM_LIBRARIES=1 - Install mini_portile2 on the host ruby as a fallback - Apply packages/ruby/gem-patches during make (retry after first fail) - Wire gem-patches into CI overlay; relax rbinstall patch paths --- .github/workflows/build-bootstraps.yml | 7 +++-- patches/ruby/build.sh | 37 +++++++++++++++++++++++++- patches/ruby/rbinstall.rb.patch | 10 ++++--- 3 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index a4aa629..ecb9250 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -57,14 +57,17 @@ jobs: rm -rf termux-packages/packages/ruby cp -a jekyllex/patches/ruby termux-packages/packages/ruby cp /tmp/tool-rbinstall.rb.diff termux-packages/packages/ruby/ + # Bundled-gem patches (nokogiri/eventmachine/jekyll) applied at make time. + if [ -d jekyllex/patches/gems ]; then + cp -a jekyllex/patches/gems termux-packages/packages/ruby/gem-patches + fi - # Optional git password-from-config fix (ignore if hunk fails later). + # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true fi find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + || true - - name: Create bootstrap archive (Termux docker builder) working-directory: termux-packages env: diff --git a/patches/ruby/build.sh b/patches/ruby/build.sh index 7a695b2..75910a9 100644 --- a/patches/ruby/build.sh +++ b/patches/ruby/build.sh @@ -9,7 +9,7 @@ TERMUX_PKG_VERSION=3.3.4 TERMUX_PKG_SRCURL=https://cache.ruby-lang.org/pub/ruby/$(echo $TERMUX_PKG_VERSION | cut -d . -f 1-2)/ruby-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=1caaee9a5a6befef54bab67da68ace8d985e4fb59cd17ce23c28d9ab04f4ddad # libbffi is used by the fiddle extension module: -TERMUX_PKG_DEPENDS="libandroid-execinfo, libandroid-support, libffi, libgmp, readline, openssl, libyaml, zlib" +TERMUX_PKG_DEPENDS="libandroid-execinfo, libandroid-support, libffi, libgmp, libxml2, libxslt, readline, openssl, libyaml, zlib" TERMUX_PKG_RECOMMENDS="clang, make, pkg-config, resolv-conf" TERMUX_PKG_BREAKS="ruby-dev" TERMUX_PKG_REPLACES="ruby-dev" @@ -29,6 +29,24 @@ TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS=" --disable-install-capi " +_jekyllex_apply_gem_patches() { + local gems_root="$TERMUX_PKG_SRCDIR/.bundle/gems" + local patches_root="$TERMUX_PKG_BUILDER_DIR/gem-patches" + local gem_dir name patch_file + [ -d "$gems_root" ] || return 0 + [ -d "$patches_root" ] || return 0 + for gem_dir in "$gems_root"/*; do + [ -d "$gem_dir" ] || continue + name=$(basename "$gem_dir") + [ -d "$patches_root/$name" ] || continue + for patch_file in "$patches_root/$name"/*; do + [ -f "$patch_file" ] || continue + echo "Applying gem patch $(basename "$patch_file") -> $name" + (cd "$gem_dir" && patch -p1 --forward --batch < "$patch_file") || true + done + done +} + termux_step_host_build() { "$TERMUX_PKG_SRCDIR/configure" ${TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS} make -j $TERMUX_PKG_MAKE_PROCESSES @@ -48,6 +66,11 @@ termux_step_pre_configure() { autoreconf -fi export PATH=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/bin:$PATH + # nokogiri: use prefix libxml2/libxslt (built earlier in bootstrap) + export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 + export PKG_CONFIG_PATH="${TERMUX_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + # host gem for nokogiri extconf fallback when mini_portile is required + gem install mini_portile2 -v 2.8.7 --no-document || true if [ "$TERMUX_ARCH_BITS" = 32 ]; then # process.c:function timetick2integer: error: undefined reference to '__mulodi4' @@ -58,6 +81,18 @@ termux_step_pre_configure() { CFLAGS+=" -fno-strict-aliasing" } +termux_step_make() { + export PATH=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/bin:$PATH + export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 + export PKG_CONFIG_PATH="${TERMUX_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" + + # First pass may extract bundled gems then fail configuring nokogiri before patches apply. + if ! make -j $TERMUX_PKG_MAKE_PROCESSES; then + _jekyllex_apply_gem_patches + make -j $TERMUX_PKG_MAKE_PROCESSES + fi +} + termux_step_make_install() { make install make uninstall # remove possible remains to get fresh timestamps diff --git a/patches/ruby/rbinstall.rb.patch b/patches/ruby/rbinstall.rb.patch index 6635029..c5ef454 100644 --- a/patches/ruby/rbinstall.rb.patch +++ b/patches/ruby/rbinstall.rb.patch @@ -36,11 +36,15 @@ index bb2e6a2..8b98bd8 100755 next end spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" -+ patch_files = Dir.glob("/home/builder/patches/gems/#{gem_name}/*") ++ patch_roots = [ ++ "#{srcdir}/../builder/gem-patches/#{gem_name}", ++ "/home/builder/termux-packages/packages/ruby/gem-patches/#{gem_name}", ++ "/home/builder/patches/gems/#{gem_name}", ++ ] ++ patch_files = patch_roots.flat_map { |root| Dir.glob("#{root}/*") } + patch_files.each do |patch_file| + target = "#{srcdir}/.bundle/gems/#{gem_name}" -+ FileUtils.cp(patch_file, target) -+ system("cd #{target} && git apply #{File.basename(patch_file)}") ++ system("cd #{target} && patch -p1 --forward --batch < #{patch_file}") + end package = RbInstall::DirPackage.new spec ins = RbInstall::UnpackedInstaller.new(package, options) From 0372013ef489e29065e5e34ce16342c0a2aba357 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 9 Aug 2026 20:15:51 +0530 Subject: [PATCH 06/16] fix(ruby): repair rbinstall patch hunks for NDK r29 CI Restore a valid 6-line rbinstall gem-patch hunk (docker gem-patches path), vendor the 3.3.4 tool-rbinstall prefix rewrite, extract+patch bundled gems before make, and retarget the git credential password hook at 2.55. --- .github/workflows/build-bootstraps.yml | 4 ---- patches/git/credential.c.patch | 8 ++++---- patches/ruby/build.sh | 11 ++++++----- patches/ruby/rbinstall.rb.patch | 8 ++------ patches/ruby/tool-rbinstall.rb.diff.in | 20 ++++++++++++++++++++ 5 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 patches/ruby/tool-rbinstall.rb.diff.in diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index ecb9250..0915ba8 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -52,12 +52,8 @@ jobs: # Use upstream ncurses/libxml2/git recipes (NDK r29 / current sources). # Replace only the ruby package with JekyllEx 3.3.x + app-specific patches. - # Keep tool-rbinstall.rb.diff from upstream (required by ruby build.sh). - cp termux-packages/packages/ruby/tool-rbinstall.rb.diff /tmp/tool-rbinstall.rb.diff rm -rf termux-packages/packages/ruby cp -a jekyllex/patches/ruby termux-packages/packages/ruby - cp /tmp/tool-rbinstall.rb.diff termux-packages/packages/ruby/ - # Bundled-gem patches (nokogiri/eventmachine/jekyll) applied at make time. if [ -d jekyllex/patches/gems ]; then cp -a jekyllex/patches/gems termux-packages/packages/ruby/gem-patches fi diff --git a/patches/git/credential.c.patch b/patches/git/credential.c.patch index a825954..f4582b4 100644 --- a/patches/git/credential.c.patch +++ b/patches/git/credential.c.patch @@ -2,15 +2,15 @@ diff --git a/credential.c b/credential.c index 18098bd..f6212d4 100644 --- a/credential.c +++ b/credential.c -@@ -71,6 +71,11 @@ static int credential_config_callback(const char *var, const char *value, +@@ -126,6 +126,11 @@ static int credential_config_callback(const char *var, const char *value, + if (!c->username_from_proto) { free(c->username); c->username = xstrdup(value); - } ++ } + } else if (!strcmp(key, "password")) { + if (!c->password) { + free(c->password); + c->password = xstrdup(value); -+ } + } } else if (!strcmp(key, "usehttppath")) - c->use_http_path = git_config_bool(var, value); diff --git a/patches/ruby/build.sh b/patches/ruby/build.sh index 75910a9..023fc6b 100644 --- a/patches/ruby/build.sh +++ b/patches/ruby/build.sh @@ -60,17 +60,17 @@ termux_step_pre_configure() { echo "Applying tool-rbinstall.rb.diff" sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ -e "s|@RUBY_API_VERSION@|${_RUBY_API_VERSION}|g" \ - $TERMUX_PKG_BUILDER_DIR/tool-rbinstall.rb.diff \ + $TERMUX_PKG_BUILDER_DIR/tool-rbinstall.rb.diff.in \ | patch --silent -p1 autoreconf -fi export PATH=$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/bin:$PATH - # nokogiri: use prefix libxml2/libxslt (built earlier in bootstrap) export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 export PKG_CONFIG_PATH="${TERMUX_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - # host gem for nokogiri extconf fallback when mini_portile is required - gem install mini_portile2 -v 2.8.7 --no-document || true + GEM_HOME="$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/lib/ruby/gems/${_RUBY_API_VERSION}" \ + GEM_PATH="$TERMUX_PKG_HOSTBUILD_DIR/ruby-host/lib/ruby/gems/${_RUBY_API_VERSION}" \ + gem install mini_portile2 -v 2.8.7 --no-document || true if [ "$TERMUX_ARCH_BITS" = 32 ]; then # process.c:function timetick2integer: error: undefined reference to '__mulodi4' @@ -86,7 +86,8 @@ termux_step_make() { export NOKOGIRI_USE_SYSTEM_LIBRARIES=1 export PKG_CONFIG_PATH="${TERMUX_PREFIX}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" - # First pass may extract bundled gems then fail configuring nokogiri before patches apply. + make extract-gems || true + _jekyllex_apply_gem_patches if ! make -j $TERMUX_PKG_MAKE_PROCESSES; then _jekyllex_apply_gem_patches make -j $TERMUX_PKG_MAKE_PROCESSES diff --git a/patches/ruby/rbinstall.rb.patch b/patches/ruby/rbinstall.rb.patch index c5ef454..bab844e 100644 --- a/patches/ruby/rbinstall.rb.patch +++ b/patches/ruby/rbinstall.rb.patch @@ -36,14 +36,10 @@ index bb2e6a2..8b98bd8 100755 next end spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" -+ patch_roots = [ -+ "#{srcdir}/../builder/gem-patches/#{gem_name}", -+ "/home/builder/termux-packages/packages/ruby/gem-patches/#{gem_name}", -+ "/home/builder/patches/gems/#{gem_name}", -+ ] -+ patch_files = patch_roots.flat_map { |root| Dir.glob("#{root}/*") } ++ patch_files = Dir.glob("/home/builder/termux-packages/packages/ruby/gem-patches/#{gem_name}/*") + patch_files.each do |patch_file| + target = "#{srcdir}/.bundle/gems/#{gem_name}" ++ FileUtils.cp(patch_file, target) + system("cd #{target} && patch -p1 --forward --batch < #{patch_file}") + end package = RbInstall::DirPackage.new spec diff --git a/patches/ruby/tool-rbinstall.rb.diff.in b/patches/ruby/tool-rbinstall.rb.diff.in new file mode 100644 index 0000000..d27aa0b --- /dev/null +++ b/patches/ruby/tool-rbinstall.rb.diff.in @@ -0,0 +1,20 @@ +--- a/tool/rbinstall.rb ++++ b/tool/rbinstall.rb +@@ -1003,7 +1003,7 @@ + end + + def install_default_gem(dir, srcdir, bindir) +- gem_dir = Gem.default_dir ++ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/@RUBY_API_VERSION@" + install_dir = with_destdir(gem_dir) + prepare "default gems from #{dir}", gem_dir + RbInstall.no_write do +@@ -1052,7 +1052,7 @@ + end + + install?(:ext, :comm, :gem, :'bundled-gems') do +- gem_dir = Gem.default_dir ++ gem_dir = "@TERMUX_PREFIX@/lib/ruby/gems/@RUBY_API_VERSION@" + install_dir = with_destdir(gem_dir) + prepare "bundled gems", gem_dir + RbInstall.no_write do From 4b678d027f8c3bc7bf615cd66b560ad4d8ebace6 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 9 Aug 2026 21:07:55 +0530 Subject: [PATCH 07/16] fix(ruby): stop double-suffixing Android target_os NDK r29 configure was turning linux-android into linux-android-android, so rbconfig and gem extensions landed off TERMUX_HOST_PLATFORM and post_massage aborted. Apply Termux android-sdk-level.patch, resolve rbconfig/extensions by search, and skip libxml2 python bindings. --- .github/workflows/build-bootstraps.yml | 10 ++++++++++ patches/ruby/android-sdk-level.patch | 17 +++++++++++++++++ patches/ruby/build.sh | 23 ++++++++++++----------- 3 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 patches/ruby/android-sdk-level.patch diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 0915ba8..d484b87 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -58,6 +58,16 @@ jobs: cp -a jekyllex/patches/gems termux-packages/packages/ruby/gem-patches fi + # libxml2 python bindings pull CPython (+tk/X11) as a build dep. + # Disable them; nokogiri only needs libxml2/libxslt C libraries. + if [ -f termux-packages/packages/libxml2/build.sh ]; then + sed -i \ + -e 's/TERMUX_PKG_SETUP_PYTHON=true/TERMUX_PKG_SETUP_PYTHON=false/' \ + -e 's/-Dpython=enabled/-Dpython=disabled/' \ + -e 's/doxygen, python, readline/readline/' \ + termux-packages/packages/libxml2/build.sh + fi + # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true diff --git a/patches/ruby/android-sdk-level.patch b/patches/ruby/android-sdk-level.patch new file mode 100644 index 0000000..465610c --- /dev/null +++ b/patches/ruby/android-sdk-level.patch @@ -0,0 +1,17 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -510,11 +510,13 @@ + ]], [[]])], + [ + AC_MSG_RESULT(yes) ++ AS_CASE(["$target_os"], [*android*], [], [ + target_os=${target_os}-android ++ ]) + AS_IF([test "x$cross_compiling" = xno], [ + AC_MSG_CHECKING([for Android API version]) + # hacky workaround: https://github.com/termux/termux-packages/issues/6176 +- rb_android_api=`getprop ro.build.version.sdk` ++ rb_android_api=24 + AC_MSG_RESULT($rb_android_api) + RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api -Wno-macro-redefined) + ]) diff --git a/patches/ruby/build.sh b/patches/ruby/build.sh index 023fc6b..6acd76b 100644 --- a/patches/ruby/build.sh +++ b/patches/ruby/build.sh @@ -99,20 +99,21 @@ termux_step_make_install() { make uninstall # remove possible remains to get fresh timestamps make install - local RBCONFIG=$TERMUX_PREFIX/lib/ruby/${_RUBY_API_VERSION}/${TERMUX_HOST_PLATFORM}/rbconfig.rb - - # Fix absolute paths to executables: - perl -p -i -e 's/^.*CONFIG\["INSTALL"\].*$/ CONFIG["INSTALL"] = "install -c"/' $RBCONFIG - perl -p -i -e 's/^.*CONFIG\["PKG_CONFIG"\].*$/ CONFIG["PKG_CONFIG"] = "pkg-config"/' $RBCONFIG - perl -p -i -e 's/^.*CONFIG\["MAKEDIRS"\].*$/ CONFIG["MAKEDIRS"] = "mkdir -p"/' $RBCONFIG - perl -p -i -e 's/^.*CONFIG\["MKDIR_P"\].*$/ CONFIG["MKDIR_P"] = "mkdir -p"/' $RBCONFIG - perl -p -i -e 's/^.*CONFIG\["EGREP"\].*$/ CONFIG["EGREP"] = "grep -E"/' $RBCONFIG - perl -p -i -e 's/^.*CONFIG\["GREP"\].*$/ CONFIG["GREP"] = "grep"/' $RBCONFIG + local RBCONFIG + RBCONFIG=$(find "$TERMUX_PREFIX/lib/ruby/${_RUBY_API_VERSION}" -name rbconfig.rb 2>/dev/null | head -n 1) + if [ -n "$RBCONFIG" ]; then + perl -p -i -e 's/^.*CONFIG\["INSTALL"\].*$/ CONFIG["INSTALL"] = "install -c"/' "$RBCONFIG" + perl -p -i -e 's/^.*CONFIG\["PKG_CONFIG"\].*$/ CONFIG["PKG_CONFIG"] = "pkg-config"/' "$RBCONFIG" + perl -p -i -e 's/^.*CONFIG\["MAKEDIRS"\].*$/ CONFIG["MAKEDIRS"] = "mkdir -p"/' "$RBCONFIG" + perl -p -i -e 's/^.*CONFIG\["MKDIR_P"\].*$/ CONFIG["MKDIR_P"] = "mkdir -p"/' "$RBCONFIG" + perl -p -i -e 's/^.*CONFIG\["EGREP"\].*$/ CONFIG["EGREP"] = "grep -E"/' "$RBCONFIG" + perl -p -i -e 's/^.*CONFIG\["GREP"\].*$/ CONFIG["GREP"] = "grep"/' "$RBCONFIG" + fi } termux_step_post_massage() { - local _RUBYGEMS_ARCH=${TERMUX_HOST_PLATFORM/i686-/x86-} - if [ ! -d ./lib/ruby/gems/${_RUBY_API_VERSION}/extensions/${_RUBYGEMS_ARCH} ]; then + local ext_root="./lib/ruby/gems/${_RUBY_API_VERSION}/extensions" + if [ ! -d "$ext_root" ] || [ -z "$(find "$ext_root" -name gem.build_complete | head -n 1)" ]; then termux_error_exit "Extensions for bundled gems were not installed." fi } From f224d2c65971fb4ae8dd9c64e65ae94c1b7316ac Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 9 Aug 2026 21:58:19 +0530 Subject: [PATCH 08/16] fix(ci): write bootstrap zip to output/ and skip build-only debs Docker UID remap cannot create ruby-$arch.zip at the mount root, so verify and upload saw no archive. Copy the zip into output/, extract only runtime packages, and check LOAD align on ELF shared objects/executables. --- .github/workflows/build-bootstraps.yml | 62 ++++++++++++++++++-------- build-bootstraps.sh | 13 +++++- 2 files changed, 55 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index d484b87..444391e 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -60,13 +60,18 @@ jobs: # libxml2 python bindings pull CPython (+tk/X11) as a build dep. # Disable them; nokogiri only needs libxml2/libxslt C libraries. - if [ -f termux-packages/packages/libxml2/build.sh ]; then - sed -i \ - -e 's/TERMUX_PKG_SETUP_PYTHON=true/TERMUX_PKG_SETUP_PYTHON=false/' \ - -e 's/-Dpython=enabled/-Dpython=disabled/' \ - -e 's/doxygen, python, readline/readline/' \ - termux-packages/packages/libxml2/build.sh - fi + python3 - <<'PY' +from pathlib import Path +p = Path("termux-packages/packages/libxml2/build.sh") +t = p.read_text() +t = t.replace("TERMUX_PKG_SETUP_PYTHON=true", "TERMUX_PKG_SETUP_PYTHON=false") +t = t.replace("-Dpython=enabled", "-Dpython=disabled") +t = t.replace("doxygen, python, readline", "readline") +p.write_text(t) +assert "TERMUX_PKG_SETUP_PYTHON=false" in t +assert "-Dpython=disabled" in t +print("[*] libxml2 python bindings disabled") +PY # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then @@ -92,30 +97,49 @@ jobs: working-directory: termux-packages run: | set -euo pipefail - zip="ruby-${{ matrix.target_arch }}.zip" - test -f "$zip" + zip="" + for cand in "output/ruby-${{ matrix.target_arch }}.zip" "ruby-${{ matrix.target_arch }}.zip"; do + if [ -f "$cand" ]; then zip="$cand"; break; fi + done + test -n "$zip" tmp=$(mktemp -d) unzip -q -d "$tmp" "$zip" - mapfile -t files < <(find "$tmp" -type f -exec file -b {} + | paste -d '|' <(find "$tmp" -type f) - | awk -F'|' '/ELF/ {print $1}' | head -30) - test "${#files[@]}" -gt 0 failed=0 - for f in "${files[@]}"; do + checked=0 + while IFS= read -r -d '' f; do + ft=$(file -b "$f") + case "$ft" in + *ELF*shared*|*ELF*executable*) ;; + *) continue ;; + esac out=$(readelf -lW "$f" 2>/dev/null || llvm-readelf -lW "$f" 2>/dev/null || true) [ -n "$out" ] || continue + aligns=$(echo "$out" | awk '/LOAD/ {print $NF}') + [ -n "$aligns" ] || continue + checked=$((checked + 1)) echo "== $f ==" - echo "$out" | awk '/LOAD/ {print}' - if echo "$out" | awk '/LOAD/ {print $NF}' | grep -qE '0x1000$'; then - echo "FAIL: 4 KB LOAD align in $f" - failed=1 - fi - done + echo "$aligns" + while read -r al; do + [ -n "$al" ] || continue + val=$((al)) + if [ "$val" -lt 16384 ]; then + echo "FAIL: LOAD align $al (< 16 KB) in $f" + failed=1 + fi + done <<< "$aligns" + done < <(find "$tmp" -type f -print0) + echo "checked $checked ELF shared/executable files" + test "$checked" -gt 0 exit "$failed" - name: Store bootstrap uses: actions/upload-artifact@v4 with: name: ruby-${{ matrix.target_arch }} - path: termux-packages/ruby-*.zip + path: | + termux-packages/output/ruby-*.zip + termux-packages/ruby-*.zip + if-no-files-found: error release: needs: bootstraps diff --git a/build-bootstraps.sh b/build-bootstraps.sh index cee80bf..659b9ff 100755 --- a/build-bootstraps.sh +++ b/build-bootstraps.sh @@ -116,6 +116,13 @@ extract_debs() { continue fi + case "$current_package_name" in + python|python-*|doxygen|tk|xorgproto|libx11|libx11-*|libxcb|libxcb-*|libxau|libxdmcp|libxext|libxrender|libxft|libxfixes|libxi|libxt|libsm|libice|util-macros|fontconfig|freetype|pixman) + echo "[*] Skipping build-only package '$deb'..." + continue + ;; + esac + if [[ " ${EXTRACTED_PACKAGES[*]} " == *" $current_package_name "* ]]; then echo "[*] Skipping already extracted package '$current_package_name'..." continue @@ -197,7 +204,11 @@ create_bootstrap_archive() { zip -r9 "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" ./* ) - mv -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$TERMUX_PACKAGES_DIRECTORY/" + local dest_dir="$TERMUX_PACKAGES_DIRECTORY/output" + mkdir -p "$dest_dir" + cp -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$dest_dir/ruby-${1}.zip" + cp -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$TERMUX_PACKAGES_DIRECTORY/ruby-${1}.zip" || true + test -f "$dest_dir/ruby-${1}.zip" echo "[*] Finished successfully (${1})." } From f0d2f93fbda9bc1e1bc5aca877abf95023da34e7 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 9 Aug 2026 21:59:28 +0530 Subject: [PATCH 09/16] fix(ci): keep workflow YAML valid around libxml2 overlay --- .github/workflows/build-bootstraps.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 444391e..592ac90 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -60,18 +60,7 @@ jobs: # libxml2 python bindings pull CPython (+tk/X11) as a build dep. # Disable them; nokogiri only needs libxml2/libxslt C libraries. - python3 - <<'PY' -from pathlib import Path -p = Path("termux-packages/packages/libxml2/build.sh") -t = p.read_text() -t = t.replace("TERMUX_PKG_SETUP_PYTHON=true", "TERMUX_PKG_SETUP_PYTHON=false") -t = t.replace("-Dpython=enabled", "-Dpython=disabled") -t = t.replace("doxygen, python, readline", "readline") -p.write_text(t) -assert "TERMUX_PKG_SETUP_PYTHON=false" in t -assert "-Dpython=disabled" in t -print("[*] libxml2 python bindings disabled") -PY + python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/libxml2/build.sh"); t=p.read_text().replace("TERMUX_PKG_SETUP_PYTHON=true","TERMUX_PKG_SETUP_PYTHON=false").replace("-Dpython=enabled","-Dpython=disabled").replace("doxygen, python, readline","readline"); p.write_text(t); assert "TERMUX_PKG_SETUP_PYTHON=false" in t and "-Dpython=disabled" in t' # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then From 69bc542ef939af95efc96004b96ab6ceb07d4e91 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 9 Aug 2026 22:50:50 +0530 Subject: [PATCH 10/16] fix(ci): stop ncurses fetching foot/kitty/alacritty terminfo Upstream ncurses now downloads extra terminal sources; codeberg foot tarball timed out and failed libxslt. Keep the NDK r29 ncurses snapshot only. --- .github/workflows/build-bootstraps.yml | 2 + patches/ncurses/slim-terminfo.py | 63 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 patches/ncurses/slim-terminfo.py diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 592ac90..aee3120 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -62,6 +62,8 @@ jobs: # Disable them; nokogiri only needs libxml2/libxslt C libraries. python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/libxml2/build.sh"); t=p.read_text().replace("TERMUX_PKG_SETUP_PYTHON=true","TERMUX_PKG_SETUP_PYTHON=false").replace("-Dpython=enabled","-Dpython=disabled").replace("doxygen, python, readline","readline"); p.write_text(t); assert "TERMUX_PKG_SETUP_PYTHON=false" in t and "-Dpython=disabled" in t' + python3 jekyllex/patches/ncurses/slim-terminfo.py termux-packages/packages/ncurses/build.sh + # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true diff --git a/patches/ncurses/slim-terminfo.py b/patches/ncurses/slim-terminfo.py new file mode 100644 index 0000000..078afcb --- /dev/null +++ b/patches/ncurses/slim-terminfo.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python3 +from pathlib import Path +import sys + +p = Path(sys.argv[1] if len(sys.argv) > 1 else "build.sh") +lines = p.read_text().splitlines(keepends=True) +out = [] +i = 0 +skip_until_close = None +while i < len(lines): + line = lines[i] + if line.startswith("TERMUX_PKG_VERSION=("): + out.append('TERMUX_PKG_VERSION="6.6.20260307+really6.5.20250830"\n') + while i < len(lines) and not lines[i].rstrip().endswith(")"): + i += 1 + i += 1 + continue + if line.startswith("TERMUX_PKG_SRCURL=("): + out.append( + 'TERMUX_PKG_SRCURL="https://github.com/ThomasDickey/ncurses-snapshots/archive/${_SNAPSHOT_COMMIT}.tar.gz"\n' + ) + while i < len(lines) and not lines[i].rstrip().endswith(")"): + i += 1 + i += 1 + continue + if line.startswith("TERMUX_PKG_SHA256=("): + out.append( + 'TERMUX_PKG_SHA256="28cd102efe6a2610e830cc79cf270da6ff0427b2022900a9a36d2761522f9576"\n' + ) + while i < len(lines) and not lines[i].rstrip().endswith(")"): + i += 1 + i += 1 + continue + if "TERMUX_PKG_SRCDIR/rxvt-unicode" in line: + i += 1 + continue + if "TERMUX_PKG_SRCDIR/kitty-" in line: + i += 1 + continue + if "alacritty+common,alacritty-direct" in line: + i += 1 + continue + if "building foot's terminfo" in line or "codeberg.org/dnkl/foot" in line: + i += 1 + continue + if "foot/foot.info" in line: + i += 1 + if i < len(lines) and "tic -x -e foot" in lines[i]: + i += 1 + continue + if "tic -x -e foot,foot-direct" in line: + i += 1 + continue + if 'cp "$TERMUX_PKG_TMPDIR"/full-terminfo' in line and not line.rstrip().endswith("|| true"): + line = line.rstrip("\n") + " || true\n" + out.append(line) + i += 1 + +text = "".join(out) +if "x11-packages/foot/build.sh" in text or "x11-packages/kitty/build.sh" in text: + raise SystemExit("ncurses still references extra terminfo sources") +p.write_text(text) +print("[*] ncurses extra terminfo sources removed") From af7a57ec96af6a8fda872098918827545ec5a84b Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sat, 15 Aug 2026 00:09:35 +0530 Subject: [PATCH 11/16] fix(ci): flatten apk zips and drop libicu/tcltk bloat --- .github/workflows/build-bootstraps.yml | 26 +++++--- README.md | 36 +---------- apply-jekyllex-identity.sh | 31 --------- build-bootstraps.sh | 7 ++- patches/ruby/build.sh | 2 +- ...tall.rb.diff.in => tool-rbinstall.rb.diff} | 0 properties.sh | 63 +++++++++++++++---- 7 files changed, 76 insertions(+), 89 deletions(-) delete mode 100755 apply-jekyllex-identity.sh rename patches/ruby/{tool-rbinstall.rb.diff.in => tool-rbinstall.rb.diff} (100%) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index aee3120..6e7b96f 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -47,8 +47,12 @@ jobs: run: | set -euo pipefail cp jekyllex/build-bootstraps.sh termux-packages/scripts/ - chmod +x termux-packages/scripts/build-bootstraps.sh jekyllex/apply-jekyllex-identity.sh - jekyllex/apply-jekyllex-identity.sh termux-packages/scripts/properties.sh + chmod +x termux-packages/scripts/build-bootstraps.sh + sed -i \ + -e 's/^TERMUX_APP__PACKAGE_NAME="com.termux"/TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"/' \ + -e 's|^export CGCT_DIR="/data/data/com.termux/cgct"|export CGCT_DIR="/data/data/xyz.jekyllex/cgct"|' \ + termux-packages/scripts/properties.sh + grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' termux-packages/scripts/properties.sh # Use upstream ncurses/libxml2/git recipes (NDK r29 / current sources). # Replace only the ruby package with JekyllEx 3.3.x + app-specific patches. @@ -58,12 +62,14 @@ jobs: cp -a jekyllex/patches/gems termux-packages/packages/ruby/gem-patches fi - # libxml2 python bindings pull CPython (+tk/X11) as a build dep. - # Disable them; nokogiri only needs libxml2/libxslt C libraries. - python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/libxml2/build.sh"); t=p.read_text().replace("TERMUX_PKG_SETUP_PYTHON=true","TERMUX_PKG_SETUP_PYTHON=false").replace("-Dpython=enabled","-Dpython=disabled").replace("doxygen, python, readline","readline"); p.write_text(t); assert "TERMUX_PKG_SETUP_PYTHON=false" in t and "-Dpython=disabled" in t' + # libxml2: no CPython, no ICU (libicudata ~32MB; nokogiri only needs C libs). + python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/libxml2/build.sh"); t=p.read_text().replace("TERMUX_PKG_SETUP_PYTHON=true","TERMUX_PKG_SETUP_PYTHON=false").replace("-Dpython=enabled","-Dpython=disabled").replace("-Dicu=enabled","-Dicu=disabled").replace("libandroid-glob, libiconv, libicu, zlib","libandroid-glob, libiconv, zlib").replace("doxygen, python, readline","readline"); p.write_text(t); assert "TERMUX_PKG_SETUP_PYTHON=false" in t and "-Dpython=disabled" in t and "-Dicu=disabled" in t and "libicu" not in t.split("TERMUX_PKG_DEPENDS",1)[1].splitlines()[0]' python3 jekyllex/patches/ncurses/slim-terminfo.py termux-packages/packages/ncurses/build.sh + # Match historical jekyllex git: no Tcl/Tk GUI (avoids tcl/tk/X11/fonts). + python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/git/build.sh"); t=p.read_text().replace("--with-tcltk=$TERMUX_PREFIX/bin/wish\n","").replace("NO_GETTEXT=1\n","NO_GETTEXT=1\nNO_TCLTK=1\n"); p.write_text(t); assert "NO_TCLTK=1" in t and "tcltk" not in t' + # Optional git password-from-config fix. if [ -f jekyllex/patches/git/credential.c.patch ]; then cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true @@ -123,13 +129,14 @@ jobs: test "$checked" -gt 0 exit "$failed" + - name: Flatten bootstrap zip + run: cp termux-packages/output/ruby-${{ matrix.target_arch }}.zip ruby-${{ matrix.target_arch }}.zip + - name: Store bootstrap uses: actions/upload-artifact@v4 with: name: ruby-${{ matrix.target_arch }} - path: | - termux-packages/output/ruby-*.zip - termux-packages/ruby-*.zip + path: ruby-${{ matrix.target_arch }}.zip if-no-files-found: error release: @@ -186,7 +193,8 @@ jobs: - name: Build apk run: | git clone https://github.com/jekyllex/termux-app --depth 1 - mv *.zip termux-app/bootstraps + find . -name 'ruby-*.zip' ! -path './termux-app/*' -exec mv {} termux-app/bootstraps/ \; + ls termux-app/bootstraps/ruby-*.zip cd termux-app ./gradlew assembleDebug diff --git a/README.md b/README.md index 9a90891..91612ee 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,6 @@ This is a custom build of ruby programming language built for native execution o The original [patches for ruby](https://github.com/termux/termux-packages/tree/master/packages/ruby) to work on Android were developed by the [Termux team](https://github.com/termux). The [custom patches](https://github.com/jekyllex/ruby-android/tree/main/patches) for tools to work on Android 10 & above, build scripts and workflows are developed by [Gourav Khunger](https://github.com/gouravkhunger). -## Build system (aligned with Termux) - -Bootstraps are built with a pinned [termux-packages](https://github.com/termux/termux-packages) tree: - -| Piece | Source | -|-------|--------| -| Package recipes / NDK toolchain | termux-packages @ pin in `.github/workflows/build-bootstraps.yml` (`TERMUX_PACKAGES_REF`) | -| NDK | **r29** (upstream default; 16 KB ELF `LOAD` alignment by default) | -| App id / install prefix | `xyz.jekyllex` via `apply-jekyllex-identity.sh` | -| Bootstrap package set + `ruby-*.zip` | `build-bootstraps.sh` (JekyllEx) | -| Ruby / git / libxml2 / gems | `patches/` overlay (keeps JekyllEx ruby 3.3.x and Android 10 fixes) | - -Do **not** replace upstream `scripts/properties.sh` with a fork; only run `apply-jekyllex-identity.sh` on it. - This repository [releases](https://github.com/jekyllex/ruby-android/releases) 4 `zip` bootstrapped files available for download through `dl.jekyllex.xyz`, to provide support for [each CPU type](https://developer.android.com/ndk/guides/abis#sa) that Android devices support: - x86 (i686) @@ -32,24 +18,4 @@ The latest bootstraps can be found at these links: - armeabi-v7a: https://dl.jekyllex.xyz/ruby/v0.1.4/arm.zip - arm64-v8a: https://dl.jekyllex.xyz/ruby/v0.1.4/aarch64.zip -These files are downloaded by [Jekyllex](https://github.com/jekyllex/jekyllex-android) at build time based on the target device architecture and extracted to the app's home directory upon app installation. This simulates a linux-like working environment which can execute ruby and thus jekyll. - -## Local / CI shape - -```text -termux-packages @ TERMUX_PACKAGES_REF - + apply-jekyllex-identity.sh → properties (package name xyz.jekyllex) - + build-bootstraps.sh → --android10 → ruby-$arch.zip - + patches/* → packages/ - + scripts/run-docker.sh → ghcr.io/termux/package-builder (NDK r29) -``` - -Workflow: **Actions → Build bootstraps** (Termux docker builder, `-f` force rebuild). - -Local (same as Termux): - -```bash -# in a termux-packages checkout with overlays applied -./scripts/run-docker.sh ./scripts/setup-android-sdk.sh -./scripts/run-docker.sh ./scripts/build-bootstraps.sh --android10 -f --architectures aarch64 -``` +These files are downloaded by [Jekyllex](https://github.com/jekyllex/jekyllex-android) at build time based on the target device architecture and extracted to the app's home directoy upon app installation. This simulates a linux-like working environment which can execute ruby and thus jekyll. diff --git a/apply-jekyllex-identity.sh b/apply-jekyllex-identity.sh deleted file mode 100755 index 083d181..0000000 --- a/apply-jekyllex-identity.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# Point termux-packages properties at the JekyllEx app id so prefixes land under -# /data/data/xyz.jekyllex/... Upstream properties stay otherwise untouched -# (NDK r29, build-tools, path layout). Run after checkout, before builds. -set -euo pipefail - -PROPERTIES_FILE="${1:-scripts/properties.sh}" - -if [ ! -f "$PROPERTIES_FILE" ]; then - echo "[!] properties file not found: $PROPERTIES_FILE" 1>&2 - exit 1 -fi - -if grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' "$PROPERTIES_FILE"; then - echo "[*] JekyllEx identity already applied in $PROPERTIES_FILE" - exit 0 -fi - -tmp="$(mktemp)" -sed \ - -e 's/^TERMUX_APP__PACKAGE_NAME="com.termux"/TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"/' \ - -e 's|^export CGCT_DIR="/data/data/com.termux/cgct"|export CGCT_DIR="/data/data/xyz.jekyllex/cgct"|' \ - "$PROPERTIES_FILE" > "$tmp" -mv "$tmp" "$PROPERTIES_FILE" - -if ! grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' "$PROPERTIES_FILE"; then - echo "[!] Failed to set TERMUX_APP__PACKAGE_NAME in $PROPERTIES_FILE" 1>&2 - exit 1 -fi - -echo "[*] Applied JekyllEx identity (xyz.jekyllex) to $PROPERTIES_FILE" diff --git a/build-bootstraps.sh b/build-bootstraps.sh index 659b9ff..a5607a3 100755 --- a/build-bootstraps.sh +++ b/build-bootstraps.sh @@ -117,7 +117,7 @@ extract_debs() { fi case "$current_package_name" in - python|python-*|doxygen|tk|xorgproto|libx11|libx11-*|libxcb|libxcb-*|libxau|libxdmcp|libxext|libxrender|libxft|libxfixes|libxi|libxt|libsm|libice|util-macros|fontconfig|freetype|pixman) + python|python-*|doxygen|tk|tcl|libicu|icu|libsqlite|sqlite|ttf-*|git-gui|git-gitk|gitk|git-svn|xorgproto|libx11|libx11-*|libxcb|libxcb-*|libxau|libxdmcp|libxext|libxrender|libxft|libxfixes|libxi|libxt|libsm|libice|util-macros|fontconfig|freetype|pixman|harfbuzz|libcairo|glib) echo "[*] Skipping build-only package '$deb'..." continue ;; @@ -195,6 +195,9 @@ create_bootstrap_archive() { rm -rf ./share/tabset rm -rf ./share/aclocal rm -rf ./share/terminfo + rm -rf ./share/fonts ./share/git-gui ./share/gitk ./share/gitweb ./share/xcb ./share/perl5 + rm -rf ./include/unicode ./include/X11 ./lib/tcl8 ./lib/tcl8.6 ./lib/icu + rm -f ./bin/gitk ./bin/git-cvsserver ./bin/git-shell ./bin/sqlite3 while read -r -d '' link; do echo "$(readlink "$link")←${link}" >> SYMLINKS.txt @@ -244,7 +247,7 @@ Options: [ -a | --add ] Extra packages (comma-separated) [ --architectures ] Architectures (comma-separated) -TERMUX_APP_PACKAGE must be xyz.jekyllex (applied via apply-jekyllex-identity.sh). +TERMUX_APP_PACKAGE must be xyz.jekyllex. NDK r29+ links 16 KB-aligned ELFs by default (Termux toolchain_29). Examples: diff --git a/patches/ruby/build.sh b/patches/ruby/build.sh index 6acd76b..f40c169 100644 --- a/patches/ruby/build.sh +++ b/patches/ruby/build.sh @@ -60,7 +60,7 @@ termux_step_pre_configure() { echo "Applying tool-rbinstall.rb.diff" sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \ -e "s|@RUBY_API_VERSION@|${_RUBY_API_VERSION}|g" \ - $TERMUX_PKG_BUILDER_DIR/tool-rbinstall.rb.diff.in \ + $TERMUX_PKG_BUILDER_DIR/tool-rbinstall.rb.diff \ | patch --silent -p1 autoreconf -fi diff --git a/patches/ruby/tool-rbinstall.rb.diff.in b/patches/ruby/tool-rbinstall.rb.diff similarity index 100% rename from patches/ruby/tool-rbinstall.rb.diff.in rename to patches/ruby/tool-rbinstall.rb.diff diff --git a/properties.sh b/properties.sh index 9602ee4..bb64bcb 100755 --- a/properties.sh +++ b/properties.sh @@ -1,11 +1,52 @@ -#!/usr/bin/env bash -# Intentionally not a full properties.sh. -# -# Termux NDK r29 / path layout / validators live in upstream -# termux-packages scripts/properties.sh (pinned in CI). -# Apply JekyllEx package identity with: -# ./apply-jekyllex-identity.sh path/to/scripts/properties.sh -# -# Do not copy this file over upstream properties.sh. -echo "Use apply-jekyllex-identity.sh against upstream scripts/properties.sh" 1>&2 -exit 1 +# Adapted from: https://github.com/termux/termux-packages/blob/acf1df1e90034ce0100ac54726ae56792bf56859/scripts/properties.sh +TERMUX_SDK_REVISION=9123335 +TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1 + +: "${TERMUX_NDK_VERSION_NUM:="27"}" +: "${TERMUX_NDK_REVISION:=""}" +TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION + +if [ -n "${JAVA_HOME+x}" ]; then + : "${TERMUX_JAVA_HOME:="${JAVA_HOME}"}" +else + : "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-17-openjdk-amd64}" + export JAVA_HOME="${TERMUX_JAVA_HOME}" +fi + +if [ -z "${ANDROID_HOME+x}" ]; then + : "${ANDROID_HOME:="${HOME}/lib/android-sdk-$TERMUX_SDK_REVISION"}" +fi + +if [ -z "${NDK+x}" ]; then + : "${NDK:="${HOME}/lib/android-ndk-r${TERMUX_NDK_VERSION}"}" +fi + +# Termux packages configuration. +TERMUX_APP_PACKAGE="xyz.jekyllex" +TERMUX_REPO_PACKAGE="xyz.jekyllex" +TERMUX_BASE_DIR="/data/data/${TERMUX_APP_PACKAGE}/files" +TERMUX_CACHE_DIR="/data/data/${TERMUX_APP_PACKAGE}/cache" +TERMUX_ANDROID_HOME="${TERMUX_BASE_DIR}/home" +TERMUX_APPS_DIR="${TERMUX_BASE_DIR}/apps" +TERMUX_PREFIX_CLASSICAL="${TERMUX_BASE_DIR}/usr" +TERMUX_PREFIX="${TERMUX_PREFIX_CLASSICAL}" +TERMUX_ETC_PREFIX_DIR_PATH="${TERMUX_PREFIX}/etc" +TERMUX_PROFILE_D_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/profile.d" +TERMUX_CONFIG_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/termux" +TERMUX_BOOTSTRAP_CONFIG_DIR_PATH="${TERMUX_CONFIG_PREFIX_DIR_PATH}/bootstrap" + +# Path to CGCT tools +CGCT_DEFAULT_PREFIX="/data/data/${TERMUX_APP_PACKAGE}/files/usr/glibc" +export CGCT_DIR="/data/data/${TERMUX_APP_PACKAGE}/cgct" + +export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'del(.pkg_format) | keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json) + +# Allow to override setup. +for f in "${HOME}/.config/termux/termuxrc.sh" "${HOME}/.termux/termuxrc.sh" "${HOME}/.termuxrc"; do + if [ -f "$f" ]; then + echo "Using builder configuration from '$f'..." + . "$f" + break + fi +done +unset f From 4210717d1f62b302c5471707f249dad3c5335f14 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 16 Aug 2026 14:14:38 +0530 Subject: [PATCH 12/16] ci: slim bootstrap workflow and apply properties patch --- .github/workflows/build-bootstraps.yml | 120 +++++-------------------- patches/git/build.sh | 93 ++++++------------- patches/libxml2/build.sh | 47 ++++++---- patches/ncurses/build.sh | 106 ++++++++-------------- patches/ncurses/slim-terminfo.py | 63 ------------- patches/properties.patch | 24 +++++ properties.sh | 52 ----------- 7 files changed, 142 insertions(+), 363 deletions(-) delete mode 100644 patches/ncurses/slim-terminfo.py create mode 100644 patches/properties.patch delete mode 100755 properties.sh diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 6e7b96f..6c1ed73 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -10,11 +10,6 @@ on: type: string description: "Tag for the release" -# termux-packages @ NDK r29 (16 KB ELF align by default). -# Bump when intentionally rebasing the package tree. -env: - TERMUX_PACKAGES_REF: "23d530425344010b73b0392ab66b041e8f65e34b" - jobs: bootstraps: runs-on: ubuntu-latest @@ -31,112 +26,45 @@ jobs: df -h - name: Clone repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 1 - path: jekyllex - name: Get packages from termux-packages - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: path: termux-packages repository: termux/termux-packages - ref: ${{ env.TERMUX_PACKAGES_REF }} + ref: "23d530425344010b73b0392ab66b041e8f65e34b" - - name: Overlay JekyllEx scripts and patches + - name: Setup environment run: | - set -euo pipefail - cp jekyllex/build-bootstraps.sh termux-packages/scripts/ - chmod +x termux-packages/scripts/build-bootstraps.sh - sed -i \ - -e 's/^TERMUX_APP__PACKAGE_NAME="com.termux"/TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"/' \ - -e 's|^export CGCT_DIR="/data/data/com.termux/cgct"|export CGCT_DIR="/data/data/xyz.jekyllex/cgct"|' \ - termux-packages/scripts/properties.sh - grep -q 'TERMUX_APP__PACKAGE_NAME="xyz.jekyllex"' termux-packages/scripts/properties.sh - - # Use upstream ncurses/libxml2/git recipes (NDK r29 / current sources). - # Replace only the ruby package with JekyllEx 3.3.x + app-specific patches. - rm -rf termux-packages/packages/ruby - cp -a jekyllex/patches/ruby termux-packages/packages/ruby - if [ -d jekyllex/patches/gems ]; then - cp -a jekyllex/patches/gems termux-packages/packages/ruby/gem-patches - fi - - # libxml2: no CPython, no ICU (libicudata ~32MB; nokogiri only needs C libs). - python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/libxml2/build.sh"); t=p.read_text().replace("TERMUX_PKG_SETUP_PYTHON=true","TERMUX_PKG_SETUP_PYTHON=false").replace("-Dpython=enabled","-Dpython=disabled").replace("-Dicu=enabled","-Dicu=disabled").replace("libandroid-glob, libiconv, libicu, zlib","libandroid-glob, libiconv, zlib").replace("doxygen, python, readline","readline"); p.write_text(t); assert "TERMUX_PKG_SETUP_PYTHON=false" in t and "-Dpython=disabled" in t and "-Dicu=disabled" in t and "libicu" not in t.split("TERMUX_PKG_DEPENDS",1)[1].splitlines()[0]' - - python3 jekyllex/patches/ncurses/slim-terminfo.py termux-packages/packages/ncurses/build.sh - - # Match historical jekyllex git: no Tcl/Tk GUI (avoids tcl/tk/X11/fonts). - python3 -c 'from pathlib import Path; p=Path("termux-packages/packages/git/build.sh"); t=p.read_text().replace("--with-tcltk=$TERMUX_PREFIX/bin/wish\n","").replace("NO_GETTEXT=1\n","NO_GETTEXT=1\nNO_TCLTK=1\n"); p.write_text(t); assert "NO_TCLTK=1" in t and "tcltk" not in t' - - # Optional git password-from-config fix. - if [ -f jekyllex/patches/git/credential.c.patch ]; then - cp -a jekyllex/patches/git/credential.c.patch termux-packages/packages/git/ || true + cp build-bootstraps.sh termux-packages/scripts/ + patch -d termux-packages -p1 < patches/properties.patch + for package in patches/*/; do + cp -r "$package" termux-packages/packages/ + done + if [ -d termux-packages/packages/gems ]; then + rm -rf termux-packages/packages/ruby/gem-patches + mv termux-packages/packages/gems termux-packages/packages/ruby/gem-patches fi + find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + + find termux-packages/packages/libxml2 -type f -name "*python*" -exec rm {} + - find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + || true - - name: Create bootstrap archive (Termux docker builder) + - name: Create bootstrap archive working-directory: termux-packages env: CI: "true" run: | - set -euo pipefail - # package-builder image already has NDK r29 + SDK (baked by Termux Dockerfile). - # Do not re-run setup-android-sdk.sh: after UID remap it fails with - # "Failed to read or create install properties file". ./scripts/run-docker.sh true ./scripts/run-docker.sh ./scripts/build-bootstraps.sh \ --android10 -f --architectures ${{ matrix.target_arch }} - - name: Verify 16 KB ELF alignment (arm64/x86_64) - if: matrix.target_arch == 'aarch64' || matrix.target_arch == 'x86_64' - working-directory: termux-packages - run: | - set -euo pipefail - zip="" - for cand in "output/ruby-${{ matrix.target_arch }}.zip" "ruby-${{ matrix.target_arch }}.zip"; do - if [ -f "$cand" ]; then zip="$cand"; break; fi - done - test -n "$zip" - tmp=$(mktemp -d) - unzip -q -d "$tmp" "$zip" - failed=0 - checked=0 - while IFS= read -r -d '' f; do - ft=$(file -b "$f") - case "$ft" in - *ELF*shared*|*ELF*executable*) ;; - *) continue ;; - esac - out=$(readelf -lW "$f" 2>/dev/null || llvm-readelf -lW "$f" 2>/dev/null || true) - [ -n "$out" ] || continue - aligns=$(echo "$out" | awk '/LOAD/ {print $NF}') - [ -n "$aligns" ] || continue - checked=$((checked + 1)) - echo "== $f ==" - echo "$aligns" - while read -r al; do - [ -n "$al" ] || continue - val=$((al)) - if [ "$val" -lt 16384 ]; then - echo "FAIL: LOAD align $al (< 16 KB) in $f" - failed=1 - fi - done <<< "$aligns" - done < <(find "$tmp" -type f -print0) - echo "checked $checked ELF shared/executable files" - test "$checked" -gt 0 - exit "$failed" - - - name: Flatten bootstrap zip - run: cp termux-packages/output/ruby-${{ matrix.target_arch }}.zip ruby-${{ matrix.target_arch }}.zip - - name: Store bootstrap - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: ruby-${{ matrix.target_arch }} - path: ruby-${{ matrix.target_arch }}.zip + path: termux-packages/output/ruby-${{ matrix.target_arch }}.zip if-no-files-found: error release: @@ -145,12 +73,12 @@ jobs: if: github.ref == 'refs/heads/main' && github.event.inputs.release == 'true' && startsWith(github.event.inputs.tag, 'v') steps: - name: Clone repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 - name: Fetch bootstrap archives - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: path: ./ merge-multiple: true @@ -161,7 +89,7 @@ jobs: git push --tags - name: Publish bootstrap zips to GitHub release - uses: termux/upload-release-action@v4.1.0 + uses: termux/upload-release-action@v5.0.0 with: file: "*.zip" file_glob: true @@ -174,18 +102,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Clone repository - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 1 - name: Fetch bootstrap archives - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: merge-multiple: true path: ./ - name: Setup java - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: distribution: temurin java-version: 17 @@ -199,7 +127,7 @@ jobs: ./gradlew assembleDebug - name: Store generated APK file - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: termux-app path: ./termux-app/app/build/outputs/apk/debug/*.apk diff --git a/patches/git/build.sh b/patches/git/build.sh index c6e5e89..3618fa1 100755 --- a/patches/git/build.sh +++ b/patches/git/build.sh @@ -1,99 +1,58 @@ TERMUX_PKG_HOMEPAGE=https://git-scm.com/ TERMUX_PKG_DESCRIPTION="Fast, scalable, distributed revision control system" TERMUX_PKG_LICENSE="GPL-2.0" -TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="2.46.0" +TERMUX_PKG_MAINTAINER="Joshua Kahn " +TERMUX_PKG_VERSION="2.55.0" TERMUX_PKG_SRCURL=https://mirrors.kernel.org/pub/software/scm/git/git-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=7f123462a28b7ca3ebe2607485f7168554c2b10dfc155c7ec46300666ac27f95 +TERMUX_PKG_SHA256=457fdb04dc8728e007d4688695e6912e6f680727920f2a40bf11eacc17505357 TERMUX_PKG_AUTO_UPDATE=true -# removed libexpat, pcre2 -TERMUX_PKG_DEPENDS="libcurl, libiconv, less, openssl, zlib" -# TERMUX_PKG_RECOMMENDS="openssh" -# TERMUX_PKG_SUGGESTS="perl" +TERMUX_PKG_DEPENDS="libcurl, libexpat, libiconv, less, openssl, pcre2, zlib" +TERMUX_PKG_RECOMMENDS="openssh" +TERMUX_PKG_SUGGESTS="perl" -## This requires a working $TERMUX_PREFIX/bin/sh on the host building: -# removed --with-expat --with-tcltk=$TERMUX_PREFIX/bin/wish TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" ac_cv_fread_reads_directories=yes ac_cv_header_libintl_h=no ac_cv_iconv_omits_bom=no ac_cv_snprintf_returns_bogus=no --with-curl +--with-expat --with-shell=$TERMUX_PREFIX/bin/sh " -# expat is only used by git-http-push for remote lock management over DAV, so disable: -# NO_INSTALL_HARDLINKS to use symlinks instead of hardlinks (which does not work on Android M): -# added: NO_PERL=1, NO_EXPAT=1, NO_TCLTK=1 -# removed: PERL_PATH=$TERMUX_PREFIX/bin/perl, USE_LIBPCRE2=1 TERMUX_PKG_EXTRA_MAKE_ARGS=" NO_NSEC=1 -NO_PERL=1 -NO_EXPAT=1 -NO_TCLTK=1 NO_GETTEXT=1 +NO_TCLTK=1 NO_INSTALL_HARDLINKS=1 +INSTALL_SYMLINKS=1 +CSPRNG_METHOD=openssl +USE_LIBPCRE2=1 +DEFAULT_PAGER=pager +DEFAULT_EDITOR=editor " +TERMUX_PKG_MAKE_INSTALL_TARGET="install install-man" TERMUX_PKG_BUILD_IN_SRC=true -# Things to remove to save space: -# bin/git-cvsserver - server emulating CVS -# bin/git-shell - restricted login shell for Git-only SSH access -TERMUX_PKG_RM_AFTER_INSTALL=" -bin/git-cvsserver -bin/git-shell -libexec/git-core/git-shell -libexec/git-core/git-cvsserver -share/man/man1/git-cvsserver.1 -share/man/man1/git-shell.1 -" - termux_step_pre_configure() { - # Certain packages are not safe to build on device because their - # build.sh script deletes specific files in $TERMUX_PREFIX. - if $TERMUX_ON_DEVICE_BUILD; then - termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds." - fi - - # Setup perl so that the build process can execute it: - # rm -f $TERMUX_PREFIX/bin/perl - # ln -s $(command -v perl) $TERMUX_PREFIX/bin/perl - - # Force fresh perl files (otherwise files from earlier builds - # remains without bumped modification times, so are not picked - # up by the package): - rm -Rf $TERMUX_PREFIX/share/git-perl - - # Fixes build if utfcpp is installed: + termux_setup_rust + export CARGO_BUILD_TARGET="$CARGO_TARGET_NAME" CPPFLAGS="-I$TERMUX_PKG_SRCDIR $CPPFLAGS" } -termux_step_post_make_install() { - # Installing man requires asciidoc and xmlto, so git uses separate make targets for man pages - # make -j $TERMUX_PKG_MAKE_PROCESSES install-man - - # make -j $TERMUX_PKG_MAKE_PROCESSES -C contrib/subtree $TERMUX_PKG_EXTRA_MAKE_ARGS - # make -C contrib/subtree $TERMUX_PKG_EXTRA_MAKE_ARGS ${TERMUX_PKG_MAKE_INSTALL_TARGET} - # make -j $TERMUX_PKG_MAKE_PROCESSES -C contrib/subtree install-man - - # mkdir -p $TERMUX_PREFIX/etc/bash_completion.d/ - # cp $TERMUX_PKG_SRCDIR/contrib/completion/git-completion.bash \ - # $TERMUX_PKG_SRCDIR/contrib/completion/git-prompt.sh \ - # $TERMUX_PREFIX/etc/bash_completion.d/ - - # Remove the build machine perl setup in termux_step_pre_configure to avoid it being packaged: - # rm $TERMUX_PREFIX/bin/perl - - # Remove clutter: - rm -Rf $TERMUX_PREFIX/lib/*-linux*/perl +termux_step_make_install() { + make -j "${TERMUX_PKG_MAKE_PROCESSES}" ${TERMUX_PKG_EXTRA_MAKE_ARGS} ${TERMUX_PKG_MAKE_INSTALL_TARGET} + make -C contrib/subtree -j "${TERMUX_PKG_MAKE_PROCESSES}" ${TERMUX_PKG_EXTRA_MAKE_ARGS} ${TERMUX_PKG_MAKE_INSTALL_TARGET} +} - # Remove duplicated binaries in bin/ with symlink to the one in libexec/git-core: - (cd $TERMUX_PREFIX/bin; ln -s -f ../libexec/git-core/git git) - (cd $TERMUX_PREFIX/bin; ln -s -f ../libexec/git-core/git-upload-pack git-upload-pack) - # (cd $TERMUX_PREFIX/libexec/git-core; ln -s -f git-gui git-citool) +termux_step_post_make_install() { + mkdir -p "$TERMUX_PREFIX/etc/bash_completion.d/" + cp "$TERMUX_PKG_SRCDIR/contrib/completion/git-completion.bash" \ + "$TERMUX_PKG_SRCDIR/contrib/completion/git-prompt.sh" \ + "$TERMUX_PREFIX/etc/bash_completion.d/" } termux_step_post_massage() { - if [ ! -f libexec/git-core/git-remote-https ]; then + if [[ ! -f libexec/git-core/git-remote-https ]]; then termux_error_exit "Git built without https support" fi } diff --git a/patches/libxml2/build.sh b/patches/libxml2/build.sh index f2b7ffa..e7aa626 100755 --- a/patches/libxml2/build.sh +++ b/patches/libxml2/build.sh @@ -1,36 +1,47 @@ -TERMUX_PKG_HOMEPAGE=http://www.xmlsoft.org +TERMUX_PKG_HOMEPAGE=https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home TERMUX_PKG_DESCRIPTION="Library for parsing XML documents" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" -TERMUX_PKG_VERSION="2.13.3" -TERMUX_PKG_REVISION=1 -_MAJOR_VERSION="${TERMUX_PKG_VERSION%.*}" -TERMUX_PKG_SRCURL=https://download.gnome.org/sources/libxml2/${_MAJOR_VERSION}/libxml2-${TERMUX_PKG_VERSION}.tar.xz -TERMUX_PKG_SHA256=0805d7c180cf09caad71666c7a458a74f041561a532902454da5047d83948138 +TERMUX_PKG_VERSION="2.15.3" +TERMUX_PKG_REVISION=2 +TERMUX_PKG_SRCURL="https://download.gnome.org/sources/libxml2/${TERMUX_PKG_VERSION%.*}/libxml2-${TERMUX_PKG_VERSION}.tar.xz" +TERMUX_PKG_SHA256=78262a6e7ac170d6528ebfe2efccdf220191a5af6a6cd61ea4a9a9a5042c7a07 TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_SETUP_PYTHON=false TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" ---with-legacy ---without-python + -Ddocs=disabled + -Dhttp=enabled + -Dicu=disabled + -Dlegacy=enabled + -Dpython=disabled + -Dhistory=enabled + -Dreadline=enabled " -TERMUX_PKG_RM_AFTER_INSTALL="share/gtk-doc" -TERMUX_PKG_DEPENDS="libiconv, liblzma, zlib" +TERMUX_PKG_RM_AFTER_INSTALL=" +share/doc/libxml2/html +share/doc/libxml2/xmlcatalog.html +share/doc/libxml2/xmllint.html +" +TERMUX_PKG_DEPENDS="libandroid-glob, libiconv, zlib" +TERMUX_PKG_BUILD_DEPENDS="readline" TERMUX_PKG_BREAKS="libxml2-dev" TERMUX_PKG_REPLACES="libxml2-dev" -termux_step_pre_configure() { - # SOVERSION suffix is needed for SONAME of shared libs to avoid conflict - # with system ones (in /system/lib64 or /system/lib): - sed -i 's/^\(linux\*android\)\*)/\1-notermux)/' configure +termux_step_configure() { + LDFLAGS+=" -landroid-glob" + export TERMUX_MESON_ENABLE_SOVERSION=1 + termux_step_configure_meson } termux_step_post_massage() { - # Check if SONAME is properly set: if ! readelf -d lib/libxml2.so | grep -q '(SONAME).*\[libxml2\.so\.'; then termux_error_exit "SONAME for libxml2.so is not properly set." fi - local _GUARD_FILE="lib/libxml2.so.2" - if [ ! -e "${_GUARD_FILE}" ]; then - termux_error_exit "Error: file ${_GUARD_FILE} not found." + local _SOVERSION=16 + if [[ ! -e "lib/libxml2.so.${_SOVERSION}" ]]; then + echo "ERROR - Expected: lib/libxml2.so.${_SOVERSION}" >&2 + echo "ERROR - Found : $(find lib/libxml2* -regex '.*so\.[0-9]+')" >&2 + termux_error_exit "Not proceeding with update." fi } diff --git a/patches/ncurses/build.sh b/patches/ncurses/build.sh index d33cc13..ab38ba0 100644 --- a/patches/ncurses/build.sh +++ b/patches/ncurses/build.sh @@ -2,39 +2,19 @@ TERMUX_PKG_HOMEPAGE=https://invisible-island.net/ncurses/ TERMUX_PKG_DESCRIPTION="Library for text-based user interfaces in a terminal-independent manner" TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_MAINTAINER="@termux" -# This references a commit in https://github.com/ThomasDickey/ncurses-snapshots, specifically -# https://github.com/ThomasDickey/ncurses-snapshots/commit/${_SNAPSHOT_COMMIT} -# Check the commit description to see which version a commit belongs to - correct version -# is checked in termux_step_pre_configure(), so the build will fail on a mistake. -# Using this simplifies things (no need to avoid downloading and applying patches manually), -# and uses github is a high available hosting. -_SNAPSHOT_COMMIT=8bd5a3d98fc741bdcc9e5fada1a3d5980e1ea22a -TERMUX_PKG_VERSION=(6.4.20231001 - 9.31 - 15 - 0.31.0 - 0.11.0) -TERMUX_PKG_REVISION=5 -TERMUX_PKG_SRCURL=(https://github.com/ThomasDickey/ncurses-snapshots/archive/${_SNAPSHOT_COMMIT}.tar.gz - http://dist.schmorp.de/rxvt-unicode/Attic/rxvt-unicode-${TERMUX_PKG_VERSION[1]}.tar.bz2 - https://github.com/thestinger/termite/archive/v${TERMUX_PKG_VERSION[2]}.tar.gz - https://github.com/kovidgoyal/kitty/releases/download/v${TERMUX_PKG_VERSION[3]}/kitty-${TERMUX_PKG_VERSION[3]}.tar.xz - https://github.com/alacritty/alacritty/archive/refs/tags/v${TERMUX_PKG_VERSION[4]}.tar.gz) -TERMUX_PKG_SHA256=(ca4a28ed4d38a7b79e1cd883e3d2755839072a7e4fe8cf265be1ef4ae79b6bc2 - aaa13fcbc149fe0f3f391f933279580f74a96fd312d6ed06b8ff03c2d46672e8 - 3ae9ebef28aad081c6c11351f086776e2fd9547563b2f900732b41c376bec05a - d122497134abab8e25dfcb6b127af40cfe641980e007f696732f70ed298198f5 - 0fb3370c662f5b87d1b9a487aef999195212b192e08f6f68a572fed8fd637e07) +_SNAPSHOT_COMMIT=5f58399b2de47ed14bdfe3a0cb149293b27893d5 +TERMUX_PKG_VERSION="6.6.20260307+really6.5.20250830" +TERMUX_PKG_SRCURL="https://github.com/ThomasDickey/ncurses-snapshots/archive/${_SNAPSHOT_COMMIT}.tar.gz" +TERMUX_PKG_SHA256="28cd102efe6a2610e830cc79cf270da6ff0427b2022900a9a36d2761522f9576" TERMUX_PKG_AUTO_UPDATE=false -# ncurses-utils: tset/reset/clear are moved to package 'ncurses'. TERMUX_PKG_BREAKS="ncurses-dev, ncurses-utils (<< 6.1.20190511-4)" TERMUX_PKG_REPLACES="ncurses-dev, ncurses-utils (<< 6.1.20190511-4)" -# --disable-stripping to disable -s argument to install which does not work when cross compiling: TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" ac_cv_header_locale_h=no am_cv_langinfo_codeset=no +--disable-opaque-panel --disable-stripping --enable-const --enable-ext-colors @@ -61,64 +41,56 @@ share/man/man7 " termux_step_pre_configure() { - MAIN_VERSION=$(cut -f 2 VERSION) - PATCH_VERSION=$(cut -f 3 VERSION) - ACTUAL_VERSION=${MAIN_VERSION}.${PATCH_VERSION} - EXPECTED_VERSION=${TERMUX_PKG_VERSION[0]} - if [ "${ACTUAL_VERSION}" != "${EXPECTED_VERSION}" ]; then + MAIN_VERSION="$(cut -f 2 VERSION)" + PATCH_VERSION="$(cut -f 3 VERSION)" + ACTUAL_VERSION="${MAIN_VERSION}.${PATCH_VERSION}" + EXPECTED_VERSION="${TERMUX_PKG_VERSION#*really}" + if [[ "${ACTUAL_VERSION}" != "${EXPECTED_VERSION}" ]]; then termux_error_exit "Version mismatch - expected ${EXPECTED_VERSION}, was ${ACTUAL_VERSION}. Check https://github.com/ThomasDickey/ncurses-snapshots/commit/${_SNAPSHOT_COMMIT}" fi export CPPFLAGS+=" -fPIC" } termux_step_post_make_install() { - cd $TERMUX_PREFIX/lib + cd "$TERMUX_PREFIX/lib" || termux_error_exit "Prefix 'lib' directory does not exist." + + local version="${TERMUX_PKG_VERSION#*really}" - # Ncursesw/Ncurses compatibility symlinks. for lib in form menu ncurses panel; do - ln -sfr lib${lib}w.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so.${TERMUX_PKG_VERSION:0:3} - ln -sfr lib${lib}w.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so.${TERMUX_PKG_VERSION:0:1} - ln -sfr lib${lib}w.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so - ln -sfr lib${lib}w.a lib${lib}.a - (cd pkgconfig; ln -sf ${lib}w.pc $lib.pc) + ln -sfr "lib${lib}w.so.${version:0:3}" "lib${lib}.so.${version:0:3}" + ln -sfr "lib${lib}w.so.${version:0:3}" "lib${lib}.so.${version:0:1}" + ln -sfr "lib${lib}w.so.${version:0:3}" "lib${lib}.so" + ln -sfr "lib${lib}w.a" "lib${lib}.a" + (cd pkgconfig; ln -sf "${lib}w.pc" "$lib.pc") || termux_error_exit "Failed to install comatibility symlink for '${lib}'" done - # Legacy compatibility symlinks (libcurses, libtermcap, libtic, libtinfo). for lib in curses termcap tic tinfo; do - ln -sfr libncursesw.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so.${TERMUX_PKG_VERSION:0:3} - ln -sfr libncursesw.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so.${TERMUX_PKG_VERSION:0:1} - ln -sfr libncursesw.so.${TERMUX_PKG_VERSION:0:3} lib${lib}.so - ln -sfr libncursesw.a lib${lib}.a - (cd pkgconfig; ln -sfr ncursesw.pc ${lib}.pc) + ln -sfr "libncursesw.so.${version:0:3}" "lib${lib}.so.${version:0:3}" + ln -sfr "libncursesw.so.${version:0:3}" "lib${lib}.so.${version:0:1}" + ln -sfr "libncursesw.so.${version:0:3}" "lib${lib}.so" + ln -sfr libncursesw.a "lib${lib}.a" + (cd pkgconfig; ln -sfr ncursesw.pc "${lib}.pc") || termux_error_exit "Failed to install legacy comatibility symlink for '${lib}'" done - # Some packages want these: - cd $TERMUX_PREFIX/include/ + cd "$TERMUX_PREFIX/include/" || termux_error_exit "Prefix 'include' directory does not exist." rm -Rf ncurses{,w} mkdir ncurses{,w} ln -s ../{curses.h,eti.h,form.h,menu.h,ncurses_dll.h,ncurses.h,panel.h,termcap.h,term_entry.h,term.h,unctrl.h} ncurses ln -s ../{curses.h,eti.h,form.h,menu.h,ncurses_dll.h,ncurses.h,panel.h,termcap.h,term_entry.h,term.h,unctrl.h} ncursesw - # Strip away 30 years of cruft to decrease size. - local TI=$TERMUX_PREFIX/share/terminfo - mv $TI $TERMUX_PKG_TMPDIR/full-terminfo - mkdir -p $TI/{a,d,e,g,n,k,l,p,r,s,t,v,x} - cp $TERMUX_PKG_TMPDIR/full-terminfo/a/ansi $TI/a/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/d/{dtterm,dumb} $TI/d/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/e/eterm-color $TI/e/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/g/gnome{,-256color} $TI/g/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/n/nsterm $TI/n/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/k/kitty{,+common,-direct} $TI/k/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/l/linux $TI/l/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/p/putty{,-256color} $TI/p/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/r/rxvt{,-256color} $TI/r/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/s/{screen{,2,-256color},st{,-256color}} $TI/s/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/t/tmux{,-256color} $TI/t/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/v/{vt52,vt100,vt102} $TI/v/ - cp $TERMUX_PKG_TMPDIR/full-terminfo/x/xterm{,-color,-new,-16color,-256color,+256color} $TI/x/ - - tic -x -o $TI $TERMUX_PKG_SRCDIR/rxvt-unicode-${TERMUX_PKG_VERSION[1]}/doc/etc/rxvt-unicode.terminfo - tic -x -o $TI $TERMUX_PKG_SRCDIR/termite-${TERMUX_PKG_VERSION[2]}/termite.terminfo - tic -x -o $TI $TERMUX_PKG_SRCDIR/kitty-${TERMUX_PKG_VERSION[3]}/terminfo/kitty.terminfo - tic -x -o $TI $TERMUX_PKG_SRCDIR/alacritty-${TERMUX_PKG_VERSION[4]}/extra/alacritty.info + local TI="$TERMUX_PREFIX/share/terminfo" + mv "$TI" "$TERMUX_PKG_TMPDIR/full-terminfo" + mkdir -p "$TI"/{a,d,e,g,n,l,p,r,s,t,v,x} + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/a/ansi "$TI/a/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/d/{dtterm,dumb} "$TI/d/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/e/eterm-color "$TI/e/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/g/gnome{,-256color} "$TI/g/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/n/nsterm "$TI/n/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/l/linux "$TI/l/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/p/putty{,-256color} "$TI/p/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/r/rxvt{,-256color} "$TI/r/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/s/{screen{,2,-256color},st{,-256color}} "$TI/s/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/t/tmux{,-256color} "$TI/t/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/v/vt{52,100,102} "$TI/v/" + cp "$TERMUX_PKG_TMPDIR"/full-terminfo/x/xterm{,-color,-new,-16color,-256color,+256color} "$TI/x/" } diff --git a/patches/ncurses/slim-terminfo.py b/patches/ncurses/slim-terminfo.py deleted file mode 100644 index 078afcb..0000000 --- a/patches/ncurses/slim-terminfo.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python3 -from pathlib import Path -import sys - -p = Path(sys.argv[1] if len(sys.argv) > 1 else "build.sh") -lines = p.read_text().splitlines(keepends=True) -out = [] -i = 0 -skip_until_close = None -while i < len(lines): - line = lines[i] - if line.startswith("TERMUX_PKG_VERSION=("): - out.append('TERMUX_PKG_VERSION="6.6.20260307+really6.5.20250830"\n') - while i < len(lines) and not lines[i].rstrip().endswith(")"): - i += 1 - i += 1 - continue - if line.startswith("TERMUX_PKG_SRCURL=("): - out.append( - 'TERMUX_PKG_SRCURL="https://github.com/ThomasDickey/ncurses-snapshots/archive/${_SNAPSHOT_COMMIT}.tar.gz"\n' - ) - while i < len(lines) and not lines[i].rstrip().endswith(")"): - i += 1 - i += 1 - continue - if line.startswith("TERMUX_PKG_SHA256=("): - out.append( - 'TERMUX_PKG_SHA256="28cd102efe6a2610e830cc79cf270da6ff0427b2022900a9a36d2761522f9576"\n' - ) - while i < len(lines) and not lines[i].rstrip().endswith(")"): - i += 1 - i += 1 - continue - if "TERMUX_PKG_SRCDIR/rxvt-unicode" in line: - i += 1 - continue - if "TERMUX_PKG_SRCDIR/kitty-" in line: - i += 1 - continue - if "alacritty+common,alacritty-direct" in line: - i += 1 - continue - if "building foot's terminfo" in line or "codeberg.org/dnkl/foot" in line: - i += 1 - continue - if "foot/foot.info" in line: - i += 1 - if i < len(lines) and "tic -x -e foot" in lines[i]: - i += 1 - continue - if "tic -x -e foot,foot-direct" in line: - i += 1 - continue - if 'cp "$TERMUX_PKG_TMPDIR"/full-terminfo' in line and not line.rstrip().endswith("|| true"): - line = line.rstrip("\n") + " || true\n" - out.append(line) - i += 1 - -text = "".join(out) -if "x11-packages/foot/build.sh" in text or "x11-packages/kitty/build.sh" in text: - raise SystemExit("ncurses still references extra terminfo sources") -p.write_text(text) -print("[*] ncurses extra terminfo sources removed") diff --git a/patches/properties.patch b/patches/properties.patch new file mode 100644 index 0000000..786b526 --- /dev/null +++ b/patches/properties.patch @@ -0,0 +1,24 @@ +--- a/scripts/properties.sh ++++ b/scripts/properties.sh +@@ -464,7 +464,7 @@ + # + # Default value: `com.termux` + ## +-TERMUX_APP__PACKAGE_NAME="com.termux" ++TERMUX_APP__PACKAGE_NAME="xyz.jekyllex" + TERMUX_APP_PACKAGE="$TERMUX_APP__PACKAGE_NAME" # Deprecated alternative variable for `TERMUX_APP__PACKAGE_NAME` + + __termux_build_props__add_variables_validator_actions "TERMUX_APP__PACKAGE_NAME" "app_package_name" +@@ -2231,10 +2231,10 @@ + __termux_build_props__add_variables_validator_actions "TERMUX_CLEANUP_BUILT_PACKAGES_THRESHOLD" "unsigned_int" + + # Path to CGCT tools +-CGCT_DEFAULT_PREFIX="/data/data/com.termux/files/usr/glibc" ++CGCT_DEFAULT_PREFIX="/data/data/xyz.jekyllex/files/usr/glibc" + __termux_build_props__add_variables_validator_actions "CGCT_DEFAULT_PREFIX" "safe_absolute_path invalid_termux_prefix_paths" + +-export CGCT_DIR="/data/data/com.termux/cgct" ++export CGCT_DIR="/data/data/xyz.jekyllex/cgct" + __termux_build_props__add_variables_validator_actions "CGCT_DIR" "safe_absolute_path invalid_termux_prefix_paths" + + # Allow to override setup. diff --git a/properties.sh b/properties.sh deleted file mode 100755 index bb64bcb..0000000 --- a/properties.sh +++ /dev/null @@ -1,52 +0,0 @@ -# Adapted from: https://github.com/termux/termux-packages/blob/acf1df1e90034ce0100ac54726ae56792bf56859/scripts/properties.sh -TERMUX_SDK_REVISION=9123335 -TERMUX_ANDROID_BUILD_TOOLS_VERSION=33.0.1 - -: "${TERMUX_NDK_VERSION_NUM:="27"}" -: "${TERMUX_NDK_REVISION:=""}" -TERMUX_NDK_VERSION=$TERMUX_NDK_VERSION_NUM$TERMUX_NDK_REVISION - -if [ -n "${JAVA_HOME+x}" ]; then - : "${TERMUX_JAVA_HOME:="${JAVA_HOME}"}" -else - : "${TERMUX_JAVA_HOME:=/usr/lib/jvm/java-17-openjdk-amd64}" - export JAVA_HOME="${TERMUX_JAVA_HOME}" -fi - -if [ -z "${ANDROID_HOME+x}" ]; then - : "${ANDROID_HOME:="${HOME}/lib/android-sdk-$TERMUX_SDK_REVISION"}" -fi - -if [ -z "${NDK+x}" ]; then - : "${NDK:="${HOME}/lib/android-ndk-r${TERMUX_NDK_VERSION}"}" -fi - -# Termux packages configuration. -TERMUX_APP_PACKAGE="xyz.jekyllex" -TERMUX_REPO_PACKAGE="xyz.jekyllex" -TERMUX_BASE_DIR="/data/data/${TERMUX_APP_PACKAGE}/files" -TERMUX_CACHE_DIR="/data/data/${TERMUX_APP_PACKAGE}/cache" -TERMUX_ANDROID_HOME="${TERMUX_BASE_DIR}/home" -TERMUX_APPS_DIR="${TERMUX_BASE_DIR}/apps" -TERMUX_PREFIX_CLASSICAL="${TERMUX_BASE_DIR}/usr" -TERMUX_PREFIX="${TERMUX_PREFIX_CLASSICAL}" -TERMUX_ETC_PREFIX_DIR_PATH="${TERMUX_PREFIX}/etc" -TERMUX_PROFILE_D_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/profile.d" -TERMUX_CONFIG_PREFIX_DIR_PATH="${TERMUX_ETC_PREFIX_DIR_PATH}/termux" -TERMUX_BOOTSTRAP_CONFIG_DIR_PATH="${TERMUX_CONFIG_PREFIX_DIR_PATH}/bootstrap" - -# Path to CGCT tools -CGCT_DEFAULT_PREFIX="/data/data/${TERMUX_APP_PACKAGE}/files/usr/glibc" -export CGCT_DIR="/data/data/${TERMUX_APP_PACKAGE}/cgct" - -export TERMUX_PACKAGES_DIRECTORIES=$(jq --raw-output 'del(.pkg_format) | keys | .[]' ${TERMUX_SCRIPTDIR}/repo.json) - -# Allow to override setup. -for f in "${HOME}/.config/termux/termuxrc.sh" "${HOME}/.termux/termuxrc.sh" "${HOME}/.termuxrc"; do - if [ -f "$f" ]; then - echo "Using builder configuration from '$f'..." - . "$f" - break - fi -done -unset f From 58b0902e703c11e78224adf80cbd7f7e5d140b13 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 16 Aug 2026 14:20:33 +0530 Subject: [PATCH 13/16] ci: restore host bootstrap build like main --- .github/workflows/build-bootstraps.yml | 49 +++++++++++++++----------- build-bootstraps.sh | 27 +++++--------- 2 files changed, 36 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 6c1ed73..2a51992 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -20,10 +20,10 @@ jobs: target_arch: [aarch64, arm, i686, x86_64] steps: - - name: Free disk space + - name: Install requirements run: | - sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/share/boost || true - df -h + sudo apt-get update + sudo apt-get install -y autopoint - name: Clone repository uses: actions/checkout@v7 @@ -37,35 +37,43 @@ jobs: repository: termux/termux-packages ref: "23d530425344010b73b0392ab66b041e8f65e34b" + - name: Setup java + uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 17 + - name: Setup environment run: | - cp build-bootstraps.sh termux-packages/scripts/ - patch -d termux-packages -p1 < patches/properties.patch + sudo mkdir -p /data + sudo chown $USER:$USER /data + mv *.sh termux-packages/scripts/ + mv termux-packages/* . + patch -p1 < patches/properties.patch for package in patches/*/; do - cp -r "$package" termux-packages/packages/ + cp -r "$package" packages done - if [ -d termux-packages/packages/gems ]; then - rm -rf termux-packages/packages/ruby/gem-patches - mv termux-packages/packages/gems termux-packages/packages/ruby/gem-patches + if [ -d packages/gems ]; then + rm -rf packages/ruby/gem-patches + mv packages/gems packages/ruby/gem-patches fi - find termux-packages/packages/git -type f -name "*subpackage*" -exec rm {} + - find termux-packages/packages/libxml2 -type f -name "*python*" -exec rm {} + + find packages/git -type f -name "*subpackage*" -exec rm {} + + find packages/libxml2 -type f -name "*python*" -exec rm {} + + sudo mkdir -p /home/builder && mv ./* /home/builder - name: Create bootstrap archive - working-directory: termux-packages - env: - CI: "true" + working-directory: /home/builder run: | - ./scripts/run-docker.sh true - ./scripts/run-docker.sh ./scripts/build-bootstraps.sh \ - --android10 -f --architectures ${{ matrix.target_arch }} + export TERMUX_JAVA_HOME="${JAVA_HOME}" + ./clean.sh + ./scripts/setup-android-sdk.sh + ./scripts/build-bootstraps.sh --android10 --architectures ${{ matrix.target_arch }} - name: Store bootstrap uses: actions/upload-artifact@v7 with: name: ruby-${{ matrix.target_arch }} - path: termux-packages/output/ruby-${{ matrix.target_arch }}.zip - if-no-files-found: error + path: "/home/builder/*.zip" release: needs: bootstraps @@ -121,8 +129,7 @@ jobs: - name: Build apk run: | git clone https://github.com/jekyllex/termux-app --depth 1 - find . -name 'ruby-*.zip' ! -path './termux-app/*' -exec mv {} termux-app/bootstraps/ \; - ls termux-app/bootstraps/ruby-*.zip + mv *.zip termux-app/bootstraps cd termux-app ./gradlew assembleDebug diff --git a/build-bootstraps.sh b/build-bootstraps.sh index a5607a3..971aea0 100755 --- a/build-bootstraps.sh +++ b/build-bootstraps.sh @@ -2,18 +2,12 @@ # shellcheck disable=SC2039,SC2059 # Title: build-bootstrap.sh -# Description: Build bootstrap archives for JekyllEx from local package -# sources (termux-packages tree). Based on termux-packages -# scripts/build-bootstraps.sh (NDK r29 / 16 KB default). -# Usage: run "build-bootstraps.sh --help" -# -# JekyllEx deltas vs upstream: -# - Package set: coreutils, libxslt, libxml2, unzip, ruby, git, zip (+deps) -# - Output name: ruby-${arch}.zip (jekyllex-android / dl.jekyllex.xyz contract) -# - Layout: TERMUX_PACKAGES_DIRECTORY defaults to Termux docker path -# /home/builder/termux-packages (override with env if flattening locally) -# - No termux second-stage bootstrap (app installs zip as libN.so itself) -# - --android10 for APK packaging / Android 10+ exec model +# Description: A script to build bootstrap archives for the termux-app +# from local package sources instead of debs published in +# apt repo like done by generate-bootstrap.sh. It allows +# bootstrap archives to be easily built for (forked) termux +# apps without having to publish an apt repo first. +# Usage: run "build-bootstrap.sh --help" # # Adapted from: https://github.com/termux/termux-packages/blob/23d530425344010b73b0392ab66b041e8f65e34b/scripts/build-bootstraps.sh version=0.2.0 @@ -35,8 +29,7 @@ BOOTSTRAP_ANDROID10_COMPATIBLE=false TERMUX_DEFAULT_ARCHITECTURES=("aarch64" "arm" "i686" "x86_64") TERMUX_ARCHITECTURES=("${TERMUX_DEFAULT_ARCHITECTURES[@]}") -# Match termux-packages docker mount (run-docker.sh → /home/builder/termux-packages). -: "${TERMUX_PACKAGES_DIRECTORY:="/home/builder/termux-packages"}" +TERMUX_PACKAGES_DIRECTORY="/home/builder" TERMUX_BUILT_DEBS_DIRECTORY="$TERMUX_PACKAGES_DIRECTORY/output" TERMUX_BUILT_PACKAGES_DIRECTORY="/data/data/.built-packages" @@ -207,11 +200,7 @@ create_bootstrap_archive() { zip -r9 "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" ./* ) - local dest_dir="$TERMUX_PACKAGES_DIRECTORY/output" - mkdir -p "$dest_dir" - cp -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$dest_dir/ruby-${1}.zip" - cp -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$TERMUX_PACKAGES_DIRECTORY/ruby-${1}.zip" || true - test -f "$dest_dir/ruby-${1}.zip" + mv -f "${BOOTSTRAP_TMPDIR}/ruby-${1}.zip" "$TERMUX_PACKAGES_DIRECTORY/" echo "[*] Finished successfully (${1})." } From 303070ae281a1cba2396b8fe65969220977ea373 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 16 Aug 2026 14:35:44 +0530 Subject: [PATCH 14/16] fix: keep gem patches in place and slim git --- .github/workflows/build-bootstraps.yml | 10 ++++---- patches/git/build.sh | 33 ++++++++++++++++---------- patches/ruby/android-sdk-level.patch | 17 ------------- patches/ruby/build.sh | 2 +- patches/ruby/rbinstall.rb.patch | 2 +- 5 files changed, 26 insertions(+), 38 deletions(-) delete mode 100644 patches/ruby/android-sdk-level.patch diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 2a51992..093a924 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -50,21 +50,19 @@ jobs: mv *.sh termux-packages/scripts/ mv termux-packages/* . patch -p1 < patches/properties.patch - for package in patches/*/; do + for package in patches/*; do + [ -d "$package" ] || continue cp -r "$package" packages done - if [ -d packages/gems ]; then - rm -rf packages/ruby/gem-patches - mv packages/gems packages/ruby/gem-patches - fi find packages/git -type f -name "*subpackage*" -exec rm {} + find packages/libxml2 -type f -name "*python*" -exec rm {} + sudo mkdir -p /home/builder && mv ./* /home/builder - name: Create bootstrap archive working-directory: /home/builder + env: + TERMUX_JAVA_HOME: ${{ env.JAVA_HOME }} run: | - export TERMUX_JAVA_HOME="${JAVA_HOME}" ./clean.sh ./scripts/setup-android-sdk.sh ./scripts/build-bootstraps.sh --android10 --architectures ${{ matrix.target_arch }} diff --git a/patches/git/build.sh b/patches/git/build.sh index 3618fa1..a5a7028 100755 --- a/patches/git/build.sh +++ b/patches/git/build.sh @@ -6,9 +6,7 @@ TERMUX_PKG_VERSION="2.55.0" TERMUX_PKG_SRCURL=https://mirrors.kernel.org/pub/software/scm/git/git-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=457fdb04dc8728e007d4688695e6912e6f680727920f2a40bf11eacc17505357 TERMUX_PKG_AUTO_UPDATE=true -TERMUX_PKG_DEPENDS="libcurl, libexpat, libiconv, less, openssl, pcre2, zlib" -TERMUX_PKG_RECOMMENDS="openssh" -TERMUX_PKG_SUGGESTS="perl" +TERMUX_PKG_DEPENDS="libcurl, libiconv, less, openssl, zlib" TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" ac_cv_fread_reads_directories=yes @@ -16,39 +14,48 @@ ac_cv_header_libintl_h=no ac_cv_iconv_omits_bom=no ac_cv_snprintf_returns_bogus=no --with-curl ---with-expat --with-shell=$TERMUX_PREFIX/bin/sh " TERMUX_PKG_EXTRA_MAKE_ARGS=" NO_NSEC=1 -NO_GETTEXT=1 +NO_PERL=1 +NO_EXPAT=1 NO_TCLTK=1 +NO_GETTEXT=1 NO_INSTALL_HARDLINKS=1 INSTALL_SYMLINKS=1 CSPRNG_METHOD=openssl -USE_LIBPCRE2=1 DEFAULT_PAGER=pager DEFAULT_EDITOR=editor " -TERMUX_PKG_MAKE_INSTALL_TARGET="install install-man" TERMUX_PKG_BUILD_IN_SRC=true +TERMUX_PKG_RM_AFTER_INSTALL=" +bin/git-cvsserver +bin/git-shell +libexec/git-core/git-shell +libexec/git-core/git-cvsserver +share/man/man1/git-cvsserver.1 +share/man/man1/git-shell.1 +" + termux_step_pre_configure() { + if $TERMUX_ON_DEVICE_BUILD; then + termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds." + fi termux_setup_rust export CARGO_BUILD_TARGET="$CARGO_TARGET_NAME" + rm -Rf $TERMUX_PREFIX/share/git-perl CPPFLAGS="-I$TERMUX_PKG_SRCDIR $CPPFLAGS" } termux_step_make_install() { - make -j "${TERMUX_PKG_MAKE_PROCESSES}" ${TERMUX_PKG_EXTRA_MAKE_ARGS} ${TERMUX_PKG_MAKE_INSTALL_TARGET} - make -C contrib/subtree -j "${TERMUX_PKG_MAKE_PROCESSES}" ${TERMUX_PKG_EXTRA_MAKE_ARGS} ${TERMUX_PKG_MAKE_INSTALL_TARGET} + make -j "${TERMUX_PKG_MAKE_PROCESSES}" ${TERMUX_PKG_EXTRA_MAKE_ARGS} install } termux_step_post_make_install() { - mkdir -p "$TERMUX_PREFIX/etc/bash_completion.d/" - cp "$TERMUX_PKG_SRCDIR/contrib/completion/git-completion.bash" \ - "$TERMUX_PKG_SRCDIR/contrib/completion/git-prompt.sh" \ - "$TERMUX_PREFIX/etc/bash_completion.d/" + rm -Rf $TERMUX_PREFIX/lib/*-linux*/perl + (cd $TERMUX_PREFIX/bin; ln -s -f ../libexec/git-core/git git) } termux_step_post_massage() { diff --git a/patches/ruby/android-sdk-level.patch b/patches/ruby/android-sdk-level.patch deleted file mode 100644 index 465610c..0000000 --- a/patches/ruby/android-sdk-level.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- a/configure.ac -+++ b/configure.ac -@@ -510,11 +510,13 @@ - ]], [[]])], - [ - AC_MSG_RESULT(yes) -+ AS_CASE(["$target_os"], [*android*], [], [ - target_os=${target_os}-android -+ ]) - AS_IF([test "x$cross_compiling" = xno], [ - AC_MSG_CHECKING([for Android API version]) - # hacky workaround: https://github.com/termux/termux-packages/issues/6176 -- rb_android_api=`getprop ro.build.version.sdk` -+ rb_android_api=24 - AC_MSG_RESULT($rb_android_api) - RUBY_APPEND_OPTIONS(CPPFLAGS, -D__ANDROID_API__=$rb_android_api -Wno-macro-redefined) - ]) diff --git a/patches/ruby/build.sh b/patches/ruby/build.sh index f40c169..94fd3e6 100644 --- a/patches/ruby/build.sh +++ b/patches/ruby/build.sh @@ -31,7 +31,7 @@ TERMUX_PKG_EXTRA_HOSTBUILD_CONFIGURE_ARGS=" _jekyllex_apply_gem_patches() { local gems_root="$TERMUX_PKG_SRCDIR/.bundle/gems" - local patches_root="$TERMUX_PKG_BUILDER_DIR/gem-patches" + local patches_root="$TERMUX_SCRIPTDIR/patches/gems" local gem_dir name patch_file [ -d "$gems_root" ] || return 0 [ -d "$patches_root" ] || return 0 diff --git a/patches/ruby/rbinstall.rb.patch b/patches/ruby/rbinstall.rb.patch index bab844e..0e51cc8 100644 --- a/patches/ruby/rbinstall.rb.patch +++ b/patches/ruby/rbinstall.rb.patch @@ -36,7 +36,7 @@ index bb2e6a2..8b98bd8 100755 next end spec.extension_dir = "#{extensions_dir}/#{spec.full_name}" -+ patch_files = Dir.glob("/home/builder/termux-packages/packages/ruby/gem-patches/#{gem_name}/*") ++ patch_files = Dir.glob("/home/builder/patches/gems/#{gem_name}/*") + patch_files.each do |patch_file| + target = "#{srcdir}/.bundle/gems/#{gem_name}" + FileUtils.cp(patch_file, target) From f52639723a452d827f9baae7bbf64898130a31d3 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 16 Aug 2026 14:45:45 +0530 Subject: [PATCH 15/16] fix: drop unused git rust and termux ruby 3.4 patches --- .github/workflows/build-bootstraps.yml | 1 + patches/git/build.sh | 3 +-- patches/git/credential.c.patch | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-bootstraps.yml b/.github/workflows/build-bootstraps.yml index 093a924..1a6c944 100644 --- a/.github/workflows/build-bootstraps.yml +++ b/.github/workflows/build-bootstraps.yml @@ -56,6 +56,7 @@ jobs: done find packages/git -type f -name "*subpackage*" -exec rm {} + find packages/libxml2 -type f -name "*python*" -exec rm {} + + find packages/ruby -type f \( -name 'process.c.patch' -o -name 'yjit-src-*.patch' -o -name 'lib-rubygems-install_update_options.rb.patch' \) -exec rm {} + sudo mkdir -p /home/builder && mv ./* /home/builder - name: Create bootstrap archive diff --git a/patches/git/build.sh b/patches/git/build.sh index a5a7028..9292fa7 100755 --- a/patches/git/build.sh +++ b/patches/git/build.sh @@ -23,6 +23,7 @@ NO_EXPAT=1 NO_TCLTK=1 NO_GETTEXT=1 NO_INSTALL_HARDLINKS=1 +NO_RUST=1 INSTALL_SYMLINKS=1 CSPRNG_METHOD=openssl DEFAULT_PAGER=pager @@ -43,8 +44,6 @@ termux_step_pre_configure() { if $TERMUX_ON_DEVICE_BUILD; then termux_error_exit "Package '$TERMUX_PKG_NAME' is not safe for on-device builds." fi - termux_setup_rust - export CARGO_BUILD_TARGET="$CARGO_TARGET_NAME" rm -Rf $TERMUX_PREFIX/share/git-perl CPPFLAGS="-I$TERMUX_PKG_SRCDIR $CPPFLAGS" } diff --git a/patches/git/credential.c.patch b/patches/git/credential.c.patch index f4582b4..a825954 100644 --- a/patches/git/credential.c.patch +++ b/patches/git/credential.c.patch @@ -2,15 +2,15 @@ diff --git a/credential.c b/credential.c index 18098bd..f6212d4 100644 --- a/credential.c +++ b/credential.c -@@ -126,6 +126,11 @@ static int credential_config_callback(const char *var, const char *value, - if (!c->username_from_proto) { +@@ -71,6 +71,11 @@ static int credential_config_callback(const char *var, const char *value, free(c->username); c->username = xstrdup(value); -+ } + } + } else if (!strcmp(key, "password")) { + if (!c->password) { + free(c->password); + c->password = xstrdup(value); - } ++ } } else if (!strcmp(key, "usehttppath")) + c->use_http_path = git_config_bool(var, value); From 27f8bd3bc3ea7370f71446da8946f59eee38de34 Mon Sep 17 00:00:00 2001 From: Gourav Khunger Date: Sun, 16 Aug 2026 15:15:12 +0530 Subject: [PATCH 16/16] fix(git): drop redundant bin/git symlink on 2.55 --- patches/git/build.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/patches/git/build.sh b/patches/git/build.sh index 9292fa7..ab53650 100755 --- a/patches/git/build.sh +++ b/patches/git/build.sh @@ -54,7 +54,6 @@ termux_step_make_install() { termux_step_post_make_install() { rm -Rf $TERMUX_PREFIX/lib/*-linux*/perl - (cd $TERMUX_PREFIX/bin; ln -s -f ../libexec/git-core/git git) } termux_step_post_massage() {