Build system: Add option to pack the extension

This commit is contained in:
Romain Vigier
2022-05-24 23:42:06 +02:00
parent e9de843b08
commit c1162a5403
6 changed files with 44 additions and 6 deletions
+1
View File
@@ -4,4 +4,5 @@
.cache .cache
build build
dist
node_modules node_modules
+3 -6
View File
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2020, 2021 Romain Vigier <contact AT romainvigier.fr> # SPDX-FileCopyrightText: 2020-2022 Romain Vigier <contact AT romainvigier.fr>
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
variables: variables:
@@ -69,11 +69,8 @@ extension:
- reuse - reuse
image: registry.gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension:latest image: registry.gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension:latest
script: script:
- meson builddir - meson builddir -Dpack=true -Dpackdir=.
- DESTDIR=${CI_PROJECT_DIR}/buildroot meson install -C builddir - meson install -C builddir
- cd buildroot/usr/local/share/gnome-shell/extensions/nightthemeswitcher@romainvigier.fr
- zip -r nightthemeswitcher@romainvigier.fr.zip *
- mv nightthemeswitcher@romainvigier.fr.zip $CI_PROJECT_DIR
artifacts: artifacts:
name: $CI_COMMIT_REF_NAME name: $CI_COMMIT_REF_NAME
expose_as: Extension expose_as: Extension
+21
View File
@@ -0,0 +1,21 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
# SPDX-License-Identifier: GPL-3.0-or-later
ZIP_EXE=$1
UUID=$2
PACK_DIR=$3
# Remove previous archive
rm -f $PACK_DIR/$UUID.zip
# Create the destination directory
mkdir -p $PACK_DIR
# Archive extension
cd $MESON_BUILD_ROOT/$UUID
$ZIP_EXE -r $PACK_DIR/$UUID.zip *
# Remove unarchived files
rm -rf $MESON_BUILD_ROOT/$UUID
+4
View File
@@ -13,6 +13,10 @@ DNS = 'org.gnome.shell.extensions.nightthemeswitcher'
INSTALL_DIR = get_option('datadir') / 'gnome-shell' / 'extensions' / UUID INSTALL_DIR = get_option('datadir') / 'gnome-shell' / 'extensions' / UUID
if (get_option('pack'))
INSTALL_DIR = meson.project_build_root() / UUID
endif
gnome = import('gnome') gnome = import('gnome')
i18n = import('i18n') i18n = import('i18n')
+5
View File
@@ -0,0 +1,5 @@
# SPDX-FileCopyrightText: 2022 Romain Vigier <contact AT romainvigier.fr>
# SPDX-License-Identifier: GPL-3.0-or-later
option('pack', type: 'boolean', value: false, description: 'Create a distributable archive instead of installing')
option('packdir', type: 'string', value: 'dist', description: 'Directory to put the distributable archive')
+10
View File
@@ -50,3 +50,13 @@ install_data(preferences, install_dir: INSTALL_DIR / 'preferences')
subdir('data') subdir('data')
subdir('po') subdir('po')
if (get_option('pack'))
zip_exe = find_program('zip')
meson.add_install_script(
meson.project_source_root() / 'build-aux' / 'pack.sh',
zip_exe.full_path(),
UUID,
meson.project_source_root() / get_option('packdir')
)
endif