This commit is contained in:
Stephanie Wilde-Hobbs 2022-09-08 15:55:26 +02:00
parent c274d14545
commit 0061bab884
6 changed files with 9 additions and 270 deletions

View File

@ -1,12 +1,13 @@
pkgbase = zephyr-sdk
pkgdesc = SDK for Zephyr real-time operating system
pkgver = 0.14.1
pkgver = 0.15.0
pkgrel = 1
url = https://www.zephyrproject.org/
install = zephyr-sdk.install
arch = x86_64
license = Apache
makedepends = patchelf
makedepends = wget
depends = python-breathe>=4.9.1
depends = python-docutils>=0.14
depends = python-pyaml>=5.1
@ -46,10 +47,9 @@ pkgbase = zephyr-sdk
depends = cmake>=3.8.2
optdepends = pyocd: programming and debugging ARM MCUs
options = !strip
source = https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.14.1/zephyr-sdk-0.14.1_linux-x86_64.tar.gz
source = https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.15.0/zephyr-sdk-0.15.0_linux-x86_64.tar.gz
source = zephyrrc
sha256sums = b7b70e5e70968ac6ae3184c90c3f3f8a6836acadd1432bf7b3702be7a1d317d8
sha256sums = 993c23dc104b7e6e211b1a30ec3dbbf93f7e435d1e103b63c93c6e33f33f415f
sha256sums = 7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05
pkgname = zephyr-sdk

View File

@ -1,28 +0,0 @@
From b8d47d156f3e89237a80b349eb2ec48160046b05 Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Sat, 18 Jul 2020 12:06:52 -0400
Subject: [PATCH 1/4] scripts/template_dir: don't let -y override -[no]rc
Overlooked in 6dd3e26c271bbf139f6d30523bc55fc7673b52f5
---
scripts/template_dir | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/template_dir b/scripts/template_dir
index 1ae2794..ab3394c 100644
--- a/scripts/template_dir
+++ b/scripts/template_dir
@@ -66,7 +66,9 @@ while [ "$1" != "" ]; do
;;
-y )
confirm="y";
- rc_confirm="y";
+ if [ -z "$rc_confirm" ]; then
+ rc_confirm="y"
+ fi
;;
-rc )
rc_confirm="y";
--
2.27.0

View File

@ -1,33 +0,0 @@
From e2e27bb5c5c044203c6085279a99514416799c51 Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Sat, 18 Jul 2020 12:04:52 -0400
Subject: [PATCH 2/4] scripts/template_dir: don't prompt for cmake when -y set
---
scripts/template_dir | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/scripts/template_dir b/scripts/template_dir
index ab3394c..b03d4b5 100644
--- a/scripts/template_dir
+++ b/scripts/template_dir
@@ -163,15 +163,7 @@ do_cmake_package()
return
fi
- echo "Do you want to register the Zephyr-sdk at location: $target_sdk_dir"
- echo " in the CMake package registry (y/n)?"
-
- while read confirm; do
- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \
- -o "$confirm" = "N" ] && break
- echo "Invalid input \"$confirm\", please input 'y' or 'n': "
- done
-
+ read_confirm "registering Zephyr-sdk CMake module with path $target_sdk_dir "
if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then
mkdir -p $ZEPHYR_SDK_REGISTRY_DIR
--
2.27.0

View File

@ -1,108 +0,0 @@
From 03933375277558f939a12990cae3ee372511d87e Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Sat, 18 Jul 2020 12:14:07 -0400
Subject: [PATCH 3/4] scripts/template_dir: re-use common prompting code
---
scripts/template_dir | 56 ++++++++++++++++++++++++--------------------
1 file changed, 31 insertions(+), 25 deletions(-)
diff --git a/scripts/template_dir b/scripts/template_dir
index b03d4b5..0a0d69e 100644
--- a/scripts/template_dir
+++ b/scripts/template_dir
@@ -131,15 +131,10 @@ do_zephyrrc()
echo " export ZEPHYR_SDK_INSTALL_DIR=$target_sdk_dir"
echo
if [ -z "$rc_confirm" ]; then
- echo "Update/Create $HOME/.zephyrrc with environment variables setup for you (y/n)? "
- while read rc_confirm; do
- [ "$rc_confirm" = "Y" -o "$rc_confirm" = "y" \
- -o "$rc_confirm" = "n" \
- -o "$rc_confirm" = "N" ] && break
- echo "Invalid input \"$rc_confirm\", please input 'y' or 'n': "
- done
+ prompt "creating/updating $HOME/.zephyrrc with environment variables setup for you "
+ rc_confirm=$answer
fi
- if [ "$rc_confirm" = "y" -o "$rc_confirm" = "Y" ]; then
+ if [ "$rc_confirm" = "y" ]; then
if [ -f $HOME/.zephyrrc ]; then
sed -i "s#ZEPHYR_SDK_INSTALL_DIR=.*#ZEPHYR_SDK_INSTALL_DIR=${target_sdk_dir}#" $HOME/.zephyrrc
sed -i "s#ZEPHYR_TOOLCHAIN_VARIANT=.*#ZEPHYR_TOOLCHAIN_VARIANT=zephyr#" $HOME/.zephyrrc
@@ -163,8 +158,8 @@ do_cmake_package()
return
fi
- read_confirm "registering Zephyr-sdk CMake module with path $target_sdk_dir "
- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
+ query "registering Zephyr-sdk CMake module with path $target_sdk_dir "
+ if [ "$answer" = "y" ]; then
if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then
mkdir -p $ZEPHYR_SDK_REGISTRY_DIR
fi
@@ -176,17 +171,28 @@ do_cmake_package()
# Read the input "y"
# $1 is optional, but allows the caller to provide additional text.
-read_confirm () {
- if [ "$confirm" != "y" ]; then
- echo "Do you want to continue $1(y/n)? "
- while read confirm; do
- [ "$confirm" = "Y" -o "$confirm" = "y" -o "$confirm" = "n" \
- -o "$confirm" = "N" ] && break
- echo "Invalid input \"$confirm\", please input 'y' or 'n': "
- done
- else
- echo
- fi
+prompt () {
+ echo "Do you want to continue $1(y/n)? "
+ while read answer; do
+ if [ "$answer" = "Y" -o "$answer" = "y" ]; then
+ answer="y"
+ break
+ elif [ "$answer" = "N" -o "$answer" = "n" ]; then
+ answer="n"
+ break
+ else
+ echo "Invalid input \"$answer\", please input 'y' or 'n': "
+ fi
+ done
+}
+# Like prompt, but only if prompts were not pre-answered by -y argument
+query () {
+ if [ "$confirm" != "y" ]; then
+ prompt "$1"
+ else
+ answer="y"
+ echo
+ fi
}
verify_os
@@ -261,8 +267,8 @@ if [ "$sdk_dirname" != "/opt" \
echo Note: The version number \'-$SDK_VERSION\' can be omitted.
echo
- read_confirm "installing to ${target_sdk_dir} "
- if [ "$confirm" = "n" -o "$confirm" = "N" ]; then
+ query "installing to ${target_sdk_dir} "
+ if [ "$answer" = "n" ]; then
# Abort the installation
echo "SDK installation aborted!"
exit 1
@@ -282,8 +288,8 @@ if [ -d $target_sdk_dir ]; then
# wipe the directory first
if [ -d $target_sdk_dir/sysroots ]; then
echo "The directory $target_sdk_dir/sysroots will be removed! "
- read_confirm
- if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
+ query
+ if [ "$answer" = "y" ]; then
rm -rf $target_sdk_dir/sysroots/
rm -rf $target_sdk_dir/info-zephyr-sdk*/
rm -fr $target_sdk_dir/sdk_version
--
2.27.0

View File

@ -1,92 +0,0 @@
From 706b10cddfd781e3c7f1006a64ad23e09601e77c Mon Sep 17 00:00:00 2001
From: Alexei Colin <ac@alexeicolin.com>
Date: Sat, 18 Jul 2020 12:18:20 -0400
Subject: [PATCH 4/4] scripts/template_dir: -[no]cmake flag for CMake module
installation
There are two issues with CMake module installation that are
problematic for distro packages:
1. the cmake module is installed under $HOME and this path is not overridable
2. the path to SDK recorded in the cmake file is the same as the
target directory, which might be prefixed by the staging path of the
package build (e.g. ~/mypackages/zerphyr-sdk/destdir/opt/zerphyr-sdk),
not the final installation directory in the system (/opt/zephyr-sdk).
1 is fixable by making the variable overridable from the environment:
: ${ZEPHYR_SDK_REGISTRY_DIR:=$HOME/.cmake/packages/Zephyr-sdk}
(but this may be a bashism). But, 1 is not useful unless 2 is also
addressed.
2 might be fixable by introducing a prefix argument -p (default "") in
addition to the target_dir (-d), and composing the destination directory
for copying files as $prefix/$target_dir while using only $target_dir
wherever installation paths are written, such as in the CMake module.
Until 1 or 2 are addressed, add -[no]cmake arg so that the package
scripts can install the CMake module themselves.
---
scripts/template_dir | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/scripts/template_dir b/scripts/template_dir
index 0a0d69e..fccf6f0 100644
--- a/scripts/template_dir
+++ b/scripts/template_dir
@@ -3,6 +3,7 @@ target_sdk_dir=""
post_install_cleanup=1
confirm=0
rc_confirm=""
+cmake_confirm=""
usage () {
cat << EOF
@@ -22,6 +23,9 @@ Options:
-[no]rc
Whether to create/update the ~/.zerphyrc file (prompt if not given)
+ -[no]cmake
+ Whether to install Zephyr-sdk CMake module (prompt if not given)
+
EOF
}
@@ -69,6 +73,9 @@ while [ "$1" != "" ]; do
if [ -z "$rc_confirm" ]; then
rc_confirm="y"
fi
+ if [ -z "$cmake_confirm" ]; then
+ cmake_confirm="y"
+ fi
;;
-rc )
rc_confirm="y";
@@ -76,6 +83,12 @@ while [ "$1" != "" ]; do
-norc )
rc_confirm="n";
;;
+ -cmake )
+ cmake_confirm="y"
+ ;;
+ -nocmake )
+ cmake_confirm="n"
+ ;;
* )
echo "Error: Invalid argument \"$1\""
usage
@@ -158,8 +171,11 @@ do_cmake_package()
return
fi
- query "registering Zephyr-sdk CMake module with path $target_sdk_dir "
- if [ "$answer" = "y" ]; then
+ if [ -z "$cmake_confirm" ]; then
+ prompt "registering Zephyr-sdk CMake module with path $target_sdk_dir "
+ cmake_confirm=$answer
+ fi
+ if [ "$cmake_confirm" = "y" ]; then
if [ ! -d $ZEPHYR_SDK_REGISTRY_DIR ]; then
mkdir -p $ZEPHYR_SDK_REGISTRY_DIR
fi
--
2.27.0

View File

@ -1,7 +1,7 @@
# Maintainer: Alexei Colin <ac@alexeicolin.com>
pkgname=zephyr-sdk
pkgver=0.14.1
pkgver=0.15.0
pkgrel=1
pkgdesc="SDK for Zephyr real-time operating system"
arch=('x86_64')
@ -26,10 +26,13 @@ depends=('python-breathe>=4.9.1' 'python-docutils>=0.14'
'git-spindle' 'gitlint' 'ninja' 'gperf' 'gcovr' 'ccache'
'doxygen' 'dfu-util' 'dtc' 'cmake>=3.8.2')
optdepends=('pyocd: programming and debugging ARM MCUs')
makedepends=('patchelf')
makedepends=('patchelf' 'wget')
source=("https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v${pkgver}/zephyr-sdk-${pkgver}_linux-x86_64.tar.gz"
"zephyrrc"
)
sha256sums=('993c23dc104b7e6e211b1a30ec3dbbf93f7e435d1e103b63c93c6e33f33f415f'
'7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05')
options=(!strip)
install=$pkgname.install
@ -114,6 +117,3 @@ package ()
# Hello World! qemu_cortex_a53
# More info: https://docs.zephyrproject.org/latest/getting_started/index.html
sha256sums=('b7b70e5e70968ac6ae3184c90c3f3f8a6836acadd1432bf7b3702be7a1d317d8'
'7a1257272c64bdec281283d391e3149cece065935c9e8394d6bece32d0f6fc05')