Skip to content

Commit beb22a0

Browse files
feat(snap): add ARM64 support to Snap package (#1337)
1 parent 5bffc1b commit beb22a0

File tree

5 files changed

+124
-29
lines changed

5 files changed

+124
-29
lines changed

.github/workflows/snapcraft.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "Snapcraft CI"
2+
3+
on: [push]
4+
5+
jobs:
6+
snapcraft_amd64:
7+
name: Snapcraft x86_64
8+
runs-on: ubuntu-24.04
9+
timeout-minutes: 120
10+
11+
steps:
12+
- name: Install dependencies
13+
run: |
14+
sudo apt-get update --fix-missing
15+
sudo apt upgrade;
16+
sudo apt -y install build-essential;
17+
sudo apt -y install apt-transport-https ca-certificates gnupg software-properties-common wget ;
18+
sudo apt -y install snap;
19+
- name: Setup Snapcraft
20+
run: |
21+
sudo apt install -y snapd
22+
sudo snap install core --channel=stable
23+
sudo snap install snapcraft --classic
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
- name: Get package version
27+
uses: myrotvorets/info-from-package-json-action@2.0.1
28+
id: json_version
29+
- name: Update version and build
30+
run: |
31+
python $GITHUB_WORKSPACE/tools/update_version/update_version.py
32+
NELSON_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
33+
echo $NELSON_VERSION
34+
sudo snapcraft --destructive-mode --verbose
35+
- name: Copy artifacts
36+
run: mkdir artifacts && mv ./*_amd64.snap artifacts
37+
- uses: actions/upload-artifact@v4
38+
with:
39+
name: nelson-github-action-artifacts-snapcraft-amd64-${{ steps.json_version.outputs.packageVersion }}.${{ github.run_number }}
40+
path: artifacts/
41+
- name: Install snap
42+
run: |
43+
NELSON_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
44+
echo $NELSON_VERSION
45+
sudo snap install ./artifacts/nelson_${NELSON_VERSION}_amd64.snap --dangerous
46+
- name: Tests snap
47+
run: nelson --cli -e "test_run('minimal_tests');exit"
48+
49+
snapcraft_arm64:
50+
name: Snapcraft arm64
51+
runs-on: ubuntu-24.04-arm
52+
timeout-minutes: 120
53+
54+
steps:
55+
- name: Install dependencies
56+
run: |
57+
sudo apt-get update --fix-missing
58+
sudo apt upgrade;
59+
sudo apt -y install build-essential;
60+
sudo apt -y install apt-transport-https ca-certificates gnupg software-properties-common wget ;
61+
sudo apt -y install snap;
62+
- name: Setup Snapcraft
63+
run: |
64+
sudo apt install -y snapd
65+
sudo snap install core --channel=stable
66+
sudo snap install snapcraft --classic
67+
- name: Checkout
68+
uses: actions/checkout@v4
69+
- name: Get package version
70+
uses: myrotvorets/info-from-package-json-action@2.0.1
71+
id: json_version
72+
- name: Update version and build
73+
run: |
74+
python $GITHUB_WORKSPACE/tools/update_version/update_version.py
75+
NELSON_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
76+
echo $NELSON_VERSION
77+
sudo snapcraft --destructive-mode --verbose
78+
- name: Copy artifacts
79+
run: mkdir artifacts && mv ./*_arm64.snap artifacts
80+
- uses: actions/upload-artifact@v4
81+
with:
82+
name: nelson-github-action-artifacts-snapcraft-arm64-${{ steps.json_version.outputs.packageVersion }}.${{ github.run_number }}
83+
path: artifacts/
84+
- name: Install snap
85+
run: |
86+
NELSON_VERSION=$(grep -oP '"version": "\K[^"]+' package.json)
87+
echo $NELSON_VERSION
88+
sudo snap install ./artifacts/nelson_${NELSON_VERSION}_arm64.snap --dangerous
89+
- name: Tests snap
90+
run: nelson --cli -e "test_run('minimal_tests');exit"

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Github CI Ubuntu 24.04 arm64 (Cobalt 100 processor).
13+
- Github CI Snapcraft build amd64 and arm64.
14+
- Snapcraft arm64.
1315

1416
### Changed
1517

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ Nelson is tested and supported on a wide range of platforms. **[Downloads](https
152152
| **macOS Sonoma** | arm64 || |
153153
| **macOS Ventura** | x86-64 (64-bit) || |
154154
| **Ubuntu 24.04** | x86-64 || ✓ (Snap) |
155-
| **Ubuntu 24.04** | arm64 (cobalt 100) || ✓ (.deb) |
155+
| **Ubuntu 24.04** | arm64 (cobalt 100) || ✓ (Snap) |
156156
| **Ubuntu 22.04** | x86-64 || ✓ (Snap) |
157157
| **Ubuntu 20.04** | x86-64 || ✓ (Snap) |
158158
| **Fedora 40** | x86-64 || ✓ (Snap) |

modules/tests_manager/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ install(
8787
install(
8888
FILES ${CMAKE_CURRENT_SOURCE_DIR}/loader.m
8989
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/modules/${module_name}")
90+
install(
91+
FILES ${CMAKE_CURRENT_SOURCE_DIR}/minimal_tests.m
92+
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/modules/${module_name}")
9093
install(
9194
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/etc
9295
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/modules/${module_name}"

snap/snapcraft.yaml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ compression: lzo
2222

2323
platforms:
2424
amd64:
25+
build-on: [amd64]
26+
build-for: [amd64]
27+
arm64:
28+
build-on: [arm64]
29+
build-for: [arm64]
2530

2631
plugs:
2732
gtk-3-themes:
@@ -47,16 +52,14 @@ environment:
4752
# XKB config
4853
XKB_CONFIG_ROOT: $SNAP/usr/share/X11/xkb
4954
XDG_RUNTIME_DIR: /tmp
50-
LD_LIBRARY_PATH: "$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu/:$SNAP/usr/lib/x86_64-linux-gnu/openblas-openmp:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio"
55+
LD_LIBRARY_PATH: "$SNAP/usr/lib:$SNAP/usr/lib/$SNAP_LAUNCHER_ARCH_TRIPLET/:$SNAP/usr/lib/$SNAP_LAUNCHER_ARCH_TRIPLET/openblas-openmp:$SNAP/usr/lib/$SNAP_LAUNCHER_ARCH_TRIPLET/pulseaudio"
5156
LANG: C.UTF-8
5257
LC_ALL: C.UTF-8
5358

5459
parts:
5560
nelson:
5661
plugin: nil
57-
source: https://github.com/nelson-lang/nelson
58-
source-type: git
59-
source-branch: master
62+
source: .
6063

6164
override-build: |
6265
craftctl default
@@ -82,8 +85,9 @@ parts:
8285
rm -rf $CRAFT_PART_INSTALL/usr/share/texmf
8386
8487
override-prime: |
88+
SNAP_LAUNCHER_ARCH_TRIPLET=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
8589
craftctl default
86-
rm -vf usr/lib/x86_64-linux-gnu/libc_malloc_debug.so
90+
rm -vf usr/lib/$SNAP_LAUNCHER_ARCH_TRIPLET/libc_malloc_debug.so
8791
8892
build-packages:
8993
- build-essential
@@ -142,8 +146,6 @@ parts:
142146
- libtbb-dev
143147

144148
stage-packages:
145-
146-
147149
- libc6
148150
- libstdc++6
149151
- build-essential
@@ -228,10 +230,11 @@ apps:
228230
desktop: usr/share/applications/org.nelson.Nelson.desktop
229231
environment:
230232
XDG_CURRENT_DESKTOP: $XDG_CURRENT_DESKTOP:Unity:Unity7
231-
LD_LIBRARY_PATH: "/usr/lib/Nelson:/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu/:$SNAP/usr/lib/x86_64-linux-gnu/oss4-libsalsa/:$SNAP/usr/lib/x86_64-linux-gnu/openblas-openmp:$SNAP/usr/lib/x86_64-linux-gnu/blas:$SNAP/usr/lib/x86_64-linux-gnu/lapack:$SNAP/usr/lib/x86_64-linux-gnu/pulseaudio:$SNAP/usr/lib/x86_64-linux-gnu/libproxy"
233+
LD_LIBRARY_PATH: "/usr/lib/Nelson:/usr/lib:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/oss4-libsalsa/:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/openblas-openmp:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libproxy:$SNAP/usr/lib"
234+
232235
LOCPATH: "$SNAP/usr/lib/locale"
233-
PATH: "$SNAP/usr/lib/x86_64-linux-gnu:$SNAP/usr/lib:$SNAP/usr/bin:$SNAP/bin:/usr/lib/x86_64-linux-gnu/qt6/bin:$PATH"
234-
QTDIR: "/usr/lib/x86_64-linux-gnu/qt6/"
236+
PATH: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR:$SNAP/usr/lib:$SNAP/usr/bin:$SNAP/bin:/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/bin:$PATH"
237+
QTDIR: "/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6/"
235238
QTDIR_BINARIES: "$SNAP/usr/lib/qt6/bin/"
236239
__NELSON_PYTHON_VERSION__: "3.12"
237240
__NELSON_PYTHON_EXECUTABLE__: "/usr/bin/python3"
@@ -277,9 +280,8 @@ layout:
277280
/usr/bin/qhelpgenerator:
278281
bind-file: $SNAP/usr/lib/qt6/bin/qhelpgenerator
279282

280-
281283
/usr/lib/Nelson:
282-
bind: $SNAP/usr/lib/x86_64-linux-gnu/Nelson
284+
bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/Nelson
283285

284286
/usr/share/Nelson:
285287
bind: $SNAP/usr/share/Nelson
@@ -288,27 +290,25 @@ layout:
288290
symlink: $SNAP/usr/local/lib
289291

290292
# Make staged qt plugins available in expected locations
291-
/usr/lib/x86_64-linux-gnu/qt6:
292-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/qt6
293+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6:
294+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/qt6
293295

294296
# Make staged dri and pulseaudio modules available in expected locations
295-
/usr/lib/x86_64-linux-gnu/dri:
296-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/dri
297-
/usr/lib/x86_64-linux-gnu/pulseaudio:
298-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/pulseaudio
297+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/dri:
298+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/dri
299+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio:
300+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pulseaudio
299301

300302
# Dynamic link (used for external modules and mex)
301303
/usr/include:
302304
bind: $SNAP/usr/include
303-
/usr/lib/x86_64-linux-gnu/libc_nonshared.a:
304-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/libc_nonshared.a
305-
/usr/lib/x86_64-linux-gnu/libmvec_nonshared.a:
306-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/libmvec_nonshared.a
307-
/usr/lib/x86_64-linux-gnu/libpthread_nonshared.a:
308-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/libpthread_nonshared.a
305+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libc_nonshared.a:
306+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libc_nonshared.a
307+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libmvec_nonshared.a:
308+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libmvec_nonshared.a
309+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpthread_nonshared.a:
310+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libpthread_nonshared.a
309311

310312
#alsa
311-
/usr/lib/x86_64-linux-gnu/alsa-lib:
312-
symlink: $SNAP/usr/lib/x86_64-linux-gnu/alsa-lib
313-
/usr/share/alsa:
314-
symlink: $SNAP/usr/share/alsa
313+
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib:
314+
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/alsa-lib

0 commit comments

Comments
 (0)