Skip to content

Commit 9027134

Browse files
authored
Add arm64 support. (redis#8)
1 parent 19a4c08 commit 9027134

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

.github/workflows/unstable.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,28 @@ jobs:
1414
with:
1515
repository: redis/redis
1616
path: redis
17+
- name: Prepare for cross-compilation
18+
run: |
19+
sudo dpkg --add-architecture arm64
20+
sudo sed -i 's/^deb /deb [arch=amd64] /g' /etc/apt/sources.list
21+
cat <<_END_ | sudo tee /etc/apt/sources.list.d/crosscompile.list
22+
deb [arch=arm64] http://ports.ubuntu.com $(lsb_release -cs) main universe
23+
deb [arch=arm64] http://ports.ubuntu.com $(lsb_release -cs)-updates main universe
24+
_END_
1725
- name: Setup Snapcraft
1826
run: |
19-
sudo snap install snapcraft --classic
20-
echo "$SNAP_TOKEN" | snapcraft login --with -
21-
snapcraft
22-
snapcraft upload --release=edge *.snap
27+
sudo snap install snapcraft --classic
28+
echo "$SNAP_TOKEN" | snapcraft login --with -
2329
env:
2430
SNAP_TOKEN: ${{secrets.SNAP_TOKEN}}
31+
- name: Build amd64
32+
env:
2533
SNAPCRAFT_BUILD_ENVIRONMENT: host
34+
run: snapcraft --target-arch amd64 --destructive-mode --enable-experimental-target-arch
35+
- name: Build arm64
36+
env:
37+
SNAPCRAFT_BUILD_ENVIRONMENT: host
38+
run: snapcraft --target-arch arm64 --destructive-mode --enable-experimental-target-arch
39+
- name: Upload
40+
run: |
41+
snapcraft upload --release=edge *.snap

snap/snapcraft.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ parts:
6464
source: redis/
6565
override-build: |
6666
mkdir -p ${SNAPCRAFT_PART_INSTALL}/usr
67+
export CC=${SNAPCRAFT_ARCH_TRIPLET}-gcc
68+
export DEB_HOST_GNU_TYPE=${SNAPCRAFT_ARCH_TRIPLET}
6769
make -j4 BUILD_TLS=yes
6870
PREFIX=${SNAPCRAFT_PART_INSTALL}/usr make BUILD_TLS=yes install
6971
VER=`sed -n 's/^.* REDIS_VERSION "\(.*\)"$/\1/g p' < src/version.h`
@@ -73,7 +75,8 @@ parts:
7375
fi
7476
snapcraftctl set-version $VER
7577
build-packages:
76-
- build-essential
77-
- pkg-config
78-
- libssl-dev
79-
- gcc
78+
- on amd64:
79+
- to arm64:
80+
- libssl-dev:arm64
81+
- to amd64:
82+
- libssl-dev

0 commit comments

Comments
 (0)