blob: 4ce01be68d10bb942e4481826e76f2ceeb4a3514 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#!/bin/mkpkg
# description: High-level scripting language
# url: https://www.python.org/
name=python3
version=3.14.7
release=2
_basever=3.14
depends=(bzip2 expat libffi mpdecimal libressl readline sqlite xz zlib zstd)
makedeps=(pkgconf)
source=(
https://www.python.org/ftp/python/$version/Python-$version.tar.xz
musl-find_library.patch
)
sha256sums=(
"3b48dac8fb59f62eaa67ac83c1eb12bda1b7a08406dd286e252c11a66be27f81"
"c5d0a7f7639a5632231bb9cd8896b1db1dea9cbd97d4ec67caaadd200ababda4"
)
patch() {
cd Python-$version
# musl ctypes fix
patch -p1 -i "$SRC/musl-find_library.patch"
# LibreSSL compat: X509_VERIFY_PARAM_get_hostflags not implemented
sed -i 's/host_flags = X509_VERIFY_PARAM_get_hostflags(ssl_verification_params);/host_flags = 0;/' Modules/_ssl.c
# Remove bundled libraries
rm -rf Modules/expat
}
build() {
cd Python-$version
# musl thread stack size
export CFLAGS="$CFLAGS -DTHREAD_STACK_SIZE=0x200000"
./configure \
--prefix=/usr \
--enable-shared \
--with-dbmliborder=gdbm:ndbm \
--with-system-expat \
--with-system-libmpdec \
--without-ensurepip \
--without-readline \
--disable-test-modules \
--disable-idle3 \
--disable-tk \
--without-pymalloc \
ac_cv_working_tzset=yes
make
make DESTDIR="$PKG" install
#
# Post-install cleanup
#
# Canonical symlinks
ln -sf python${_basever} "$PKG/usr/bin/python3"
ln -sf python3 "$PKG/usr/bin/python"
ln -sf python${_basever}-config "$PKG/usr/bin/python3-config"
ln -sf python3-config "$PKG/usr/bin/python-config"
# Remove test suite
rm -rf \
"$PKG/usr/lib/python${_basever}/test" \
"$PKG/usr/lib/python${_basever}/lib2to3/tests"
# Remove unused stdlib components (no configure options available)
rm -rf \
"$PKG/usr/bin/idle"* \
"$PKG/usr/lib/python${_basever}/idlelib" \
"$PKG/usr/lib/python${_basever}/tkinter" \
"$PKG/usr/lib/python${_basever}/turtle.py" \
"$PKG/usr/lib/python${_basever}/turtledemo" \
# "$PKG/usr/lib/python${_basever}/unittest" \
"$PKG/usr/lib/python${_basever}/pydoc_data"
# Remove deprecated tools
rm -f "$PKG/usr/bin/2to3"*
# Remove platform-specific modules (we're on Linux)
rm -f "$PKG/usr/lib/python${_basever}/_aix_support.py"
rm -f "$PKG/usr/lib/python${_basever}/_android_support.py"
rm -f "$PKG/usr/lib/python${_basever}/_ios_support.py"
rm -f "$PKG/usr/lib/python${_basever}/_osx_support.py"
rm -f "$PKG/usr/lib/python${_basever}/venv/scripts/common/Activate.ps1"
rm -rf "$PKG/usr/lib/python${_basever}/ctypes/macholib"
find "$PKG/usr/lib/python${_basever}/asyncio" -name 'windows_*.py' -delete 2>/dev/null || true
find "$PKG/usr/lib/python${_basever}/multiprocessing" -name '*win32*' -delete 2>/dev/null || true
# Remove libtool junk
find "$PKG" -name "*.la" -delete
#
# Bytecode compilation: compile with max optimization, then remove sources
#
# Compile all .py to .pyc with -OO (strips docstrings and asserts)
# -b puts .pyc alongside .py instead of __pycache__/
#python3 -OO -m compileall -b -q "$PKG/usr/lib/python${_basever}"
# Use the just-built python, not system python
LD_LIBRARY_PATH="$PWD" ./python -OO -m compileall -b -q "$PKG/usr/lib/python${_basever}"
# Remove all .py source files (keep only .pyc bytecode)
find "$PKG/usr/lib/python${_basever}" -name '*.py' -delete
# Clean up any __pycache__ directories (should be empty now)
find "$PKG/usr/lib/python${_basever}" \
-type d -name "__pycache__" -prune -exec rm -rf {} +
}
signify() {
untrusted comment: public key
RWTZ9IduCSQ/mL8337TEUinPwT92xFEUpD92hkS7IxcOnzTt9QdpohT3
}
# vim: filetype=sh
|