Skip to content
Merged
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
42 changes: 42 additions & 0 deletions tur-pypi-312/python3.12-brotli/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
TERMUX_PKG_HOMEPAGE=https://github.com/google/brotli
TERMUX_PKG_DESCRIPTION="lossless compression algorithm and format (Python bindings)"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.1.0
TERMUX_PKG_SRCURL=https://github.com/google/brotli/archive/v$TERMUX_PKG_VERSION.tar.gz
TERMUX_PKG_SHA256=e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff
TERMUX_PKG_DEPENDS="python, python-pip"
TERMUX_PKG_PYTHON_COMMON_DEPS="wheel"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true

TERMUX_PYTHON_VERSION=3.12
TERMUX_PYTHON_HOME=$TERMUX_PREFIX/lib/python${TERMUX_PYTHON_VERSION}
TERMUX_PYTHON_CROSSENV_PREFIX=$TERMUX_PKG_BUILDDIR/python${TERMUX_PYTHON_VERSION/./}-crossenv-prefix-$TERMUX_ARCH
TUR_AUTO_AUDIT_WHEEL=true
TUR_AUDIT_WHEEL_NO_LIBS=true

source $TERMUX_SCRIPTDIR/common-files/tur_build_wheel.sh

termux_step_configure() {
mkdir -p $TERMUX_PKG_TMPDIR/_fake_bin
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
-e "s|@COMPILER@|$(command -v ${CC})|g" \
"$TERMUX_PKG_BUILDER_DIR"/wrapper.py.in \
> $TERMUX_PKG_TMPDIR/_fake_bin/"$(basename ${CC})"
chmod +x $TERMUX_PKG_TMPDIR/_fake_bin/"$(basename ${CC})"
export PATH="$TERMUX_PKG_TMPDIR/_fake_bin:$PATH"

# ERROR: ./lib/python3.12/site-packages/_brotli.cpython-312.so contains undefined symbols:
# 31: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND log2
LDFLAGS+=" -lm"
LDFLAGS+=" -Wl,--no-as-needed,-lpython${TERMUX_PYTHON_VERSION}"
}

termux_step_make() {
:
}

termux_step_make_install() {
pip install . --prefix=$TERMUX_PREFIX -vv --no-build-isolation --no-deps
}
30 changes: 30 additions & 0 deletions tur-pypi-312/python3.12-brotli/wrapper.py.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/python3
import os
import subprocess
import sys
import typing

COMPLIER_PATH = "@COMPILER@"
TERMUX_PREFIX = "@TERMUX_PREFIX@"

def main(argv: typing.List[str]):
cwd = os.getcwd()
# Move `-I@TERMUX_PREFIX@/include` to the last include param
argv_new = []
argv_last = []
for arg in argv[1:]:
if arg.startswith("-I@TERMUX_PREFIX@"):
argv_last.append(arg)
else:
argv_new.append(arg)
ind = -1
for i, arg in enumerate(argv_new):
if arg.startswith("-I"):
ind = i
if ind != -1:
argv_new = argv_new[:ind + 1] + argv_last + argv_new[ind + 1:]
args = [COMPLIER_PATH] + argv_new
subprocess.check_call(args, env=os.environ, cwd=cwd, text=True)

if __name__ == '__main__':
main(sys.argv)