From 10160b646ae49135596d301b323169461dd5a34c Mon Sep 17 00:00:00 2001 From: lod Date: Sun, 26 Nov 2023 15:38:32 +0100 Subject: [PATCH 1/3] add srcdir to _pkgbase and put custom variables in prepare function --- PKGBUILD | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 8fdd006..7484cf5 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -19,8 +19,6 @@ makedepends=('arm-none-eabi-binutils' 'arm-none-eabi-gcc' 'arm-none-eabi-newlib' options=('!debug') provides=('companion') conflicts=('companion') -_pkgbase=${pkgname%%-*} -_versuff=${pkgver/./} && _versuff=${_versuff%%.*} source=("git+https://github.com/EdgeTX/edgetx.git#tag=v$pkgver" "git+https://github.com/jbeder/yaml-cpp.git" "git+https://github.com/raphaelcoeffic/AccessDenied.git" @@ -45,6 +43,9 @@ b2sums=('SKIP' '6ad8cfff9f623c1d0182713839419b633f421e762d01cd46b2ce817c1552929d9ffadcb38f112d6ac9d3d196346b781d842ad0d9c34d4dbe0d5709a3edbc6026') prepare() { + _pkgbase=$srcdir/${pkgname%%-*} + _versuff=${pkgver/./} && _versuff=${_versuff%%.*} + export EDGETX_VERSION_TAG=$pkgver cd $_pkgbase @@ -52,25 +53,25 @@ prepare() { patch ./tools/build-companion.sh < $srcdir/install.patch patch ./companion/src/CMakeLists.txt < $srcdir/remove-ssl-check.patch - cd $srcdir/$_pkgbase/companion/src/thirdparty/ + cd $_pkgbase/companion/src/thirdparty/ git submodule init git config submodule.yaml-cpp.url $srcdir/yaml-cpp git submodule update --init - cd $srcdir/$_pkgbase/radio/src/thirdparty/ + cd $_pkgbase/radio/src/thirdparty/ git submodule init git config submodule.AccessDenied.url $srcdir/AccessDenied git config submodule.FreeRTOS-Kernel.url $srcdir/FreeRTOS git config submodule.libopenui.url $srcdir/libopenui git submodule update --init - cd $srcdir/$_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/ + cd $_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/ git submodule init git config submodule.FreeRTOS-Kernel-Community-Supported-Ports.url $srcdir/Community-Supported-Ports git config submodule.FreeRTOS-Kernel-Partner-Supported-Ports.url $srcdir/FreeRTOS-Kernel-Partner-Supported-Ports git submodule update --init - cd $srcdir/$_pkgbase/radio/src/thirdparty/libopenui/thirdparty/ + cd $_pkgbase/radio/src/thirdparty/libopenui/thirdparty/ git submodule init git config submodule.lvgl.url $srcdir/lvgl git config submodule.stb.url $srcdir/stb @@ -79,7 +80,7 @@ prepare() { build() { cd $_pkgbase - ./tools/build-companion.sh $MAKEFLAGS $srcdir/$_pkgbase $srcdir/build $_versuff + ./tools/build-companion.sh $MAKEFLAGS $_pkgbase $srcdir/build $_versuff } package() { From 28f5bc15b4183624aa010af3e4bd82ac6a54ba0e Mon Sep 17 00:00:00 2001 From: lod Date: Sun, 26 Nov 2023 15:41:48 +0100 Subject: [PATCH 2/3] use associative array and for loops to init submoduls --- PKGBUILD | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index 7484cf5..cbddb9f 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -53,29 +53,21 @@ prepare() { patch ./tools/build-companion.sh < $srcdir/install.patch patch ./companion/src/CMakeLists.txt < $srcdir/remove-ssl-check.patch - cd $_pkgbase/companion/src/thirdparty/ - git submodule init - git config submodule.yaml-cpp.url $srcdir/yaml-cpp - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/ - git submodule init - git config submodule.AccessDenied.url $srcdir/AccessDenied - git config submodule.FreeRTOS-Kernel.url $srcdir/FreeRTOS - git config submodule.libopenui.url $srcdir/libopenui - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/ - git submodule init - git config submodule.FreeRTOS-Kernel-Community-Supported-Ports.url $srcdir/Community-Supported-Ports - git config submodule.FreeRTOS-Kernel-Partner-Supported-Ports.url $srcdir/FreeRTOS-Kernel-Partner-Supported-Ports - git submodule update --init - - cd $_pkgbase/radio/src/thirdparty/libopenui/thirdparty/ - git submodule init - git config submodule.lvgl.url $srcdir/lvgl - git config submodule.stb.url $srcdir/stb - git submodule update --init + declare -A submodules=( + ["$_pkgbase/companion/src/thirdparty/"]="yaml-cpp" + ["$_pkgbase/radio/src/thirdparty/"]="AccessDenied FreeRTOS-Kernel libopenui" + ["$_pkgbase/radio/src/thirdparty/FreeRTOS/portable/ThirdParty/"]="FreeRTOS-Kernel-Community-Supported-Ports FreeRTOS-Kernel-Partner-Supported-Ports" + ["$_pkgbase/radio/src/thirdparty/libopenui/thirdparty/"]="lvgl stb" + ) + + for path in "${!submodules[@]}"; do + cd $path + git submodule init + for module in ${submodules[$path]}; do + git config submodule.$module.url $srcdir/$module + done + git submodule update --init + done } build() { From 2d595fa03f23869e89d408ecc3738ba0696df16a Mon Sep 17 00:00:00 2001 From: lod Date: Sun, 26 Nov 2023 15:47:10 +0100 Subject: [PATCH 3/3] remove Version suffix, we dont need it anymore --- PKGBUILD | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/PKGBUILD b/PKGBUILD index cbddb9f..aac900e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -44,7 +44,6 @@ b2sums=('SKIP' prepare() { _pkgbase=$srcdir/${pkgname%%-*} - _versuff=${pkgver/./} && _versuff=${_versuff%%.*} export EDGETX_VERSION_TAG=$pkgver @@ -72,13 +71,10 @@ prepare() { build() { cd $_pkgbase - ./tools/build-companion.sh $MAKEFLAGS $_pkgbase $srcdir/build $_versuff + ./tools/build-companion.sh $MAKEFLAGS $_pkgbase $srcdir/build } package() { cd $srcdir/build/native make DESTDIR=$pkgdir/ install - cd $pkgdir/usr/share/applications - sed -i -e 's/Categories=Application/Categories=Utility/' companion$_versuff.desktop - sed -i -e 's/Categories=Application/Categories=Utility/' simulator$_versuff.desktop }