这是indexloc提供的服务,不要输入任何密码
Skip to content

-c flag errors after make + various odds and ends #24089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions build-package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/env bash
# shellcheck disable=SC1117

# Setting the TMPDIR variable
Expand Down Expand Up @@ -370,6 +370,10 @@ source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_create_pacman_package.sh"
# shellcheck source=scripts/build/termux_step_finish_build.sh
source "$TERMUX_SCRIPTDIR/scripts/build/termux_step_finish_build.sh"

termux_step_post_finish_build() {
return
}

################################################################################

# shellcheck source=scripts/properties.sh
Expand Down Expand Up @@ -663,9 +667,11 @@ for ((i=0; i<${#PACKAGE_LIST[@]}; i++)); do
termux_step_get_dependencies_python
termux_step_patch_package
termux_step_replace_guess_scripts
fi

$TERMUX_CONTINUE_BUILD && echo try to not reset the build just set the version variables without touching any build files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

termux_step_pre_configure should NOT get re-executed when continue-build is on. If you really really need it, use workaround below.

if [ "$TERMUX_CONTINUE_BUILD" == "true" ]; then
termux_step_pre_configure
cd $TERMUX_PKG_SRCDIR
fi

cd "$TERMUX_PKG_SRCDIR"
termux_step_pre_configure
fi

# Even on continued build we might need to setup paths
# to tools so need to run part of configure step
Expand Down Expand Up @@ -708,6 +714,7 @@ for ((i=0; i<${#PACKAGE_LIST[@]}; i++)); do
termux_add_package_to_built_packages_list "$TERMUX_PKG_NAME"
termux_step_finish_build
) 5< "$TERMUX_BUILD_LOCK_FILE"
termux_step_post_finish_build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case termux_step_post_finish_build will be executed in parent shell. Move it to termux_step_finish_build invocation please.

Also, why exactly termux_step_post_finish_build is needed? You can perform checks in termux_step_post_massage step.

done

# Removing a file to store a list of compiled packages
Expand Down
45 changes: 45 additions & 0 deletions packages/test/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
TERMUX_PKG_DESCRIPTION="empty test packet for build system "
TERMUX_PKG_VERSION=0
TERMUX_PKG_LICENSE="WTFPL"
TERMUX_PKG_NO_ELF_CLEANER=true

termux_step_pre_configure() {
# echo $TERMUX_PREFIX
# echo $TERMUX_PREFIX_CLASSICAL
echo TERMUX_TOPDIR=$TERMUX_TOPDIR
# exit
# $TERMUX_ON_DEVICE_BUILD && test TERMUX_PREFIX = TERMUX_PREFIX_CLASSICAL && echo unsafe prefix detected && exit
echo pwd=
pwd
# touch a
# touch configure.in
# exit
test=123
$TERMUX_CONTINUE_BUILD || termux_error_exit I failed redo with -c
}

termux_step_post_make_install() {
test $test = 123 || echo test != 123
pwd
mkdir -p $TERMUX_PREFIX
# cp $TERMUX_PKG_SRCDIR/* $TERMUX_PREFIX/
# install -Dm700 -t $TERMUX_PREFIX/ $TERMUX_PKG_SRCDIR/a
# cat $TERMUX_PKG_SRCDIR/configure.in
mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/usr
touch $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/usr/a
}

termux_step_extract_into_massagedir() {
$TERMUX_ON_DEVICE_BUILD && echo skip prefix folder scan on device to save the memory chip
}

# termux_step_post_massage() {
termux_step_post_finish_build() {
echo
echo -e '\e[1m post massage \e[0m'
echo TERMUX_PKG_PACKAGEDIR=$TERMUX_PKG_PACKAGEDIR
ls $TERMUX_PKG_PACKAGEDIR
tar tf $TERMUX_PKG_PACKAGEDIR/data.*
dpkg -c $TERMUX_OUTPUT_DIR/test* | grep /DEBIAN/control && termux_error_exit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The check will not work with pacman packages.

echo done
}
1 change: 1 addition & 0 deletions scripts/build/termux_step_create_debian_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ termux_step_create_debian_package() {
# Metapackage doesn't have data inside.
rm -rf data
fi
$TERMUX_CONTINUE_BUILD && rm -rf DEBIAN
tar --sort=name \
--mtime="@${SOURCE_DATE_EPOCH}" \
--owner=0 --group=0 --numeric-owner \
Expand Down
4 changes: 2 additions & 2 deletions scripts/build/termux_step_massage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ termux_step_massage() {
find ./${ADDING_PREFIX}share/man -mindepth 1 -maxdepth 1 -type d ! -name man\* | xargs -r rm -rf

# Compress man pages with gzip:
find ./${ADDING_PREFIX}share/man -type f ! -iname \*.gz -print0 | xargs -r -0 gzip -9 -n
find ./${ADDING_PREFIX}share/man -type f ! -iname \*.gz -print0 | xargs -r -0 gzip -9 -n || $TERMUX_CONTINUE_BUILD
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give an example on how it will fail.


# Update man page symlinks, e.g. unzstd.1 -> zstd.1:
while IFS= read -r -d '' file; do
Expand Down Expand Up @@ -179,7 +179,7 @@ termux_step_massage() {
# Check so that package is not affected by
# https://github.com/android/ndk/issues/1614, or
# https://github.com/termux/termux-packages/issues/9944
if [[ "${TERMUX_PACKAGE_LIBRARY}" == "bionic" ]]; then
if [[ "${TERMUX_PACKAGE_LIBRARY}" == "bionic" ]] && ! $TERMUX_ON_DEVICE_BUILD; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I need this because, I and licy183 need to build in $TERMUX_ON_DEVICE_BUILD=true mode and then we copy and paste the .deb from one device to another device. If undefined symbols are allowed to pass from Android 9 to Android 7, the program will crash.

echo "INFO: READELF=${READELF} ... $(command -v ${READELF})"
export pattern_file_undef=$(mktemp)
echo "INFO: Generating undefined symbols regex to ${pattern_file_undef}"
Expand Down
5 changes: 3 additions & 2 deletions scripts/build/termux_step_setup_variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ termux_step_setup_variables() {
TERMUX_BUILT_PACKAGES_DIRECTORY="$TERMUX_TOPDIR/.built-packages"
TERMUX_NO_CLEAN="true"

if [ "$TERMUX_PACKAGE_LIBRARY" = "bionic" ]; then
# this imbecile message needs to be sileneced
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without this, on-device building will not work at all when executing bash scripts with shebang /bin or /usr/bin.

if [ "$TERMUX_PACKAGE_LIBRARY" = "bionic" ] && ! $TERMUX_FORCE_BUILD; then
# On-device builds without termux-exec are unsupported.
if ! grep -q "${TERMUX_PREFIX}/lib/libtermux-exec.so" <<< "${LD_PRELOAD-x}"; then
termux_error_exit "On-device builds without termux-exec are not supported."
termux_error_exit "On-device builds without termux-exec are not supported. use -f to ignore "
fi
fi
else
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/termux_step_start_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ termux_step_start_build() {
termux_error_exit "Package '$TERMUX_PKG_NAME' is not available for on-device builds."
fi

if [ "$TERMUX_PACKAGE_LIBRARY" = "bionic" ]; then
if [ "$TERMUX_PACKAGE_LIBRARY" = "bionic" ] && ! $TERMUX_PKG_NO_ELF_CLEANER; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Installing elf-cleaner will not take too much space. Is there any particular reason to skip it?

if [ "$TERMUX_ON_DEVICE_BUILD" = "true" ]; then
case "$TERMUX_APP_PACKAGE_MANAGER" in
"apt") apt install -y termux-elf-cleaner;;
Expand Down
2 changes: 1 addition & 1 deletion scripts/build/toolchain/termux_setup_toolchain_27c.sh
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ termux_setup_toolchain_27c() {
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
usr/include/android/api-level.h

$TERMUX_ELF_CLEANER --api-level=$TERMUX_PKG_API_LEVEL usr/lib/*/*/*.so
$TERMUX_PKG_NO_ELF_CLEANER || $TERMUX_ELF_CLEANER --api-level=$TERMUX_PKG_API_LEVEL usr/lib/*/*/*.so
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code path will not execute when on-device building as it is early-returned at

.

This only affects non-on-device build.

for dir in usr/lib/*; do
# This seem to be needed when building rust
# packages
Expand Down