-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.sh
executable file
·79 lines (62 loc) · 1.6 KB
/
build.sh
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
#!/bin/bash
set -e
ARCH=aarch64
VER=python3.11
jobs=4
install_dir=$(pwd)/rootfs
toolchain=${ARCH}-linux-musl
echo "Creating ${install_dir} folder with $(whoami) user permissions ..."
[ -d ${install_dir} ] || mkdir -p ${install_dir}
[ -d build ] || mkdir build
cd build
for d in $(ls ../package/*)
do
echo $d
dir=$(basename $d)
dir=${dir%%.*}
if ! [ -d ${dir}* ]; then
tar xf $d
# To build
if [[ $dir == Python-3* ]]; then
continue
elif [[ $dir == zlib* ]]; then
pushd ${dir}*
CROSS_PREFIX="${toolchain}-" ./configure --prefix=${install_dir}
make -j${jobs} && make install
popd
else
pushd ${dir}*
./configure --host=${toolchain} --enable-static=yes --prefix=${install_dir}
make -j${jobs} && make install
popd
fi
fi
done
echo "Building ${VER}"
cd Python-3*
export PKG_CONFIG_PATH=${install_dir}/lib/pkgconfig
unset CFLAGS LDFLAGS CC
export CC=aarch64-linux-musl-gcc
export CFLAGS+=" -I${install_dir}/include/" # Just to include libffi
export LDFLAGS+=" -L${install_dir}/lib/"
export CONFIG_SITE=config.site
echo '
ac_cv_file__dev_ptmx=yes
ac_cv_file__dev_ptc=no
ac_cv_func_accept4=no
ac_cv_func_utimensat=no
ac_cv_func_setitimer=no
ac_cv_func_clock_getres=no
ac_cv_func_clock_nanosleep=no
ac_cv_func_wait4=no
ac_cv_func_select6=no
' > ./config.site
./configure --prefix=${install_dir} --with-build-python=${VER} --build=x86_64 --host=${toolchain} \
--enable-ipv6 --with-config-site=./CONFIG_SITE --enable-optimizations
# --with-static-libpython=yes
# --enable-shared=no
# --with-system-ffi=no
make -j4 -s && make install
# make test
echo ========= Cross compiled python successfully =========
echo Please check ${install_dir}