Skip to content

Commit dcea166

Browse files
committed
Fix absolute symlink targets in bzip2
1 parent 1678a30 commit dcea166

File tree

3 files changed

+45
-16
lines changed

3 files changed

+45
-16
lines changed

android-env.sh

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This script must be sourced with the following variables already set:
2-
: ${ANDROID_HOME:?} # Path to Android SDK
3-
: ${HOST:?} # GNU target triplet
2+
: "${ANDROID_HOME:?}" # Path to Android SDK
3+
: "${HOST:?}" # GNU target triplet
44

55
# You may also override the following:
6-
: ${api_level:=21} # Minimum Android API level the build will run on
7-
: ${PREFIX:-} # Path in which to find required libraries
6+
: "${ANDROID_API_LEVEL:=21}" # Minimum Android API level the build will run on
7+
: "${PREFIX:-}" # Path in which to find required libraries
88

99

1010
# Print all messages on stderr so they're visible when running within build-wheel.
@@ -24,26 +24,26 @@ fail() {
2424
# * https://android.googlesource.com/platform/ndk/+/ndk-rXX-release/docs/BuildSystemMaintainers.md
2525
# where XX is the NDK version. Do a diff against the version you're upgrading from, e.g.:
2626
# https://android.googlesource.com/platform/ndk/+/ndk-r25-release..ndk-r26-release/docs/BuildSystemMaintainers.md
27-
ndk_version=27.1.12297006
27+
ndk_version=27.2.12479018
2828

2929
ndk=$ANDROID_HOME/ndk/$ndk_version
30-
if ! [ -e $ndk ]; then
30+
if ! [ -e "$ndk" ]; then
3131
log "Installing NDK - this may take several minutes"
32-
yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "ndk;$ndk_version"
32+
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" "ndk;$ndk_version"
3333
fi
3434

35-
if [ $HOST = "arm-linux-androideabi" ]; then
35+
if [ "$HOST" = "arm-linux-androideabi" ]; then
3636
clang_triplet=armv7a-linux-androideabi
3737
else
38-
clang_triplet=$HOST
38+
clang_triplet="$HOST"
3939
fi
4040

4141
# These variables are based on BuildSystemMaintainers.md above, and
4242
# $ndk/build/cmake/android.toolchain.cmake.
43-
toolchain=$(echo $ndk/toolchains/llvm/prebuilt/*)
43+
toolchain=$(echo "$ndk"/toolchains/llvm/prebuilt/*)
4444
export AR="$toolchain/bin/llvm-ar"
4545
export AS="$toolchain/bin/llvm-as"
46-
export CC="$toolchain/bin/${clang_triplet}${api_level}-clang"
46+
export CC="$toolchain/bin/${clang_triplet}${ANDROID_API_LEVEL}-clang"
4747
export CXX="${CC}++"
4848
export LD="$toolchain/bin/ld"
4949
export NM="$toolchain/bin/llvm-nm"
@@ -72,22 +72,28 @@ LDFLAGS="$LDFLAGS -lm"
7272

7373
# -mstackrealign is included where necessary in the clang launcher scripts which are
7474
# pointed to by $CC, so we don't need to include it here.
75-
if [ $HOST = "arm-linux-androideabi" ]; then
75+
if [ "$HOST" = "arm-linux-androideabi" ]; then
7676
CFLAGS="$CFLAGS -march=armv7-a -mthumb"
7777
fi
7878

7979
if [ -n "${PREFIX:-}" ]; then
80-
abs_prefix=$(realpath $PREFIX)
80+
abs_prefix="$(realpath "$PREFIX")"
8181
CFLAGS="$CFLAGS -I$abs_prefix/include"
8282
LDFLAGS="$LDFLAGS -L$abs_prefix/lib"
8383

8484
export PKG_CONFIG="pkg-config --define-prefix"
8585
export PKG_CONFIG_LIBDIR="$abs_prefix/lib/pkgconfig"
8686
fi
8787

88+
# When compiling C++, some build systems will combine CFLAGS and CXXFLAGS, and some will
89+
# use CXXFLAGS alone.
90+
export CXXFLAGS="$CFLAGS"
91+
8892
# Use the same variable name as conda-build
89-
if [ $(uname) = "Darwin" ]; then
90-
export CPU_COUNT=$(sysctl -n hw.ncpu)
93+
if [ "$(uname)" = "Darwin" ]; then
94+
CPU_COUNT="$(sysctl -n hw.ncpu)"
95+
export CPU_COUNT
9196
else
92-
export CPU_COUNT=$(nproc)
97+
CPU_COUNT="$(nproc)"
98+
export CPU_COUNT
9399
fi

bzip2/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ cd $build_dir
2020
tar -xf $version_dir/$src_filename
2121
cd $(basename $src_filename .tar.gz)
2222

23+
patch -p1 -i "$recipe_dir/symlink.patch"
24+
2325
CFLAGS+=" -O2 -fPIC"
2426
# -e is needed to override explicit assignment to CC, CFLAGS etc. in the Makefile.
2527
make -e -j $CPU_COUNT bzip2 bzip2recover

bzip2/symlink.patch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
--- a/Makefile 2019-07-13 18:50:05
2+
+++ b/Makefile 2025-06-04 14:42:54
3+
@@ -90,14 +90,14 @@
4+
cp -f libbz2.a $(PREFIX)/lib
5+
chmod a+r $(PREFIX)/lib/libbz2.a
6+
cp -f bzgrep $(PREFIX)/bin/bzgrep
7+
- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzegrep
8+
- ln -s -f $(PREFIX)/bin/bzgrep $(PREFIX)/bin/bzfgrep
9+
+ ln -s -f bzgrep $(PREFIX)/bin/bzegrep
10+
+ ln -s -f bzgrep $(PREFIX)/bin/bzfgrep
11+
chmod a+x $(PREFIX)/bin/bzgrep
12+
cp -f bzmore $(PREFIX)/bin/bzmore
13+
- ln -s -f $(PREFIX)/bin/bzmore $(PREFIX)/bin/bzless
14+
+ ln -s -f bzmore $(PREFIX)/bin/bzless
15+
chmod a+x $(PREFIX)/bin/bzmore
16+
cp -f bzdiff $(PREFIX)/bin/bzdiff
17+
- ln -s -f $(PREFIX)/bin/bzdiff $(PREFIX)/bin/bzcmp
18+
+ ln -s -f bzdiff $(PREFIX)/bin/bzcmp
19+
chmod a+x $(PREFIX)/bin/bzdiff
20+
cp -f bzgrep.1 bzmore.1 bzdiff.1 $(PREFIX)/man/man1
21+
chmod a+r $(PREFIX)/man/man1/bzgrep.1

0 commit comments

Comments
 (0)