[U] Update builder script

This commit is contained in:
Azalea Gui 2024-12-22 06:23:55 -05:00
parent 3a80670491
commit e8e0a58e4b

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
FASTFETCH_VERSION="2.28.0"
FASTFETCH_VERSION="2.32.1"
FASTFETCH_DL="https://github.com/fastfetch-cli/fastfetch/releases/download/$FASTFETCH_VERSION/"
# Get script directory
@ -23,6 +23,9 @@ python3 setup.py sdist bdist_wheel
twine check dist/*.tar.gz
twine check dist/*.whl
# Build rust package
#"$DIR/build_rust.sh"
# =================
# Build for windows
cd dist
@ -44,19 +47,24 @@ cp -r git/ wheel/hyfetch/
# Embed fastfetch binary
echo "> Embedding fastfetch binary"
wget -q "$FASTFETCH_DL/fastfetch-windows-i686.zip" -O fastfetch-windows.zip
wget -q "$FASTFETCH_DL/fastfetch-windows-amd64.zip" -O fastfetch-windows.zip
mkdir -p wheel/hyfetch/fastfetch
bsdtar -zxf fastfetch-windows.zip -C wheel/hyfetch/fastfetch
rm -rf fastfetch-windows.zip
# Embed rust binary
echo "> Embedding rust binary"
mkdir -p wheel/hyfetch/rust
cp "$DIR/../target/x86_64-pc-windows-gnu/release/hyfetch.exe" wheel/hyfetch/rust/
# Edit .dist-info/WHEEL "Tag: {platform}" and rehash
sed -i 's/Tag: py3-none-.*/Tag: py3-none-win32/' wheel/*.dist-info/WHEEL
python "$DIR/build_rehash.py" wheel
# Zip to -win32.whl
new_name=${file/-any/-win32}
cd wheel && zip -qq -y -r "../$new_name" * && cd ..
twine check "$new_name"
#new_name=${file/-any/-win32}
#cd wheel && zip -qq -y -r "../$new_name" * && cd ..
#twine check "$new_name"
# Zip to -win_amd64.whl
# Since pypi doesn't allow two identical files with different names to be uploaded
@ -76,6 +84,7 @@ rm -rf wheel/git
function build_for_platform() {
ff_platform=$1
wheel_platform=$2
rust_platform=$3
echo "Building for $ff_platform"
@ -91,6 +100,10 @@ function build_for_platform() {
bsdtar -zxf "fastfetch-$ff_platform.zip" -C wheel/hyfetch/fastfetch --strip-components 1
rm -rf "fastfetch-$ff_platform.zip"
# Copy rust binary to wheel/hyfetch/rust
mkdir -p wheel/hyfetch/rust
cp "$DIR/../target/$rust_platform/release/hyfetch" wheel/hyfetch/rust
# Change the file name
new_name=${file/-any/-"$wheel_platform"}
@ -107,17 +120,17 @@ function build_for_platform() {
# See https://packaging.python.org/en/latest/specifications/platform-compatibility-tags/
# The official fastfetch build uses Ubuntu 20.04 with glibc 2.31
build_for_platform "linux-amd64" "manylinux_2_31_x86_64"
build_for_platform "linux-aarch64" "manylinux_2_31_aarch64"
build_for_platform "linux-armv7l" "manylinux_2_31_armv7l"
build_for_platform "linux-amd64" "manylinux_2_31_x86_64" "x86_64-unknown-linux-musl"
build_for_platform "linux-aarch64" "manylinux_2_31_aarch64" "aarch64-unknown-linux-musl"
build_for_platform "linux-armv7l" "manylinux_2_31_armv7l" "armv7-unknown-linux-musleabihf"
# There doesn't seem to be tags for freebsd?
# build_for_platform "freebsd-amd64" "freebsd_x86_64"
# build_for_platform "freebsd-aarch64" "freebsd_aarch64"
build_for_platform "musl-amd64" "musllinux_1_1_x86_64"
build_for_platform "musl-amd64" "musllinux_1_1_x86_64" "x86_64-unknown-linux-musl"
# build_for_platform "musl-aarch64" "musllinux_1_1_aarch64"
# The official fastfetch build uses macOS 12.0
build_for_platform "macos-universal" "macosx_11_0_x86_64"
build_for_platform "macos-universal" "macosx_11_0_arm64"
build_for_platform "macos-universal" "macosx_11_0_x86_64" "x86_64-apple-darwin"
build_for_platform "macos-universal" "macosx_11_0_arm64" "aarch64-apple-darwin"
# TODO: linux_riscv64 (pypi's platform tag support is not there yet)
# build_for_platform "linux-riscv64" "manylinux_2_31_riscv64"