Skip to content

Commit 3b7e011

Browse files
committed
new package: python3.12-brotli
1 parent d747398 commit 3b7e011

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
TERMUX_PKG_HOMEPAGE=https://github.com/google/brotli
2+
TERMUX_PKG_DESCRIPTION="lossless compression algorithm and format (Python bindings)"
3+
TERMUX_PKG_LICENSE="MIT"
4+
TERMUX_PKG_MAINTAINER="@termux"
5+
TERMUX_PKG_VERSION=1.1.0
6+
TERMUX_PKG_SRCURL=https://github.com/google/brotli/archive/v$TERMUX_PKG_VERSION.tar.gz
7+
TERMUX_PKG_SHA256=e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff
8+
TERMUX_PKG_DEPENDS="python, python-pip"
9+
TERMUX_PKG_PYTHON_COMMON_DEPS="wheel"
10+
TERMUX_PKG_BUILD_IN_SRC=true
11+
TERMUX_PKG_AUTO_UPDATE=true
12+
13+
TERMUX_PYTHON_VERSION=3.12
14+
TERMUX_PYTHON_HOME=$TERMUX_PREFIX/lib/python${TERMUX_PYTHON_VERSION}
15+
TERMUX_PYTHON_CROSSENV_PREFIX=$TERMUX_PKG_BUILDDIR/python${TERMUX_PYTHON_VERSION/./}-crossenv-prefix-$TERMUX_ARCH
16+
TUR_AUTO_AUDIT_WHEEL=true
17+
TUR_AUDIT_WHEEL_NO_LIBS=true
18+
19+
source $TERMUX_SCRIPTDIR/common-files/tur_build_wheel.sh
20+
21+
termux_step_configure() {
22+
mkdir -p $TERMUX_PKG_TMPDIR/_fake_bin
23+
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
24+
-e "s|@COMPILER@|$(command -v ${CC})|g" \
25+
"$TERMUX_PKG_BUILDER_DIR"/wrapper.py.in \
26+
> $TERMUX_PKG_TMPDIR/_fake_bin/"$(basename ${CC})"
27+
chmod +x $TERMUX_PKG_TMPDIR/_fake_bin/"$(basename ${CC})"
28+
export PATH="$TERMUX_PKG_TMPDIR/_fake_bin:$PATH"
29+
30+
# ERROR: ./lib/python3.12/site-packages/_brotli.cpython-312.so contains undefined symbols:
31+
# 31: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND log2
32+
LDFLAGS+=" -lm"
33+
LDFLAGS+=" -Wl,--no-as-needed,-lpython${TERMUX_PYTHON_VERSION}"
34+
}
35+
36+
termux_step_make() {
37+
:
38+
}
39+
40+
termux_step_make_install() {
41+
pip install . --prefix=$TERMUX_PREFIX -vv --no-build-isolation --no-deps
42+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/python3
2+
import os
3+
import subprocess
4+
import sys
5+
import typing
6+
7+
COMPLIER_PATH = "@COMPILER@"
8+
TERMUX_PREFIX = "@TERMUX_PREFIX@"
9+
10+
def main(argv: typing.List[str]):
11+
cwd = os.getcwd()
12+
# Move `-I@TERMUX_PREFIX@/include` to the last include param
13+
argv_new = []
14+
argv_last = []
15+
for arg in argv[1:]:
16+
if arg.startswith("-I@TERMUX_PREFIX@"):
17+
argv_last.append(arg)
18+
else:
19+
argv_new.append(arg)
20+
ind = -1
21+
for i, arg in enumerate(argv_new):
22+
if arg.startswith("-I"):
23+
ind = i
24+
if ind != -1:
25+
argv_new = argv_new[:ind + 1] + argv_last + argv_new[ind + 1:]
26+
args = [COMPLIER_PATH] + argv_new
27+
subprocess.check_call(args, env=os.environ, cwd=cwd, text=True)
28+
29+
if __name__ == '__main__':
30+
main(sys.argv)

0 commit comments

Comments
 (0)