diff --git a/main/calamares-extensions/APKBUILD b/main/calamares-extensions/APKBUILD new file mode 100644 index 000000000..bff9de2f7 --- /dev/null +++ b/main/calamares-extensions/APKBUILD @@ -0,0 +1,104 @@ +# Maintainer: Oliver Smith +pkgname=calamares-extensions +pkgver=1.0.0 +pkgrel=0 +arch="noarch !armhf" # blocked by qt5-qtdeclarative +url="https://github.com/calamares/calamares-extensions" +pkgdesc="Calamares Branding and Module Examples" +license="GPL-3.0-or-later" +makedepends=" + calamares-dev + qt5-qtsvg-dev + qt5-qtdeclarative-dev + " +source="https://github.com/calamares/calamares-extensions/releases/download/v$pkgver/calamares-extensions-$pkgver.tar.gz" +options="!check" # has no tests + +# Modules and brandings to build: +# https://github.com/calamares/calamares-extensions/tree/calamares/modules +# https://github.com/calamares/calamares-extensions/tree/calamares/branding +_modules=" + mobile + " +_brandings=" + default-mobile + " + +for i in $_modules; do + subpackages="$pkgname-mod-$i:_module:$CARCH $subpackages" +done +for i in $_brandings; do + subpackages="$pkgname-brand-$i:_branding $subpackages" +done + +# Check if one module/branding is enabled +# $1: name of module/branding +# $2: either $_modules or $_brandings +is_enabled() { + local i + for i in $2; do + [ "$i" = "$1" ] && return 0 + done + return 1 +} + +# Check if string $1 is in CMakeLists.txt and comment it out +comment_out() { + sed -i "s~$1~#&~g" "$builddir/CMakeLists.txt" +} + +prepare() { + default_prepare + + local i + + msg "disabled modules:" + cd "$builddir/modules" + for i in *; do + if ! [ -d "$i" ] || is_enabled "$i" "$_modules"; then + continue + fi + echo " - $i" + comment_out "calamares_add_module_subdirectory( modules/$i " + done + + msg "disabled brandings:" + cd "$builddir/branding" + for i in *; do + if ! [ -d "$i" ] || is_enabled "$i" "$_brandings"; then + continue + fi + echo " - $i" + comment_out "calamares_add_branding_subdirectory( branding/$i " + done +} + +build() { + cmake -B build \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_INSTALL_LIBDIR=lib + cmake --build build +} + +_module() { + local module=${subpkgname##calamares-extensions-mod-} + local path="usr/lib/calamares/modules" + + mkdir -p "$subpkgdir/$path" + mv "$pkgdir/$path/$module" "$subpkgdir/$path/$module" +} + +_branding() { + local branding=${subpkgname##calamares-extensions-brand-} + local path="usr/share/calamares/branding" + + mkdir -p "$subpkgdir/$path" + mv "$pkgdir/$path/$branding" "$subpkgdir/$path/$branding" +} + +package() { + DESTDIR="$pkgdir" cmake --install build +} + +sha512sums="46801342c14ad8e744378c90bcea8a60bff805096b39958b4856fef3c855b60be4d8507643e101700c52c1605db3ce1c872170a3ea79e59ef123cda0fdfe0a01 calamares-extensions-1.0.0.tar.gz"