- Reverted behviour of `-f` flag changed in b9b5987 and only force build current package instead of dependencies.
- Added a new `-F` flag to force build current package and dependencies as well.
- If both `-I` and `-F` flags are passed and dependencies cannot be compiled on device, i.e `$TERMUX_PKG_ON_DEVICE_BUILD_NOT_SUPPORTED` is set to `true` in `build.sh` of package, then they will be downloaded instead.
- If only `-F` flag is passed without the `-I` flag, and building on device is not supported, then building with fail with error.
- The `$TERMUX_BUILD_PACKAGE_CALL_DEPTH` variable will be used to track depth of recursive calls to `build-package.sh`.
- The file at `$TERMUX_BUILD_PACKAGE_CALL_BUILT_PACKAGES_LIST_FILE_PATH` will be used to track list of packages and their dependencies that have been compiled at any instant by recursive calls to `build-package.sh`.
- Added `scripts/utils/package/package.sh` to store package utils. The `pacakge__is_package_version_built()` method can be used to check if a certain package version has been built. In future this should include `$TERMUX_APP_PACKAGE` as well.
Co-authored-by: agnostic-apollo <agnosticapollo@gmail.com>
Co-authored-by: Maxython <mixython@gmail.com>
NDK r25 has removed GNU Assembler (GAS). Removal of GAS introduced a number of build issues.
The most prominent is:
/usr/bin/as: unrecognized option '-EL'
Some options to solve this:
1. Disable building custom assembly and suffer performance penalty
2. Hand rewrite the custom assembly to be LLVM compatible
3. Wait for upstream to write LLVM compatible assembly (openssl, openssl-1.1)
4. Bring back GAS from NDK r23c
In this commit, GAS is brought back as a separate toolchain instead of following NDK r23c file hierarchy.
We pass "--gcc-toolchain=GAS_TOOLCHAIN_DIR" to NDK r25 clang to detect.
Packages only have to add "termux_step_gnu_as_23c" to build.sh to enable GAS.
In the future, we expect packages should follow option 3 more than option 4 as that is a last resort.
This commit also bumps revision for packages that rely (or previously rely) on "-fno-integrated-as":
hors, libffi, libgcrypt, libpixman, openssl, openssl-1.1
Co-authored-by: Henrik Grimler <grimler@termux.dev>
Co-authored-by: Chongyun Lee <45286352+licy183@users.noreply.github.com>
And keep ndk-patches in 23c/ subdirectory. Run
termux_step_setup_toolchain_23c only if TERMUX_NDK_VERSION equals 23c.
This is a step towards having the possibility to use different NDK
versions. Using a different NDK version than the one termux
officially supports should *really* not be done except for
testing/debug/development reasons, or if it is strictly necessary to
be able to compile a program (for example for packages that need a
fortran compiler, which at the moment is only supported with old
gcc-using NDKs).
Otherwise these variables is not visible to child shells. This caused
configure step of termux-tools to always use debian/apt combination,
since it checks for variables among environmental variables and they
were not visible.
If `--tty` is not passed to `docker exec` because stdout is not available (`[ ! -t 1 ]`), like due to redirection to file (`&> build.log`) or if stdin is not available (`< /dev/null`), then docker does not forward kill signals to the process started and they remain running.
To fix the issue, the `DOCKER_EXEC_PID_FILE_PATH` env variable with the value `/tmp/docker-exec-pid-<timestamp>` is passed to the process called with `docke exec` and the process started stores its pid in the file path passed. Traps are set in `run-docker.sh` that runs the `docker exec` command to receive any kills signals, and if it does, it runs another `docker exec` command to read the pid of the process previously started from `DOCKER_EXEC_PID_FILE_PATH` and then kills it and all its children.
See Also:
https://github.com/docker/cli/issues/2607https://github.com/moby/moby/issues/9098https://github.com/moby/moby/pull/41548https://stackoverflow.com/questions/41097652/how-to-fix-ctrlc-inside-a-docker-container
Also passing `--init` to `docker run` to "Run an init inside the container that forwards signals and reaps processes", although it does not work for above cases, but may helpful in others. The `--init` flag changes will only engage on new container creation.
https://docs.docker.com/engine/reference/run/#specify-an-init-processhttps://docs.docker.com/engine/reference/commandline/run/
```
./scripts/run-docker.sh ./build-package.sh -f libjpeg-turbo &> build.log
^C
$ ./scripts/run-docker.sh ps -efww
Running container 'termux-package-builder' from image 'termux/package-builder'...
UID PID PPID C STIME TTY TIME CMD
builder 1 0 0 05:48 pts/0 00:00:00 bash
builder 9243 0 0 06:01 pts/1 00:00:00 bash
builder 28127 0 0 06:12 ? 00:00:00 /bin/bash ./build-package.sh -f libjpeg-turbo
builder 28141 28127 0 06:12 ? 00:00:00 /bin/bash ./build-package.sh -f libjpeg-turbo
builder 28449 28141 1 06:12 ? 00:00:00 ninja -w dupbuild=warn -j 8
builder 28656 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28657 28656 79 06:12 ? 00:00:01 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28694 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28695 28694 89 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28728 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28729 28728 0 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28731 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28734 28731 0 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28740 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28741 28740 0 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28744 0 0 06:12 pts/2 00:00:00 ps -efww
builder 28748 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28752 28748 0 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28753 28449 0 06:12 ? 00:00:00 /bin/sh -c /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28754 28753 0 06:12 ? 00:00:00 /home/builder/.termux-build/_cache/android-r23c-api-24-v0/bin/clang
builder 28755 28449 0 06:12 ? 00:00:00 ninja -w dupbuild=warn -j 8
$ ./scripts/run-docker.sh ./build-package.sh -f libjpeg-turbo &> build.log
$ ./scripts/run-docker.sh ./build-package.sh -f libjpeg-turbo
Running container 'termux-package-builder' from image 'termux/package-builder'...
ERROR: Another build is already running within same environment.
```
Make changes as per new design implemented in termux/termux-app@b950efec and termux/termux-app#2740
The package build and termux-tools scripts use current package manager for custom logic. The `termux-tools/termux-setup-package-manager` script has been added that will now be used to provide backward compatibility for termux-app `< 0.119.0` (when its released) and validate the package manager. It will also ensure the variable in not unset to prevent `unbound variable` errors if `set -u` is being used by calling scripts.
Closes#10782
x11-repo uses distribution x11, and root-repo distribution root.
Store this information in the json file as well, and parse it to set
both REPOSITORY_NAME and REPOSITORY_DISTRIBUTION.
Also remove unnecessary `< repo.json` from jq command, jq accepts the
file as an argument.
This fixes upload issues to x11-repo and root-repo.
This will need some more work. Currently
termux_create_haskell_debscripts is run for all packages, even
non-haskell ones, which causes errors in postinst and prerm scripts in
an ugly way.
This reverts commit dc2474b2c2.
- `termux_setup_ghc_cross_compiler` should not be called by build.sh, as it installs cross-compiler
in $TERMUX_PREFIX (otherwise ghc adds wrong `rpaths` to built libs and executables)
Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
To be used by packages that need nodejs during build (gitea and
frida-server for example).
Use LTS version for now (gitea had issues with latest version).
After https://github.com/termux/termux-packages/commit/e34ae5da030d,
llvm-config was created before termux_step_get_dependencies, meaning
that it gets overwritten if libllvm is installed.
Fix this by creating llvm-config in a new function
termux_step_override_config_scripts, that is run right after
termux_step_get_dependencies.
As replacement for TERMUX_PKG_QUICK_REBUILD. Running
./build-package.sh -c <package> starts a build for <package>, but does
not extract and patch the source from scratch. Instead it sets up the
build variables and starts from termux_step_make.
When working on a big package that can take hours to build it is
convenient to be able to build until there is an error, then apply
some new patch (manually) to the source, and then continue from where
the build failed.
Do not let privileged commands appear in build.sh. Any environment
configuration should be done by scripts like setup-ubuntu.sh. Execution
of arbitrary sudo commands could mess up host system, in case if not
building package in Docker container or VM.
termux-packages is not guaranteed to be always used as git repository.
Relying on git here may lead to issues.
P.S. Avoid unfinished work on master branch!
By moving the checks we can make the function more general, and
thereby re-use it for creating subpackages and potentially hostbuild
tools packages.
tests: building libandroid-support and build-essential.