summaryrefslogtreecommitdiff
path: root/branding/templates/snap/snapcraft-template.yaml
blob: 4a6bd89f8252184046f6a65607427ecc70b2bafa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: ${binaryName}
version: ${version}
summary: ${applicationName}, secure VPN. Powered by Bitmask.
description: |
  ${applicationName} is an easy, fast, and secure VPN service from ${providerURL}.
  ${applicationName} does not require a user account, keep logs, or track you in
  any way. The service is paid for entirely by donations from users like you.
grade: stable
confinement: classic
icon: snap/gui/icon.svg 
base: core20

parts:

  bitmask-root:
    plugin: dump
    source: helpers
    source-type: local
    override-prime: |
      mkdir -p bin
      cp $SNAPCRAFT_PART_SRC/bitmask-root bin/
      chmod +x bin/bitmask-root

  openvpn:
    plugin: nil
    stage-packages: [openvpn]
    prime:
      - -usr/share/doc
      - -usr/share/man

  bitmask-vpn:
    plugin: nil
    source: .
    source-type: local
    stage:
        - bin/${binaryName}
    override-build: |
        # TODO - this still has some round corners for vendoring.
        # Maybe we just need to put the providers.json in the VENDOR_PATH
        # and pass it to gui/providers from some path that snap can access.
        # Same for the vendor.qrc
        mkdir -p $SNAPCRAFT_PART_INSTALL/snap/
        mkdir -p $SNAPCRAFT_PRIME/snap/
        echo ${version} > $SNAPCRAFT_PRIME/snap/version.txt
        make build_golib
        QT_SELECT=5 XBUILD=no TARGET=${binaryName} make build_gui
        mkdir -p $SNAPCRAFT_PART_INSTALL/bin
        mv build/qt/release/${binaryName} $SNAPCRAFT_PART_INSTALL/bin/
    override-prime: |
      rm -rf $SNAPCRAFT_PROJECT_DIR/snap/hooks/.mypy_cache
      snapcraftctl prime
    build-packages:
      - pkg-config
      - g++
      - golang
      - git
      - make
      - qt5-qmake
      - qttools5-dev-tools
      - qtdeclarative5-dev
    stage-packages:  # for some reason they're not picked from here - duplicating in desktop-qt5.
      - libqt5qml5
      - libqt5quick5
      - qml-module-qtquick-controls
      - qml-module-qtquick-dialogs
      - qml-module-qtquick-extras
      - qml-module-qt-labs-qmlmodels
      - qml-module-qt-labs-platform
    after: [desktop-qt5]

  desktop-qt5:
    source: https://github.com/ubuntu/snapcraft-desktop-helpers.git
    source-subdir: qt
    plugin: make
    make-parameters: ["FLAVOR=qt5"]
    build-packages:
      - build-essential
      - qtbase5-dev
      - dpkg-dev
    stage-packages:
      - libxkbcommon0
      - ttf-ubuntu-font-family
      - dmz-cursor-theme
      - light-themes
      - adwaita-icon-theme
      - gnome-themes-standard
      - shared-mime-info
      - locales-all
      - xdg-user-dirs
      - fcitx-frontend-qt5
      - libxcb1
      - libqt5gui5
      - libgdk-pixbuf2.0-0
      - libqt5svg5
      - libqt5qml5
      - libqt5quick5
      - qml-module-qtquick2
      - qml-module-qtquick-controls
      - qml-module-qtquick-dialogs
      - qml-module-qtquick-extras
      - qml-module-qt-labs-platform
      - qml-module-qt-labs-qmlmodels
      - try: [appmenu-qt5] # not available on core18

apps:

  bitmask-root:
    command: bin/bitmask-root

  openvpn:
    command: usr/sbin/openvpn
    environment:
      LD_LIBRARY_PATH: &library-path
          $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET

  launcher:
    command: bin/${binaryName}
    environment:
      QT_PLUGIN_PATH: &path
        $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml
      LD_LIBRARY_PATH:
        $SNAP/lib:$SNAP/lib/$SNAPCRAFT_ARCH_TRIPLET:$SNAP/usr/lib:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET:$LD_LIBRARY_PATH
      QML2_IMPORT_PATH:
        $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml
      # debug -------------
      #QT_DEBUG_PLUGINS: 1
      SNAP_DESKTOP_DEBUG: 1
      # debug -------------