Skip to content
Permalink
Browse files

Linux: add support for building snap packages.

  • Loading branch information...
ppd1990 authored and whitequark committed Sep 11, 2019
1 parent b1e280e commit 219df31c53f3689e3b355c1716730130419cefa9
Showing with 117 additions and 0 deletions.
  1. +3 −0 pkg/snap/.gitignore
  2. +12 −0 pkg/snap/build.sh
  3. +76 −0 pkg/snap/snap/snapcraft.yaml
  4. +16 −0 res/CMakeLists.txt
  5. +10 −0 res/freedesktop/solvespace-snap.desktop
@@ -0,0 +1,3 @@
*.snap
solvespace-snap-src
squashfs-root
@@ -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 "$@"
@@ -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
@@ -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
@@ -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;

0 comments on commit 219df31

Please sign in to comment.
You can’t perform that action at this time.