From d93c8f7ab0886e030ff8f30aaf99d86ab95cd687 Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Sun, 12 Jun 2022 22:30:52 +0200 Subject: [PATCH 1/3] Add support for arm64 # Conflicts: # contrib/build.Dockerfile # contrib/build_bin.sh --- contrib/build_bin.sh | 10 ++++++---- hwi.spec | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/contrib/build_bin.sh b/contrib/build_bin.sh index 17f6e14eb..7e8d5a71d 100755 --- a/contrib/build_bin.sh +++ b/contrib/build_bin.sh @@ -4,6 +4,8 @@ set -ex +ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') + eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" pip install -U pip @@ -12,7 +14,7 @@ pip install poetry gui_support="${1:---with-gui}"; # Setup poetry and install the dependencies -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then poetry install -E qt else poetry install @@ -26,7 +28,7 @@ TZ=UTC find ${lib_dir} -name '*.py' -type f -execdir touch -t "201901010000.00" export PYTHONHASHSEED=42 poetry run pyinstaller hwi.spec -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $ARCH == "x86_64" ]]; then poetry run contrib/generate-ui.sh poetry run pyinstaller hwi-qt.spec fi @@ -40,7 +42,7 @@ OS=`uname | tr '[:upper:]' '[:lower:]'` if [[ $OS == "darwin" ]]; then OS="mac" fi -ARCH=$(uname -m | tr '[:upper:]' '[:lower:]') + target_tarfile="hwi-${VERSION}-${OS}-${ARCH}.tar.gz" if [[ $gui_support == "--with-gui" ]]; then @@ -54,7 +56,7 @@ target_dir="$target_tarfile.dir" mkdir $target_dir mv hwi $target_dir -if [[ $gui_support == "--with-gui" ]]; then +if [[ $gui_support == "--with-gui" && $arch == "x86_64" ]]; then mv hwi-qt $target_dir fi diff --git a/hwi.spec b/hwi.spec index 1502458f8..6ad8d380c 100644 --- a/hwi.spec +++ b/hwi.spec @@ -13,7 +13,7 @@ def get_libusb_path(): prefix = proc.communicate()[0].rstrip().decode() return os.path.join(prefix, "lib", "libusb-1.0.dylib") if platform.system() == "Linux": - for lib_dir in ["/lib/x86_64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]: + for lib_dir in ["/lib/x86_64-linux-gnu", "/lib/aarch64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]: libusb_path = os.path.join(lib_dir, "libusb-1.0.so.0") if os.path.exists(libusb_path): return libusb_path From ee3cf5f4655cf2dbd270453d0b865717a3088dfa Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Fri, 19 Jan 2024 08:28:31 +0100 Subject: [PATCH 2/3] Add release instructions --- docs/development/release-process.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/development/release-process.rst b/docs/development/release-process.rst index 34db9fb7f..42af0c595 100644 --- a/docs/development/release-process.rst +++ b/docs/development/release-process.rst @@ -17,11 +17,15 @@ Create the docker images:: docker build --no-cache -t hwi-builder -f contrib/build.Dockerfile . docker build --no-cache -t hwi-wine-builder -f contrib/build-wine.Dockerfile . + docker buildx build --no-cache --platform linux/arm64 -t hwi-builder-arm64 -f contrib/build.Dockerfile . Build everything:: docker run -it --name hwi-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-builder /bin/bash -c "contrib/build_bin.sh && contrib/build_dist.sh" docker run -it --name hwi-wine-builder -v $PWD:/opt/hwi --rm --workdir /opt/hwi hwi-wine-builder /bin/bash -c "contrib/build_wine.sh" + docker run --platform linux/arm64 -it --rm --name hwi-builder-arm64 -v $PWD:/opt/hwi --workdir /opt/hwi hwi-builder-arm64 /bin/bash -c "contrib/build_bin.sh --without-gui && contrib/build_dist.sh --without-gui" + +i.e. Building macOS binary ===================== From 3d3c02d30949b378101446cb6f8ca57a7665ff00 Mon Sep 17 00:00:00 2001 From: Kiminuo Date: Fri, 19 Jan 2024 08:41:08 +0100 Subject: [PATCH 3/3] Improve --- docs/development/release-process.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/development/release-process.rst b/docs/development/release-process.rst index 42af0c595..6a3c58d04 100644 --- a/docs/development/release-process.rst +++ b/docs/development/release-process.rst @@ -17,6 +17,9 @@ Create the docker images:: docker build --no-cache -t hwi-builder -f contrib/build.Dockerfile . docker build --no-cache -t hwi-wine-builder -f contrib/build-wine.Dockerfile . + + # arm64 + sudo apt-get install qemu-user-static docker buildx build --no-cache --platform linux/arm64 -t hwi-builder-arm64 -f contrib/build.Dockerfile . Build everything::