Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
appstream-generator/snapcraft.yaml
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
245 lines (224 sloc)
6.93 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Copyright (C) 2020 Matthias Klumpp <matthias@tenstral.net> | |
| # Copyright (C) 2020 Canonical Ltd | |
| # Author: Iain Lane <iain@orangesquash.org.uk> | |
| # | |
| # SPDX-License-Identifier: FSFAP | |
| # | |
| # This Snapcraft file and the resulting Snap is NOT OFFICIALLY SUPPORTED. | |
| # If you can, please use a provided native build for your distribution. | |
| # Patches to improve this file are very welcome though, and so is testing the Snap! | |
| # | |
| # This snap is strict, but it has an important limitation: | |
| # - it needs read/write access to wherever the user puts the workspace | |
| # definition (could be anywhere, but most commonly it's in /srv, in /home or | |
| # in /var), access to a local archive mount (can be in /mnt), and that should | |
| # be it (unless optipng and ffprobe have extra requirements). | |
| # | |
| # Until that is overcome, this snap should be installed using `--devmode` to | |
| # effectively disable the confinement. | |
| # | |
| # This Snap is autobuilt, you can check its status at https://build.snapcraft.io/user/ximion/appstream-generator | |
| name: appstream-generator | |
| license: LGPL-3.0 | |
| base: core22 | |
| adopt-info: appstream-generator | |
| confinement: strict | |
| grade: stable | |
| architectures: | |
| - build-on: [amd64] | |
| apps: | |
| appstream-generator: | |
| command: usr/bin/appstream-generator | |
| common-id: org.freedesktop.appstream.generator | |
| plugs: | |
| - network | |
| - home | |
| environment: | |
| GSETTINGS_SCHEMA_DIR: "$SNAP/usr/share/glib-2.0/schemas" | |
| GIO_EXTRA_MODULES: "$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gio/modules" | |
| layout: | |
| /usr/share/appstream: | |
| bind: $SNAP/usr/share/appstream | |
| /usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0: | |
| bind: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/gdk-pixbuf-2.0 | |
| /usr/share/i18n: | |
| bind: $SNAP/usr/share/i18n | |
| /usr/share/mime: | |
| bind: $SNAP/usr/share/mime | |
| parts: | |
| appstream-generator: | |
| source: . | |
| source-type: git | |
| parse-info: [usr/share/metainfo/org.freedesktop.appstream.generator.metainfo.xml] | |
| override-pull: | | |
| snapcraftctl pull | |
| # set version from Git | |
| snapcraftctl set-version "$(git describe --always | sed -e 's/v//;s/-/+git/;y/-/./')" | |
| # adjust to an absolute path to help finding the GIR file from the AppStream part | |
| sed -i 's|AppStream-1.0.gir|$SNAPCRAFT_STAGE/usr/share/gir-1.0/AppStream-1.0.gir|g' ${SNAPCRAFT_PART_SRC}/contrib/girwrap/APILookupAppStream.txt | |
| sed -i 's|AppStreamCompose-1.0.gir|$SNAPCRAFT_STAGE/usr/share/gir-1.0/AppStreamCompose-1.0.gir|g' ${SNAPCRAFT_PART_SRC}/contrib/girwrap/APILookupAppStreamCompose.txt | |
| plugin: meson | |
| build-environment: | |
| - LD_LIBRARY_PATH: $SNAPCRAFT_STAGE/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/ | |
| override-build: | | |
| # install yarn | |
| curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
| echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
| apt-get update && apt-get install --no-install-recommends -y yarn nodejs | |
| # actually build asgen - we need to run everything manually here, | |
| # because snapcraft will kill the build if run with maximum amount of ninja jobs, | |
| # and I found no way to limit the amount of permitted ninja jobs other than overriding everything | |
| meson --prefix=/usr --buildtype=debugoptimized -Ddownload-js=true ${SNAPCRAFT_PART_BUILD} ${SNAPCRAFT_PART_SRC} | |
| ninja -C "${SNAPCRAFT_PART_BUILD}" -j4 | |
| meson test -C "${SNAPCRAFT_PART_BUILD}" --verbose | |
| DESTDIR=${SNAPCRAFT_PART_INSTALL} ninja -C "${SNAPCRAFT_PART_BUILD}" install | |
| override-prime: | | |
| set -eux | |
| snapcraftctl prime | |
| for dir in usr/lib/*/gdk-pixbuf-2.0; do | |
| if [ -d "${dir}" ]; then | |
| for subdir in "${dir}"/*; do | |
| if [ -d "${subdir}" ] && [ -d "${subdir}/loaders" ]; then | |
| GDK_PIXBUF_MODULEDIR="$(pwd)/${subdir}/loaders" "${dir}/gdk-pixbuf-query-loaders" > "${subdir}/loaders.cache" | |
| sed -i "s,$(pwd),," "${subdir}/loaders.cache" | |
| fi | |
| done | |
| fi | |
| done | |
| update-mime-database -V usr/share/mime/ | |
| usr/lib/${SNAPCRAFT_ARCH_TRIPLET}/glib-2.0/glib-compile-schemas usr/share/glib-2.0/schemas | |
| build-packages: | |
| - curl | |
| - meson | |
| - docbook-xsl | |
| - docbook-xml | |
| - xsltproc | |
| - ffmpeg | |
| - libgdk-pixbuf2.0-dev | |
| - libarchive-dev | |
| - librsvg2-dev | |
| - liblmdb-dev | |
| - libglib2.0-dev | |
| - libcurl4-gnutls-dev | |
| - libcairo2-dev | |
| - libfreetype6-dev | |
| - libfontconfig1-dev | |
| - libpango1.0-dev | |
| stage-packages: | |
| - gdb | |
| - glib-networking | |
| - ffmpeg | |
| - optipng | |
| - libc-bin | |
| - libglu1-mesa | |
| - freeglut3 | |
| - libslang2 | |
| - libarchive13 | |
| - libcairo2 | |
| - libcroco3 | |
| - libdatrie1 | |
| - libfontconfig1 | |
| - libfreetype6 | |
| - libgdk-pixbuf2.0-0 | |
| - libglib2.0-0 | |
| - libglib2.0-bin | |
| - libgraphite2-3 | |
| - libharfbuzz0b | |
| - libpango-1.0-0 | |
| - libpangocairo-1.0-0 | |
| - libpangoft2-1.0-0 | |
| - libpixman-1-0 | |
| - libpng16-16 | |
| - librsvg2-2 | |
| - librsvg2-common | |
| - libcurl3-gnutls | |
| - libthai0 | |
| - libx11-6 | |
| - libxau6 | |
| - libxcb-render0 | |
| - libxcb-shm0 | |
| - libxcb1 | |
| - libxdmcp6 | |
| - libxext6 | |
| - libxrender1 | |
| - locales | |
| - locales-all | |
| - shared-mime-info | |
| after: | |
| - appstream | |
| - ldc | |
| - gir-to-d | |
| - glibd | |
| appstream: | |
| source: https://github.com/ximion/appstream.git | |
| source-type: git | |
| source-tag: v0.16.0 | |
| plugin: meson | |
| meson-parameters: | |
| - --prefix=/usr | |
| - --buildtype=debugoptimized | |
| - -Dcompose=true | |
| - -Dapidocs=false | |
| - -Dsystemd=false | |
| build-packages: | |
| - build-essential | |
| - docbook-xsl | |
| - docbook-xml | |
| - gettext | |
| - gobject-introspection | |
| - gperf | |
| - itstool | |
| - libgirepository1.0-dev | |
| - libglib2.0-dev | |
| - libxmlb-dev | |
| - liblzma-dev | |
| - libcurl4-gnutls-dev | |
| - libstemmer-dev | |
| - libxml2-dev | |
| - libyaml-dev | |
| - meson | |
| - xsltproc | |
| stage-packages: | |
| - libicu66 | |
| - liblmdb0 | |
| - libcurl3-gnutls | |
| - libstemmer0d | |
| - libxml2 | |
| gir-to-d: | |
| source: https://github.com/gtkd-developers/gir-to-d.git | |
| source-type: git | |
| source-tag: v0.22.0 | |
| plugin: meson | |
| meson-parameters: | |
| - --prefix=/usr | |
| - --buildtype=release | |
| build-packages: | |
| - meson | |
| after: | |
| - ldc | |
| glibd: | |
| source: https://github.com/gtkd-developers/GlibD.git | |
| source-type: git | |
| source-tag: v2.3.0 | |
| plugin: meson | |
| meson-parameters: | |
| - --prefix=/usr | |
| - --buildtype=release | |
| build-packages: | |
| - meson | |
| - gobject-introspection | |
| - libgirepository1.0-dev | |
| - libglib2.0-dev | |
| after: | |
| - gir-to-d | |
| - ldc | |
| ldc: | |
| plugin: dump | |
| source: https://github.com/ldc-developers/ldc/releases/download/v1.30.0/ldc2-1.30.0-linux-x86_64.tar.xz | |
| override-build: | | |
| # link shared by default | |
| sed -i '/\sswitches =/a \ "-link-defaultlib-shared",' etc/ldc2.conf | |
| # remove unneeded libs | |
| rm -rf lib32 | |
| snapcraftctl build |