Skip to content

Commit 4f44d39

Browse files
committed
Add support for arm64
1 parent 0e6934e commit 4f44d39

File tree

3 files changed

+34
-18
lines changed

3 files changed

+34
-18
lines changed

contrib/build.Dockerfile

+8-11
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,14 @@ ENV BUILD_DATE="Jan 1 2019"
4141
ENV BUILD_TIME="00:00:00"
4242
RUN eval "$(pyenv init --path)" && eval "$(pyenv virtualenv-init -)" && cat /opt/reproducible-python.diff | pyenv install -kp 3.9.7
4343

44-
RUN dpkg --add-architecture i386
45-
RUN wget -nc https://dl.winehq.org/wine-builds/winehq.key
46-
RUN apt-key add winehq.key
47-
RUN echo "deb https://dl.winehq.org/wine-builds/debian/ stretch main" >> /etc/apt/sources.list
48-
RUN apt-get update
49-
RUN apt-get install --install-recommends -y \
50-
wine-stable-amd64 \
51-
wine-stable-i386 \
52-
wine-stable \
53-
winehq-stable \
54-
p7zip-full
44+
RUN if [[ $(dpkg --print-architecture) == "amd64" ]]; then \
45+
dpkg --add-architecture i386; \
46+
wget -nc https://dl.winehq.org/wine-builds/winehq.key; \
47+
apt-key add winehq.key; \
48+
echo "deb https://dl.winehq.org/wine-builds/debian/ stretch main" >> /etc/apt/sources.list; \
49+
apt-get update; \
50+
apt-get install --install-recommends -y wine-stable-amd64 wine-stable-i386 wine-stable winehq-stable p7zip-full; \
51+
fi
5552

5653
ENV LC_ALL=C.UTF-8
5754
ENV LANG=C.UTF-8

contrib/build_bin.sh

+25-6
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33

44
set -ex
55

6+
arch=`dpkg --print-architecture`
7+
68
eval "$(pyenv init --path)"
79
eval "$(pyenv virtualenv-init -)"
810
pip install -U pip
911
pip install poetry
1012

1113
# Setup poetry and install the dependencies
12-
poetry install -E qt
14+
if [[ $arch == "amd64" ]]; then
15+
poetry install -E qt
16+
else
17+
poetry install
18+
fi
1319

1420
# We also need to change the timestamps of all of the base library files
1521
lib_dir=`pyenv root`/versions/3.9.7/lib/python3.9
@@ -18,8 +24,12 @@ TZ=UTC find ${lib_dir} -name '*.py' -type f -execdir touch -t "201901010000.00"
1824
# Make the standalone binary
1925
export PYTHONHASHSEED=42
2026
poetry run pyinstaller hwi.spec
21-
poetry run contrib/generate-ui.sh
22-
poetry run pyinstaller hwi-qt.spec
27+
28+
if [[ $arch == "amd64" ]]; then
29+
poetry run contrib/generate-ui.sh
30+
poetry run pyinstaller hwi-qt.spec
31+
fi
32+
2333
unset PYTHONHASHSEED
2434

2535
# Make the final compressed package
@@ -29,13 +39,22 @@ OS=`uname | tr '[:upper:]' '[:lower:]'`
2939
if [[ $OS == "darwin" ]]; then
3040
OS="mac"
3141
fi
32-
target_tarfile="hwi-${VERSION}-${OS}-amd64.tar.gz"
33-
tar -czf $target_tarfile hwi hwi-qt
42+
43+
target_tarfile="hwi-${VERSION}-${OS}-${arch}.tar.gz"
44+
45+
if [[ $arch == "amd64" ]]; then
46+
tar -czf $target_tarfile hwi hwi-qt
47+
else
48+
tar -czf $target_tarfile hwi
49+
fi
3450

3551
# Copy the binaries to subdir for shasum
3652
target_dir="$target_tarfile.dir"
3753
mkdir $target_dir
3854
mv hwi $target_dir
39-
mv hwi-qt $target_dir
55+
56+
if [[ $arch == "amd64" ]]; then
57+
mv hwi-qt $target_dir
58+
fi
4059

4160
popd

hwi.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get_libusb_path():
1313
prefix = proc.communicate()[0].rstrip().decode()
1414
return os.path.join(prefix, "lib", "libusb-1.0.dylib")
1515
if platform.system() == "Linux":
16-
for lib_dir in ["/lib/x86_64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]:
16+
for lib_dir in ["/lib/x86_64-linux-gnu", "/lib/aarch64-linux-gnu", "/usr/lib64", "/lib64" "/usr/lib", "/lib"]:
1717
libusb_path = os.path.join(lib_dir, "libusb-1.0.so.0")
1818
if os.path.exists(libusb_path):
1919
return libusb_path

0 commit comments

Comments
 (0)