From 51cd26c2db185b76302ff4374ef58d6aff1e1660 Mon Sep 17 00:00:00 2001 From: Dongxu Li Date: Wed, 17 Apr 2024 23:48:09 -0400 Subject: [PATCH] Initial snapcraft support --- .github/workflows/build-all.yml | 20 +++++++++++- scripts/createSnap.sh | 6 ++++ snapcraft.yaml | 57 +++++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100755 scripts/createSnap.sh create mode 100644 snapcraft.yaml diff --git a/.github/workflows/build-all.yml b/.github/workflows/build-all.yml index c887bae920..6a27ee96f5 100644 --- a/.github/workflows/build-all.yml +++ b/.github/workflows/build-all.yml @@ -10,13 +10,21 @@ jobs: steps: - name: Checkout code uses: actions/checkout@main + uses: snapcore/action-build@v1 + id: snapcraft + uses: actions/upload-artifact@v3 + with: + name: snap + path: ${{ steps.snapcraft.outputs.snap }} + with: fetch-depth: 0 - name: Install Qt and dependencies run: | sudo apt-get -y update - sudo apt-get -qq install qtbase5-dev libqt5svg5-dev qt5-qmake qtbase5-dev-tools qttools5-dev-tools qtchooser libgl-dev libmuparser-dev libboost-dev librsvg2-bin libfreetype6-dev libicu-dev pkg-config libfuse2 + sudo apt-get -qq install qtbase5-dev libqt5svg5-dev qt5-qmake qtbase5-dev-tools qttools5-dev-tools qtchooser \ + libgl-dev libmuparser-dev libboost-dev librsvg2-bin libfreetype6-dev libicu-dev pkg-config libfuse2 sudo ln -snf /usr/lib/x86_64-linux-gnu/qtchooser/qt5.conf /usr/lib/x86_64-linux-gnu/qtchooser/default.conf sudo rm -rf /usr/local/lib/android @@ -64,6 +72,16 @@ jobs: path: LibreCAD*.AppImage retention-days: 2 + - name: Create snapcraft + run: | + ./scripts/createSnap.sh + + - name: Uploading snap + uses: actions/upload-artifact@v3.1.0 + with: + path: ${{ github.workspace }}/librecad**snap + name: LibreCAD.snap + BuildMacOS: runs-on: macos-latest steps: diff --git a/scripts/createSnap.sh b/scripts/createSnap.sh new file mode 100755 index 0000000000..93f31c7182 --- /dev/null +++ b/scripts/createSnap.sh @@ -0,0 +1,6 @@ +sudo snap install snapcraft --classic + +snap run snapcraft --destructive-mode + +sudo snap install librecad_2.2.1-beta_amd64.snap --devmode --dangerous + diff --git a/snapcraft.yaml b/snapcraft.yaml new file mode 100644 index 0000000000..acedcc4c7b --- /dev/null +++ b/snapcraft.yaml @@ -0,0 +1,57 @@ +name: librecad +version: '2.2.1-beta' +grade: beta +base: core22 +confinement: devmode +summary: "librecad: is a 2D open source CAD" +description: | + LibreCAD is a cross-platform 2D CAD program written in C++17. It can read DXF/DWG files and can write DXF/PDF/SVG files. It supports point/line/circle/ellipse/parabola/spline primitives. The user interface is highly customizable, and has dozens of translations. +environment: + LD_LIBRARY_PATH: $SNAP/usr/local/lib/:$SNAP/usr/lib/x86_64-linux-gnu/:$SNAP/usr/lib64/:$LD_LIBRARY_PATH + +apps: + librecad: + command: unix/librecad +parts: + librecad: + plugin: qmake + qmake-project-file: librecad.pro + build-snaps: + source: . + build-packages: + - qttools5-dev + - qttools5-dev-tools + - librsvg2-bin + - libfreetype6-dev + - libicu-dev + - libqt5opengl5-dev + - git + - g++ + - libcairo2-dev + - libpango-1.0-0 + - libpango1.0-dev + - libboost-dev + - libboost-log-dev + - libboost-program-options-dev + - libqt5svg5-dev + - libgtest-dev + - libcurl4-gnutls-dev + - libgtk-3-dev + - libglew-dev + - rapidjson-dev + - libbz2-dev + - libglfw3-dev + - libglm-dev + stage-packages: + - libboost-dev + - libboost-log-dev + - libboost-program-options-dev + #For 18.04 + #configflags: + # - "-DCMAKE_INSTALL_PREFIX=/usr" + # - "-DBUILD_SHARED_LIBS=On" + + #For 18.04 + #configflags: + # - "-DBUILD_SHARED_LIBS=On" +