Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 7/7] dev-libs/libbsd: Strip prefix from paths in ld script
Date: Sat, 21 Jan 2023 22:23:17
Message-Id: 20230121222037.29094-8-chewi@gentoo.org
In Reply to: [gentoo-dev] Allow prefixed systems to be cross-compiled by James Le Cuirot
1 ld scripts on standalone prefix (RAP) systems should have the prefix stripped
2 from any paths, as the sysroot is automatically prepended.
3
4 I originally thought this script was just used to apply --as-needed and was
5 therefore unneeded. It's actually used to automatically link libmd when it is
6 needed.
7
8 Signed-off-by: James Le Cuirot <chewi@g.o>
9 ---
10 dev-libs/libbsd/libbsd-0.11.7-r2.ebuild | 43 +++++++++++++++++++++++++
11 1 file changed, 43 insertions(+)
12 create mode 100644 dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
13
14 diff --git a/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild b/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
15 new file mode 100644
16 index 000000000000..0fcfb6bd563b
17 --- /dev/null
18 +++ b/dev-libs/libbsd/libbsd-0.11.7-r2.ebuild
19 @@ -0,0 +1,43 @@
20 +# Copyright 1999-2022 Gentoo Authors
21 +# Distributed under the terms of the GNU General Public License v2
22 +
23 +EAPI=8
24 +
25 +VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/guillemjover.asc
26 +inherit multilib multilib-minimal verify-sig
27 +
28 +DESCRIPTION="Library to provide useful functions commonly found on BSD systems"
29 +HOMEPAGE="https://libbsd.freedesktop.org/wiki/ https://gitlab.freedesktop.org/libbsd/libbsd"
30 +SRC_URI="https://${PN}.freedesktop.org/releases/${P}.tar.xz"
31 +SRC_URI+=" verify-sig? ( https://${PN}.freedesktop.org/releases/${P}.tar.xz.asc )"
32 +
33 +LICENSE="BSD BSD-2 BSD-4 ISC"
34 +SLOT="0"
35 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
36 +IUSE="static-libs"
37 +
38 +RDEPEND="app-crypt/libmd[${MULTILIB_USEDEP}]"
39 +DEPEND="${RDEPEND}
40 + >=sys-kernel/linux-headers-3.17
41 +"
42 +BDEPEND="verify-sig? ( sec-keys/openpgp-keys-guillemjover )"
43 +
44 +multilib_src_configure() {
45 + # The build system will install libbsd-ctor.a despite USE="-static-libs"
46 + # which is correct, see:
47 + # https://gitlab.freedesktop.org/libbsd/libbsd/commit/c5b959028734ca2281250c85773d9b5e1d259bc8
48 + ECONF_SOURCE="${S}" econf $(use_enable static-libs static)
49 +}
50 +
51 +multilib_src_install() {
52 + emake DESTDIR="${D}" install
53 +
54 + find "${ED}" -type f -name "*.la" -delete || die
55 +
56 + # ld scripts on standalone prefix (RAP) systems should have the prefix
57 + # stripped from any paths, as the sysroot is automatically prepended.
58 + local ldscript=${ED}/usr/$(get_libdir)/${PN}$(get_libname)
59 + if use prefix && ! use prefix-guest && grep -qIF "ld script" "${ldscript}" 2>/dev/null; then
60 + sed -i "s|${EPREFIX}/|/|g" "${ldscript}" || die
61 + fi
62 +}
63 --
64 2.39.1