public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2016-10-18 23:53 Anthony G. Basile
  0 siblings, 0 replies; 10+ messages in thread
From: Anthony G. Basile @ 2016-10-18 23:53 UTC (permalink / raw
  To: gentoo-commits

commit:     82e8189213284403928b9ffe36eded866609991d
Author:     Felix Janda <felix.janda <AT> posteo <DOT> de>
AuthorDate: Tue Oct 18 23:08:21 2016 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Oct 18 23:50:54 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=82e81892

sys-libs/musl: add two upstream patches

The first patch fixes the bug reported at

https://lists.freedesktop.org/archives/xcb/2016-October/010864.html

A CVE has been requested for the second patch:

http://www.openwall.com/lists/musl/2016/10/18/2

 sys-libs/musl/files/musl-1.1.15-CVE.patch          | 68 ++++++++++++++++++++++
 sys-libs/musl/files/musl-1.1.15-assert.patch       | 43 ++++++++++++++
 ...musl-1.1.15-r1.ebuild => musl-1.1.15-r2.ebuild} |  5 ++
 3 files changed, 116 insertions(+)

diff --git a/sys-libs/musl/files/musl-1.1.15-CVE.patch b/sys-libs/musl/files/musl-1.1.15-CVE.patch
new file mode 100644
index 00000000..64fbbdc
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.1.15-CVE.patch
@@ -0,0 +1,68 @@
+From c3edc06d1e1360f3570db9155d6b318ae0d0f0f7 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 06 Oct 2016 22:34:58 +0000
+Subject: fix missing integer overflow checks in regexec buffer size computations
+
+most of the possible overflows were already ruled out in practice by
+regcomp having already succeeded performing larger allocations.
+however at least the num_states*num_tags multiplication can clearly
+overflow in practice. for safety, check them all, and use the proper
+type, size_t, rather than int.
+
+also improve comments, use calloc in place of malloc+memset, and
+remove bogus casts.
+---
+diff --git a/src/regex/regexec.c b/src/regex/regexec.c
+index 16c5d0a..dd52319 100644
+--- a/src/regex/regexec.c
++++ b/src/regex/regexec.c
+@@ -34,6 +34,7 @@
+ #include <wchar.h>
+ #include <wctype.h>
+ #include <limits.h>
++#include <stdint.h>
+ 
+ #include <regex.h>
+ 
+@@ -206,11 +207,24 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string,
+ 
+   /* Allocate memory for temporary data required for matching.	This needs to
+      be done for every matching operation to be thread safe.  This allocates
+-     everything in a single large block from the stack frame using alloca()
+-     or with malloc() if alloca is unavailable. */
++     everything in a single large block with calloc(). */
+   {
+-    int tbytes, rbytes, pbytes, xbytes, total_bytes;
++    size_t tbytes, rbytes, pbytes, xbytes, total_bytes;
+     char *tmp_buf;
++
++    /* Ensure that tbytes and xbytes*num_states cannot overflow, and that
++     * they don't contribute more than 1/8 of SIZE_MAX to total_bytes. */
++    if (num_tags > SIZE_MAX/(8 * sizeof(int) * tnfa->num_states))
++      goto error_exit;
++
++    /* Likewise check rbytes. */
++    if (tnfa->num_states+1 > SIZE_MAX/(8 * sizeof(*reach_next)))
++      goto error_exit;
++
++    /* Likewise check pbytes. */
++    if (tnfa->num_states > SIZE_MAX/(8 * sizeof(*reach_pos)))
++      goto error_exit;
++
+     /* Compute the length of the block we need. */
+     tbytes = sizeof(*tmp_tags) * num_tags;
+     rbytes = sizeof(*reach_next) * (tnfa->num_states + 1);
+@@ -221,10 +235,9 @@ tre_tnfa_run_parallel(const tre_tnfa_t *tnfa, const void *string,
+       + (rbytes + xbytes * tnfa->num_states) * 2 + tbytes + pbytes;
+ 
+     /* Allocate the memory. */
+-    buf = xmalloc((unsigned)total_bytes);
++    buf = calloc(total_bytes, 1);
+     if (buf == NULL)
+       return REG_ESPACE;
+-    memset(buf, 0, (size_t)total_bytes);
+ 
+     /* Get the various pointers within tmp_buf (properly aligned). */
+     tmp_tags = (void *)buf;
+--
+cgit v0.9.0.3-65-g4555

diff --git a/sys-libs/musl/files/musl-1.1.15-assert.patch b/sys-libs/musl/files/musl-1.1.15-assert.patch
new file mode 100644
index 00000000..d531d17
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.1.15-assert.patch
@@ -0,0 +1,43 @@
+From e738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Tue, 30 Aug 2016 20:39:54 +0000
+Subject: restore _Noreturn to __assert_fail
+
+this reverts commit 2c1f8fd5da3306fd7c8a2267467e44eb61f12dd4. without
+the _Noreturn attribute, the compiler cannot use asserts to perform
+reachability/range analysis. this leads to missed optimizations and
+spurious warnings.
+
+the original backtrace problem that prompted the removal of _Noreturn
+was not clearly documented at the time, but it seems to happen only
+when libc was built without -g, which also breaks many other
+backtracing cases.
+---
+diff --git a/include/assert.h b/include/assert.h
+index e679adb..d14ec94 100644
+--- a/include/assert.h
++++ b/include/assert.h
+@@ -16,7 +16,7 @@
+ extern "C" {
+ #endif
+ 
+-void __assert_fail (const char *, const char *, int, const char *);
++_Noreturn void __assert_fail (const char *, const char *, int, const char *);
+ 
+ #ifdef __cplusplus
+ }
+diff --git a/src/exit/assert.c b/src/exit/assert.c
+index e87442a..49b0dc3 100644
+--- a/src/exit/assert.c
++++ b/src/exit/assert.c
+@@ -1,7 +1,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ 
+-void __assert_fail(const char *expr, const char *file, int line, const char *func)
++_Noreturn void __assert_fail(const char *expr, const char *file, int line, const char *func)
+ {
+ 	fprintf(stderr, "Assertion failed: %s (%s: %s: %d)\n", expr, file, func, line);
+ 	fflush(NULL);
+--
+cgit v0.9.0.3-65-g4555

diff --git a/sys-libs/musl/musl-1.1.15-r1.ebuild b/sys-libs/musl/musl-1.1.15-r2.ebuild
similarity index 97%
rename from sys-libs/musl/musl-1.1.15-r1.ebuild
rename to sys-libs/musl/musl-1.1.15-r2.ebuild
index be22eba..e21f214 100644
--- a/sys-libs/musl/musl-1.1.15-r1.ebuild
+++ b/sys-libs/musl/musl-1.1.15-r2.ebuild
@@ -38,6 +38,11 @@ IUSE="crosscompile_opts_headers-only"
 QA_SONAME="/usr/lib/libc.so"
 QA_DT_NEEDED="/usr/lib/libc.so"
 
+PATCHES=(
+	"${FILESDIR}/${P}-assert.patch"
+	"${FILESDIR}/${P}-CVE.patch"
+	)
+
 is_crosscompile() {
 	[[ ${CHOST} != ${CTARGET} ]]
 }


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2018-10-02 23:43 Anthony G. Basile
  0 siblings, 0 replies; 10+ messages in thread
From: Anthony G. Basile @ 2018-10-02 23:43 UTC (permalink / raw
  To: gentoo-commits

commit:     cf5756d9f7c89635bf73b4f781f464b24019a77c
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Tue Oct  2 23:42:46 2018 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Tue Oct  2 23:42:46 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cf5756d9

sys-libs/musl: fix bug #667234

Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.10

 .../musl/files/musl-1.1.20-fix-getaddrinfo.patch   |  51 +++++++++
 sys-libs/musl/musl-1.1.20-r1.ebuild                | 123 +++++++++++++++++++++
 2 files changed, 174 insertions(+)

diff --git a/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch b/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch
new file mode 100644
index 00000000000..28d4558b8b6
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.1.20-fix-getaddrinfo.patch
@@ -0,0 +1,51 @@
+From f381c118b2d4f7d914481d3cdc830ce41369b002 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 19 Sep 2018 18:03:22 -0400
+Subject: fix getaddrinfo regression with AI_ADDRCONFIG on some configurations
+
+despite not being documented to do so in the standard or Linux
+documentation, attempts to udp connect to 127.0.0.1 or ::1 generate
+EADDRNOTAVAIL when the loopback device is not configured and there is
+no default route for IPv6. this caused getaddrinfo with AI_ADDRCONFIG
+to fail with EAI_SYSTEM and EADDRNOTAVAIL on some no-IPv6
+configurations, rather than the intended behavior of detecting IPv6 as
+unsuppported and producing IPv4-only results.
+
+previously, only EAFNOSUPPORT was treated as unavailability of the
+address family being probed. instead, treat all errors related to
+inability to get an address or route as conclusive that the family
+being probed is unsupported, and only fail with EAI_SYSTEM on other
+errors.
+
+further improvements may be desirable, such as reporting EAI_AGAIN
+instead of EAI_SYSTEM for errors which are expected to be transient,
+but this patch should suffice to fix the serious regression.
+---
+ src/network/getaddrinfo.c | 11 ++++++++++-
+ 1 file changed, 10 insertions(+), 1 deletion(-)
+
+diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c
+index ba26847a..e33bfa28 100644
+--- a/src/network/getaddrinfo.c
++++ b/src/network/getaddrinfo.c
+@@ -76,7 +76,16 @@ int getaddrinfo(const char *restrict host, const char *restrict serv, const stru
+ 				close(s);
+ 				if (!r) continue;
+ 			}
+-			if (errno != EAFNOSUPPORT) return EAI_SYSTEM;
++			switch (errno) {
++			case EADDRNOTAVAIL:
++			case EAFNOSUPPORT:
++			case EHOSTUNREACH:
++			case ENETDOWN:
++			case ENETUNREACH:
++				break;
++			default:
++				return EAI_SYSTEM;
++			}
+ 			if (family == tf[i]) return EAI_NONAME;
+ 			family = tf[1-i];
+ 		}
+-- 
+cgit v1.2.1
+

diff --git a/sys-libs/musl/musl-1.1.20-r1.ebuild b/sys-libs/musl/musl-1.1.20-r1.ebuild
new file mode 100644
index 00000000000..cba85ae6bb6
--- /dev/null
+++ b/sys-libs/musl/musl-1.1.20-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils flag-o-matic multilib toolchain-funcs
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="git://git.musl-libc.org/musl"
+	inherit git-r3
+	SRC_URI="
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://dev.gentoo.org/~blueness/musl-misc/getent.c
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
+	KEYWORDS=""
+else
+	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://dev.gentoo.org/~blueness/musl-misc/getent.c
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
+	KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc ~x86"
+fi
+
+export CBUILD=${CBUILD:-${CHOST}}
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+	if [[ ${CATEGORY} == cross-* ]] ; then
+		export CTARGET=${CATEGORY#cross-}
+	fi
+fi
+
+DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="http://www.musl-libc.org/"
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="headers-only"
+
+QA_SONAME="/usr/lib/libc.so"
+QA_DT_NEEDED="/usr/lib/libc.so"
+
+is_crosscompile() {
+	[[ ${CHOST} != ${CTARGET} ]]
+}
+
+just_headers() {
+	use headers-only && is_crosscompile
+}
+
+pkg_setup() {
+	if [ ${CTARGET} == ${CHOST} ] ; then
+		case ${CHOST} in
+		*-musl*) ;;
+		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+		esac
+	fi
+}
+
+src_prepare() {
+	eapply "${FILESDIR}/${P}-fix-getaddrinfo.patch"
+	eapply_user
+}
+
+src_configure() {
+	tc-getCC ${CTARGET}
+	just_headers && export CC=true
+
+	local sysroot
+	is_crosscompile && sysroot=/usr/${CTARGET}
+	./configure \
+		--target=${CTARGET} \
+		--prefix=${sysroot}/usr \
+		--syslibdir=${sysroot}/lib \
+		--disable-gcc-wrapper || die
+}
+
+src_compile() {
+	emake obj/include/bits/alltypes.h
+	just_headers && return 0
+
+	emake
+	if [[ ${CATEGORY} != cross-* ]] ; then
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getconf.c -o "${T}"/getconf || die
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getent.c -o "${T}"/getent || die
+		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/iconv.c -o "${T}"/iconv || die
+	fi
+}
+
+src_install() {
+	local target="install"
+	just_headers && target="install-headers"
+	emake DESTDIR="${D}" ${target}
+	just_headers && return 0
+
+	# musl provides ldd via a sym link to its ld.so
+	local sysroot
+	is_crosscompile && sysroot=/usr/${CTARGET}
+	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
+	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+
+	if [[ ${CATEGORY} != cross-* ]] ; then
+		local arch=$("${D}"usr/lib/libc.so 2>&1 | sed -n '1s/^musl libc (\(.*\))$/\1/p')
+		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
+		cp "${FILESDIR}"/ldconfig.in "${T}" || die
+		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		into /
+		dosbin "${T}"/ldconfig
+		into /usr
+		dobin "${T}"/getconf
+		dobin "${T}"/getent
+		dobin "${T}"/iconv
+		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
+		doenvd "${T}"/00musl || die
+	fi
+}
+
+pkg_postinst() {
+	is_crosscompile && return 0
+
+	[ "${ROOT}" != "/" ] && return 0
+
+	ldconfig || die
+	# reload init ...
+	/sbin/telinit U 2>/dev/null
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2021-02-14 16:50 Jory Pratt
  0 siblings, 0 replies; 10+ messages in thread
From: Jory Pratt @ 2021-02-14 16:50 UTC (permalink / raw
  To: gentoo-commits

commit:     b54206c6c1d49820f0a65c0665168bf2a6fa46f0
Author:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 14 16:49:50 2021 +0000
Commit:     Jory Pratt <anarchy <AT> gentoo <DOT> org>
CommitDate: Sun Feb 14 16:49:50 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b54206c6

sys-libs/musl: add support for static libssp_nonshared

Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Jory Pratt <anarchy <AT> gentoo.org>

 sys-libs/musl/Manifest                             |   2 -
 sys-libs/musl/files/stack_chk_fail_local.c         |  45 +++++++
 sys-libs/musl/musl-1.1.24.ebuild                   | 126 --------------------
 sys-libs/musl/musl-1.2.0-r1.ebuild                 | 129 ---------------------
 .../{musl-1.2.1-r1.ebuild => musl-1.2.1-r2.ebuild} |   3 +
 sys-libs/musl/musl-1.2.1.ebuild                    | 129 ---------------------
 .../{musl-1.2.2-r1.ebuild => musl-1.2.2-r2.ebuild} |   3 +
 sys-libs/musl/musl-9999.ebuild                     |   3 +
 8 files changed, 54 insertions(+), 386 deletions(-)

diff --git a/sys-libs/musl/Manifest b/sys-libs/musl/Manifest
index 79243901162..35cd11cf03b 100644
--- a/sys-libs/musl/Manifest
+++ b/sys-libs/musl/Manifest
@@ -1,8 +1,6 @@
 DIST getconf.c 11614 BLAKE2B ba49a573fc16d51780a0b0b81fbf7b64a1142f1dbad203c9609a59b6b07e7404f676c415383ae88c0aede95694821f6ee381bffd93cc3330501e17dc07d122bd SHA512 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d
 DIST getent.c 9438 BLAKE2B dc20353583c10a001bd8fe8474f32b70254dc56da186d1cdbaf4081570c3d7a10497024da5815a485fc4728adc9eebd270aec99ba93b7546b38c728978e3e00b SHA512 b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2
 DIST iconv.c 2577 BLAKE2B 070ca87b30c90ab98c27d5faf7a2fcb64ff7c67ca212ee6072165b2146979c551f714954dbd465462a171837c59b6ea027e0206458a2df0f977e45f01be3ce48 SHA512 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf
-DIST musl-1.1.24.tar.gz 1024988 BLAKE2B 5fa26746eed0f2334b740adf94a8400568d56d9b2276bf1fbac828f9b707b4e215d3c16af9ea048b9d771f1d0a58ada3bc6e1bf0ba8f5fa693f5042fc6af30df SHA512 8987f1e194ea616f34f4f21fe9def28fb7f81d7060e38619206c6349f79db3bbb76bae8b711f5f9b8ed038799c9aea1a4cbec69e0bc4131e246203e133149e77
-DIST musl-1.2.0.tar.gz 1035265 BLAKE2B 0a47e0f438cca0f3ce31ae024c19358160214842115b560efc48e66228055c9147d9550957a79425322d510ba773f197d0944bb844bf6addbbf698088a3358a9 SHA512 58bd88189a6002356728cea1c6f6605a893fe54f7687595879add4eab283c8692c3b031eb9457ad00d1edd082cfe62fcc0eb5eb1d3bf4f1d749c0efa2a95fec1
 DIST musl-1.2.1.tar.gz 1047481 BLAKE2B 5ccdee248d4caa1b433ab9c56cce3842fb46a269fd6a53d0880ba5eaad208997306e6b56fd345917e5076714fbfac0804ea226e6dc3f0f2e75f8c824a7155535 SHA512 455464ef47108a78457291bda2b1ea574987a1787f6001e9376956f20521593a4816bc215dab41c1a80292ae7ebd315accb4d4fa6a1210ff77d9a4d68239e960
 DIST musl-1.2.2.tar.gz 1055220 BLAKE2B a000357ed52e417d8cebe5537df658dc0f8f02f2da3efcd79125544ad63e11e05fa96136551d0bfeb09a3f6c9a2260bffcfbd329ea92e6a7b62aa690f48968aa SHA512 5344b581bd6463d71af8c13e91792fa51f25a96a1ecbea81e42664b63d90b325aeb421dfbc8c22e187397ca08e84d9296a0c0c299ba04fa2b751d6864914bd82
 DIST musl-getent-93a08815f8598db442d8b766b463d0150ed8e2ab.c 11656 BLAKE2B 1b7bf7102a1eb91a8cb881ed8ca65eb8eed911dd50238e97dc2952d89d4c6ebed6bfd046a2b38776c550b2872ab54ced8cb452fcc2ad56e5616f722debda761f SHA512 7f5b9d934d82deb5f8b23e16169a5d9b99ccab3a4708df06a95d685e1b24a3a3e69b3dcf4942f2f66c12a3d4bf0c5827e2ee2e8c4d7b1997359fccc2ac212dee

diff --git a/sys-libs/musl/files/stack_chk_fail_local.c b/sys-libs/musl/files/stack_chk_fail_local.c
new file mode 100644
index 00000000000..e1c903a3b63
--- /dev/null
+++ b/sys-libs/musl/files/stack_chk_fail_local.c
@@ -0,0 +1,45 @@
+/* Stack protector support.
+   Copyright (C) 2005-2019 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+In addition to the permissions in the GNU General Public License, the
+Free Software Foundation gives you unlimited permission to link the
+compiled version of this file into combinations with other programs,
+and to distribute those combinations without any restriction coming
+from the use of this file.  (The General Public License restrictions
+do apply in other respects; for example, they cover modification of
+the file, and distribution when not linked into a combine
+executable.)
+
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  */
+
+extern void __stack_chk_fail (void);
+
+/* Some targets can avoid loading a GP for calls to hidden functions.
+   Using this entry point may avoid the load of a GP entirely for the
+   function, making the overall code smaller.  */
+
+void
+__attribute__((visibility ("hidden")))
+__stack_chk_fail_local (void)
+{
+  __stack_chk_fail ();
+}

diff --git a/sys-libs/musl/musl-1.1.24.ebuild b/sys-libs/musl/musl-1.1.24.ebuild
deleted file mode 100644
index 453281e19f2..00000000000
--- a/sys-libs/musl/musl-1.1.24.ebuild
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils flag-o-matic multilib toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-	SRC_URI="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS=""
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="http://www.musl-libc.org/"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getconf.c -o "${T}"/getconf || die
-		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/getent.c -o "${T}"/getent || die
-		$(tc-getCC) ${CFLAGS} "${DISTDIR}"/iconv.c -o "${T}"/iconv || die
-	fi
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}

diff --git a/sys-libs/musl/musl-1.2.0-r1.ebuild b/sys-libs/musl/musl-1.2.0-r1.ebuild
deleted file mode 100644
index 170c94aedcf..00000000000
--- a/sys-libs/musl/musl-1.2.0-r1.ebuild
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-inherit eutils flag-o-matic multilib toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-	SRC_URI="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS=""
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86"
-fi
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="http://www.musl-libc.org/"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${DISTDIR}"
-	fi
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}

diff --git a/sys-libs/musl/musl-1.2.1-r1.ebuild b/sys-libs/musl/musl-1.2.1-r2.ebuild
similarity index 95%
rename from sys-libs/musl/musl-1.2.1-r1.ebuild
rename to sys-libs/musl/musl-1.2.1-r2.ebuild
index d433abdd339..cfd94b27181 100644
--- a/sys-libs/musl/musl-1.2.1-r1.ebuild
+++ b/sys-libs/musl/musl-1.2.1-r2.ebuild
@@ -90,6 +90,9 @@ src_compile() {
 			LDFLAGS="${LDFLAGS}" \
 			VPATH="${DISTDIR}"
 	fi
+
+	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
 }
 
 src_install() {

diff --git a/sys-libs/musl/musl-1.2.1.ebuild b/sys-libs/musl/musl-1.2.1.ebuild
deleted file mode 100644
index 69c39b164c3..00000000000
--- a/sys-libs/musl/musl-1.2.1.ebuild
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit eutils flag-o-matic multilib toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-	SRC_URI="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS=""
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://dev.gentoo.org/~blueness/musl-misc/getent.c
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c"
-	KEYWORDS="-* amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 x86"
-fi
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="http://www.musl-libc.org/"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${DISTDIR}"
-	fi
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}

diff --git a/sys-libs/musl/musl-1.2.2-r1.ebuild b/sys-libs/musl/musl-1.2.2-r2.ebuild
similarity index 95%
rename from sys-libs/musl/musl-1.2.2-r1.ebuild
rename to sys-libs/musl/musl-1.2.2-r2.ebuild
index bbe899d8ce1..b6a413c2363 100644
--- a/sys-libs/musl/musl-1.2.2-r1.ebuild
+++ b/sys-libs/musl/musl-1.2.2-r2.ebuild
@@ -97,6 +97,9 @@ src_compile() {
 			LDFLAGS="${LDFLAGS}" \
 			VPATH="${WORKDIR}/misc"
 	fi
+
+	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
 }
 
 src_install() {

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index bbe899d8ce1..b6a413c2363 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -97,6 +97,9 @@ src_compile() {
 			LDFLAGS="${LDFLAGS}" \
 			VPATH="${WORKDIR}/misc"
 	fi
+
+	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
 }
 
 src_install() {


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2021-11-19  3:03 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2021-11-19  3:03 UTC (permalink / raw
  To: gentoo-commits

commit:     bd2656625bf0ed0b05e5b6de9ead4a73f09c58fe
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 18 00:45:48 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 19 03:02:40 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd265662

sys-libs/musl: additional ROOT fixes for ldconfig

Move around some declarations so we get sensible default
values but only perform the sanity checks _after_ we
parse command line arguments to take into account e.g.
-r (root).

Bug: https://bugs.gentoo.org/666246
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in-r1                      | 17 +++++++++--------
 .../musl/{musl-9999.ebuild => musl-1.2.2-r5.ebuild}     | 11 +++++++++--
 sys-libs/musl/musl-9999.ebuild                          |  2 +-
 3 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/sys-libs/musl/files/ldconfig.in-r1 b/sys-libs/musl/files/ldconfig.in-r1
index 362d11ce815a..14aa7c3466b8 100644
--- a/sys-libs/musl/files/ldconfig.in-r1
+++ b/sys-libs/musl/files/ldconfig.in-r1
@@ -1,16 +1,9 @@
 #!/bin/bash -e
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 ROOT="/"
-
 LDSO_CONF="/etc/ld.so.conf"
-if [[ ! -e $LDSO_CONF ]]; then
-	echo "$LDSO_CONF not found" >&2
-	exit 1
-fi
-
-LDSO_CONF_DIR=$(dirname $LDSO_CONF)
 
 VERBOSE=0
 
@@ -124,6 +117,14 @@ sanitize() {
 }
 
 get_options "$@"
+
+if [[ ! -e $LDSO_CONF ]]; then
+        echo "$LDSO_CONF not found" >&2
+        exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname $LDSO_CONF)
+
 drs=$(read_ldso_conf "$LDSO_CONF")
 drs=$(sanitize $drs)
 

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-1.2.2-r5.ebuild
similarity index 94%
copy from sys-libs/musl/musl-9999.ebuild
copy to sys-libs/musl/musl-1.2.2-r5.ebuild
index 1ba86e7846fb..79a60682c79f 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-1.2.2-r5.ebuild
@@ -9,7 +9,7 @@ if [[ ${PV} == "9999" ]] ; then
 	inherit git-r3
 else
 	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
-	KEYWORDS="-* ~amd64 ~arm ~arm64 ~mips ~ppc ~ppc64 ~x86"
+	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
 fi
 GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
 GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
@@ -71,6 +71,13 @@ src_unpack() {
 	cp "${DISTDIR}"/iconv.c misc/iconv.c || die
 }
 
+src_prepare() {
+	default
+
+	# Expand gethostid instead of being just a stub
+	eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
+}
+
 src_configure() {
 	tc-getCC ${CTARGET}
 	just_headers && export CC=true
@@ -137,7 +144,7 @@ src_install() {
 			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
 		fi
 
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
+		cp "${FILESDIR}"/ldconfig.in-r1 "${T}"/ldconfig.in || die
 		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
 		into /
 		dosbin "${T}"/ldconfig

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index 1ba86e7846fb..0d528e720587 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -137,7 +137,7 @@ src_install() {
 			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
 		fi
 
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
+		cp "${FILESDIR}"/ldconfig.in "${T}"/ldconfig.in || die
 		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
 		into /
 		dosbin "${T}"/ldconfig


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2021-11-22 12:18 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2021-11-22 12:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d9a66f3d2030eb59c117cb96296d7a617d757fc1
Author:     Kofi Hannam <meeyou <AT> tuta <DOT> io>
AuthorDate: Mon Nov 22 11:58:15 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 22 11:58:49 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d9a66f3d

sys-libs/musl: exit early in ldconfig if nothing has changed

This fixes an access violation when compiling sys-libs/ncurses
and /usr/bin/ld is not ld.bfd.

Closes: https://bugs.gentoo.org/719330
Closes: https://github.com/gentoo/gentoo/pull/21939
Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Kofi Hannam <meeyou <AT> tuta.io>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in-r1                           | 8 ++++++++
 sys-libs/musl/{musl-1.2.2-r5.ebuild => musl-1.2.2-r6.ebuild} | 0
 2 files changed, 8 insertions(+)

diff --git a/sys-libs/musl/files/ldconfig.in-r1 b/sys-libs/musl/files/ldconfig.in-r1
index 1b565baf9eed..7bf254dfd91c 100644
--- a/sys-libs/musl/files/ldconfig.in-r1
+++ b/sys-libs/musl/files/ldconfig.in-r1
@@ -116,6 +116,13 @@ sanitize() {
 	echo ${drs}
 }
 
+changed() {
+	[[ -f ${ETC_LDSO_PATH} ]] || return 0
+	local current=$(<${ETC_LDSO_PATH})
+	current=${current//$'\n'/ }
+	[[ ${current} != ${drs} ]] || return 1
+}
+
 get_options "$@"
 
 if [[ ! -e ${LDSO_CONF} ]]; then
@@ -139,6 +146,7 @@ LDSO_ARCH=$(basename ${LDSO_PATH})
 LDSO_NAME=${LDSO_ARCH%.so.1}
 ETC_LDSO_PATH="${ROOT}/etc/${LDSO_NAME}.path"
 
+changed || exit 0
 X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
 for d in ${drs}; do
 	echo ${d} >> ${X}

diff --git a/sys-libs/musl/musl-1.2.2-r5.ebuild b/sys-libs/musl/musl-1.2.2-r6.ebuild
similarity index 100%
rename from sys-libs/musl/musl-1.2.2-r5.ebuild
rename to sys-libs/musl/musl-1.2.2-r6.ebuild


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2022-02-20  0:31 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2022-02-20  0:31 UTC (permalink / raw
  To: gentoo-commits

commit:     b02003640228503cb93d5c371bef1f55c555429f
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Sat Feb 12 15:34:33 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Feb 20 00:29:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b0200364

sys-libs/musl: Support Gentoo prefix

Added necessary framework to get this libc to run properly under a prefix.

Closes: https://bugs.gentoo.org/833192
Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/24169
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in-r3                 | 160 +++++++++++++++++++++
 .../{musl-9999.ebuild => musl-1.2.2-r8.ebuild}     |  44 +++---
 sys-libs/musl/musl-9999.ebuild                     |  44 +++---
 3 files changed, 200 insertions(+), 48 deletions(-)

diff --git a/sys-libs/musl/files/ldconfig.in-r3 b/sys-libs/musl/files/ldconfig.in-r3
new file mode 100644
index 000000000000..60f6cc9e1130
--- /dev/null
+++ b/sys-libs/musl/files/ldconfig.in-r3
@@ -0,0 +1,160 @@
+#!/bin/bash -e
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+ROOT="/"
+EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
+LDSO_CONF_FILE="/etc/ld.so.conf"
+
+VERBOSE=0
+
+UPDATE_LINKS=1
+
+get_options() {
+	LDSO_CONF=""
+	while getopts "vnNXf:C:r:p" opt "$@"; do
+		case $opt in
+		v)
+			echo "ldconfig for musl in Gentoo"
+			VERBOSE=1
+			;;
+		r)
+			ROOT=${OPTARG}
+			;;
+		f)
+			LDSO_CONF=${OPTARG}
+			;;
+		X)
+			UPDATE_LINKS=0
+			;;
+		\?)
+			echo "Invalid option: -${opt}" >&2
+			exit 1
+			;;
+		n|N|C|p)
+			echo "Unimplemented option: -${opt}" >&2
+			exit 1
+			;;
+		esac
+	done
+	if [[ -z ${LDSO_CONF} ]]; then
+		LDSO_CONF=${ROOT}${EPREFIX}${LDSO_CONF_FILE}
+	fi
+
+	if [[ ${UPDATE_LINKS} == 1 ]]; then
+		echo "Updating links is not implemented."
+	fi
+}
+
+
+repeated() {
+	local l=${1}
+	local drs="${@:2}"
+	for m in ${drs}; do
+		[[ ${m} == ${l} ]] && return 0
+	done
+	return 1
+}
+
+expand() {
+	# We are assuming the ld.so.conf's 'include' is not recursive
+	local f line l
+	local glob="${LDSO_CONF_DIR}/${1}"
+	local drs="${@:2} "
+
+	for f in ${glob}; do
+		[[ ! -f ${f} ]] && continue
+		while read line; do
+			line=${line%%#*}
+			line=${line//:/ }
+			line=${line//,/ }
+			for l in ${line}; do
+				# We must add this whether or not the directory exists
+				repeated ${l} ${drs} && continue
+				drs+=" ${l} "
+			done
+		done < ${f}
+	done
+
+	echo ${drs}
+}
+
+read_ldso_conf() {
+	local drs=" "
+
+	while read line; do
+		# Sanitize the line - see ldconfig(8) for delimiters
+		# Note: bash read turns tabs into spaces and read already
+		# delimits on newlines with the default $IFS
+		line=${line%%#*}   # Remove comments
+		line=${line//:/ }  # Change colon delimiter to space
+		line=${line//,/ }  # Change comma delimiter to space
+
+		next=0
+		for l in ${line}; do
+			if [[ ${next} == 1 ]]; then
+				next=0
+				drs=$(expand ${l} ${drs})
+			elif [[ ${l} == "include" ]]; then
+				next=1
+			else
+				# glibc's ldconfig silently skips non directories
+				if [[ -d ${l} ]]; then
+					repeated ${l} ${drs} && continue
+					drs+=" ${l} "
+				fi
+			fi
+		done
+	done < ${1}
+
+	echo ${drs}
+}
+
+sanitize() {
+	local drs=$@
+
+	repeated "${EPREFIX}/lib" ${drs} || drs="${EPREFIX}/lib ${drs}"
+	repeated "${EPREFIX}/usr/lib" ${drs} || drs="${EPREFIX}/usr/lib ${drs}"
+
+	echo ${drs}
+}
+
+changed() {
+	[[ -f ${ETC_LDSO_PATH} ]] || return 0
+	local current=$(<${ETC_LDSO_PATH})
+	current=${current//$'\n'/ }
+	[[ ${current} != ${drs} ]] || return 1
+}
+
+get_options "$@"
+
+if [[ ! -e ${LDSO_CONF} ]]; then
+        echo "${LDSO_CONF} not found" >&2
+        exit 1
+fi
+
+LDSO_CONF_DIR=$(dirname ${LDSO_CONF})
+
+drs=$(read_ldso_conf "${LDSO_CONF}")
+drs=$(sanitize ${drs})
+
+ARCH=@@ARCH@@
+LDSO_PATH="${ROOT}${EPREFIX}/lib/ld-musl-${ARCH}.so.1"
+if [[ ! -e ${LDSO_PATH} ]]; then
+	echo "${LDSO_PATH} not found" >&2
+	exit 1
+fi
+
+LDSO_ARCH=$(basename ${LDSO_PATH})
+LDSO_NAME=${LDSO_ARCH%.so.1}
+ETC_LDSO_PATH="${ROOT}${EPREFIX}/etc/${LDSO_NAME}.path"
+
+changed || exit 0
+X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
+for d in ${drs}; do
+	echo ${d} >> ${X}
+done
+chmod 644 ${X}
+# busybox doesn't support mz -Z
+cp ${X} ${ETC_LDSO_PATH}
+rm ${X}

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-1.2.2-r8.ebuild
similarity index 76%
copy from sys-libs/musl/musl-9999.ebuild
copy to sys-libs/musl/musl-1.2.2-r8.ebuild
index 6a5e2688dd5a..52960e95a004 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-1.2.2-r8.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-inherit eapi8-dosym flag-o-matic toolchain-funcs
+inherit eapi8-dosym flag-o-matic toolchain-funcs prefix
 if [[ ${PV} == "9999" ]] ; then
 	EGIT_REPO_URI="git://git.musl-libc.org/musl"
 	inherit git-r3
@@ -76,11 +76,11 @@ src_configure() {
 	just_headers && export CC=true
 
 	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
+	is_crosscompile && sysroot=/usr/${CTARGET}
 	./configure \
 		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
+		--prefix=${EPREFIX}${sysroot}/usr \
+		--syslibdir=${EPREFIX}${sysroot}/lib \
 		--disable-gcc-wrapper || die
 }
 
@@ -111,8 +111,8 @@ src_install() {
 	# musl provides ldd via a sym link to its ld.so
 	local sysroot
 	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+	local ldso=$(basename "${ED}"${sysroot}/lib/ld-musl-*)
+	dosym ${EPREFIX}${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
 
 	if [[ ${CATEGORY} != cross-* ]] ; then
 		# Fish out of config:
@@ -121,24 +121,20 @@ src_install() {
 		# and print $(ARCH)$(SUBARCH).
 		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
 
-		if [[ ! -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] ; then
-			# During cross (using crossdev), when emerging sys-libs/musl,
-			# if /usr/lib/libc.so.1 doesn't exist on the system, installation
-			# would fail.
-			#
-			# The musl build system seems to create a symlink:
-			# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
-			# During cross, there's no guarantee that the host is using musl
-			# so that file may not exist. Use a relative symlink within ${D}
-			# instead.
-			dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-			# If it's still a dead symlnk, OK, we really do need to abort.
-			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
-		fi
-
-		cp "${FILESDIR}"/ldconfig.in-r1 "${T}"/ldconfig.in || die
+		# The musl build system seems to create a symlink:
+		# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
+		# During cross or within prefix, there's no guarantee that the host is
+		# using musl so that file may not exist. Use a relative symlink within
+		# ${D} instead.
+		rm -f "${ED}"/lib/ld-musl-${arch}.so.1 || die
+		dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+
+		# If it's still a dead symlnk, OK, we really do need to abort.
+		[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+
+		cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
 		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		eprefixify "${T}"/ldconfig
 		into /
 		dosbin "${T}"/ldconfig
 		into /usr

diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild
index 6a5e2688dd5a..52960e95a004 100644
--- a/sys-libs/musl/musl-9999.ebuild
+++ b/sys-libs/musl/musl-9999.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=7
 
-inherit eapi8-dosym flag-o-matic toolchain-funcs
+inherit eapi8-dosym flag-o-matic toolchain-funcs prefix
 if [[ ${PV} == "9999" ]] ; then
 	EGIT_REPO_URI="git://git.musl-libc.org/musl"
 	inherit git-r3
@@ -76,11 +76,11 @@ src_configure() {
 	just_headers && export CC=true
 
 	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
+	is_crosscompile && sysroot=/usr/${CTARGET}
 	./configure \
 		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
+		--prefix=${EPREFIX}${sysroot}/usr \
+		--syslibdir=${EPREFIX}${sysroot}/lib \
 		--disable-gcc-wrapper || die
 }
 
@@ -111,8 +111,8 @@ src_install() {
 	# musl provides ldd via a sym link to its ld.so
 	local sysroot
 	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
+	local ldso=$(basename "${ED}"${sysroot}/lib/ld-musl-*)
+	dosym ${EPREFIX}${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
 
 	if [[ ${CATEGORY} != cross-* ]] ; then
 		# Fish out of config:
@@ -121,24 +121,20 @@ src_install() {
 		# and print $(ARCH)$(SUBARCH).
 		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
 
-		if [[ ! -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] ; then
-			# During cross (using crossdev), when emerging sys-libs/musl,
-			# if /usr/lib/libc.so.1 doesn't exist on the system, installation
-			# would fail.
-			#
-			# The musl build system seems to create a symlink:
-			# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
-			# During cross, there's no guarantee that the host is using musl
-			# so that file may not exist. Use a relative symlink within ${D}
-			# instead.
-			dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-			# If it's still a dead symlnk, OK, we really do need to abort.
-			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
-		fi
-
-		cp "${FILESDIR}"/ldconfig.in-r1 "${T}"/ldconfig.in || die
+		# The musl build system seems to create a symlink:
+		# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
+		# During cross or within prefix, there's no guarantee that the host is
+		# using musl so that file may not exist. Use a relative symlink within
+		# ${D} instead.
+		rm -f "${ED}"/lib/ld-musl-${arch}.so.1 || die
+		dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+
+		# If it's still a dead symlnk, OK, we really do need to abort.
+		[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+
+		cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
 		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		eprefixify "${T}"/ldconfig
 		into /
 		dosbin "${T}"/ldconfig
 		into /usr


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2022-04-17 18:32 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2022-04-17 18:32 UTC (permalink / raw
  To: gentoo-commits

commit:     bab089b31cc0021fbf8fc389c4a1abdc41dd3fa6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 17 18:25:25 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Apr 17 18:25:25 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bab089b3

sys-libs/musl: drop 1.2.2-r3, 1.2.2-r4, 1.2.2-r6

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in    | 144 --------------------------------
 sys-libs/musl/files/ldconfig.in-r1 | 155 ----------------------------------
 sys-libs/musl/musl-1.2.2-r3.ebuild | 151 ---------------------------------
 sys-libs/musl/musl-1.2.2-r4.ebuild | 167 -------------------------------------
 sys-libs/musl/musl-1.2.2-r6.ebuild | 167 -------------------------------------
 5 files changed, 784 deletions(-)

diff --git a/sys-libs/musl/files/ldconfig.in b/sys-libs/musl/files/ldconfig.in
deleted file mode 100644
index 19c94d85353a..000000000000
--- a/sys-libs/musl/files/ldconfig.in
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash -e
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-ROOT="/"
-
-LDSO_CONF="/etc/ld.so.conf"
-if [[ ! -e $LDSO_CONF ]]; then
-	echo "$LDSO_CONF not found" >&2
-	exit 1
-fi
-
-LDSO_CONF_DIR=$(dirname $LDSO_CONF)
-
-VERBOSE=0
-
-UPDATE_LINKS=1
-
-get_options() {
-	while getopts "vnNXf:C:r:p" opt "$@"; do
-		case $opt in
-		v)
-			echo "ldconfig for musl in Gentoo"
-			VERBOSE=1
-			;;
-		r)
-			ROOT=$OPTARG
-			;;
-		f)
-			LDSO_CONF=$OPTARG
-			;;
-		X)
-			UPDATE_LINKS=0
-			;;
-		\?)
-			echo "Invalid option: -$opt" >&2
-			exit 1
-			;;
-		n|N|C|p)
-			echo "Unimplemented option: -$opt" >&2
-			exit 1
-			;;
-		esac
-	done
-
-	if [[ $UPDATE_LINKS == 1 ]]; then
-		echo "Updating links is not implemented."
-	fi
-}
-
-
-repeated() {
-	local l=$1
-	local drs="${@:2}"
-	for m in $drs; do
-		[[ $m == $l ]] && return 0
-	done
-	return 1
-}
-
-expand() {
-	# We are assuming the ld.so.conf's 'include' is not recursive
-	local f line l
-	local glob="$LDSO_CONF_DIR/$1"
-	local drs="${@:2} "
-
-	for f in $glob; do
-		[[ ! -f $f ]] && continue
-		while read line; do
-			line=${line%%#*}
-			line=${line//:/ }
-			line=${line//,/ }
-			for l in $line; do
-				#We must add this whether or not the directory exists
-				repeated $l $drs && continue
-				drs+=" $l "
-			done
-		done < $f
-	done
-
-	echo $drs
-}
-
-read_ldso_conf() {
-	local drs=" "
-
-	while read line; do
-		# Sanitize the line - see ldconfig(8) for delimiters
-		# Note: bash read turns tabs into spaces and read already
-		# delimits on newlines with the default $IFS
-		line=${line%%#*}   # Remove comments
-		line=${line//:/ }  # Change colon delimiter to space
-		line=${line//,/ }  # Change comma delimiter to space
-
-		next=0
-		for l in $line; do
-			if [[ $next == 1 ]]; then
-				next=0
-				drs=$(expand $l $drs)
-			elif [[ $l == "include" ]]; then
-				next=1
-			else
-				# glibc's ldconfig silently skips non directories
-				if [[ -d $l ]]; then
-					repeated $l $drs && continue
-					drs+=" $l "
-				fi
-			fi
-		done
-	done < $1
-
-	echo $drs
-}
-
-sanitize() {
-	local drs=$@
-
-	repeated "/lib" $drs || drs="/lib $drs"
-	repeated "/usr/lib" $drs || drs="/usr/lib $drs"
-
-	echo $drs
-}
-
-get_options "$@"
-drs=$(read_ldso_conf "$LDSO_CONF")
-drs=$(sanitize $drs)
-
-ARCH=@@ARCH@@
-LDSO_PATH="/lib/ld-musl-${ARCH}.so.1"
-if [[ ! -e $LDSO_PATH ]]; then
-	echo "$LDSO_PATH not found" >&2
-	exit 1
-fi
-
-LDSO_ARCH=$(basename $LDSO_PATH)
-LDSO_NAME=${LDSO_ARCH%.so.1}
-ETC_LDSO_PATH=/etc/${LDSO_NAME}.path
-
-X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
-for d in $drs; do
-	echo $d >> $X
-done
-chmod 644 $X
-mv $X $ETC_LDSO_PATH

diff --git a/sys-libs/musl/files/ldconfig.in-r1 b/sys-libs/musl/files/ldconfig.in-r1
deleted file mode 100644
index 7bf254dfd91c..000000000000
--- a/sys-libs/musl/files/ldconfig.in-r1
+++ /dev/null
@@ -1,155 +0,0 @@
-#!/bin/bash -e
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-ROOT="/"
-LDSO_CONF="/etc/ld.so.conf"
-
-VERBOSE=0
-
-UPDATE_LINKS=1
-
-get_options() {
-	while getopts "vnNXf:C:r:p" opt "$@"; do
-		case $opt in
-		v)
-			echo "ldconfig for musl in Gentoo"
-			VERBOSE=1
-			;;
-		r)
-			ROOT=${OPTARG}
-			LDSO_CONF=${ROOT}${LDSO_CONF}
-			LDSO_CONF_DIR=$(dirname ${LDSO_CONF})
-			;;
-		f)
-			LDSO_CONF=${OPTARG}
-			;;
-		X)
-			UPDATE_LINKS=0
-			;;
-		\?)
-			echo "Invalid option: -${opt}" >&2
-			exit 1
-			;;
-		n|N|C|p)
-			echo "Unimplemented option: -${opt}" >&2
-			exit 1
-			;;
-		esac
-	done
-
-	if [[ ${UPDATE_LINKS} == 1 ]]; then
-		echo "Updating links is not implemented."
-	fi
-}
-
-
-repeated() {
-	local l=${1}
-	local drs="${@:2}"
-	for m in ${drs}; do
-		[[ ${m} == ${l} ]] && return 0
-	done
-	return 1
-}
-
-expand() {
-	# We are assuming the ld.so.conf's 'include' is not recursive
-	local f line l
-	local glob="${LDSO_CONF_DIR}/${1}"
-	local drs="${@:2} "
-
-	for f in ${glob}; do
-		[[ ! -f ${f} ]] && continue
-		while read line; do
-			line=${line%%#*}
-			line=${line//:/ }
-			line=${line//,/ }
-			for l in ${line}; do
-				# We must add this whether or not the directory exists
-				repeated ${l} ${drs} && continue
-				drs+=" ${l} "
-			done
-		done < ${f}
-	done
-
-	echo ${drs}
-}
-
-read_ldso_conf() {
-	local drs=" "
-
-	while read line; do
-		# Sanitize the line - see ldconfig(8) for delimiters
-		# Note: bash read turns tabs into spaces and read already
-		# delimits on newlines with the default $IFS
-		line=${line%%#*}   # Remove comments
-		line=${line//:/ }  # Change colon delimiter to space
-		line=${line//,/ }  # Change comma delimiter to space
-
-		next=0
-		for l in ${line}; do
-			if [[ ${next} == 1 ]]; then
-				next=0
-				drs=$(expand ${l} ${drs})
-			elif [[ ${l} == "include" ]]; then
-				next=1
-			else
-				# glibc's ldconfig silently skips non directories
-				if [[ -d ${l} ]]; then
-					repeated ${l} ${drs} && continue
-					drs+=" ${l} "
-				fi
-			fi
-		done
-	done < ${1}
-
-	echo ${drs}
-}
-
-sanitize() {
-	local drs=$@
-
-	repeated "/lib" ${drs} || drs="/lib ${drs}"
-	repeated "/usr/lib" ${drs} || drs="/usr/lib ${drs}"
-
-	echo ${drs}
-}
-
-changed() {
-	[[ -f ${ETC_LDSO_PATH} ]] || return 0
-	local current=$(<${ETC_LDSO_PATH})
-	current=${current//$'\n'/ }
-	[[ ${current} != ${drs} ]] || return 1
-}
-
-get_options "$@"
-
-if [[ ! -e ${LDSO_CONF} ]]; then
-        echo "${LDSO_CONF} not found" >&2
-        exit 1
-fi
-
-LDSO_CONF_DIR=$(dirname ${LDSO_CONF})
-
-drs=$(read_ldso_conf "${LDSO_CONF}")
-drs=$(sanitize ${drs})
-
-ARCH=@@ARCH@@
-LDSO_PATH="${ROOT}/lib/ld-musl-${ARCH}.so.1"
-if [[ ! -e ${LDSO_PATH} ]]; then
-	echo "${LDSO_PATH} not found" >&2
-	exit 1
-fi
-
-LDSO_ARCH=$(basename ${LDSO_PATH})
-LDSO_NAME=${LDSO_ARCH%.so.1}
-ETC_LDSO_PATH="${ROOT}/etc/${LDSO_NAME}.path"
-
-changed || exit 0
-X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
-for d in ${drs}; do
-	echo ${d} >> ${X}
-done
-chmod 644 ${X}
-mv ${X} ${ETC_LDSO_PATH}

diff --git a/sys-libs/musl/musl-1.2.2-r3.ebuild b/sys-libs/musl/musl-1.2.2-r3.ebuild
deleted file mode 100644
index 5d2851eac250..000000000000
--- a/sys-libs/musl/musl-1.2.2-r3.ebuild
+++ /dev/null
@@ -1,151 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit flag-o-matic toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
-	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
-GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
-SRC_URI+="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
-"
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="https://musl.libc.org"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_unpack() {
-	if [[ ${PV} == 9999 ]]; then
-		git-r3_src_unpack
-	else
-		unpack "${P}.tar.gz"
-	fi
-	mkdir misc || die
-	cp "${DISTDIR}"/getconf.c misc/getconf.c || die
-	cp "${DISTDIR}/${GETENT_FILE}" misc/getent.c || die
-	cp "${DISTDIR}"/iconv.c misc/iconv.c || die
-}
-
-src_prepare() {
-	default
-
-	# Expand gethostid instead of being just a stub
-	eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${WORKDIR}/misc"
-	fi
-
-	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
-	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-		[[ -e "${D}"/lib/ld-musl-${arch}.so.1 ]] || die
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-		dolib.a libssp_nonshared.a
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}

diff --git a/sys-libs/musl/musl-1.2.2-r4.ebuild b/sys-libs/musl/musl-1.2.2-r4.ebuild
deleted file mode 100644
index 868577f61ad2..000000000000
--- a/sys-libs/musl/musl-1.2.2-r4.ebuild
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit eapi8-dosym flag-o-matic toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
-	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
-GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
-SRC_URI+="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
-"
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="https://musl.libc.org"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_unpack() {
-	if [[ ${PV} == 9999 ]]; then
-		git-r3_src_unpack
-	else
-		unpack "${P}.tar.gz"
-	fi
-	mkdir misc || die
-	cp "${DISTDIR}"/getconf.c misc/getconf.c || die
-	cp "${DISTDIR}/${GETENT_FILE}" misc/getent.c || die
-	cp "${DISTDIR}"/iconv.c misc/iconv.c || die
-}
-
-src_prepare() {
-	default
-
-	# Expand gethostid instead of being just a stub
-	eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${WORKDIR}/misc"
-	fi
-
-	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
-	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-
-		if [[ ! -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] ; then
-			# During cross (using crossdev), when emerging sys-libs/musl,
-			# if /usr/lib/libc.so.1 doesn't exist on the system, installation
-			# would fail.
-			#
-			# The musl build system seems to create a symlink:
-			# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
-			# During cross, there's no guarantee that the host is using musl
-			# so that file may not exist. Use a relative symlink within ${D}
-			# instead.
-			dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-			# If it's still a dead symlnk, OK, we really do need to abort.
-			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
-		fi
-
-		cp "${FILESDIR}"/ldconfig.in "${T}" || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-		dolib.a libssp_nonshared.a
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}

diff --git a/sys-libs/musl/musl-1.2.2-r6.ebuild b/sys-libs/musl/musl-1.2.2-r6.ebuild
deleted file mode 100644
index 79a60682c79f..000000000000
--- a/sys-libs/musl/musl-1.2.2-r6.ebuild
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit eapi8-dosym flag-o-matic toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
-	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
-GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
-SRC_URI+="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
-"
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="https://musl.libc.org"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_unpack() {
-	if [[ ${PV} == 9999 ]]; then
-		git-r3_src_unpack
-	else
-		unpack "${P}.tar.gz"
-	fi
-	mkdir misc || die
-	cp "${DISTDIR}"/getconf.c misc/getconf.c || die
-	cp "${DISTDIR}/${GETENT_FILE}" misc/getent.c || die
-	cp "${DISTDIR}"/iconv.c misc/iconv.c || die
-}
-
-src_prepare() {
-	default
-
-	# Expand gethostid instead of being just a stub
-	eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${WORKDIR}/misc"
-	fi
-
-	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
-	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-
-		if [[ ! -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] ; then
-			# During cross (using crossdev), when emerging sys-libs/musl,
-			# if /usr/lib/libc.so.1 doesn't exist on the system, installation
-			# would fail.
-			#
-			# The musl build system seems to create a symlink:
-			# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
-			# During cross, there's no guarantee that the host is using musl
-			# so that file may not exist. Use a relative symlink within ${D}
-			# instead.
-			dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-			# If it's still a dead symlnk, OK, we really do need to abort.
-			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
-		fi
-
-		cp "${FILESDIR}"/ldconfig.in-r1 "${T}"/ldconfig.in || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-		dolib.a libssp_nonshared.a
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ "${ROOT}" != "/" ] && return 0
-
-	ldconfig || die
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2022-07-26  4:15 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2022-07-26  4:15 UTC (permalink / raw
  To: gentoo-commits

commit:     88ddfaf3f21c38a62cd7bac3e0d17e3c9de8dfdb
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 04:13:47 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 04:13:47 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88ddfaf3

sys-libs/musl: drop 1.2.2-r7

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/musl/files/ldconfig.in-r2 | 157 ----------------------------------
 sys-libs/musl/musl-1.2.2-r7.ebuild | 167 -------------------------------------
 2 files changed, 324 deletions(-)

diff --git a/sys-libs/musl/files/ldconfig.in-r2 b/sys-libs/musl/files/ldconfig.in-r2
deleted file mode 100644
index 72a2f58bc744..000000000000
--- a/sys-libs/musl/files/ldconfig.in-r2
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/bash -e
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-ROOT="/"
-LDSO_CONF="/etc/ld.so.conf"
-
-VERBOSE=0
-
-UPDATE_LINKS=1
-
-get_options() {
-	while getopts "vnNXf:C:r:p" opt "$@"; do
-		case $opt in
-		v)
-			echo "ldconfig for musl in Gentoo"
-			VERBOSE=1
-			;;
-		r)
-			ROOT=${OPTARG}
-			LDSO_CONF=${ROOT}${LDSO_CONF}
-			LDSO_CONF_DIR=$(dirname ${LDSO_CONF})
-			;;
-		f)
-			LDSO_CONF=${OPTARG}
-			;;
-		X)
-			UPDATE_LINKS=0
-			;;
-		\?)
-			echo "Invalid option: -${opt}" >&2
-			exit 1
-			;;
-		n|N|C|p)
-			echo "Unimplemented option: -${opt}" >&2
-			exit 1
-			;;
-		esac
-	done
-
-	if [[ ${UPDATE_LINKS} == 1 ]]; then
-		echo "Updating links is not implemented."
-	fi
-}
-
-
-repeated() {
-	local l=${1}
-	local drs="${@:2}"
-	for m in ${drs}; do
-		[[ ${m} == ${l} ]] && return 0
-	done
-	return 1
-}
-
-expand() {
-	# We are assuming the ld.so.conf's 'include' is not recursive
-	local f line l
-	local glob="${LDSO_CONF_DIR}/${1}"
-	local drs="${@:2} "
-
-	for f in ${glob}; do
-		[[ ! -f ${f} ]] && continue
-		while read line; do
-			line=${line%%#*}
-			line=${line//:/ }
-			line=${line//,/ }
-			for l in ${line}; do
-				# We must add this whether or not the directory exists
-				repeated ${l} ${drs} && continue
-				drs+=" ${l} "
-			done
-		done < ${f}
-	done
-
-	echo ${drs}
-}
-
-read_ldso_conf() {
-	local drs=" "
-
-	while read line; do
-		# Sanitize the line - see ldconfig(8) for delimiters
-		# Note: bash read turns tabs into spaces and read already
-		# delimits on newlines with the default $IFS
-		line=${line%%#*}   # Remove comments
-		line=${line//:/ }  # Change colon delimiter to space
-		line=${line//,/ }  # Change comma delimiter to space
-
-		next=0
-		for l in ${line}; do
-			if [[ ${next} == 1 ]]; then
-				next=0
-				drs=$(expand ${l} ${drs})
-			elif [[ ${l} == "include" ]]; then
-				next=1
-			else
-				# glibc's ldconfig silently skips non directories
-				if [[ -d ${l} ]]; then
-					repeated ${l} ${drs} && continue
-					drs+=" ${l} "
-				fi
-			fi
-		done
-	done < ${1}
-
-	echo ${drs}
-}
-
-sanitize() {
-	local drs=$@
-
-	repeated "/lib" ${drs} || drs="/lib ${drs}"
-	repeated "/usr/lib" ${drs} || drs="/usr/lib ${drs}"
-
-	echo ${drs}
-}
-
-changed() {
-	[[ -f ${ETC_LDSO_PATH} ]] || return 0
-	local current=$(<${ETC_LDSO_PATH})
-	current=${current//$'\n'/ }
-	[[ ${current} != ${drs} ]] || return 1
-}
-
-get_options "$@"
-
-if [[ ! -e ${LDSO_CONF} ]]; then
-        echo "${LDSO_CONF} not found" >&2
-        exit 1
-fi
-
-LDSO_CONF_DIR=$(dirname ${LDSO_CONF})
-
-drs=$(read_ldso_conf "${LDSO_CONF}")
-drs=$(sanitize ${drs})
-
-ARCH=@@ARCH@@
-LDSO_PATH="${ROOT}/lib/ld-musl-${ARCH}.so.1"
-if [[ ! -e ${LDSO_PATH} ]]; then
-	echo "${LDSO_PATH} not found" >&2
-	exit 1
-fi
-
-LDSO_ARCH=$(basename ${LDSO_PATH})
-LDSO_NAME=${LDSO_ARCH%.so.1}
-ETC_LDSO_PATH="${ROOT}/etc/${LDSO_NAME}.path"
-
-changed || exit 0
-X=$(mktemp -p /tmp ${LDSO_NAME}.XXXXXX)
-for d in ${drs}; do
-	echo ${d} >> ${X}
-done
-chmod 644 ${X}
-# busybox doesn't support mz -Z
-cp ${X} ${ETC_LDSO_PATH}
-rm ${X}

diff --git a/sys-libs/musl/musl-1.2.2-r7.ebuild b/sys-libs/musl/musl-1.2.2-r7.ebuild
deleted file mode 100644
index de91db9af87b..000000000000
--- a/sys-libs/musl/musl-1.2.2-r7.ebuild
+++ /dev/null
@@ -1,167 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit eapi8-dosym flag-o-matic toolchain-funcs
-if [[ ${PV} == "9999" ]] ; then
-	EGIT_REPO_URI="git://git.musl-libc.org/musl"
-	inherit git-r3
-else
-	SRC_URI="http://www.musl-libc.org/releases/${P}.tar.gz"
-	KEYWORDS="-* amd64 arm arm64 ~mips ppc ppc64 x86"
-fi
-GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
-GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
-SRC_URI+="
-	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
-	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
-	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
-"
-
-export CBUILD=${CBUILD:-${CHOST}}
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
-	if [[ ${CATEGORY} == cross-* ]] ; then
-		export CTARGET=${CATEGORY#cross-}
-	fi
-fi
-
-DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
-HOMEPAGE="https://musl.libc.org"
-LICENSE="MIT LGPL-2 GPL-2"
-SLOT="0"
-IUSE="headers-only"
-
-QA_SONAME="/usr/lib/libc.so"
-QA_DT_NEEDED="/usr/lib/libc.so"
-
-is_crosscompile() {
-	[[ ${CHOST} != ${CTARGET} ]]
-}
-
-just_headers() {
-	use headers-only && is_crosscompile
-}
-
-pkg_setup() {
-	if [ ${CTARGET} == ${CHOST} ] ; then
-		case ${CHOST} in
-		*-musl*) ;;
-		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
-		esac
-	fi
-
-	# fix for #667126, copied from glibc ebuild
-	# make sure host make.conf doesn't pollute us
-	if is_crosscompile || tc-is-cross-compiler ; then
-		CHOST=${CTARGET} strip-unsupported-flags
-	fi
-}
-
-src_unpack() {
-	if [[ ${PV} == 9999 ]]; then
-		git-r3_src_unpack
-	else
-		unpack "${P}.tar.gz"
-	fi
-	mkdir misc || die
-	cp "${DISTDIR}"/getconf.c misc/getconf.c || die
-	cp "${DISTDIR}/${GETENT_FILE}" misc/getent.c || die
-	cp "${DISTDIR}"/iconv.c misc/iconv.c || die
-}
-
-src_prepare() {
-	default
-
-	# Expand gethostid instead of being just a stub
-	eapply "${FILESDIR}/${PN}-1.2.2-gethostid.patch"
-}
-
-src_configure() {
-	tc-getCC ${CTARGET}
-	just_headers && export CC=true
-
-	local sysroot
-	is_crosscompile && sysroot="${EPREFIX}"/usr/${CTARGET}
-	./configure \
-		--target=${CTARGET} \
-		--prefix=${sysroot}/usr \
-		--syslibdir=${sysroot}/lib \
-		--disable-gcc-wrapper || die
-}
-
-src_compile() {
-	emake obj/include/bits/alltypes.h
-	just_headers && return 0
-
-	emake
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		emake -C "${T}" getconf getent iconv \
-			CC="$(tc-getCC)" \
-			CFLAGS="${CFLAGS}" \
-			CPPFLAGS="${CPPFLAGS}" \
-			LDFLAGS="${LDFLAGS}" \
-			VPATH="${WORKDIR}/misc"
-	fi
-
-	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
-	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
-}
-
-src_install() {
-	local target="install"
-	just_headers && target="install-headers"
-	emake DESTDIR="${D}" ${target}
-	just_headers && return 0
-
-	# musl provides ldd via a sym link to its ld.so
-	local sysroot
-	is_crosscompile && sysroot=/usr/${CTARGET}
-	local ldso=$(basename "${D}"${sysroot}/lib/ld-musl-*)
-	dosym ${sysroot}/lib/${ldso} ${sysroot}/usr/bin/ldd
-
-	if [[ ${CATEGORY} != cross-* ]] ; then
-		# Fish out of config:
-		#   ARCH = ...
-		#   SUBARCH = ...
-		# and print $(ARCH)$(SUBARCH).
-		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
-
-		if [[ ! -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] ; then
-			# During cross (using crossdev), when emerging sys-libs/musl,
-			# if /usr/lib/libc.so.1 doesn't exist on the system, installation
-			# would fail.
-			#
-			# The musl build system seems to create a symlink:
-			# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
-			# During cross, there's no guarantee that the host is using musl
-			# so that file may not exist. Use a relative symlink within ${D}
-			# instead.
-			dosym8 -r /usr/lib/libc.so /lib/ld-musl-${arch}.so.1
-
-			# If it's still a dead symlnk, OK, we really do need to abort.
-			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
-		fi
-
-		cp "${FILESDIR}"/ldconfig.in-r2 "${T}"/ldconfig.in || die
-		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
-		into /
-		dosbin "${T}"/ldconfig
-		into /usr
-		dobin "${T}"/getconf
-		dobin "${T}"/getent
-		dobin "${T}"/iconv
-		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
-		doenvd "${T}"/00musl
-		dolib.a libssp_nonshared.a
-	fi
-}
-
-pkg_postinst() {
-	is_crosscompile && return 0
-
-	[ -n "${ROOT}" ] && return 0
-
-	ldconfig || die
-}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2023-11-09  0:57 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2023-11-09  0:57 UTC (permalink / raw
  To: gentoo-commits

commit:     6167c89db9b5c6f986d8fe7f54e72953d0e9026c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Nov  9 00:56:25 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Nov  9 00:56:25 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6167c89d

sys-libs/musl: fix header compat w/ elfutils-0.190

Per #musl, this is similar to what will be pushed in musl git soon.

Closes: https://bugs.gentoo.org/916857
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/musl-1.2.4-elfutils-0.190-relr.patch     |  73 ++++++++
 sys-libs/musl/musl-1.2.4-r1.ebuild                 | 204 +++++++++++++++++++++
 2 files changed, 277 insertions(+)

diff --git a/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch b/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch
new file mode 100644
index 000000000000..e5eaf46f7810
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.2.4-elfutils-0.190-relr.patch
@@ -0,0 +1,73 @@
+https://www.openwall.com/lists/musl/2023/11/06/3
+https://inbox.vuxu.org/musl/20231106113336.3664-2-ncopa@alpinelinux.org/T/#u
+https://sourceware.org/bugzilla/show_bug.cgi?id=31034
+https://bugs.gentoo.org/916857
+
+From mboxrd@z Thu Jan  1 00:00:00 1970
+X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org
+X-Spam-Level: 
+X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED,
+	MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,
+	RCVD_IN_MSPIKE_WL,T_SCC_BODY_TEXT_LINE autolearn=ham
+	autolearn_force=no version=3.4.4
+Received: (qmail 5179 invoked from network); 6 Nov 2023 11:46:34 -0000
+Received: from second.openwall.net (193.110.157.125)
+  by inbox.vuxu.org with ESMTPUTF8; 6 Nov 2023 11:46:34 -0000
+Received: (qmail 30570 invoked by uid 550); 6 Nov 2023 11:46:29 -0000
+Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm
+Precedence: bulk
+List-Post: <mailto:musl@lists.openwall.com>
+List-Help: <mailto:musl-help@lists.openwall.com>
+List-Unsubscribe: <mailto:musl-unsubscribe@lists.openwall.com>
+List-Subscribe: <mailto:musl-subscribe@lists.openwall.com>
+List-ID: <musl.lists.openwall.com>
+Reply-To: musl@lists.openwall.com
+Received: (qmail 30538 invoked from network); 6 Nov 2023 11:46:29 -0000
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alpinelinux.org;
+	s=smtp; t=1699271177;
+	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
+	 to:to:cc:cc:mime-version:mime-version:
+	 content-transfer-encoding:content-transfer-encoding;
+	bh=73HDLjg72r1JGckDGbEyPxYrYL7dC7MB3gMwy/yp7hc=;
+	b=pSGCs/DrFDbs9eEA89un578pZbyzpmTw81QGH7xK4ZAAkYiXx1ysaXlsllwxGd076F+plw
+	kE1QbGVndutc+ieeUOiHomF4O8IP4AqO/8xCy52LlYmnhMTcxgoXD/GWHfVcXmIgFb+8Uc
+	jvgM9nXFOXceFSlHLLOwJBQFE2dyBrU=
+From: Natanael Copa <ncopa@alpinelinux.org>
+To: musl@lists.openwall.com
+Cc: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon,  6 Nov 2023 12:33:37 +0100
+Message-ID: <20231106113336.3664-2-ncopa@alpinelinux.org>
+X-Mailer: git-send-email 2.42.1
+MIME-Version: 1.0
+Content-Transfer-Encoding: 8bit
+Subject: [musl] [PATCH] elf.h: add typedefs for Elf*_Relr
+
+Add typedefs for Elf32_Relr and Elf64_Relr as a follow-up to commit
+d32dadd60efb (ldso: support DT_RELR relative relocation format)
+
+---
+This fixes build of iproute2 with elfutils 0.190, which assumes that
+Elf*_Relr are typedef'ed when SHT_RELR is defined.
+
+ref: https://sourceware.org/git/?p=elfutils.git;a=commit;h=39f2c500542f69c2f1a13fd0ae4eaa5778d2ed8d
+ref: https://sourceware.org/bugzilla/show_bug.cgi?id=31034
+
+ include/elf.h | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/include/elf.h b/include/elf.h
+index 23f2c4bc..aa186d9d 100644
+--- a/include/elf.h
++++ b/include/elf.h
+@@ -32,6 +32,9 @@ typedef uint16_t Elf64_Section;
+ typedef Elf32_Half Elf32_Versym;
+ typedef Elf64_Half Elf64_Versym;
+ 
++typedef Elf32_Word Elf32_Relr;
++typedef Elf64_Xword Elf64_Relr;
++
+ #define EI_NIDENT (16)
+ 
+ typedef struct {
+-- 
+2.42.1

diff --git a/sys-libs/musl/musl-1.2.4-r1.ebuild b/sys-libs/musl/musl-1.2.4-r1.ebuild
new file mode 100644
index 000000000000..899ae673cc90
--- /dev/null
+++ b/sys-libs/musl/musl-1.2.4-r1.ebuild
@@ -0,0 +1,204 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit crossdev flag-o-matic toolchain-funcs prefix
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="git://git.musl-libc.org/musl"
+	inherit git-r3
+else
+	VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/musl.asc
+	inherit verify-sig
+
+	SRC_URI="https://musl.libc.org/releases/${P}.tar.gz"
+	SRC_URI+=" verify-sig? ( https://musl.libc.org/releases/${P}.tar.gz.asc )"
+	KEYWORDS="-* ~amd64 ~arm ~arm64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+
+	BDEPEND="verify-sig? ( sec-keys/openpgp-keys-musl )"
+fi
+GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
+GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
+SRC_URI+="
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
+"
+
+DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="https://musl.libc.org"
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crypt headers-only split-usr"
+
+QA_SONAME="usr/lib/libc.so"
+QA_DT_NEEDED="usr/lib/libc.so"
+# bug #830213
+QA_PRESTRIPPED="usr/lib/crtn.o"
+
+# We want crypt on by default for this as sys-libs/libxcrypt isn't (yet?)
+# built as part as crossdev. Also, elide the blockers when in cross-*,
+# as it doesn't make sense to block the normal CBUILD libxcrypt at all
+# there when we're installing into /usr/${CHOST} anyway.
+if is_crosspkg ; then
+	IUSE="${IUSE/crypt/+crypt}"
+else
+	RDEPEND="crypt? ( !sys-libs/libxcrypt[system] )"
+	PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )"
+fi
+
+PATCHES=(
+	"${FILESDIR}"/${P}-elfutils-0.190-relr.patch
+)
+
+just_headers() {
+	use headers-only && target_is_not_host
+}
+
+pkg_setup() {
+	if [ ${CTARGET} == ${CHOST} ] ; then
+		case ${CHOST} in
+		*-musl*) ;;
+		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+		esac
+	fi
+
+	# fix for #667126, copied from glibc ebuild
+	# make sure host make.conf doesn't pollute us
+	if target_is_not_host || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	elif use verify-sig ; then
+		# We only verify the release; not the additional (fixed, safe) files
+		# we download.
+		# (Seem to get IPC error on verifying in cross?)
+		! target_is_not_host && verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
+	fi
+
+	default
+}
+
+src_prepare() {
+	default
+
+	mkdir "${WORKDIR}"/misc || die
+	cp "${DISTDIR}"/getconf.c "${WORKDIR}"/misc/getconf.c || die
+	cp "${DISTDIR}/${GETENT_FILE}" "${WORKDIR}"/misc/getent.c || die
+	cp "${DISTDIR}"/iconv.c "${WORKDIR}"/misc/iconv.c || die
+}
+
+src_configure() {
+	strip-flags && filter-lto # Prevent issues caused by aggressive optimizations & bug #877343
+	tc-getCC ${CTARGET}
+
+	just_headers && export CC=true
+
+	local sysroot
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	./configure \
+		--target=${CTARGET} \
+		--prefix="${EPREFIX}${sysroot}/usr" \
+		--syslibdir="${EPREFIX}${sysroot}/lib" \
+		--disable-gcc-wrapper || die
+}
+
+src_compile() {
+	emake obj/include/bits/alltypes.h
+	just_headers && return 0
+
+	emake
+	if ! is_crosspkg ; then
+		emake -C "${T}" getconf getent iconv \
+			CC="$(tc-getCC)" \
+			CFLAGS="${CFLAGS}" \
+			CPPFLAGS="${CPPFLAGS}" \
+			LDFLAGS="${LDFLAGS}" \
+			VPATH="${WORKDIR}/misc"
+	fi
+
+	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
+}
+
+src_install() {
+	local target="install"
+	just_headers && target="install-headers"
+	emake DESTDIR="${D}" ${target}
+	just_headers && return 0
+
+	# musl provides ldd via a sym link to its ld.so
+	local sysroot=
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	local ldso=$(basename "${ED}${sysroot}"/lib/ld-musl-*)
+	dosym -r "${sysroot}/lib/${ldso}" "${sysroot}/usr/bin/ldd"
+
+	if ! use crypt ; then
+		# Allow sys-libs/libxcrypt[system] to provide it instead
+		rm "${ED}/usr/include/crypt.h" || die
+		rm "${ED}/usr/$(get_libdir)/libcrypt.a" || die
+	fi
+
+	if ! is_crosspkg ; then
+		# Fish out of config:
+		#   ARCH = ...
+		#   SUBARCH = ...
+		# and print $(ARCH)$(SUBARCH).
+		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
+
+		# The musl build system seems to create a symlink:
+		# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
+		# During cross or within prefix, there's no guarantee that the host is
+		# using musl so that file may not exist. Use a relative symlink within
+		# ${D} instead.
+		rm "${ED}"/lib/ld-musl-${arch}.so.1 || die
+		if use split-usr; then
+			dosym ../usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+			# If it's still a dead symlnk, OK, we really do need to abort.
+			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+		else
+			dosym libc.so /usr/lib/ld-musl-${arch}.so.1
+			[[ -e "${ED}"/usr/lib/ld-musl-${arch}.so.1 ]] || die
+		fi
+
+		cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
+		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		eprefixify "${T}"/ldconfig
+		into /
+		dosbin "${T}"/ldconfig
+		into /usr
+		dobin "${T}"/getconf
+		dobin "${T}"/getent
+		dobin "${T}"/iconv
+		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
+		doenvd "${T}"/00musl
+	fi
+
+	if target_is_not_host ; then
+		into /usr/${CTARGET}
+		dolib.a libssp_nonshared.a
+	else
+		dolib.a libssp_nonshared.a
+	fi
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+}
+
+pkg_postinst() {
+	target_is_not_host && return 0
+
+	[ -n "${ROOT}" ] && return 0
+
+	ldconfig || die
+}


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

* [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/
@ 2024-05-20  8:16 Sam James
  0 siblings, 0 replies; 10+ messages in thread
From: Sam James @ 2024-05-20  8:16 UTC (permalink / raw
  To: gentoo-commits

commit:     9aabd6aa9abd2c48f85cb582fadf81eae944600f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon May 20 08:16:22 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon May 20 08:16:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9aabd6aa

sys-libs/musl: fix crti.o on arm64

Closes: https://bugs.gentoo.org/931782
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/musl-1.2.4-arm64-crti-alignment.patch    |  32 ++++
 sys-libs/musl/musl-1.2.4-r2.ebuild                 | 205 ++++++++++++++++++++
 sys-libs/musl/musl-1.2.5-r1.ebuild                 | 207 +++++++++++++++++++++
 3 files changed, 444 insertions(+)

diff --git a/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch b/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch
new file mode 100644
index 000000000000..8b548bdb255f
--- /dev/null
+++ b/sys-libs/musl/files/musl-1.2.4-arm64-crti-alignment.patch
@@ -0,0 +1,32 @@
+https://git.musl-libc.org/cgit/musl/commit/?id=cbf59dd662cea8786c2f3a5ea21f8da64f002b30
+https://github.com/rui314/mold/issues/1255
+https://bugs.gentoo.org/931782
+
+From cbf59dd662cea8786c2f3a5ea21f8da64f002b30 Mon Sep 17 00:00:00 2001
+From: mojyack <mojyack@gmail.com>
+Date: Sun, 12 May 2024 12:13:06 -0400
+Subject: aarch64 crti.o: fix alignment of _init/_fini
+
+without explicit alignment directives, whether they end up at the
+necessary alignment depends on linker/linking conditions. initially
+reported as mold issue 1255.
+--- a/crt/aarch64/crti.s
++++ b/crt/aarch64/crti.s
+@@ -1,6 +1,7 @@
+ .section .init
+ .global _init
+ .type _init,%function
++.align 2
+ _init:
+ 	stp x29,x30,[sp,-16]!
+ 	mov x29,sp
+@@ -8,6 +9,7 @@ _init:
+ .section .fini
+ .global _fini
+ .type _fini,%function
++.align 2
+ _fini:
+ 	stp x29,x30,[sp,-16]!
+ 	mov x29,sp
+-- 
+cgit v1.2.1

diff --git a/sys-libs/musl/musl-1.2.4-r2.ebuild b/sys-libs/musl/musl-1.2.4-r2.ebuild
new file mode 100644
index 000000000000..1ec30208d947
--- /dev/null
+++ b/sys-libs/musl/musl-1.2.4-r2.ebuild
@@ -0,0 +1,205 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit crossdev flag-o-matic toolchain-funcs prefix
+if [[ ${PV} == "9999" ]] ; then
+	EGIT_REPO_URI="https://git.musl-libc.org/git/musl"
+	inherit git-r3
+else
+	VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/musl.asc
+	inherit verify-sig
+
+	SRC_URI="https://musl.libc.org/releases/${P}.tar.gz"
+	SRC_URI+=" verify-sig? ( https://musl.libc.org/releases/${P}.tar.gz.asc )"
+	KEYWORDS="-* ~amd64 ~arm ~arm64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+
+	BDEPEND="verify-sig? ( sec-keys/openpgp-keys-musl )"
+fi
+GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
+GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
+SRC_URI+="
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
+"
+
+DESCRIPTION="Light, fast and simple C library focused on standards-conformance and safety"
+HOMEPAGE="https://musl.libc.org"
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crypt headers-only split-usr"
+
+QA_SONAME="usr/lib/libc.so"
+QA_DT_NEEDED="usr/lib/libc.so"
+# bug #830213
+QA_PRESTRIPPED="usr/lib/crtn.o"
+
+# We want crypt on by default for this as sys-libs/libxcrypt isn't (yet?)
+# built as part as crossdev. Also, elide the blockers when in cross-*,
+# as it doesn't make sense to block the normal CBUILD libxcrypt at all
+# there when we're installing into /usr/${CHOST} anyway.
+if is_crosspkg ; then
+	IUSE="${IUSE/crypt/+crypt}"
+else
+	RDEPEND="crypt? ( !sys-libs/libxcrypt[system] )"
+	PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )"
+fi
+
+PATCHES=(
+	"${FILESDIR}"/${P}-elfutils-0.190-relr.patch
+	"${FILESDIR}"/${PN}-1.2.4-arm64-crti-alignment.patch
+)
+
+just_headers() {
+	use headers-only && target_is_not_host
+}
+
+pkg_setup() {
+	if [[ ${CTARGET} == ${CHOST} ]] ; then
+		case ${CHOST} in
+		*-musl*) ;;
+		*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+		esac
+	fi
+
+	# fix for #667126, copied from glibc ebuild
+	# make sure host make.conf doesn't pollute us
+	if target_is_not_host || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	elif use verify-sig ; then
+		# We only verify the release; not the additional (fixed, safe) files
+		# we download.
+		# (Seem to get IPC error on verifying in cross?)
+		! target_is_not_host && verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
+	fi
+
+	default
+}
+
+src_prepare() {
+	default
+
+	mkdir "${WORKDIR}"/misc || die
+	cp "${DISTDIR}"/getconf.c "${WORKDIR}"/misc/getconf.c || die
+	cp "${DISTDIR}/${GETENT_FILE}" "${WORKDIR}"/misc/getent.c || die
+	cp "${DISTDIR}"/iconv.c "${WORKDIR}"/misc/iconv.c || die
+}
+
+src_configure() {
+	strip-flags && filter-lto # Prevent issues caused by aggressive optimizations & bug #877343
+	tc-getCC ${CTARGET}
+
+	just_headers && export CC=true
+
+	local sysroot
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	./configure \
+		--target=${CTARGET} \
+		--prefix="${EPREFIX}${sysroot}/usr" \
+		--syslibdir="${EPREFIX}${sysroot}/lib" \
+		--disable-gcc-wrapper || die
+}
+
+src_compile() {
+	emake obj/include/bits/alltypes.h
+	just_headers && return 0
+
+	emake
+	if ! is_crosspkg ; then
+		emake -C "${T}" getconf getent iconv \
+			CC="$(tc-getCC)" \
+			CFLAGS="${CFLAGS}" \
+			CPPFLAGS="${CPPFLAGS}" \
+			LDFLAGS="${LDFLAGS}" \
+			VPATH="${WORKDIR}/misc"
+	fi
+
+	$(tc-getCC) ${CFLAGS} -c -o libssp_nonshared.o  "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
+}
+
+src_install() {
+	local target="install"
+	just_headers && target="install-headers"
+	emake DESTDIR="${D}" ${target}
+	just_headers && return 0
+
+	# musl provides ldd via a sym link to its ld.so
+	local sysroot=
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	local ldso=$(basename "${ED}${sysroot}"/lib/ld-musl-*)
+	dosym -r "${sysroot}/lib/${ldso}" "${sysroot}/usr/bin/ldd"
+
+	if ! use crypt ; then
+		# Allow sys-libs/libxcrypt[system] to provide it instead
+		rm "${ED}/usr/include/crypt.h" || die
+		rm "${ED}/usr/$(get_libdir)/libcrypt.a" || die
+	fi
+
+	if ! is_crosspkg ; then
+		# Fish out of config:
+		#   ARCH = ...
+		#   SUBARCH = ...
+		# and print $(ARCH)$(SUBARCH).
+		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
+
+		# The musl build system seems to create a symlink:
+		# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
+		# During cross or within prefix, there's no guarantee that the host is
+		# using musl so that file may not exist. Use a relative symlink within
+		# ${D} instead.
+		rm "${ED}"/lib/ld-musl-${arch}.so.1 || die
+		if use split-usr; then
+			dosym ../usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+			# If it's still a dead symlink, OK, we really do need to abort.
+			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+		else
+			dosym libc.so /usr/lib/ld-musl-${arch}.so.1
+			[[ -e "${ED}"/usr/lib/ld-musl-${arch}.so.1 ]] || die
+		fi
+
+		cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
+		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		eprefixify "${T}"/ldconfig
+		into /
+		dosbin "${T}"/ldconfig
+		into /usr
+		dobin "${T}"/getconf
+		dobin "${T}"/getent
+		dobin "${T}"/iconv
+		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
+		doenvd "${T}"/00musl
+	fi
+
+	if target_is_not_host ; then
+		into /usr/${CTARGET}
+		dolib.a libssp_nonshared.a
+	else
+		dolib.a libssp_nonshared.a
+	fi
+}
+
+pkg_preinst() {
+	# nothing to do if just installing headers
+	just_headers && return
+
+	# prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+}
+
+pkg_postinst() {
+	target_is_not_host && return 0
+
+	[ -n "${ROOT}" ] && return 0
+
+	ldconfig || die
+}

diff --git a/sys-libs/musl/musl-1.2.5-r1.ebuild b/sys-libs/musl/musl-1.2.5-r1.ebuild
new file mode 100644
index 000000000000..9d233979f7e2
--- /dev/null
+++ b/sys-libs/musl/musl-1.2.5-r1.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit crossdev flag-o-matic toolchain-funcs prefix
+
+DESCRIPTION="Light, fast and, simple C library focused on standards-conformance and safety"
+HOMEPAGE="https://musl.libc.org"
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://git.musl-libc.org/git/musl"
+	inherit git-r3
+else
+	VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/musl.asc
+	inherit verify-sig
+
+	SRC_URI="https://musl.libc.org/releases/${P}.tar.gz"
+	SRC_URI+=" verify-sig? ( https://musl.libc.org/releases/${P}.tar.gz.asc )"
+	KEYWORDS="-* ~riscv"
+	#KEYWORDS="-* ~amd64 ~arm ~arm64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+
+	BDEPEND="verify-sig? ( sec-keys/openpgp-keys-musl )"
+fi
+
+GETENT_COMMIT="93a08815f8598db442d8b766b463d0150ed8e2ab"
+GETENT_FILE="musl-getent-${GETENT_COMMIT}.c"
+SRC_URI+="
+	https://dev.gentoo.org/~blueness/musl-misc/getconf.c
+	https://gitlab.alpinelinux.org/alpine/aports/-/raw/${GETENT_COMMIT}/main/musl/getent.c -> ${GETENT_FILE}
+	https://dev.gentoo.org/~blueness/musl-misc/iconv.c
+"
+
+LICENSE="MIT LGPL-2 GPL-2"
+SLOT="0"
+IUSE="crypt headers-only split-usr"
+
+QA_SONAME="usr/lib/libc.so"
+QA_DT_NEEDED="usr/lib/libc.so"
+# bug #830213
+QA_PRESTRIPPED="usr/lib/crtn.o"
+
+# We want crypt on by default for this as sys-libs/libxcrypt isn't (yet?)
+# built as part as crossdev. Also, elide the blockers when in cross-*,
+# as it doesn't make sense to block the normal CBUILD libxcrypt at all
+# there when we're installing into /usr/${CHOST} anyway.
+if is_crosspkg ; then
+	IUSE="${IUSE/crypt/+crypt}"
+else
+	RDEPEND="crypt? ( !sys-libs/libxcrypt[system] )"
+	PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )"
+fi
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-1.2.4-arm64-crti-alignment.patch
+)
+
+just_headers() {
+	use headers-only && target_is_not_host
+}
+
+pkg_setup() {
+	if [[ ${CTARGET} == ${CHOST} ]] ; then
+		case ${CHOST} in
+			*-musl*) ;;
+			*) die "Use sys-devel/crossdev to build a musl toolchain" ;;
+		esac
+	fi
+
+	# Fix for bug #667126, copied from glibc ebuild:
+	# make sure host make.conf doesn't pollute us
+	if target_is_not_host || tc-is-cross-compiler ; then
+		CHOST=${CTARGET} strip-unsupported-flags
+	fi
+}
+
+src_unpack() {
+	if [[ ${PV} == 9999 ]] ; then
+		git-r3_src_unpack
+	elif use verify-sig ; then
+		# We only verify the release; not the additional (fixed, safe) files
+		# we download.
+		# (Seem to get IPC error on verifying in cross?)
+		! target_is_not_host && verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.asc}
+	fi
+
+	default
+}
+
+src_prepare() {
+	default
+
+	mkdir "${WORKDIR}"/misc || die
+	cp "${DISTDIR}"/getconf.c "${WORKDIR}"/misc/getconf.c || die
+	cp "${DISTDIR}/${GETENT_FILE}" "${WORKDIR}"/misc/getent.c || die
+	cp "${DISTDIR}"/iconv.c "${WORKDIR}"/misc/iconv.c || die
+}
+
+src_configure() {
+	strip-flags && filter-lto # Prevent issues caused by aggressive optimizations & bug #877343
+	tc-getCC ${CTARGET}
+
+	just_headers && export CC=true
+
+	local sysroot
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	./configure \
+		--target=${CTARGET} \
+		--prefix="${EPREFIX}${sysroot}/usr" \
+		--syslibdir="${EPREFIX}${sysroot}/lib" \
+		--disable-gcc-wrapper || die
+}
+
+src_compile() {
+	emake obj/include/bits/alltypes.h
+	just_headers && return 0
+
+	emake
+	if ! is_crosspkg ; then
+		emake -C "${T}" getconf getent iconv \
+			CC="$(tc-getCC)" \
+			CFLAGS="${CFLAGS}" \
+			CPPFLAGS="${CPPFLAGS}" \
+			LDFLAGS="${LDFLAGS}" \
+			VPATH="${WORKDIR}/misc"
+	fi
+
+	$(tc-getCC) ${CPPFLAGS} ${CFLAGS} -c -o libssp_nonshared.o "${FILESDIR}"/stack_chk_fail_local.c || die
+	$(tc-getAR) -rcs libssp_nonshared.a libssp_nonshared.o || die
+}
+
+src_install() {
+	local target="install"
+	just_headers && target="install-headers"
+	emake DESTDIR="${D}" ${target}
+	just_headers && return 0
+
+	# musl provides ldd via a sym link to its ld.so
+	local sysroot=
+	target_is_not_host && sysroot=/usr/${CTARGET}
+	local ldso=$(basename "${ED}${sysroot}"/lib/ld-musl-*)
+	dosym -r "${sysroot}/lib/${ldso}" "${sysroot}/usr/bin/ldd"
+
+	if ! use crypt ; then
+		# Allow sys-libs/libxcrypt[system] to provide it instead
+		rm "${ED}/usr/include/crypt.h" || die
+		rm "${ED}/usr/$(get_libdir)/libcrypt.a" || die
+	fi
+
+	if ! is_crosspkg ; then
+		# Fish out of config:
+		#   ARCH = ...
+		#   SUBARCH = ...
+		# and print $(ARCH)$(SUBARCH).
+		local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak)
+
+		# The musl build system seems to create a symlink:
+		# ${D}/lib/ld-musl-${arch}.so.1 -> /usr/lib/libc.so.1 (absolute)
+		# During cross or within prefix, there's no guarantee that the host is
+		# using musl so that file may not exist. Use a relative symlink within
+		# ${D} instead.
+		rm "${ED}"/lib/ld-musl-${arch}.so.1 || die
+		if use split-usr; then
+			dosym ../usr/lib/libc.so /lib/ld-musl-${arch}.so.1
+			# If it's still a dead symlink, OK, we really do need to abort.
+			[[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die
+		else
+			dosym libc.so /usr/lib/ld-musl-${arch}.so.1
+			[[ -e "${ED}"/usr/lib/ld-musl-${arch}.so.1 ]] || die
+		fi
+
+		cp "${FILESDIR}"/ldconfig.in-r3 "${T}"/ldconfig.in || die
+		sed -e "s|@@ARCH@@|${arch}|" "${T}"/ldconfig.in > "${T}"/ldconfig || die
+		eprefixify "${T}"/ldconfig
+		into /
+		dosbin "${T}"/ldconfig
+		into /usr
+		dobin "${T}"/getconf
+		dobin "${T}"/getent
+		dobin "${T}"/iconv
+		echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00musl || die
+		doenvd "${T}"/00musl
+	fi
+
+	if target_is_not_host ; then
+		into /usr/${CTARGET}
+		dolib.a libssp_nonshared.a
+	else
+		dolib.a libssp_nonshared.a
+	fi
+}
+
+pkg_preinst() {
+	# Nothing to do if just installing headers
+	just_headers && return
+
+	# Prepare /etc/ld.so.conf.d/ for files
+	mkdir -p "${EROOT}"/etc/ld.so.conf.d
+}
+
+pkg_postinst() {
+	target_is_not_host && return 0
+
+	[[ -n "${ROOT}" ]] && return 0
+
+	ldconfig || die
+}


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

end of thread, other threads:[~2024-05-20  8:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-20  0:31 [gentoo-commits] repo/gentoo:master commit in: sys-libs/musl/, sys-libs/musl/files/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-05-20  8:16 Sam James
2023-11-09  0:57 Sam James
2022-07-26  4:15 Sam James
2022-04-17 18:32 Sam James
2021-11-22 12:18 Sam James
2021-11-19  3:03 Sam James
2021-02-14 16:50 Jory Pratt
2018-10-02 23:43 Anthony G. Basile
2016-10-18 23:53 Anthony G. Basile

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox