Skip to contentSkip to conversation

abseil-cpp: A little clean-up

PATCH New Peter Kjellerstedt 1 participant 2 messages Mar 11, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 abseil-cpp: A little clean-up

* Remove ASNEEDED:class-native and ASNEEDED:class-nativesdk as they make no difference since ${ASNEEDED} is only added to TARGET_LDFLAGS.
* Remove additions to FILES:${PN}-dev since the added paths are already added by default.

---

This restores the two commits that were (presumably) acidentally reverted in commit 903c8e58ed2240f7214261c9005a38f15d782c29.

 .../recipes-devtools/abseil-cpp/abseil-cpp_20240116.1.bb | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20240116.1.bb +2 -7
index 82b2d20e0..9cb325870 100644
@@ -1,7 +1,7 @@
 SUMMARY = "Abseil is a cpp library like STL"
 DESCRIPTION = "Abseil provides pieces missing from the C++ standard. Contains \
 additional useful libraries like algorithm, container, debugging, hash, memory, \
-meta, numeric, strings, synchronization, time, types and utility"
+meta, numeric, strings, synchronization, time, types and utility."
 HOMEPAGE = "https://abseil.io/"
 SECTION = "libs"
 LICENSE = "Apache-2.0"
@@ -18,9 +18,6 @@ SRC_URI = "git://github.com/abseil/abseil-cpp;branch=${BRANCH};protocol=https \
 
 S = "${WORKDIR}/git"
 
-ASNEEDED:class-native = ""
-ASNEEDED:class-nativesdk = ""
-
 inherit cmake
 
 EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON \
@@ -28,8 +25,6 @@ EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON \
                  -DABSL_ENABLE_INSTALL=ON \
                 "
 
-BBCLASSEXTEND = "native nativesdk"
-
 SYSROOT_DIRS:append:class-nativesdk:mingw32 = " ${bindir}"
 
-FILES:${PN}-dev += "${includedir} ${libdir}/cmake ${libdir}/pkgconfig"
+BBCLASSEXTEND = "native nativesdk"
#1 lore raw

PATCH 2/2 abseil-cpp: Split so-files into separate packages

From: Ola x Nilsson <[email protected]>

Use PACKAGES_DYNAMIC and PACKAGESPLITFUNCS to put each shared object into its own package named libabsl-*.
The shared objects depend on each other which means you still get a lot of them if you link against a single one.

The main package abseil-cpp RDEPENDS on all of the libabsl-* packages.

---
 .../abseil-cpp/abseil-cpp_20240116.1.bb       | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
meta-oe/recipes-devtools/abseil-cpp/abseil-cpp_20240116.1.bb +23 -0
index 9cb325870..e6c65d306 100644
@@ -27,4 +27,27 @@ EXTRA_OECMAKE = "-DBUILD_SHARED_LIBS=ON \
 
 SYSROOT_DIRS:append:class-nativesdk:mingw32 = " ${bindir}"
 
+PACKAGES_DYNAMIC = "^libabsl-*"
+PACKAGES_DYNAMIC:class-native = ""
+
+PACKAGESPLITFUNCS =+ "split_dynamic_packages"
+
+python split_dynamic_packages() {
+    libdir = d.getVar('libdir')
+
+    libpackages = do_split_packages(
+        d,
+        root=libdir,
+        file_regex=r'^libabsl_(.*)\.so\..*$',
+        output_pattern='libabsl-%s',
+        description="abseil shared library %s",
+        prepend=True,
+        extra_depends='',
+    )
+    if libpackages:
+        d.appendVar('RDEPENDS:' + d.getVar('PN'), ' ' + ' '.join(libpackages))
+}
+
+ALLOW_EMPTY:${PN} = "1"
+
 BBCLASSEXTEND = "native nativesdk"