diff mbox series

[meta-oe] srecord: fix install prefix

Message ID 20240102210554.843148-1-iillyyaa@gmail.com
State Superseded
Headers show
Series [meta-oe] srecord: fix install prefix | expand

Commit Message

Ilya A. Kriveshko Jan. 2, 2024, 9:05 p.m. UTC
srecord's CMakeLists.txt was unconditionally setting CMAKE_INSTALL_PREFIX
for non-WIN32 builds, which caused it to ignore OE-supplied prefix
that contained the sysroot portion of the path.  Fixed by setting
the prefix only if it wasn't explicitly provided.

Signed-off-by: Ilya A. Kriveshko <iillyyaa@gmail.com>
---
 ...make-respect-explicit-install-prefix.patch | 31 +++++++++++++++++++
 .../recipes-support/srecord/srecord_1.65.0.bb |  3 +-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch

Comments

Khem Raj Jan. 2, 2024, 9:49 p.m. UTC | #1
On Tue, Jan 2, 2024 at 1:06 PM Ilya A. Kriveshko <iillyyaa@gmail.com> wrote:
>
> srecord's CMakeLists.txt was unconditionally setting CMAKE_INSTALL_PREFIX
> for non-WIN32 builds, which caused it to ignore OE-supplied prefix
> that contained the sysroot portion of the path.  Fixed by setting
> the prefix only if it wasn't explicitly provided.
>
> Signed-off-by: Ilya A. Kriveshko <iillyyaa@gmail.com>
> ---
>  ...make-respect-explicit-install-prefix.patch | 31 +++++++++++++++++++
>  .../recipes-support/srecord/srecord_1.65.0.bb |  3 +-
>  2 files changed, 33 insertions(+), 1 deletion(-)
>  create mode 100644 meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch
>
> diff --git a/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch b/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch
> new file mode 100644
> index 000000000..d310d0410
> --- /dev/null
> +++ b/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch
> @@ -0,0 +1,31 @@
> +From 4aa8cf8c93e1fa6ffeb40fc3473f32b1b83af141 Mon Sep 17 00:00:00 2001
> +From: "Ilya A. Kriveshko" <iillyyaa@gmail.com>
> +Date: Tue, 2 Jan 2024 15:37:10 -0500
> +Subject: [PATCH] cmake: respect explicit install prefix
> +
> +If CMAKE_INSTALL_PREFIX was supplied externally, use it.  This follows
> +the pattern suggested by cmake documentation in:
> +https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
> +
> +Upstream-status: Submitted

It will be good to add the tag to point to location of upstream
submitted location

Upstream-Status: Submitted [url detailing where the submission activity is]

> +---
> + CMakeLists.txt | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/CMakeLists.txt b/CMakeLists.txt
> +index 74b8108c..ac9f464e 100644
> +--- a/CMakeLists.txt
> ++++ b/CMakeLists.txt
> +@@ -30,9 +30,9 @@ include(InstallRequiredSystemLibraries)
> + include(GNUInstallDirs)
> +
> + # FHS compliant paths for Linux installation
> +-if(NOT WIN32 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
> +-#  set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}")
> +-  set(CMAKE_INSTALL_PREFIX "/usr")
> ++if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
> ++        AND NOT WIN32 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
> ++  set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install prefix" FORCE)
> + endif()
> +
> + # Pull in the rest of the pieces
> diff --git a/meta-oe/recipes-support/srecord/srecord_1.65.0.bb b/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
> index 06ce48e65..3e8a87d07 100644
> --- a/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
> +++ b/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
> @@ -4,11 +4,12 @@ LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later"
>  LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504"
>
>  SRC_URI = " \
>      https://sourceforge.net/projects/${BPN}/files/srecord/${@oe.utils.trim_version('${PV}', 2)}/${BP}-Source.tar.gz \
>      file://0001-Disable-doxygen.patch \
> -    file://0001-cmake-Do-not-try-to-compute-library-dependencies-dur.patch"
> +    file://0001-cmake-Do-not-try-to-compute-library-dependencies-dur.patch \
> +    file://0001-cmake-respect-explicit-install-prefix.patch"
>  SRC_URI[sha256sum] = "81c3d07cf15ce50441f43a82cefd0ac32767c535b5291bcc41bd2311d1337644"
>  S = "${WORKDIR}/${BP}-Source"
>
>  UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/srecord/files/releases"
>
> --
> 2.39.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#108019): https://lists.openembedded.org/g/openembedded-devel/message/108019
> Mute This Topic: https://lists.openembedded.org/mt/103487925/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Ilya A. Kriveshko Jan. 2, 2024, 10:24 p.m. UTC | #2
On Tue, Jan 2, 2024 at 4:49 PM Khem Raj <raj.khem@gmail.com> wrote:

> It will be good to add the tag to point to location of upstream
> submitted location
>
> Upstream-Status: Submitted [url detailing where the submission activity is]
>

Sorry, I should have anticipated this.  Still learning the submission
process ropes.
Thank you, and stand by for an updated patch.
diff mbox series

Patch

diff --git a/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch b/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch
new file mode 100644
index 000000000..d310d0410
--- /dev/null
+++ b/meta-oe/recipes-support/srecord/files/0001-cmake-respect-explicit-install-prefix.patch
@@ -0,0 +1,31 @@ 
+From 4aa8cf8c93e1fa6ffeb40fc3473f32b1b83af141 Mon Sep 17 00:00:00 2001
+From: "Ilya A. Kriveshko" <iillyyaa@gmail.com>
+Date: Tue, 2 Jan 2024 15:37:10 -0500
+Subject: [PATCH] cmake: respect explicit install prefix
+
+If CMAKE_INSTALL_PREFIX was supplied externally, use it.  This follows
+the pattern suggested by cmake documentation in:
+https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT.html
+
+Upstream-status: Submitted
+---
+ CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 74b8108c..ac9f464e 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -30,9 +30,9 @@ include(InstallRequiredSystemLibraries)
+ include(GNUInstallDirs)
+ 
+ # FHS compliant paths for Linux installation
+-if(NOT WIN32 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+-#  set(CMAKE_INSTALL_PREFIX "/opt/${PROJECT_NAME}")
+-  set(CMAKE_INSTALL_PREFIX "/usr")
++if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
++        AND NOT WIN32 AND CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
++  set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install prefix" FORCE)
+ endif()
+ 
+ # Pull in the rest of the pieces
diff --git a/meta-oe/recipes-support/srecord/srecord_1.65.0.bb b/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
index 06ce48e65..3e8a87d07 100644
--- a/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
+++ b/meta-oe/recipes-support/srecord/srecord_1.65.0.bb
@@ -4,11 +4,12 @@  LICENSE = "GPL-3.0-or-later & LGPL-3.0-or-later"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=d32239bcb673463ab874e80d47fae504"
 
 SRC_URI = " \
     https://sourceforge.net/projects/${BPN}/files/srecord/${@oe.utils.trim_version('${PV}', 2)}/${BP}-Source.tar.gz \
     file://0001-Disable-doxygen.patch \
-    file://0001-cmake-Do-not-try-to-compute-library-dependencies-dur.patch"
+    file://0001-cmake-Do-not-try-to-compute-library-dependencies-dur.patch \
+    file://0001-cmake-respect-explicit-install-prefix.patch"
 SRC_URI[sha256sum] = "81c3d07cf15ce50441f43a82cefd0ac32767c535b5291bcc41bd2311d1337644"
 S = "${WORKDIR}/${BP}-Source"
 
 UPSTREAM_CHECK_URI = "https://sourceforge.net/projects/srecord/files/releases"