summarylogtreecommitdiffstats
path: root/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch
diff options
context:
space:
mode:
authorAlexei Colin2020-07-18 13:53:59 -0400
committerAlexei Colin2020-07-18 13:53:59 -0400
commitd91dd42ca0614a8e7e5c3e4d5607a27b2c5c5f17 (patch)
tree0e46ba83c42136897086173a9558e8dda887f72d /0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch
parentcb5392e8291e0adf4b2c0f26f5b952f880f883a9 (diff)
downloadaur-d91dd42ca0614a8e7e5c3e4d5607a27b2c5c5f17.tar.gz
upstreamed patch for unattended installation fixes
Diffstat (limited to '0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch')
-rw-r--r--0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch92
1 files changed, 92 insertions, 0 deletions
diff --git a/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch b/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch
new file mode 100644
index 00000000000..f87f4b18d43
--- /dev/null
+++ b/0004-scripts-template_dir-no-cmake-flag-for-CMake-module-.patch
@@ -0,0 +1,92 @@
+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
+