forked from Warzone2100/warzone2100
-
Notifications
You must be signed in to change notification settings - Fork 0
/
snapcraft.yaml
249 lines (237 loc) · 7.96 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
241
242
243
244
245
246
247
248
249
name: warzone2100 # no spaces, all lower-case
# summary, description, and icon are parsed from the appdata/metainfo file
adopt-info: warzone2100 # specify the *part* name
confinement: strict
grade: stable
base: core22
# Enable LZO compression for the snap
compression: lzo
# Limit architectures to those supported by the gnome extension (and future core24)
# NOTE: Specify these as separate build-on lines to ensure separate architecture builds that each support a single architecture
architectures:
- build-on: amd64
- build-on: arm64
layout:
/usr/share/vulkan:
symlink: $SNAP/usr/share/vulkan
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_intel.so:
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_intel.so
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_radeon.so:
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_radeon.so
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_broadcom.so:
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_broadcom.so
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_freedreno.so:
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_freedreno.so
/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_lvp.so:
symlink: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libvulkan_lvp.so
plugs:
wz2100-sequences:
interface: content
content: wz2100-sequences
target: $SNAP/usr/share/warzone2100/sequences
default-provider: warzone2100-videos
apps:
warzone2100:
extensions: [gnome]
command: usr/bin/warzone2100-launcher.sh warzone2100
common-id: net.wz2100.warzone2100 # should match the appdata/metainfo file's <id> field
desktop: usr/share/applications/net.wz2100.warzone2100.desktop
environment:
XDG_DATA_HOME: $SNAP_USER_COMMON
XDG_CONFIG_HOME: $SNAP_USER_COMMON
LIBDECOR_PLUGIN_DIR: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libdecor/plugins-1
plugs:
- audio-playback
- desktop
- desktop-legacy
- network
- network-bind
- opengl
- pulseaudio
- unity7
- wayland
- x11
parts:
sdl:
source: https://github.com/libsdl-org/SDL/releases/download/release-2.30.5/SDL2-2.30.5.tar.gz
source-checksum: sha512/a5892d96e4bd97702aacaddebef16c0d731582539ef3eb4cf95494b81fcda2305e93ac0735074d6269833efd106b4ae194b964ef5696476d071e071ba22aadc4
plugin: cmake
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
- -DSDL_ALSA=OFF
- -DSDL_ARTS=OFF
- -DSDL_ESD=OFF
- -DSDL_NAS=OFF
- -DSDL_OSS=OFF
override-build: |
craftctl default
build-packages:
- git
- libdbus-1-dev
- libudev-dev
- fcitx-libs-dev
- libdecor-0-dev
- libegl1-mesa-dev
- libgl1-mesa-dev
- libgles2-mesa-dev
- libibus-1.0-dev
- libjack-dev
- libpulse-dev
- libpipewire-0.3-dev
- libsamplerate0-dev
- libsndfile1-dev
- libts-dev
- libvulkan-dev
- libwayland-dev
- libx11-dev
- libxcursor-dev
- libxfixes-dev
- libxext-dev
- libxi-dev
- libxinerama-dev
- libxkbcommon-dev
- libxrandr-dev
- libxrender-dev
- libxss-dev
- libxxf86vm-dev
- libgbm-dev
stage-packages:
- libdecor-0-0
- libdecor-0-plugin-1
- libdbus-1-3
- libudev1
- fcitx-libs
- libdrm2
- libgbm1
- libegl1-mesa
- libgl1
- libgles2
- libibus-1.0-5
- libjack0
- libpulse0
- libpipewire-0.3-0
- libsamplerate0
- libts0
- libsndfile1
- libwayland-client0
- libwayland-cursor0
- libwayland-egl1-mesa
- libvulkan1
- libx11-6
- libxcursor1
- libxext6
- libxfixes3
- libxi6
- libxinerama1
- libxkbcommon0
- libxrandr2
- libxrender1
- libxss1
- libxxf86vm1
launcher:
plugin: nil
source: .
override-build: |
mkdir -p "${CRAFT_PART_INSTALL}/usr/bin"
cp -av "${CRAFT_PART_SRC}/pkg/snap/warzone2100-launcher.sh" "${CRAFT_PART_INSTALL}/usr/bin/"
warzone2100:
after: [sdl, launcher]
plugin: cmake
source: .
parse-info:
# Parse this appdata/metainfo file for summary, description,
# and icon. Use the installed path relative to the Snap's root
- usr/share/metainfo/net.wz2100.warzone2100.metainfo.xml
override-pull: |
craftctl default
SNAP_VERSION_DESC=$(git describe --always | sed 's/[^a-zA-Z0-9\.\:\+\~\-]/~/g')
craftctl set version="${SNAP_VERSION_DESC}"
git submodule update --init
override-build: |
echo "CRAFT_ARCH_BUILD_FOR=${CRAFT_ARCH_BUILD_FOR}"
echo "CRAFT_ARCH_TRIPLET_BUILD_FOR=${CRAFT_ARCH_TRIPLET_BUILD_FOR}"
# Install Vulkan SDK
. "${CRAFT_PART_SRC}/.ci/snap/install_vulkan_sdk.sh"
if [ -f ".snapenv" ]; then set -a; source .snapenv; set +a; fi
set +u
if [ -z "$WZ_DISTRIBUTOR" ]; then export WZ_DISTRIBUTOR="UNKNOWN"; fi
cmake -S "$CRAFT_PART_SRC" -B. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DWZ_ENABLE_WARNINGS:BOOL=ON -DWZ_DISTRIBUTOR:STRING="${WZ_DISTRIBUTOR}" -DWZ_OUTPUT_NAME_SUFFIX="${WZ_OUTPUT_NAME_SUFFIX}" -DWZ_NAME_SUFFIX="${WZ_NAME_SUFFIX}" -G"Ninja"
cmake --build . -- -j$CRAFT_PARALLEL_BUILD_COUNT
DESTDIR=$CRAFT_PART_INSTALL cmake --build . -- install
# Include the icon's path in the desktop file, not just the name.
# This needs to happen post-build or the build versioning will show as "modified locally"
sed -i -E 's|Icon=(.*)|Icon=/usr/share/icons/\1.png|' $CRAFT_PART_INSTALL/usr/share/applications/net.wz2100.warzone2100.desktop
# Note: Some packages are provided by the gnome extension, and are commented out below
# See: https://snapcraft.io/docs/gnome-extension#heading--packages
# And: https://github.com/ubuntu/gnome-sdk/blob/gnome-42-2204-sdk/snapcraft.yaml, https://github.com/ubuntu/gnome-sdk/blob/gnome-42-2204/snapcraft.yaml
build-packages:
- asciidoctor
#- g++
- gettext
#- libfontconfig1-dev
- libfreetype-dev
#- libfribidi-dev
#- libharfbuzz-dev
- libopenal-dev
- libphysfs-dev
- libpng-dev
- libtheora-dev
- libogg-dev
- libopus-dev
- libvorbis-dev
- libcurl4-gnutls-dev
- libgnutls28-dev
- libsodium-dev
- libsqlite3-dev
- ninja-build
- unzip
- wget
- zip
stage-packages:
#- libfontconfig1
- libfreetype6
#- libfribidi0
#- libharfbuzz0b
- libogg0
- libopenal1
- libopus0
- libphysfs1
- libpng16-16
- libtheora0
- libvorbis0a
- libvorbisenc2
- libvorbisfile3
- libvulkan1
- libcurl3-gnutls
- libsodium23
- libsqlite3-0
- libglu1-mesa
- mesa-vulkan-drivers
- unzip
- zip
# This part removes all the files in this snap which already exist in
# connected content and base snaps. Since these files will be available
# at runtime from the content and base snaps, they do not need to be
# included in this snap itself.
#
# More info: https://forum.snapcraft.io/t/reducing-the-size-of-desktop-snaps/17280#heading--cleanup-part
#
cleanup:
after: # Make this part run last; list all your other parts here
- sdl
- warzone2100
plugin: nil
build-snaps: # List all content-snaps and base snaps you're using here
- core22
- gtk-common-themes
- gnome-42-2204
override-prime: |
set -eux
for snap in "core22" "gtk-common-themes" "gnome-42-2204"; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \;
done
# The following is required while using core18 + gnome-3-34
# See: https://forum.snapcraft.io/t/undefined-symbol-hb-buffer-set-invisible-glyph-with-gnome-3-34/24287
rm -f $CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libharfbuzz.so.0*
rm -f $CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libgio-2.0.so.0*
rm -f $CRAFT_PRIME/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libglib-2.0.so.0*