summaryrefslogtreecommitdiff
path: root/sys-libs/basu
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/basu')
-rw-r--r--sys-libs/basu/Manifest3
-rw-r--r--sys-libs/basu/basu-0.2.0-r1.ebuild43
-rw-r--r--sys-libs/basu/files/0001-basu-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch51
-rw-r--r--sys-libs/basu/files/0002-basu-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch44
4 files changed, 141 insertions, 0 deletions
diff --git a/sys-libs/basu/Manifest b/sys-libs/basu/Manifest
index e273ccbf0235..e3b55a96fcf4 100644
--- a/sys-libs/basu/Manifest
+++ b/sys-libs/basu/Manifest
@@ -1,5 +1,8 @@
+AUX 0001-basu-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch 2332 BLAKE2B 6b491a31f320cc15a05c2d9440b5277808d00f2d14507db3d4428b07c54cd9b9edc419c43fe5981b4f233076b9bfa1408f9030376e678bd3f2021482e0b6f057 SHA512 8e100449a13ab5523db117cb0fb97f61ba1fc18f2fb04796c9686bd91f73a2a59aadc6411769b32b54dee69208b4c3812fa5009082ebbfc516886377fceac26c
AUX 0001-basu-0.2.0-meson-add-libcap-option.patch 1222 BLAKE2B 6edec60701a78f5a2f109eccfdc76363379c2c07126cac46b2ce7eab6bce8f51a67b55b5bd8d689acdc11ca703dee3c601512a206f06a6954ae20e87c774abf1 SHA512 a20c6fde6297720654cd2daafbeeb11e6b2b0c1a8c565cd7680b747b7a0b178b0931bd8aede89060e20f473f4ff1dc2bdf06262fc6196515e47ea1cb5a34e1e3
AUX 0002-basu-0.2.0-meson-convert-audit-option-to-feature-object.patch 1574 BLAKE2B 44e2669b30b4f6f254b79031e8f4272e3d002ef152f93754dd93dbca13945d3dc49952de714ce2d5609600f89539417c1d505bd48d51d8e4b7bbd1f2dcfb8dab SHA512 645040b869ad362e4d0dc40210ed63018f224704ab121d59561c039486a9423d1b9f5995df4ddd73de2a6872f5752a006f6a4bc66aa8d8ca3604950072bc59a5
+AUX 0002-basu-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch 1532 BLAKE2B a52ae6a18d6600380fecab3d9d76b2f24460364d6d3b0c9e4c8fc6ac555a5c0ad5d0d87320953053a13e7237db6d7c4da7096e560f316317f2048e176a637a8d SHA512 153db7e469612106b4b0d8e031fde4d714df01b6e0927434f051a64c438bd6f776374bf9156835fb828ba1e7375177d51c89d6210cf634f2d4636fdaf02e4dfd
DIST basu-0.2.0.tar.gz 238861 BLAKE2B 4fcc664d031477c2ae82e535711561d1a7cb60503fb31fa80101c2046e3fe11f7886851649d38f3d5868a3266f45e651085d99ec95f6788baddbf78e893b1528 SHA512 dbc2f72b6e1a880fa41fe6067a38a301f456e4305dae6eb4d465089d7d9c2f629677ba23752b3e1a1fd476cb440db01ef3a218c1c976f38d0058eed584c80165
+EBUILD basu-0.2.0-r1.ebuild 1053 BLAKE2B 93b7c166af1e94fb3a0f4e7d36e5ca45e91bffdc99fa9a10e807f2917aa4d7928e06f7c4680feeb74cba38355393a8334977d31d27fa186a963a7a39cf6caa3a SHA512 63f6e59c6ea9c14308a614ca6e23af15b63effd2e6822be0439192043ab9fa59384727a767dd71b678f2cc6a66e6d5a9a97335beeb6c520fdf80a9048312f03d
EBUILD basu-0.2.0.ebuild 871 BLAKE2B 280617e4049db3c9b9588ae5cc14d2d20b34bb7cc2f58406b06052a2e66602393795f12d0ab6fb026f095308d5b621680c30c122bdd6b3b99f1e2de68d2670da SHA512 e692aeb121525e307eef9707a891f713f4bb6bf6a6822dfd3bc6fb912f7f0390e602530c98b0e7ad831e4d5deaa9af2d91fd70f3863b2e552a2df6cc798d3aa1
MISC metadata.xml 635 BLAKE2B 76f9661d661cd12fc608fa261e1a387755915fba2f9bd1ee148f7d32f3f38560b30334539837b30236ad2e69b7eb4d32e97d451a3a159605d681953e845fbf3f SHA512 e3659d0ab5a3c1bf3cc5f12c537d84a6c3f612efec64a1478899fa7a899637938000eeadd7236a43101f28dfa83e2a5831378bc026807a45c98d9d63c4f2db6f
diff --git a/sys-libs/basu/basu-0.2.0-r1.ebuild b/sys-libs/basu/basu-0.2.0-r1.ebuild
new file mode 100644
index 000000000000..97527d28343c
--- /dev/null
+++ b/sys-libs/basu/basu-0.2.0-r1.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+inherit meson python-any-r1
+
+DESCRIPTION="The sd-bus library, extracted from systemd"
+HOMEPAGE="https://sr.ht/~emersion/basu/"
+LICENSE="LGPL-2.1+"
+SLOT="0"
+
+SRC_URI="https://git.sr.ht/~emersion/basu/refs/download/v${PV}/basu-${PV}.tar.gz"
+KEYWORDS="amd64"
+
+IUSE="audit caps"
+
+DEPEND="
+ audit? ( sys-process/audit )
+ caps? ( sys-libs/libcap )
+"
+
+RDEPEND="${DEPEND}"
+# Needed to generate hash tables
+BDEPEND="${PYTHON_DEPS}
+ dev-util/gperf
+"
+
+PATCHES=(
+ "${FILESDIR}"/0001-"${PN}"-0.2.0-meson-add-libcap-option.patch
+ "${FILESDIR}"/0002-"${PN}"-0.2.0-meson-convert-audit-option-to-feature-object.patch
+ "${FILESDIR}"/0001-"${PN}"-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch
+ "${FILESDIR}"/0002-"${PN}"-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch
+)
+
+src_configure() {
+ local emesonargs=(
+ $(meson_feature audit)
+ $(meson_feature caps libcap)
+ )
+ meson_src_configure
+}
diff --git a/sys-libs/basu/files/0001-basu-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch b/sys-libs/basu/files/0001-basu-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch
new file mode 100644
index 000000000000..efc4add79542
--- /dev/null
+++ b/sys-libs/basu/files/0001-basu-0.2.0-LLD-13-and-GNU-ld-2.37-support-z-start-stop-gc-which.patch
@@ -0,0 +1,51 @@
+From baa3a54e019b8ba6161fe20943c897490f4bcde8 Mon Sep 17 00:00:00 2001
+From: Fangrui Song <i@maskray.me>
+Date: Sat, 27 Nov 2021 18:19:46 +0100
+Subject: [PATCH basu] LLD 13 and GNU ld 2.37 support -z start-stop-gc which
+ allows garbage collection of C identifier name sections despite the
+ __start_/__stop_ references. Simply set the retain attribute so that GCC 11
+ (if configure-time binutils is 2.36 or newer)/Clang 13 will set the
+ SHF_GNU_RETAIN section attribute to prevent garbage collection.
+
+Without the patch, there are linker errors like the following with -z
+start-stop-gc.
+
+```
+ld: error: undefined symbol: __start_SYSTEMD_BUS_ERROR_MAP
+>>> referenced by bus-error.c:93 (../src/libsystemd/sd-bus/bus-error.c:93)
+>>> sd-bus_bus-error.c.o:(bus_error_name_to_errno) in archive src/libsystemd/libsystemd_static.a
+```
+
+Co-authored-by: Evgeniy Khramtsov <evgeniy@khramtsov.org>
+---
+Upstream: https://git.sr.ht/~emersion/basu/commit/5fa970e868f25ebc79ccca9b1d9df4c030d97661
+Gentoo bug: https://bugs.gentoo.org/832045
+
+ src/libsystemd/sd-bus/bus-error.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/libsystemd/sd-bus/bus-error.h b/src/libsystemd/sd-bus/bus-error.h
+index 06c478a..883213f 100644
+--- a/src/libsystemd/sd-bus/bus-error.h
++++ b/src/libsystemd/sd-bus/bus-error.h
+@@ -28,11 +28,17 @@ int bus_error_set_errnofv(sd_bus_error *e, int error, const char *format, va_lis
+ * the bus error table, and BUS_ERROR_MAP_ELF_USE has to be used at
+ * least once per compilation unit (i.e. per library), to ensure that
+ * the error map is really added to the final binary.
++ *
++ * In addition, set the retain attribute so that the section cannot be
++ * discarded by ld --gc-sections -z start-stop-gc. Older compilers would
++ * warn for the unknown attribute, so just disable -Wattributes.
+ */
+
+ #define BUS_ERROR_MAP_ELF_REGISTER \
++ _Pragma("GCC diagnostic ignored \"-Wattributes\"") \
+ __attribute__ ((__section__("BUS_ERROR_MAP"))) \
+ __attribute__ ((__used__)) \
++ __attribute__ ((retain)) \
+ __attribute__ ((aligned(8)))
+
+ #define BUS_ERROR_MAP_ELF_USE(errors) \
+--
+2.34.1
+
diff --git a/sys-libs/basu/files/0002-basu-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch b/sys-libs/basu/files/0002-basu-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch
new file mode 100644
index 000000000000..c0a9399ecf77
--- /dev/null
+++ b/sys-libs/basu/files/0002-basu-0.2.0-meson-fix-linking-on-LLD-13-LD-2.37-and-older-CCs.patch
@@ -0,0 +1,44 @@
+From c4d9f5aac80d02b7e7447d2eda698e17a245071e Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Arsen=20Arsenovi=C4=87?= <arsen@aarsen.me>
+Date: Tue, 25 Jan 2022 18:36:36 +0100
+Subject: [PATCH basu] meson: fix linking on LLD 13/LD 2.37 and older CCs
+
+For compilers that do not support __attribute((retain)),
+-z no-start-stop-gc is a requirement.
+---
+Submitted at: https://lists.sr.ht/~emersion/public-inbox/patches/28722#%3C20220125192953.1781959-1-arsen@aarsen.me%3E
+Gentoo bug: https://bugs.gentoo.org/832045
+
+ meson.build | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/meson.build b/meson.build
+index 1f29690..74e9934 100644
+--- a/meson.build
++++ b/meson.build
+@@ -101,6 +101,22 @@ if get_option('buildtype') != 'debug'
+ possible_link_flags += '-Wl,--gc-sections'
+ endif
+
++if cc.get_id() in ['gcc', 'clang']
++# XXX(arsen): remember to update with a future meson release
++ has_retain_attr = cc.compiles(
++ '__attribute__((retain)) int x;',
++ args : ['-Werror=attributes'],
++ name : 'compiler supports __attribute__((retain))'
++ )
++
++ if not has_retain_attr and cc.has_link_argument('-Wl,-z,start-stop-gc')
++ possible_link_flags += [
++ '-Wl,-z,nostart-stop-gc'
++ ]
++ endif
++endif
++
++
+ add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'c')
+ add_project_link_arguments(cc.get_supported_link_arguments(possible_link_flags), language : 'c')
+
+--
+2.34.1
+