File tree 18 files changed +169
-75
lines changed 18 files changed +169
-75
lines changed Original file line number Diff line number Diff line change 24
24
25
25
def bootstrap ():
26
26
parser = argparse .ArgumentParser ()
27
+ parser .add_argument ('--musl' , action = 'store_true' )
27
28
parser .add_argument ('--optimized' , action = 'store_true' )
28
29
29
30
args = parser .parse_args ()
@@ -40,6 +41,8 @@ def bootstrap():
40
41
os .environ ['PATH' ] = '%s:%s' % (str (VENV / 'bin' ), os .environ ['PATH' ])
41
42
os .environ ['PYTHONPATH' ] = str (ROOT )
42
43
44
+ if args .musl :
45
+ os .environ ['PYBUILD_MUSL' ] = '1'
43
46
if args .optimized :
44
47
os .environ ['PYBUILD_OPTIMIZED' ] = '1'
45
48
@@ -58,6 +61,9 @@ def run():
58
61
basename = 'cpython-linux64'
59
62
extra = ''
60
63
64
+ if 'PYBUILD_MUSL' in os .environ :
65
+ basename += '-musl'
66
+ extra = '-musl'
61
67
if 'PYBUILD_OPTIMIZED' in os .environ :
62
68
basename += '-pgo'
63
69
extra = '-pgo'
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ COMMON_DEPENDS := \
11
11
12
12
PLATFORM := linux64
13
13
14
+ ifdef PYBUILD_MUSL
15
+ PLATFORM := $(PLATFORM ) -musl
16
+ endif
17
+
14
18
BASE_TOOLCHAIN_DEPENDS := \
15
19
$(OUTDIR ) /binutils-linux64.tar \
16
20
$(OUTDIR ) /gcc-linux64.tar \
@@ -22,7 +26,7 @@ TOOLCHAIN_DEPENDS := \
22
26
$(OUTDIR ) /musl-linux64.tar \
23
27
$(NULL )
24
28
25
- default : $(OUTDIR ) /cpython-linux64 $(if $(PYBUILD_OPTIMIZED ) ,-pgo,) .tar
29
+ default : $(OUTDIR ) /cpython-$( PLATFORM ) $(if $(PYBUILD_OPTIMIZED ) ,-pgo,) .tar
26
30
27
31
$(OUTDIR ) /image-% .tar : $(HERE ) /% .Dockerfile $(COMMON_DEPENDS )
28
32
$(BUILD ) image-$*
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf db-${BDB_VERSION} .tar.gz
15
13
@@ -19,7 +17,8 @@ CLFAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" ..
19
17
--build=x86_64-unknown-linux-gnu \
20
18
--target=${TARGET} \
21
19
--prefix=/tools/deps \
22
- --enable-dbm
20
+ --enable-dbm \
21
+ --disable-shared
23
22
24
23
make -j ` nproc`
25
24
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ pushd bzip2-${BZIP2_VERSION}
15
15
16
16
make -j ` nproc` install \
17
17
AR=/tools/host/bin/${TOOLCHAIN_PREFIX} ar \
18
- CC=clang \
18
+ CC=" ${CC} " \
19
19
CFLAGS=" ${EXTRA_TARGET_CFLAGS} -fPIC" \
20
20
LDFLAGS=" ${EXTRA_TARGET_LDFLAGS} " \
21
21
PREFIX=/build/out/tools/deps
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/clang-linux64/bin:/tools/host/bin:/tools/deps/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
# configure somehow has problems locating llvm-profdata even though it is in
15
13
# PATH. The macro it is using allows us to specify its path via an
@@ -26,6 +24,8 @@ tar -xf Python-${PYTHON_VERSION}.tar.xz
26
24
cat Setup.local
27
25
mv Setup.local Python-${PYTHON_VERSION} /Modules/Setup.local
28
26
27
+ cat Makefile.extra
28
+
29
29
pushd Python-${PYTHON_VERSION}
30
30
31
31
cp Modules/readline.c Modules/readline-libedit.c
@@ -44,6 +44,12 @@ CFLAGS="-fPIC -I/tools/deps/include -I/tools/deps/include/ncurses"
44
44
CPPFLAGS=$CFLAGS
45
45
LDFLAGS=" -L/tools/deps/lib"
46
46
47
+ if [ " ${CC} " = " musl-clang" ]; then
48
+ CFLAGS=" ${CFLAGS} -static"
49
+ CPPFLAGS=" ${CPPFLAGS} -static"
50
+ LDFLAGS=" ${LDFLAGS} -static"
51
+ fi
52
+
47
53
CONFIGURE_FLAGS=" --prefix=/install --with-openssl=/tools/deps --without-ensurepip"
48
54
49
55
# TODO support --with-lto
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf gdbm-${GDBM_VERSION} .tar.gz
15
13
@@ -21,6 +19,7 @@ CLFAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" ./
21
19
--build=x86_64-unknown-linux-gnu \
22
20
--target=${TARGET} \
23
21
--prefix=/tools/deps \
22
+ --disable-shared \
24
23
--enable-libgdbm-compat
25
24
26
25
make -j ` nproc`
Original file line number Diff line number Diff line change @@ -8,21 +8,25 @@ set -ex
8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf libedit-${LIBEDIT_VERSION} .tar.gz
15
13
16
14
pushd libedit-${LIBEDIT_VERSION}
17
15
18
16
cflags=" ${EXTRA_TARGET_CFLAGS} -fPIC -I/tools/deps/include -I/tools/deps/include/ncurses"
19
17
18
+ # musl doesn't define __STDC_ISO_10646__, so work around that.
19
+ if [ " ${CC} " = " musl-clang" ]; then
20
+ cflags=" ${cflags} -D__STDC_ISO_10646__=201103L"
21
+ fi
22
+
20
23
# Install to /tools/deps/libedit so it doesn't conflict with readline's files.
21
24
CLFAGS=" ${cflags} " CPPFLAGS=" ${cflags} " LDFLAGS=" -L/tools/deps/lib" \
22
25
./configure \
23
26
--build=x86_64-unknown-linux-gnu \
24
27
--host=${TARGET} \
25
28
--prefix=/tools/deps/libedit \
29
+ --disable-shared
26
30
27
31
make -j ` nproc`
28
32
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf libffi-${LIBFFI_VERSION} .tar.gz
15
13
@@ -18,7 +16,8 @@ pushd libffi-${LIBFFI_VERSION}
18
16
CFLAGS=" ${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS=" ${EXTRA_TARGET_CFLAGS} -fPIC" ./configure \
19
17
--build=x86_64-unknown-linux-gnu \
20
18
--host=${TARGET} \
21
- --prefix=/tools/deps
19
+ --prefix=/tools/deps \
20
+ --disable-shared
22
21
23
22
make -j ` nproc`
24
23
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf ncurses-${NCURSES_VERSION} .tar.gz
15
13
@@ -18,6 +16,7 @@ pushd ncurses-${NCURSES_VERSION}
18
16
CFLAGS=" ${EXTRA_TARGET_CFLAGS} -fPIC" ./configure \
19
17
--build=x86_64-unknown-linux-gnu \
20
18
--host=${TARGET} \
21
- --prefix=/tools/deps
19
+ --prefix=/tools/deps \
20
+ --without-cxx
22
21
make -j ` nproc`
23
22
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change @@ -8,14 +8,19 @@ set -ex
8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf openssl-${OPENSSL_VERSION} .tar.gz
15
13
16
14
pushd openssl-${OPENSSL_VERSION}
17
15
18
- /usr/bin/perl ./Configure --prefix=/tools/deps linux-x86_64
16
+ # musl is missing support for various primitives.
17
+ # TODO disable secure memory is a bit scary. We should look into a proper
18
+ # workaround.
19
+ if [ " ${CC} " = " musl-clang" ]; then
20
+ EXTRA_FLAGS=" no-async -DOPENSSL_NO_ASYNC -D__STDC_NO_ATOMICS__=1 no-engine -DOPENSSL_NO_SECURE_MEMORY "
21
+ fi
22
+
23
+ /usr/bin/perl ./Configure --prefix=/tools/deps linux-x86_64 no-shared ${EXTRA_FLAGS}
19
24
20
25
make -j ` nproc`
21
26
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf readline-${READLINE_VERSION} .tar.gz
15
13
@@ -20,6 +18,7 @@ CLFAGS="${EXTRA_TARGET_CFLAGS} -fPIC" CPPFLAGS="${EXTRA_TARGET_CFLAGS} -fPIC" LD
20
18
--build=x86_64-unknown-linux-gnu \
21
19
--host=${TARGET} \
22
20
--prefix=/tools/deps \
21
+ --disable-shared \
23
22
--with-curses
24
23
25
24
make -j ` nproc`
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ set -ex
8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf sqlite-autoconf-3280000.tar.gz
15
13
pushd sqlite-autoconf-3280000
16
14
17
- CFLAGS=" -fPIC" CPPFLAGS=" -fPIC" ./configure --prefix /tools/deps
15
+ CFLAGS=" -fPIC" CPPFLAGS=" -fPIC" ./configure \
16
+ --prefix /tools/deps \
17
+ --disable-shared
18
18
19
19
make -j ` nproc`
20
20
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf tcl8.6.9-src.tar.gz
15
13
Original file line number Diff line number Diff line change @@ -8,13 +8,13 @@ set -ex
8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf libuuid-${UUID_VERSION} .tar.gz
15
13
pushd libuuid-${UUID_VERSION}
16
14
17
- CFLAGS=" -fPIC" CPPFLAGS=" -fPIC" ./configure --prefix=/tools/deps
15
+ CFLAGS=" -fPIC" CPPFLAGS=" -fPIC" ./configure \
16
+ --prefix=/tools/deps \
17
+ --disable-shared
18
18
19
19
make -j ` nproc`
20
20
make -j ` nproc` install DESTDIR=/build/out
Original file line number Diff line number Diff line change @@ -8,15 +8,14 @@ set -ex
8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf xz-${XZ_VERSION} .tar.gz
15
13
16
14
pushd xz-${XZ_VERSION}
17
15
18
16
CFLAGS=" -fPIC" CPPFLAGS=" -fPIC" CCASFLAGS=" -fPIC" ./configure \
19
17
--prefix=/tools/deps \
18
+ --disable-shared \
20
19
--disable-xz \
21
20
--disable-xzdec \
22
21
--disable-lzmadec \
Original file line number Diff line number Diff line change 8
8
cd /build
9
9
10
10
export PATH=/tools/${TOOLCHAIN} /bin:/tools/host/bin:$PATH
11
- export CC=clang
12
- export CXX=clang++
13
11
14
12
tar -xf zlib-${ZLIB_VERSION} .tar.gz
15
13
You can’t perform that action at this time.
0 commit comments