diff --git a/.gitignore b/.gitignore index 73afad3..6a942c0 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .cache build +dist node_modules diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a764093..b574d40 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2020, 2021 Romain Vigier +# SPDX-FileCopyrightText: 2020-2022 Romain Vigier # SPDX-License-Identifier: GPL-3.0-or-later variables: @@ -69,11 +69,8 @@ extension: - reuse image: registry.gitlab.com/rmnvgr/nightthemeswitcher-gnome-shell-extension:latest script: - - meson builddir - - DESTDIR=${CI_PROJECT_DIR}/buildroot 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 + - meson builddir -Dpack=true -Dpackdir=. + - meson install -C builddir artifacts: name: $CI_COMMIT_REF_NAME expose_as: Extension diff --git a/build-aux/pack.sh b/build-aux/pack.sh new file mode 100644 index 0000000..cfe2c02 --- /dev/null +++ b/build-aux/pack.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2022 Romain Vigier +# 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 diff --git a/meson.build b/meson.build index b90ad46..14107a1 100644 --- a/meson.build +++ b/meson.build @@ -13,6 +13,10 @@ DNS = 'org.gnome.shell.extensions.nightthemeswitcher' INSTALL_DIR = get_option('datadir') / 'gnome-shell' / 'extensions' / UUID +if (get_option('pack')) + INSTALL_DIR = meson.project_build_root() / UUID +endif + gnome = import('gnome') i18n = import('i18n') diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..d0fabd8 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,5 @@ +# SPDX-FileCopyrightText: 2022 Romain Vigier +# 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') diff --git a/src/meson.build b/src/meson.build index 8422709..abe952f 100644 --- a/src/meson.build +++ b/src/meson.build @@ -50,3 +50,13 @@ install_data(preferences, install_dir: INSTALL_DIR / 'preferences') subdir('data') 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