All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [meta-oe][PATCH] Add suitesparse
@ 2020-11-09 16:53 greg
  2020-11-09 17:13 ` [oe] " Martin Jansa
  2020-11-09 17:45 ` [oe] " Khem Raj
  0 siblings, 2 replies; 4+ messages in thread
From: greg @ 2020-11-09 16:53 UTC (permalink / raw
  To: openembedded-devel; +Cc: Gregory Anders

---
SuiteSparse is a sparse matrix processing library. It is used by e.g.  
python3-cvxopt (which I am also submitting a patch for) to do things 
like convex optimization.

This is my first submission to meta-openembedded, so please give me 
feedback if there is anything I can improve.

 ...XXFLAGS-from-environment-in-Mongoose.patch | 43 +++++++++++
 ...serve-links-when-installing-libmetis.patch | 22 ++++++
 ...-Add-version-information-to-libmetis.patch | 49 ++++++++++++
 .../suitesparse/suitesparse_5.8.1.bb          | 77 +++++++++++++++++++
 4 files changed, 191 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
 create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
 create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
 create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb

diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
new file mode 100644
index 000000000..c955b5fa7
--- /dev/null
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
@@ -0,0 +1,43 @@
+From 83628b471a1a79dae50bb158fca9448b668dd3a6 Mon Sep 17 00:00:00 2001
+From: Gregory Anders <greg@gpanders.com>
+Date: Wed, 21 Oct 2020 10:43:16 -0600
+Subject: [PATCH] Preserve CXXFLAGS from environment in Mongoose
+
+This allows CXXFLAGS set in the environment to also be used in the CMake
+build process, instead of overwriting them. This is useful in a cross
+compile context where the CXXFLAGS variable might contain necessary
+flags for cross compiling.
+---
+ Mongoose/CMakeLists.txt | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt
+index 7e134ab..91a7f70 100644
+--- a/Mongoose/CMakeLists.txt
++++ b/Mongoose/CMakeLists.txt
+@@ -321,14 +321,14 @@ add_test(Unit_Test_EdgeSep ./tests/mongoose_unit_test_edgesep)
+ message(STATUS "CMAKE_CXX_COMPILER: " ${BoldBlue} ${CMAKE_CXX_COMPILER_ID} ${ColourReset})
+ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+     # using Clang
+-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
+     # Debug flags for Clang
+     SET(CMAKE_CXX_FLAGS_DEBUG "--coverage -g -fwrapv")
+     SET(CMAKE_C_FLAGS_DEBUG "--coverage -g")
+     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage -g")
+ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+     # using GCC
+-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
+     # Debug flags for GCC
+     if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6")
+         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
+@@ -339,7 +339,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage")
+ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
+     # using Intel C++
+-    SET(CMAKE_CXX_FLAGS "-O3 -no-prec-div -xHOST -ipo -fwrapv")
++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -no-prec-div -xHOST -ipo -fwrapv")
+     # Debug flags for Intel
+     SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv")
+     SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall")
diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
new file mode 100644
index 000000000..190eaf164
--- /dev/null
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
@@ -0,0 +1,22 @@
+From 31175fb408a4f5e85e39a9aabd4a29f9d9c1fe25 Mon Sep 17 00:00:00 2001
+From: Gregory Anders <greg@gpanders.com>
+Date: Wed, 21 Oct 2020 15:26:52 -0600
+Subject: [PATCH] Preserve links when installing libmetis
+
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 7631955..57fd022 100644
+--- a/Makefile
++++ b/Makefile
+@@ -76,7 +76,7 @@ ifeq (,$(MY_METIS_LIB))
+ 	@mkdir -p $(INSTALL_LIB)
+ 	@mkdir -p $(INSTALL_INCLUDE)
+ 	@mkdir -p $(INSTALL_DOC)
+-	- $(CP) lib/libmetis.* $(INSTALL_LIB)
++	- $(CP) -d lib/libmetis.* $(INSTALL_LIB)
+ 	- $(CP) metis-5.1.0/manual/manual.pdf $(INSTALL_DOC)/METIS_manual.pdf
+ 	- $(CP) metis-5.1.0/README.txt $(INSTALL_DOC)/METIS_README.txt
+         # the following is needed only on the Mac, so *.dylib is hardcoded:
diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
new file mode 100644
index 000000000..dee6039a8
--- /dev/null
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
@@ -0,0 +1,49 @@
+From 11ab355fdda93b762fcc07ac3f7c6ab1be0a5f5a Mon Sep 17 00:00:00 2001
+From: Gregory Anders <greg@gpanders.com>
+Date: Wed, 21 Oct 2020 15:27:07 -0600
+Subject: [PATCH] Add version information to libmetis
+
+---
+ metis-5.1.0/Makefile                | 8 ++++----
+ metis-5.1.0/libmetis/CMakeLists.txt | 1 +
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/metis-5.1.0/Makefile b/metis-5.1.0/Makefile
+index 9cc03b9..c445d85 100644
+--- a/metis-5.1.0/Makefile
++++ b/metis-5.1.0/Makefile
+@@ -18,8 +18,11 @@ systype = $(shell uname -s)
+ 
+ BUILDDIR = build/$(systype)-$(cputype)
+ 
++VERNUM=5.1.0
++PKGNAME=metis-$(VERNUM)
++
+ # Process configuration options.
+-CONFIG_FLAGS = 
++CONFIG_FLAGS = -DMETIS_VERSION=$(VERNUM)
+ ifeq ($(gklib_path), not-set)
+     gklib_path = GKlib
+ endif
+@@ -52,9 +55,6 @@ ifneq ($(cc), not-set)
+     CONFIG_FLAGS += -DCMAKE_C_COMPILER=$(cc)
+ endif
+ 
+-VERNUM=5.1.0
+-PKGNAME=metis-$(VERNUM)
+-
+ JOBS ?= 1
+ 
+ define run-config
+diff --git a/metis-5.1.0/libmetis/CMakeLists.txt b/metis-5.1.0/libmetis/CMakeLists.txt
+index 120e94d..11bde87 100644
+--- a/metis-5.1.0/libmetis/CMakeLists.txt
++++ b/metis-5.1.0/libmetis/CMakeLists.txt
+@@ -4,6 +4,7 @@ include_directories(.)
+ file(GLOB metis_sources *.c)
+ # Build libmetis.
+ add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
++set_target_properties(metis PROPERTIES VERSION ${METIS_VERSION})
+ if(UNIX)
+   target_link_libraries(metis m)
+ endif()
diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
new file mode 100644
index 000000000..af8b1f856
--- /dev/null
+++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
@@ -0,0 +1,77 @@
+LICENSE = "GPLv2 & GPLv3 & BSD-3-Clause & LGPL-2.0 & Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f9f2b9d61cb769a67c4cd079e1166de7"
+SRC_URI = "git://github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https \
+           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 \
+           "
+
+SRC_URI[md5sum] = "c414679bbc9432a3def01b31ad921140"
+SRC_URI[sha256sum] = "06726e471fbaa55f792578f9b4ab282ea9d008cf39ddcc3b42b73400acddef40"
+
+SRCREV = "v${PV}"
+
+S = "${WORKDIR}/git"
+
+DEPENDS = "cmake-native lapack gmp mpfr chrpath-native"
+
+PROVIDES = "mongoose graphblas"
+RPROVIDES_${PN} = "mongoose graphblas"
+
+# The values of $CC, $CXX, and $LD that Bitbake uses have spaces in them which
+# causes problems when the SuiteSparse Makefiles try to pass these values on
+# the command line. To get around this problem, set these variables to only the
+# program name and prepend the rest of the value onto the corresponding FLAGS
+# variable.
+CFLAGS_prepend := "${@" ".join(d.getVar('CC', True).split()[1:])} "
+export CC := "${@d.getVar('CC', True).split()[0]}"
+
+CXXFLAGS_prepend := "${@" ".join(d.getVar('CXX', True).split()[1:])} "
+export CXX := "${@d.getVar('CXX', True).split()[0]}"
+
+LDFLAGS_prepend := "${@" ".join(d.getVar('LD', True).split()[1:])} "
+export LD := "${@d.getVar('LD', True).split()[0]}"
+
+export CMAKE_OPTIONS = " \
+    -DCMAKE_INSTALL_PREFIX=${D}${prefix} \
+    -DCMAKE_INSTALL_LIBDIR=${baselib} \
+"
+
+do_compile () {
+	oe_runmake library
+}
+
+do_install () {
+	oe_runmake prefix=${D}${prefix} INSTALL=${D}${prefix} install
+
+        # Remove runtime paths from shared libraries
+        for file in ${D}${libdir}/*.so.*; do
+            if [ ! -L "$file" ]; then
+                chrpath -d "$file"
+            fi
+        done
+}
+
+FILES_${PN} += " \
+    ${libdir}/libmongoose.so.* \
+    ${libdir}/libgraphblas.so.* \
+    ${libdir}/libmetis.so.* \
+    ${libdir}/libsuitesparseconfig.so.* \
+    ${libdir}/libamd.so.* \
+    ${libdir}/libbtf.so.* \
+    ${libdir}/libcamd.so.* \
+    ${libdir}/libccolamd.so.* \
+    ${libdir}/libcolamd.so.* \
+    ${libdir}/libcholmod.so.* \
+    ${libdir}/libcxsparse.so.* \
+    ${libdir}/libldl.so.* \
+    ${libdir}/libklu.so.* \
+    ${libdir}/libumfpack.so.* \
+    ${libdir}/librbio.so.* \
+    ${libdir}/libspqr.so.* \
+    ${libdir}/libsliplu.so.* \
+    ${bindir}/mongoose \
+"
+
+FILES_${PN}-staticdev += "${libdir}/libmongoose.a"
+FILES_${PN}-dev += "${includedir} ${libdir}/*.so"
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [oe] [meta-oe][PATCH] Add suitesparse
  2020-11-09 16:53 [meta-oe][PATCH] Add suitesparse greg
@ 2020-11-09 17:13 ` Martin Jansa
  2020-11-09 18:37   ` ?utf-8?q?_=5Boe=5D?= " Gregory Anders
  2020-11-09 17:45 ` [oe] " Khem Raj
  1 sibling, 1 reply; 4+ messages in thread
From: Martin Jansa @ 2020-11-09 17:13 UTC (permalink / raw
  To: Gregory Anders; +Cc: openembedded-devel

[-- Attachment #1: Type: text/plain, Size: 10948 bytes --]

I don't have strong opinion, but when I was adding suitesparse to meta-ros
a while ago, it was a bit easier to build each library separately as in:
https://github.com/ros/meta-ros/commit/1242e0ce3c84a05363fc11244a8a6ac0e08de4e9
not sure if that changed between 5.4 and 5.8. It might be still useful to
package them separately.

If all works fine now with 5.8 I will be happy to drop it from meta-ros
once this is merged in meta-oe.

On Mon, Nov 9, 2020 at 5:54 PM Gregory Anders <greg@gpanders.com> wrote:

> ---
> SuiteSparse is a sparse matrix processing library. It is used by e.g.
> python3-cvxopt (which I am also submitting a patch for) to do things
> like convex optimization.
>
> This is my first submission to meta-openembedded, so please give me
> feedback if there is anything I can improve.
>
>  ...XXFLAGS-from-environment-in-Mongoose.patch | 43 +++++++++++
>  ...serve-links-when-installing-libmetis.patch | 22 ++++++
>  ...-Add-version-information-to-libmetis.patch | 49 ++++++++++++
>  .../suitesparse/suitesparse_5.8.1.bb          | 77 +++++++++++++++++++
>  4 files changed, 191 insertions(+)
>  create mode 100644
> meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
>  create mode 100644
> meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
>  create mode 100644
> meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/
> suitesparse_5.8.1.bb
>
> diff --git
> a/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
> new file mode 100644
> index 000000000..c955b5fa7
> --- /dev/null
> +++
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
> @@ -0,0 +1,43 @@
> +From 83628b471a1a79dae50bb158fca9448b668dd3a6 Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 10:43:16 -0600
> +Subject: [PATCH] Preserve CXXFLAGS from environment in Mongoose
> +
> +This allows CXXFLAGS set in the environment to also be used in the CMake
> +build process, instead of overwriting them. This is useful in a cross
> +compile context where the CXXFLAGS variable might contain necessary
> +flags for cross compiling.
> +---
> + Mongoose/CMakeLists.txt | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt
> +index 7e134ab..91a7f70 100644
> +--- a/Mongoose/CMakeLists.txt
> ++++ b/Mongoose/CMakeLists.txt
> +@@ -321,14 +321,14 @@ add_test(Unit_Test_EdgeSep
> ./tests/mongoose_unit_test_edgesep)
> + message(STATUS "CMAKE_CXX_COMPILER: " ${BoldBlue}
> ${CMAKE_CXX_COMPILER_ID} ${ColourReset})
> + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR
> "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
> +     # using Clang
> +-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
> +     # Debug flags for Clang
> +     SET(CMAKE_CXX_FLAGS_DEBUG "--coverage -g -fwrapv")
> +     SET(CMAKE_C_FLAGS_DEBUG "--coverage -g")
> +     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage -g")
> + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
> +     # using GCC
> +-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
> +     # Debug flags for GCC
> +     if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6")
> +         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
> +@@ -339,7 +339,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
> +     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage")
> + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
> +     # using Intel C++
> +-    SET(CMAKE_CXX_FLAGS "-O3 -no-prec-div -xHOST -ipo -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -no-prec-div -xHOST -ipo
> -fwrapv")
> +     # Debug flags for Intel
> +     SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv")
> +     SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall")
> diff --git
> a/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
> new file mode 100644
> index 000000000..190eaf164
> --- /dev/null
> +++
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
> @@ -0,0 +1,22 @@
> +From 31175fb408a4f5e85e39a9aabd4a29f9d9c1fe25 Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 15:26:52 -0600
> +Subject: [PATCH] Preserve links when installing libmetis
> +
> +---
> + Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 7631955..57fd022 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -76,7 +76,7 @@ ifeq (,$(MY_METIS_LIB))
> +       @mkdir -p $(INSTALL_LIB)
> +       @mkdir -p $(INSTALL_INCLUDE)
> +       @mkdir -p $(INSTALL_DOC)
> +-      - $(CP) lib/libmetis.* $(INSTALL_LIB)
> ++      - $(CP) -d lib/libmetis.* $(INSTALL_LIB)
> +       - $(CP) metis-5.1.0/manual/manual.pdf
> $(INSTALL_DOC)/METIS_manual.pdf
> +       - $(CP) metis-5.1.0/README.txt $(INSTALL_DOC)/METIS_README.txt
> +         # the following is needed only on the Mac, so *.dylib is
> hardcoded:
> diff --git
> a/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
> new file mode 100644
> index 000000000..dee6039a8
> --- /dev/null
> +++
> b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
> @@ -0,0 +1,49 @@
> +From 11ab355fdda93b762fcc07ac3f7c6ab1be0a5f5a Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 15:27:07 -0600
> +Subject: [PATCH] Add version information to libmetis
> +
> +---
> + metis-5.1.0/Makefile                | 8 ++++----
> + metis-5.1.0/libmetis/CMakeLists.txt | 1 +
> + 2 files changed, 5 insertions(+), 4 deletions(-)
> +
> +diff --git a/metis-5.1.0/Makefile b/metis-5.1.0/Makefile
> +index 9cc03b9..c445d85 100644
> +--- a/metis-5.1.0/Makefile
> ++++ b/metis-5.1.0/Makefile
> +@@ -18,8 +18,11 @@ systype = $(shell uname -s)
> +
> + BUILDDIR = build/$(systype)-$(cputype)
> +
> ++VERNUM=5.1.0
> ++PKGNAME=metis-$(VERNUM)
> ++
> + # Process configuration options.
> +-CONFIG_FLAGS =
> ++CONFIG_FLAGS = -DMETIS_VERSION=$(VERNUM)
> + ifeq ($(gklib_path), not-set)
> +     gklib_path = GKlib
> + endif
> +@@ -52,9 +55,6 @@ ifneq ($(cc), not-set)
> +     CONFIG_FLAGS += -DCMAKE_C_COMPILER=$(cc)
> + endif
> +
> +-VERNUM=5.1.0
> +-PKGNAME=metis-$(VERNUM)
> +-
> + JOBS ?= 1
> +
> + define run-config
> +diff --git a/metis-5.1.0/libmetis/CMakeLists.txt
> b/metis-5.1.0/libmetis/CMakeLists.txt
> +index 120e94d..11bde87 100644
> +--- a/metis-5.1.0/libmetis/CMakeLists.txt
> ++++ b/metis-5.1.0/libmetis/CMakeLists.txt
> +@@ -4,6 +4,7 @@ include_directories(.)
> + file(GLOB metis_sources *.c)
> + # Build libmetis.
> + add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources}
> ${metis_sources})
> ++set_target_properties(metis PROPERTIES VERSION ${METIS_VERSION})
> + if(UNIX)
> +   target_link_libraries(metis m)
> + endif()
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
> b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
> new file mode 100644
> index 000000000..af8b1f856
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
> @@ -0,0 +1,77 @@
> +LICENSE = "GPLv2 & GPLv3 & BSD-3-Clause & LGPL-2.0 & Apache-2.0"
> +LIC_FILES_CHKSUM =
> "file://LICENSE.txt;md5=f9f2b9d61cb769a67c4cd079e1166de7"
> +SRC_URI = "git://
> github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https \
> +
>  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 \
> +           "
> +
> +SRC_URI[md5sum] = "c414679bbc9432a3def01b31ad921140"
> +SRC_URI[sha256sum] =
> "06726e471fbaa55f792578f9b4ab282ea9d008cf39ddcc3b42b73400acddef40"
> +
> +SRCREV = "v${PV}"
> +
> +S = "${WORKDIR}/git"
> +
> +DEPENDS = "cmake-native lapack gmp mpfr chrpath-native"
> +
> +PROVIDES = "mongoose graphblas"
> +RPROVIDES_${PN} = "mongoose graphblas"
> +
> +# The values of $CC, $CXX, and $LD that Bitbake uses have spaces in them
> which
> +# causes problems when the SuiteSparse Makefiles try to pass these values
> on
> +# the command line. To get around this problem, set these variables to
> only the
> +# program name and prepend the rest of the value onto the corresponding
> FLAGS
> +# variable.
> +CFLAGS_prepend := "${@" ".join(d.getVar('CC', True).split()[1:])} "
> +export CC := "${@d.getVar('CC', True).split()[0]}"
> +
> +CXXFLAGS_prepend := "${@" ".join(d.getVar('CXX', True).split()[1:])} "
> +export CXX := "${@d.getVar('CXX', True).split()[0]}"
> +
> +LDFLAGS_prepend := "${@" ".join(d.getVar('LD', True).split()[1:])} "
> +export LD := "${@d.getVar('LD', True).split()[0]}"
> +
> +export CMAKE_OPTIONS = " \
> +    -DCMAKE_INSTALL_PREFIX=${D}${prefix} \
> +    -DCMAKE_INSTALL_LIBDIR=${baselib} \
> +"
> +
> +do_compile () {
> +       oe_runmake library
> +}
> +
> +do_install () {
> +       oe_runmake prefix=${D}${prefix} INSTALL=${D}${prefix} install
> +
> +        # Remove runtime paths from shared libraries
> +        for file in ${D}${libdir}/*.so.*; do
> +            if [ ! -L "$file" ]; then
> +                chrpath -d "$file"
> +            fi
> +        done
> +}
> +
> +FILES_${PN} += " \
> +    ${libdir}/libmongoose.so.* \
> +    ${libdir}/libgraphblas.so.* \
> +    ${libdir}/libmetis.so.* \
> +    ${libdir}/libsuitesparseconfig.so.* \
> +    ${libdir}/libamd.so.* \
> +    ${libdir}/libbtf.so.* \
> +    ${libdir}/libcamd.so.* \
> +    ${libdir}/libccolamd.so.* \
> +    ${libdir}/libcolamd.so.* \
> +    ${libdir}/libcholmod.so.* \
> +    ${libdir}/libcxsparse.so.* \
> +    ${libdir}/libldl.so.* \
> +    ${libdir}/libklu.so.* \
> +    ${libdir}/libumfpack.so.* \
> +    ${libdir}/librbio.so.* \
> +    ${libdir}/libspqr.so.* \
> +    ${libdir}/libsliplu.so.* \
> +    ${bindir}/mongoose \
> +"
> +
> +FILES_${PN}-staticdev += "${libdir}/libmongoose.a"
> +FILES_${PN}-dev += "${includedir} ${libdir}/*.so"
> --
> 2.29.2
>
>
> 
>
>

[-- Attachment #2: Type: text/html, Size: 13224 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [oe] [meta-oe][PATCH] Add suitesparse
  2020-11-09 16:53 [meta-oe][PATCH] Add suitesparse greg
  2020-11-09 17:13 ` [oe] " Martin Jansa
@ 2020-11-09 17:45 ` Khem Raj
  1 sibling, 0 replies; 4+ messages in thread
From: Khem Raj @ 2020-11-09 17:45 UTC (permalink / raw
  To: Gregory Anders; +Cc: openembeded-devel

On Mon, Nov 9, 2020 at 8:54 AM Gregory Anders <greg@gpanders.com> wrote:
>
> ---
> SuiteSparse is a sparse matrix processing library. It is used by e.g.
> python3-cvxopt (which I am also submitting a patch for) to do things
> like convex optimization.
>
> This is my first submission to meta-openembedded, so please give me
> feedback if there is anything I can improve.
>

since this is a new recipe please add it to
meta-oe/recipes-core/packagegroups/packagegroup-meta-oe.bb
in appropriate packagegroup as well.

>  ...XXFLAGS-from-environment-in-Mongoose.patch | 43 +++++++++++
>  ...serve-links-when-installing-libmetis.patch | 22 ++++++
>  ...-Add-version-information-to-libmetis.patch | 49 ++++++++++++
>  .../suitesparse/suitesparse_5.8.1.bb          | 77 +++++++++++++++++++
>  4 files changed, 191 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
>  create mode 100644 meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
>
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
> new file mode 100644
> index 000000000..c955b5fa7
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0001-Preserve-CXXFLAGS-from-environment-in-Mongoose.patch
> @@ -0,0 +1,43 @@
> +From 83628b471a1a79dae50bb158fca9448b668dd3a6 Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 10:43:16 -0600
> +Subject: [PATCH] Preserve CXXFLAGS from environment in Mongoose
> +
> +This allows CXXFLAGS set in the environment to also be used in the CMake
> +build process, instead of overwriting them. This is useful in a cross
> +compile context where the CXXFLAGS variable might contain necessary
> +flags for cross compiling.
> +---
> + Mongoose/CMakeLists.txt | 6 +++---
> + 1 file changed, 3 insertions(+), 3 deletions(-)
> +
> +diff --git a/Mongoose/CMakeLists.txt b/Mongoose/CMakeLists.txt
> +index 7e134ab..91a7f70 100644
> +--- a/Mongoose/CMakeLists.txt
> ++++ b/Mongoose/CMakeLists.txt
> +@@ -321,14 +321,14 @@ add_test(Unit_Test_EdgeSep ./tests/mongoose_unit_test_edgesep)
> + message(STATUS "CMAKE_CXX_COMPILER: " ${BoldBlue} ${CMAKE_CXX_COMPILER_ID} ${ColourReset})
> + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
> +     # using Clang
> +-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
> +     # Debug flags for Clang
> +     SET(CMAKE_CXX_FLAGS_DEBUG "--coverage -g -fwrapv")
> +     SET(CMAKE_C_FLAGS_DEBUG "--coverage -g")
> +     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "--coverage -g")
> + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
> +     # using GCC
> +-    SET(CMAKE_CXX_FLAGS "-O3 -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -fwrapv")
> +     # Debug flags for GCC
> +     if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.6")
> +         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
> +@@ -339,7 +339,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
> +     SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "-fprofile-arcs -ftest-coverage")
> + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
> +     # using Intel C++
> +-    SET(CMAKE_CXX_FLAGS "-O3 -no-prec-div -xHOST -ipo -fwrapv")
> ++    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -no-prec-div -xHOST -ipo -fwrapv")
> +     # Debug flags for Intel
> +     SET(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall -fwrapv")
> +     SET(CMAKE_C_FLAGS_DEBUG "-g -O0 -Wall")
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
> new file mode 100644
> index 000000000..190eaf164
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0002-Preserve-links-when-installing-libmetis.patch
> @@ -0,0 +1,22 @@
> +From 31175fb408a4f5e85e39a9aabd4a29f9d9c1fe25 Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 15:26:52 -0600
> +Subject: [PATCH] Preserve links when installing libmetis
> +
> +---
> + Makefile | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/Makefile b/Makefile
> +index 7631955..57fd022 100644
> +--- a/Makefile
> ++++ b/Makefile
> +@@ -76,7 +76,7 @@ ifeq (,$(MY_METIS_LIB))
> +       @mkdir -p $(INSTALL_LIB)
> +       @mkdir -p $(INSTALL_INCLUDE)
> +       @mkdir -p $(INSTALL_DOC)
> +-      - $(CP) lib/libmetis.* $(INSTALL_LIB)
> ++      - $(CP) -d lib/libmetis.* $(INSTALL_LIB)
> +       - $(CP) metis-5.1.0/manual/manual.pdf $(INSTALL_DOC)/METIS_manual.pdf
> +       - $(CP) metis-5.1.0/README.txt $(INSTALL_DOC)/METIS_README.txt
> +         # the following is needed only on the Mac, so *.dylib is hardcoded:
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
> new file mode 100644
> index 000000000..dee6039a8
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse/0003-Add-version-information-to-libmetis.patch
> @@ -0,0 +1,49 @@
> +From 11ab355fdda93b762fcc07ac3f7c6ab1be0a5f5a Mon Sep 17 00:00:00 2001
> +From: Gregory Anders <greg@gpanders.com>
> +Date: Wed, 21 Oct 2020 15:27:07 -0600
> +Subject: [PATCH] Add version information to libmetis
> +
> +---
> + metis-5.1.0/Makefile                | 8 ++++----
> + metis-5.1.0/libmetis/CMakeLists.txt | 1 +
> + 2 files changed, 5 insertions(+), 4 deletions(-)
> +
> +diff --git a/metis-5.1.0/Makefile b/metis-5.1.0/Makefile
> +index 9cc03b9..c445d85 100644
> +--- a/metis-5.1.0/Makefile
> ++++ b/metis-5.1.0/Makefile
> +@@ -18,8 +18,11 @@ systype = $(shell uname -s)
> +
> + BUILDDIR = build/$(systype)-$(cputype)
> +
> ++VERNUM=5.1.0
> ++PKGNAME=metis-$(VERNUM)
> ++
> + # Process configuration options.
> +-CONFIG_FLAGS =
> ++CONFIG_FLAGS = -DMETIS_VERSION=$(VERNUM)
> + ifeq ($(gklib_path), not-set)
> +     gklib_path = GKlib
> + endif
> +@@ -52,9 +55,6 @@ ifneq ($(cc), not-set)
> +     CONFIG_FLAGS += -DCMAKE_C_COMPILER=$(cc)
> + endif
> +
> +-VERNUM=5.1.0
> +-PKGNAME=metis-$(VERNUM)
> +-
> + JOBS ?= 1
> +
> + define run-config
> +diff --git a/metis-5.1.0/libmetis/CMakeLists.txt b/metis-5.1.0/libmetis/CMakeLists.txt
> +index 120e94d..11bde87 100644
> +--- a/metis-5.1.0/libmetis/CMakeLists.txt
> ++++ b/metis-5.1.0/libmetis/CMakeLists.txt
> +@@ -4,6 +4,7 @@ include_directories(.)
> + file(GLOB metis_sources *.c)
> + # Build libmetis.
> + add_library(metis ${METIS_LIBRARY_TYPE} ${GKlib_sources} ${metis_sources})
> ++set_target_properties(metis PROPERTIES VERSION ${METIS_VERSION})
> + if(UNIX)
> +   target_link_libraries(metis m)
> + endif()
> diff --git a/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
> new file mode 100644
> index 000000000..af8b1f856
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/suitesparse/suitesparse_5.8.1.bb
> @@ -0,0 +1,77 @@
> +LICENSE = "GPLv2 & GPLv3 & BSD-3-Clause & LGPL-2.0 & Apache-2.0"
> +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=f9f2b9d61cb769a67c4cd079e1166de7"
> +SRC_URI = "git://github.com/DrTimothyAldenDavis/SuiteSparse;protocol=https \
> +           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 \
> +           "
> +
> +SRC_URI[md5sum] = "c414679bbc9432a3def01b31ad921140"
> +SRC_URI[sha256sum] = "06726e471fbaa55f792578f9b4ab282ea9d008cf39ddcc3b42b73400acddef40"
> +
> +SRCREV = "v${PV}"
> +
> +S = "${WORKDIR}/git"
> +
> +DEPENDS = "cmake-native lapack gmp mpfr chrpath-native"
> +
> +PROVIDES = "mongoose graphblas"
> +RPROVIDES_${PN} = "mongoose graphblas"
> +
> +# The values of $CC, $CXX, and $LD that Bitbake uses have spaces in them which
> +# causes problems when the SuiteSparse Makefiles try to pass these values on
> +# the command line. To get around this problem, set these variables to only the
> +# program name and prepend the rest of the value onto the corresponding FLAGS
> +# variable.
> +CFLAGS_prepend := "${@" ".join(d.getVar('CC', True).split()[1:])} "
> +export CC := "${@d.getVar('CC', True).split()[0]}"
> +
> +CXXFLAGS_prepend := "${@" ".join(d.getVar('CXX', True).split()[1:])} "
> +export CXX := "${@d.getVar('CXX', True).split()[0]}"
> +
> +LDFLAGS_prepend := "${@" ".join(d.getVar('LD', True).split()[1:])} "
> +export LD := "${@d.getVar('LD', True).split()[0]}"
> +
> +export CMAKE_OPTIONS = " \
> +    -DCMAKE_INSTALL_PREFIX=${D}${prefix} \
> +    -DCMAKE_INSTALL_LIBDIR=${baselib} \
> +"
> +
> +do_compile () {
> +       oe_runmake library
> +}
> +
> +do_install () {
> +       oe_runmake prefix=${D}${prefix} INSTALL=${D}${prefix} install
> +
> +        # Remove runtime paths from shared libraries
> +        for file in ${D}${libdir}/*.so.*; do
> +            if [ ! -L "$file" ]; then
> +                chrpath -d "$file"
> +            fi
> +        done
> +}
> +
> +FILES_${PN} += " \
> +    ${libdir}/libmongoose.so.* \
> +    ${libdir}/libgraphblas.so.* \
> +    ${libdir}/libmetis.so.* \
> +    ${libdir}/libsuitesparseconfig.so.* \
> +    ${libdir}/libamd.so.* \
> +    ${libdir}/libbtf.so.* \
> +    ${libdir}/libcamd.so.* \
> +    ${libdir}/libccolamd.so.* \
> +    ${libdir}/libcolamd.so.* \
> +    ${libdir}/libcholmod.so.* \
> +    ${libdir}/libcxsparse.so.* \
> +    ${libdir}/libldl.so.* \
> +    ${libdir}/libklu.so.* \
> +    ${libdir}/libumfpack.so.* \
> +    ${libdir}/librbio.so.* \
> +    ${libdir}/libspqr.so.* \
> +    ${libdir}/libsliplu.so.* \
> +    ${bindir}/mongoose \
> +"
> +
> +FILES_${PN}-staticdev += "${libdir}/libmongoose.a"
> +FILES_${PN}-dev += "${includedir} ${libdir}/*.so"
> --
> 2.29.2
>
>
> 
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ?utf-8?q?_=5Boe=5D?= [meta-oe][PATCH] Add suitesparse
  2020-11-09 17:13 ` [oe] " Martin Jansa
@ 2020-11-09 18:37   ` Gregory Anders
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory Anders @ 2020-11-09 18:37 UTC (permalink / raw
  To: Martin Jansa; +Cc: openembedded-devel

On Monday, November 09, 2020 10:13 MST, Martin Jansa <martin.jansa@gmail.com> wrote:

> I don't have strong opinion, but when I was adding suitesparse to meta-ros
> a while ago, it was a bit easier to build each library separately as in:
> https://github.com/ros/meta-ros/commit/1242e0ce3c84a05363fc11244a8a6ac0e08de4e9
> not sure if that changed between 5.4 and 5.8. It might be still useful to
> package them separately.
>
> If all works fine now with 5.8 I will be happy to drop it from meta-ros
> once this is merged in meta-oe.
>

Granted, I've only tested it against compiling python3-cvxopt, but it seems to work for me. I did have to make a few patches in order to get the compiler and linker flags to pass through to the SuiteSparse build step and also to correctly generate a versioned .so file for one of the libraries, but those were the only issues I ran into.

I do not use meta-ros (and I have to admit that I was ignorant to its existence before your email), so it would be worth testing my recipe against any other recipes in meta-ros that depend on SuiteSparse to ensure it works as expected.

- G


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-09 18:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-09 16:53 [meta-oe][PATCH] Add suitesparse greg
2020-11-09 17:13 ` [oe] " Martin Jansa
2020-11-09 18:37   ` ?utf-8?q?_=5Boe=5D?= " Gregory Anders
2020-11-09 17:45 ` [oe] " Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.