          name:                   sqlitebrowser  # the name of the snap
          version:                master
          base:                   core20
          version-script:         printf "`cat currentrelease | head -n 1 `-`git rev-list master --count`-` git -C . rev-parse --short HEAD`"

          summary:                DB Browser for SQLite  # 79 char long summary
          description:            |
            SQLite Database Browser is a visual tool used to create, design and edit database files compatible with SQLite. Its interface is based on Qt, and is meant to be used for users and developers that want to create databases, edit and search data using a familiar spreadsheet-like interface, without the need to learn complicated SQL commands. Controls and wizards are available for users to:
            * Create and compact database files
            * Create, define, modify and delete tables
            * Create, define and delete indexes
            * Browse, edit, add and delete records
            * Search records
            * Import and export records as text
            * Import and export tables from/to CSV files
            * Import and export databases from/to SQL dump files
            * Issue SQL queries and inspect the results
            * Examine a log of all SQL commands issued by the application
            SQLite Database Browser is not a visual shell for the sqlite command line tool. It does not require familiarity with SQL commands.
          confinement:            strict  # use "strict" to enforce system access only via declared interfaces
          grade:                  stable
          icon:                   images/logo.svg
          type:                   app
          plugs:
            gtk-3-themes:
              interface: content
              target: $SNAP/data-dir/themes
              default-provider: gtk-common-themes:gtk-3-themes
            sound-themes:
              interface: content
              target: $SNAP/data-dir/sounds
              default-provider: gtk-common-themes:sound-themes
            icon-themes:
              interface: content
              target: $SNAP/data-dir/icons
              default-provider: gtk-common-themes:icon-themes
          apps:
            sqlitebrowser:
              command: usr/local/bin/sqlitebrowser
              command-chain:
              - bin/desktop-launch
              - usr/local/bin/sqlitebrowser
              desktop:           usr/local/share/applications/sqlitebrowser.desktop
              environment:
                DISABLE_WAYLAND:  1
                TMPDIR:           $XDG_RUNTIME_DIR
                XLOCALEDIR: '$SNAP/usr/share/X11/locale'
                LOCPATH: '$SNAP/usr/lib/locale'
                GTK_PATH: $SNAP/lib/gtk-2.0
                GTK_DATA_PREFIX: $SNAP
                XDG_DATA_DIRS: $SNAP/share:$XDG_DATA_DIRS
                XDG_CONFIG_HOME: '$HOME/.config'
                XKB_CONFIG_ROOT: '$SNAP/usr/share/X11/xkb'
                XDG_CONFIG_DIRS: '$SNAP/etc/xdg:$XDG_CONFIG_DIRS'
                XDG_DATA_HOME: '$SNAP/usr/share'
                QT_QPA_PLATFORMTHEME: qt5ct
              plugs:
                - desktop
                - gsettings
                - home
                - unity7
                - wayland
                - x11
                - removable-media
                - cups-control

          build-packages:
              - build-essential
              - g++
              - qtbase5-dev
              - qttools5-dev
              - qttools5-dev-tools
              - libsqlite3-dev
              - cmake
              - libsqlcipher-dev
              - libqcustomplot-dev
              - libqt5scintilla2-dev
              - git
          parts:
              sqlitebrowser:
                  plugin:         cmake
                  cmake-parameters:   ["-DUSE_QT5=True", "-Dsqlcipher=1", "-Wno-dev","-DSQLITE_ENABLE_JSON1=1"]
                  source:         .
              desktop-qt5:
                build-packages:
                - qtbase5-dev
                - dpkg-dev
                - libgtk-3-dev
                make-parameters:
                - FLAVOR=qt5
                plugin:           make
                source:           https://github.com/ubuntu/snapcraft-desktop-helpers.git
                source-subdir:    qt
                stage-packages:
                - libxkbcommon0
                - ttf-ubuntu-font-family
                - dmz-cursor-theme
                - light-themes
                - adwaita-icon-theme
                - gnome-themes-standard
                - shared-mime-info
                - libgtk-3-0
                - libqt5gui5
                - libgdk-pixbuf2.0-0
                - libqt5svg5
                - libglib2.0-bin
                - libgtk-3-bin
                - unity-gtk3-module
                - libappindicator3-1
                - locales-all
                - xdg-user-dirs
                - ibus-gtk3
                - libibus-1.0-5
                - libgtk2.0-0
                - qt5-image-formats-plugins
              dump:
                  source:         .
                  plugin:         dump
                  after:
                  - desktop-qt5
                  - sqlitebrowser
                  stage-packages:
                  - libc6
                  - libgcc1
                  - libsqlite3-0
                  - libstdc++6
                  - libsqlcipher-dev
                  - libatk-adaptor
                  - libgail-common
                  - libgail-3-0
                  - libgail-3-dev
                  - libgail-dev
                  - qtwayland5
                  - libqscintilla2-qt5-15
                  - libqt5printsupport5
                  - libqt5xml5
                  - libsqlcipher0
                  - libgtk-3-0
                  filesets:
                      wanted:
                      - bin/*
                      - share/*
                      - usr/lib/*.*
                      - usr/lib/*-linux-gnu*/libsqlcipher.so.0*
                      - usr/lib/*-linux-gnu*/libdb*
                      - usr/lib/*-linux-gnu*/libz.so*
                      - usr/lib/*-linux-gnu*/libatk*
                      - usr/lib/*-linux-gnu*/libgail*
                      - usr/lib/*-linux-gnu*/gtk-2.0/modules/*
                      - etc/X11/Xsession.d/90atk-adaptor
                      - usr/lib/gnome-settings-daemon-3.0/gtk-modules/at-spi2-atk.desktop
                      - usr/lib/unity-settings-daemon-1.0/gtk-modules/at-spi2-atk.desktop
                      - usr/lib/*-linux-gnu*/libQt5PrintSupport.so*
                      - usr/lib/*-linux-gnu*/libQt5Xml.so*
                  prime:
                  - $wanted
