forked from ximion/appstream-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
240 lines (219 loc) · 6.51 KB
/
snapcraft.yaml
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#
# Copyright (C) 2020 Matthias Klumpp <[email protected]>
#
# 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: core18
adopt-info: appstream-generator
confinement: strict
grade: devel
architectures:
- build-on: [amd64]
run-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: [data/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/-/./')"
plugin: meson
override-build: |
# install yarn
apt-get install -y curl
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
# 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' contrib/girwrap/APILookupAppStream.txt
# 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 snapbuild
cd snapbuild
ninja -j4
ninja test
DESTDIR=$SNAPCRAFT_PART_INSTALL ninja 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:
- meson
- docbook-xsl
- docbook-xml
- xsltproc
- ffmpeg
- libgdk-pixbuf2.0-dev
- libarchive-dev
- librsvg2-dev
- liblmdb-dev
- libglib2.0-dev
- libsoup2.4-dev
- libcairo2-dev
- libfreetype6-dev
- libfontconfig1-dev
- libpango1.0-dev
stage-packages:
- gdb
- ffmpeg
- optipng
- libc-bin
- libglu1-mesa
- freeglut3
- libslang2
- libarchive13
- libcairo2
- libcroco3
- libdatrie1
- libfontconfig1
- libfreetype6
- libgdk-pixbuf2.0-0
- libgraphite2-3
- libharfbuzz0b
- libpango-1.0-0
- libpangocairo-1.0-0
- libpangoft2-1.0-0
- libpixman-1-0
- libpng16-16
- librsvg2-2
- librsvg2-common
- libsoup2.4-1
- 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-commit: 3a0a0c977b7e9b2286349530e997d91a895ac122
plugin: meson
meson-parameters:
- --prefix=/usr
- --buildtype=release
- -Dapidocs=false
override-build: |
# we can build with a slightly lower GLib version in this instance
sed -i 's|>=2.58|>=2.56|g' meson.build
# build AS
snapcraftctl build
build-packages:
- build-essential
- docbook-xsl
- docbook-xml
- gettext
- gobject-introspection
- gperf
- libgirepository1.0-dev
- libglib2.0-dev
- liblmdb-dev
- libsoup2.4-dev
- libstemmer-dev
- libxml2-dev
- libyaml-dev
- meson
- xsltproc
stage-packages:
- libicu60
- liblmdb0
- libsoup2.4-1
- libstemmer0d
- libxml2
gir-to-d:
source: https://github.com/gtkd-developers/gir-to-d.git
source-type: git
source-tag: v0.21.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.2.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.21.0/ldc2-1.21.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