Linux: add support for building snap packages.

This commit is contained in:
Maximilian Federle 2019-09-11 12:12:53 +02:00 committed by whitequark
parent b1e280e75f
commit 219df31c53
5 changed files with 117 additions and 0 deletions

3
pkg/snap/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*.snap
solvespace-snap-src
squashfs-root

12
pkg/snap/build.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -xe
dir="$(dirname "$(readlink -f "$0")")"
solvespace_snap_src="$dir/solvespace-snap-src"
trap "rm -rf $solvespace_snap_src" EXIT
cd "$dir"
git_root="$(git rev-parse --show-toplevel)"
rsync --filter=":- .gitignore" -r "$git_root"/ "$solvespace_snap_src"
snapcraft "$@"

View File

@ -0,0 +1,76 @@
name: solvespace
base: core18
summary: Parametric 2d/3d CAD
adopt-info: solvespace
description: |
SOLVESPACE is a free (GPLv3) parametric 3d CAD tool.
Applications include
* modeling 3d parts — draw with extrudes, revolves, and Boolean (union / difference) operations
* modeling 2d parts — draw the part as a single section, and export DXF, PDF, SVG; use 3d assembly to verify fit
* 3d-printed parts — export the STL or other triangle mesh expected by most 3d printers
* preparing CAM data — export 2d vector art for a waterjet machine or laser cutter; or generate STEP or STL, for import into third-party CAM software for machining
* mechanism design — use the constraint solver to simulate planar or spatial linkages, with pin, ball, or slide joints
* plane and solid geometry — replace hand-solved trigonometry and spreadsheets with a live dimensioned drawing
confinement: strict
license: GPL-3.0
layout:
/usr/share/solvespace:
bind: $SNAP/usr/share/solvespace
apps:
solvespace:
command: usr/bin/solvespace
desktop: solvespace.desktop
extensions: [gnome-3-28]
plugs: [opengl, unity7, home, removable-media, gsettings, network]
environment:
__EGL_VENDOR_LIBRARY_DIRS: $SNAP/usr/share/glvnd/egl_vendor.d
cli:
command: usr/bin/solvespace-cli
plugs: [home, removable-media, network]
parts:
solvespace:
plugin: cmake
source: ./solvespace-snap-src
source-type: local
override-pull: |
snapcraftctl pull
version_major=$(grep "solvespace_VERSION_MAJOR" CMakeLists.txt | tr -d "()" | cut -d" " -f2)
version_minor=$(grep "solvespace_VERSION_MINOR" CMakeLists.txt | tr -d "()" | cut -d" " -f2)
version="$version_major.$version_minor~$(git rev-parse --short=8 HEAD)"
snapcraftctl set-version "$version"
git describe --exact-match HEAD && grade="stable" || grade="devel"
snapcraftctl set-grade "$grade"
git submodule update --init extlib/libdxfrw extlib/flatbuffers extlib/q3d
configflags:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DCMAKE_BUILD_TYPE=Release
- -DENABLE_TESTS=OFF
- -DSNAP=ON
build-packages:
- zlib1g-dev
- libpng-dev
- libcairo2-dev
- libfreetype6-dev
- libjson-c-dev
- libfontconfig1-dev
- libgtkmm-3.0-dev
- libpangomm-1.4-dev
- libgl-dev
- libglu-dev
- libspnav-dev
- git
stage-packages:
- libspnav0
- libatkmm-1.6-1v5
- libcairomm-1.0-1v5
- libgtkmm-3.0-1v5
- libglibmm-2.4-1v5
- libpangomm-1.4-1v5
- libsigc++-2.0-0v5
- libglew2.0
- libegl-mesa0
- libdrm2

View File

@ -153,6 +153,22 @@ else()
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}/mimetypes
RENAME com.solvespace.SolveSpace.png)
endforeach()
elseif(SNAP)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace-snap.desktop
DESTINATION /
RENAME solvespace.desktop)
# snapd does not support registering new mime types
install(FILES freedesktop/solvespace-scalable.svg
DESTINATION /meta/icons/hicolor/scalable/apps
RENAME snap.solvespace.svg)
foreach(SIZE 16x16 24x24 32x32 48x48)
install(FILES freedesktop/solvespace-${SIZE}.png
DESTINATION /meta/icons/hicolor/${SIZE}/apps
RENAME snap.solvespace.png)
endforeach()
else()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/freedesktop/solvespace.desktop.in

View File

@ -0,0 +1,10 @@
[Desktop Entry]
Version=1.0
Name=SolveSpace
Comment=A parametric 2d/3d CAD
Exec=solvespace
MimeType=application/x-solvespace
Icon=${SNAP}/meta/icons/hicolor/scalable/apps/snap.solvespace.svg
Type=Application
Categories=Graphics
Keywords=parametric;cad;2d;3d;