Skip to content

Commit 313c2d4

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 2594aee commit 313c2d4

1 file changed

Lines changed: 20 additions & 30 deletions

File tree

build.sh

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ DL="$PWD/dl"
1616
PACKAGE="$PWD/package"
1717
RELEASES="$PWD/releases"
1818
RELEASES_DEV="$PWD/releases-dev"
19+
PYTHON_FWORK="$PACKAGE/Frameworks/Python.framework"
20+
PYTHON_FWORK_VERSION="$PYTHON_FWORK/Versions/Current"
1921

2022
rm -rf "$PACKAGE"
2123

22-
mkdir -p "$DL" "$PACKAGE" "$RELEASES" "$RELEASES_DEV"
23-
mkdir -p "$PACKAGE/bin"
24+
mkdir -p "$DL" "$PACKAGE/bin" "$PACKAGE/boot" "$RELEASES" "$RELEASES_DEV"
2425

2526
echo "Determining version..."
2627

2728
VER=$(git describe --always --dirty --tags)
28-
29-
echo "Version: $VER"
30-
3129
if [ -z "$VER" ]; then
3230
if [ -e version.tag ]; then
3331
VER="$(cat version.tag)"
@@ -37,53 +35,44 @@ if [ -z "$VER" ]; then
3735
fi
3836
fi
3937

40-
echo "Downloading installer components..."
41-
42-
cd "$DL"
38+
echo "Version: $VER"
4339

44-
wget -Nc "$PYTHON_URI"
40+
echo "Downloading installer components..."
41+
wget -Nc "$DL" "$PYTHON_URI"
4542

4643
echo "Building m1n1..."
47-
4844
make -C "$M1N1" RELEASE=1 CHAINLOADING=1 -j4
4945

5046
echo "Copying files..."
51-
5247
cp -r "$SRC"/* "$PACKAGE/"
5348
cp "$ARTWORK/logos/icns/AsahiLinux_logomark.icns" "$PACKAGE/logo.icns"
54-
mkdir -p "$PACKAGE/boot"
5549
cp "$M1N1/build/m1n1.bin" "$PACKAGE/boot"
5650

5751
echo "Extracting Python framework..."
58-
59-
mkdir -p "$PACKAGE/Frameworks/Python.framework"
52+
mkdir -p "$PYTHON_FWORK"
6053

6154
7z x -so "$DL/$PYTHON_PKG" Python_Framework.pkg/Payload | zcat | \
62-
cpio -i -D "$PACKAGE/Frameworks/Python.framework"
55+
cpio -i -D "$PYTHON_FWORK"
6356

6457
echo "Slimming down Python..."
58+
(
59+
cd "$PYTHON_FWORK_VERSION"
60+
rm -rf include share
61+
cd lib
62+
rm -rf -- tdb* tk* Tk* libtk* *tcl*
63+
cd python3.*
64+
rm -rf test ensurepip idlelib
65+
cd lib-dynload
66+
rm -f _test* _tkinter*
67+
)
6568

66-
cd "$PACKAGE/Frameworks/Python.framework/Versions/Current"
67-
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-
7669
echo "Copying certificates..."
77-
7870
certs="$(python3 -c 'import certifi; print(certifi.where())')"
79-
cp "$certs" "$PACKAGE/Frameworks/Python.framework/Versions/Current/etc/openssl/cert.pem"
71+
cp "$certs" "$PYTHON_FWORK_VERSION/etc/openssl/cert.pem"
8072

8173
echo "Packaging installer..."
82-
8374
cd "$PACKAGE"
8475

85-
echo "$VER" > version.tag
86-
8776
if [ "$1" == "prod" ]; then
8877
PKGFILE="$RELEASES/installer-$VER.tar.gz"
8978
LATEST="$RELEASES/latest"
@@ -95,6 +84,7 @@ else
9584
LATEST="../latest"
9685
fi
9786

87+
echo "$VER" > version.tag
9888
tar czf "$PKGFILE" .
9989
echo "$VER" > "$LATEST"
10090

0 commit comments

Comments
 (0)