diff mbox series

[meta-openembedded] suitesparse: Update after toolchain selection changes

Message ID 20250620101405.2455812-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series [meta-openembedded] suitesparse: Update after toolchain selection changes | expand

Commit Message

Richard Purdie June 20, 2025, 10:14 a.m. UTC
The toolchain selection changes mean CC is not set until after the recipe
is parsed, breaking the manipulations made by this recipe.

Replace it with code to inherit the cmake class, which correctly
configures cmake to use the right compiler/compiler flags.

We need to patch the makefiles to avoid those options being added
incorrectly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 .../suitesparse/makefile-quoting.patch        | 32 +++++++++++++++++++
 .../suitesparse/suitesparse_5.10.1.bb         |  7 ++++
 2 files changed, 39 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch

Comments

Khem Raj June 20, 2025, 5:38 p.m. UTC | #1
Hi RIchard,

This one looks better than other proposals for this recipe so far, but
I am not able to apply it, would be good to rebase it on master-next
and resend

On Fri, Jun 20, 2025 at 3:14 AM Richard Purdie via
lists.openembedded.org
<richard.purdie=linuxfoundation.org@lists.openembedded.org> wrote:
>
> The toolchain selection changes mean CC is not set until after the recipe
> is parsed, breaking the manipulations made by this recipe.
>
> Replace it with code to inherit the cmake class, which correctly
> configures cmake to use the right compiler/compiler flags.
>
> We need to patch the makefiles to avoid those options being added
> incorrectly.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> ---
>  .../suitesparse/makefile-quoting.patch        | 32 +++++++++++++++++++
>  .../suitesparse/suitesparse_5.10.1.bb         |  7 ++++
>  2 files changed, 39 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch
>
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch
> new file mode 100644
> index 0000000000..6bd2ffbb55
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch
> @@ -0,0 +1,32 @@
> +OE's CC and CXX contain spaces and extra options which is incompatible with
> +cmake way of handling them. Remove passing the compiler options this way in
> +favour of our normal cmake toolchain files added elsewhere.
> +
> +Upstream-Status: Pending
> +
> +Index: git/Makefile
> +===================================================================
> +--- git.orig/Makefile
> ++++ git/Makefile
> +@@ -282,7 +282,7 @@ metis: include/metis.h
> + # hardcoded below.
> + include/metis.h:
> + ifeq (,$(MY_METIS_LIB))
> +-      - ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) cc=$(CC) )
> ++      - ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) )
> +       - ( cd metis-5.1.0 && $(MAKE) )
> +       - ( cd metis-5.1.0 && $(MAKE) install )
> +       - $(SO_INSTALL_NAME) $(SUITESPARSE)/lib/libmetis.dylib \
> +Index: git/SuiteSparse_config/SuiteSparse_config.mk
> +===================================================================
> +--- git.orig/SuiteSparse_config/SuiteSparse_config.mk
> ++++ git/SuiteSparse_config/SuiteSparse_config.mk
> +@@ -146,7 +146,7 @@ SUITESPARSE_VERSION = 5.10.1
> +         endif
> +     endif
> +
> +-    CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC)
> ++    #CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC)
> +
> +     #---------------------------------------------------------------------------
> +     # CFLAGS for the C/C++ compiler
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
> index b113145808..29f114a9dc 100644
> --- a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
> @@ -4,6 +4,7 @@ SRC_URI = "git://github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https;branc
>             file://0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch \
>             file://0002-Preserve-links-when-installing-libmetis.patch \
>             file://0003-Add-version-information-to-libmetis.patch \
> +           file://makefile-quoting.patch \
>             "
>  SRCREV = "538273cfd53720a10e34a3d80d3779b607e1ac26"
>
> @@ -14,11 +15,17 @@ DEPENDS = "cmake-native lapack gmp mpfr chrpath-native"
>  PROVIDES = "mongoose graphblas"
>  RPROVIDES:${PN} = "mongoose graphblas"
>
> +inherit cmake
> +
> +B = "${S}"
> +
>  export CMAKE_OPTIONS = " \
>      -DCMAKE_INSTALL_PREFIX=${D}${prefix} \
>      -DCMAKE_INSTALL_LIBDIR=${baselib} \
>  "
>
> +OECMAKE_SOURCEPATH = "${S}/Mongoose ${S}/metis-5.1.0 ${S}/GraphBLAS"
> +
>  do_compile () {
>         oe_runmake library
>  }
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#117967): https://lists.openembedded.org/g/openembedded-devel/message/117967
> Mute This Topic: https://lists.openembedded.org/mt/113739884/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Richard Purdie June 20, 2025, 5:49 p.m. UTC | #2
On Fri, 2025-06-20 at 10:38 -0700, Khem Raj wrote:
> This one looks better than other proposals for this recipe so far,
> but I am not able to apply it, would be good to rebase it on master-
> next
> and resend

I've resent a version where you can drop the patch in master-next and
then apply that one.

Cheers,

Richard
Khem Raj June 20, 2025, 7:31 p.m. UTC | #3
On Fri, Jun 20, 2025 at 10:49 AM Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
>
> On Fri, 2025-06-20 at 10:38 -0700, Khem Raj wrote:
> > This one looks better than other proposals for this recipe so far,
> > but I am not able to apply it, would be good to rebase it on master-
> > next
> > and resend
>
> I've resent a version where you can drop the patch in master-next and
> then apply that one.
>

Right, it did not apply after dropping that, but thanks for v2, that works.

> Cheers,
>
> Richard
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch
new file mode 100644
index 0000000000..6bd2ffbb55
--- /dev/null
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/makefile-quoting.patch
@@ -0,0 +1,32 @@ 
+OE's CC and CXX contain spaces and extra options which is incompatible with 
+cmake way of handling them. Remove passing the compiler options this way in
+favour of our normal cmake toolchain files added elsewhere.
+
+Upstream-Status: Pending
+
+Index: git/Makefile
+===================================================================
+--- git.orig/Makefile
++++ git/Makefile
+@@ -282,7 +282,7 @@ metis: include/metis.h
+ # hardcoded below.
+ include/metis.h:
+ ifeq (,$(MY_METIS_LIB))
+-	- ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) cc=$(CC) )
++	- ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) )
+ 	- ( cd metis-5.1.0 && $(MAKE) )
+ 	- ( cd metis-5.1.0 && $(MAKE) install )
+ 	- $(SO_INSTALL_NAME) $(SUITESPARSE)/lib/libmetis.dylib \
+Index: git/SuiteSparse_config/SuiteSparse_config.mk
+===================================================================
+--- git.orig/SuiteSparse_config/SuiteSparse_config.mk
++++ git/SuiteSparse_config/SuiteSparse_config.mk
+@@ -146,7 +146,7 @@ SUITESPARSE_VERSION = 5.10.1
+         endif
+     endif
+ 
+-    CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC)
++    #CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC)
+ 
+     #---------------------------------------------------------------------------
+     # CFLAGS for the C/C++ compiler
diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
index b113145808..29f114a9dc 100644
--- a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.10.1.bb
@@ -4,6 +4,7 @@  SRC_URI = "git://github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https;branc
            file://0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch \
            file://0002-Preserve-links-when-installing-libmetis.patch \
            file://0003-Add-version-information-to-libmetis.patch \
+           file://makefile-quoting.patch \
            "
 SRCREV = "538273cfd53720a10e34a3d80d3779b607e1ac26"
 
@@ -14,11 +15,17 @@  DEPENDS = "cmake-native lapack gmp mpfr chrpath-native"
 PROVIDES = "mongoose graphblas"
 RPROVIDES:${PN} = "mongoose graphblas"
 
+inherit cmake
+
+B = "${S}"
+
 export CMAKE_OPTIONS = " \
     -DCMAKE_INSTALL_PREFIX=${D}${prefix} \
     -DCMAKE_INSTALL_LIBDIR=${baselib} \
 "
 
+OECMAKE_SOURCEPATH = "${S}/Mongoose ${S}/metis-5.1.0 ${S}/GraphBLAS"
+
 do_compile () {
 	oe_runmake library
 }