|
26 | 26 | mv Lib/compileall.py Lib/compileall.py.bak |
27 | 27 | echo 'import sys; sys.exit(0)' > Lib/compileall.py |
28 | 28 | chmod +x Lib/compileall.py |
29 | | - sed -i 's|__FILE__|"__FILE__"|' \ |
| 29 | + sed -i 's|__FILE__|__FILE_NAME__|' \ |
30 | 30 | Python/errors.c \ |
31 | 31 | Include/pyerrors.h \ |
32 | 32 | Include/cpython/object.h \ |
33 | 33 | Modules/pyexpat.c |
| 34 | + sed -i 's|TIME __TIME__|TIME "xx:xx:xx"|' Modules/getbuildinfo.c |
| 35 | + sed -i 's|DATE __DATE__|DATE "xx/xx/xx"|' Modules/getbuildinfo.c |
| 36 | + # different build path length leads to different wrapping. avoid |
| 37 | + sed -i 's|vars, stream=f|vars, stream=f, width=2**24|' Lib/sysconfig.py |
34 | 38 | # configure: |
35 | 39 | ash configure \ |
| 40 | + ac_cv_broken_sem_getvalue=yes \ |
| 41 | + ac_cv_posix_semaphores_enabled=no \ |
| 42 | + OPT='-DNDEBUG -fwrapv -O3 -Wall' \ |
36 | 43 | --without-static-libpython \ |
37 | 44 | --build x86_64-linux-musl \ |
38 | 45 | --prefix=$out \ |
39 | 46 | --enable-shared \ |
40 | 47 | --with-ensurepip=no |
| 48 | + # ensure reproducibility in case of no /dev/shm |
| 49 | + grep 'define POSIX_SEMAPHORES_NOT_ENABLED 1' pyconfig.h |
| 50 | + grep 'define HAVE_BROKEN_SEM_GETVALUE 1' pyconfig.h |
41 | 51 | # build: |
42 | 52 | make SHELL=$SHELL -j $NPROC CFLAGS="-ffile-prefix-map=$(pwd)=/builddir/" |
43 | 53 | # install: |
44 | 54 | make SHELL=$SHELL -j $NPROC install |
45 | 55 | # restore compileall just in case |
46 | 56 | cat Lib/compileall.py.bak > $out/lib/python3.11/compileall.py |
47 | | - # strip builddir mentions |
48 | | - sed -i "s|$(pwd)|...|" \ |
| 57 | + # strip builddir mentions: |
| 58 | + sed -i "s|$(pwd)|...|g" \ |
49 | 59 | $out/lib/python3.*/_sysconfigdata__*.py \ |
50 | | - $out/lib/python3.*/config-3.11-x86_64-linux-musl/Makefile |
| 60 | + $out/lib/python3.*/config-3.*-x86_64-linux-musl/Makefile |
51 | 61 | # check for build path leaks: |
52 | 62 | ( ! grep -rF $(pwd) $out ) |
53 | 63 | ''; |
|
0 commit comments