Skip to content

Commit c8a4137

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 3f67904 commit c8a4137

1 file changed

Lines changed: 22 additions & 34 deletions

File tree

build.sh

Lines changed: 22 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,17 @@ DL="$PWD/dl"
1818
PACKAGE="$PWD/package"
1919
RELEASES="$PWD/releases"
2020
RELEASES_DEV="$PWD/releases-dev"
21+
PYTHON_FWORK="$PACKAGE/Frameworks/Python.framework"
22+
PYTHON_FWORK_VERSION="$PYTHON_FWORK/Versions/Current"
2123

2224
rm -rf "$PACKAGE"
2325

24-
mkdir -p "$DL" "$PACKAGE" "$RELEASES" "$RELEASES_DEV"
25-
mkdir -p "$PACKAGE/bin"
26+
mkdir -p "$DL" "$PACKAGE/bin" "$PACKAGE/boot" "$RELEASES" "$RELEASES_DEV"
2627

2728
echo "Determining version..."
2829

2930
VER=$(git describe --always --dirty --tags)
3031

31-
echo "Version: $VER"
32-
3332
if [ -z "$VER" ]; then
3433
if [ -e version.tag ]; then
3534
VER="$(cat version.tag)"
@@ -39,72 +38,61 @@ if [ -z "$VER" ]; then
3938
fi
4039
fi
4140

42-
echo "Downloading installer components..."
43-
44-
cd "$DL"
41+
echo "Version: $VER"
4542

46-
wget -Nc "$PYTHON_URI"
43+
echo "Downloading installer components..."
44+
wget -Nc "$DL" "$PYTHON_URI"
4745

4846
echo "Building m1n1..."
49-
5047
make -C "$M1N1" RELEASE=1 CHAINLOADING=1 -j4
5148

5249
echo "Copying files..."
53-
5450
cp -r "$SRC"/* "$PACKAGE/"
5551
rm "$PACKAGE/asahi_firmware"
5652
cp -r "$AFW" "$PACKAGE/"
5753
cp "$ARTWORK/logos/icns/AsahiLinux_logomark.icns" "$PACKAGE/logo.icns"
58-
mkdir -p "$PACKAGE/boot"
5954
cp "$M1N1/build/m1n1.bin" "$PACKAGE/boot"
6055

6156
echo "Extracting Python framework..."
62-
63-
mkdir -p "$PACKAGE/Frameworks/Python.framework"
57+
mkdir -p "$PYTHON_FWORK"
6458

6559
7z x -so "$DL/$PYTHON_PKG" Python_Framework.pkg/Payload | zcat | \
66-
cpio -i -D "$PACKAGE/Frameworks/Python.framework"
67-
68-
69-
cd "$PACKAGE/Frameworks/Python.framework/Versions/Current"
60+
cpio -i -D "$PYTHON_FWORK"
7061

7162
echo "Copying vendored libffi into Python framework..."
72-
7363
cp -P "$VENDOR"/libffi/* lib/
7464

7565
echo "Slimming down Python..."
76-
77-
rm -rf include share
78-
cd lib
79-
rm -rf -- tdb* tk* Tk* libtk* *tcl*
80-
cd python3.*
81-
rm -rf test ensurepip idlelib
82-
cd lib-dynload
83-
rm -f _test* _tkinter*
84-
66+
(
67+
cd "$PYTHON_FWORK_VERSION"
68+
rm -rf include share
69+
cd lib
70+
rm -rf -- tdb* tk* Tk* libtk* *tcl*
71+
cd python3.*
72+
rm -rf test ensurepip idlelib
73+
cd lib-dynload
74+
rm -f _test* _tkinter*
75+
)
8576

8677
echo "Copying certificates..."
87-
8878
certs="$(python3 -c 'import certifi; print(certifi.where())')"
89-
cp "$certs" "$PACKAGE/Frameworks/Python.framework/Versions/Current/etc/openssl/cert.pem"
79+
cp "$certs" "$PYTHON_FWORK_VERSION/etc/openssl/cert.pem"
9080

9181
echo "Packaging installer..."
92-
9382
cd "$PACKAGE"
9483

95-
echo "$VER" > version.tag
96-
97-
if [ "$1" == "prod" ]; then
84+
if [ "$1" = "prod" ]; then
9885
PKGFILE="$RELEASES/installer-$VER.tar.gz"
9986
LATEST="$RELEASES/latest"
100-
elif [ "$1" == "dev" ]; then
87+
elif [ "$1" = "dev" ]; then
10188
PKGFILE="$RELEASES_DEV/installer-$VER.tar.gz"
10289
LATEST="$RELEASES_DEV/latest"
10390
else
10491
PKGFILE="../installer.tar.gz"
10592
LATEST="../latest"
10693
fi
10794

95+
echo "$VER" > version.tag
10896
tar czf "$PKGFILE" .
10997
echo "$VER" > "$LATEST"
11098

0 commit comments

Comments
 (0)