Skip to content

Commit 8de1986

Browse files
committed
build: small improvements
- add python framework into variable - move command sections together - remove cd command from build process Signed-off-by: Andrej Valek <[email protected]>
1 parent e3d26f7 commit 8de1986

1 file changed

Lines changed: 19 additions & 30 deletions

File tree

build.sh

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,68 +15,57 @@ ARTWORK="$PWD/artwork"
1515
SRC="$PWD/src"
1616
DL="$PWD/dl"
1717
PACKAGE="$PWD/package"
18+
PYTHON_FWORK="$PACKAGE/Frameworks/Python.framework"
19+
PYTHON_FWORK_VERSION="$PYTHON_FWORK/Versions/Current"
1820

1921
rm -rf "$PACKAGE"
2022

21-
mkdir -p "$DL" "$PACKAGE"
22-
mkdir -p "$PACKAGE/bin"
23+
mkdir -p "$DL" "$PACKAGE/bin" "$PACKAGE/boot"
2324

2425
echo "Updating submodules..."
25-
2626
git submodule update --init --recursive
2727

2828
echo "Downloading installer components..."
29-
30-
cd "$DL"
31-
32-
wget -Nc "$PYTHON_URI"
29+
wget -P "$DL" -Nc "$PYTHON_URI"
3330

3431
echo "Building m1n1..."
35-
3632
make -C "$M1N1" RELEASE=1 -j4
3733

3834
echo "Building u-boot..."
39-
4035
make -C "$UBOOT" CROSS_COMPILE=aarch64-linux-gnu- -j4 apple_m1_defconfig all
4136

4237
echo "Copying files..."
43-
4438
cp -r "$SRC"/* "$PACKAGE/"
4539
cp "$ARTWORK/logos/icns/AsahiLinux_logomark.icns" "$PACKAGE/logo.icns"
46-
mkdir -p "$PACKAGE/boot"
4740
cp "$M1N1/build/m1n1.bin" "$PACKAGE/boot"
4841
cat "$M1N1/build/m1n1.bin" \
4942
"$UBOOT/arch/arm/dts/"t[86]*.dtb \
5043
"$UBOOT/u-boot-nodtb.bin" \
5144
> "$PACKAGE/boot/m1n1-uboot.bin"
5245

53-
echo "Extracting Python framework..."
54-
55-
mkdir -p "$PACKAGE/Frameworks/Python.framework"
5646

47+
echo "Extracting Python framework..."
48+
mkdir -p "$PYTHON_FWORK"
5749
7z x -so "$DL/$PYTHON_PKG" Python_Framework.pkg/Payload | zcat | \
58-
cpio -i -D "$PACKAGE/Frameworks/Python.framework"
50+
cpio -i -D "$PYTHON_FWORK"
5951

60-
echo "Slimming down Python..."
6152

62-
cd "$PACKAGE/Frameworks/Python.framework/Versions/Current"
53+
echo "Slimming down Python..."
54+
(
55+
cd "$PYTHON_FWORK_VERSION"
56+
rm -rf include share
57+
cd lib
58+
rm -rf -- tdb* tk* Tk* libtk* *tcl*
59+
cd python3.*
60+
rm -rf test ensurepip idlelib
61+
cd lib-dynload
62+
rm -f _test* _tkinter*
63+
)
6364

64-
rm -rf include share
65-
cd lib
66-
rm -rf -- tdb* tk* Tk* libtk* *tcl*
67-
cd python3.*
68-
rm -rf test ensurepip idlelib
69-
cd lib-dynload
70-
rm -f _test* _tkinter*
71-
7265
echo "Copying certificates..."
73-
7466
certs="$(python3 -c 'import certifi; print(certifi.where())')"
75-
cp "$certs" "$PACKAGE/Frameworks/Python.framework/Versions/Current/etc/openssl/cert.pem"
67+
cp "$certs" "$PYTHON_FWORK_VERSION/etc/openssl/cert.pem"
7668

7769
echo "Packaging installer..."
78-
7970
cd "$PACKAGE"
80-
8171
tar czf ../installer.tar.gz .
82-

0 commit comments

Comments
 (0)