From 6e1fc32629c46e29012a7e22b07085307d65ac96 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Tue, 14 Jan 2025 06:41:38 +0000 Subject: gentoo auto-resync : 14:01:2025 - 06:41:37 --- sys-libs/musl/Manifest | 7 +- .../musl-sched.h-reduce-namespace-conflicts.patch | 58 ++++++ sys-libs/musl/musl-1.2.3-r8.ebuild | 214 -------------------- sys-libs/musl/musl-1.2.3-r9.ebuild | 218 +++++++++++++++++++++ sys-libs/musl/musl-1.2.4-r2.ebuild | 207 ------------------- sys-libs/musl/musl-1.2.4-r3.ebuild | 208 ++++++++++++++++++++ sys-libs/musl/musl-1.2.5-r1.ebuild | 208 -------------------- sys-libs/musl/musl-1.2.5-r2.ebuild | 209 ++++++++++++++++++++ 8 files changed, 697 insertions(+), 632 deletions(-) create mode 100644 sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch delete mode 100644 sys-libs/musl/musl-1.2.3-r8.ebuild create mode 100644 sys-libs/musl/musl-1.2.3-r9.ebuild delete mode 100644 sys-libs/musl/musl-1.2.4-r2.ebuild create mode 100644 sys-libs/musl/musl-1.2.4-r3.ebuild delete mode 100644 sys-libs/musl/musl-1.2.5-r1.ebuild create mode 100644 sys-libs/musl/musl-1.2.5-r2.ebuild (limited to 'sys-libs/musl') diff --git a/sys-libs/musl/Manifest b/sys-libs/musl/Manifest index eba8e6200972..6d4d78e3a9ce 100644 --- a/sys-libs/musl/Manifest +++ b/sys-libs/musl/Manifest @@ -1,6 +1,7 @@ AUX ldconfig.in-r3 3093 BLAKE2B 146374fe711c660a61e4a23f89ae066e78b8bca6884719c058981069ab92833d7f660b7bd78e7c8b86112944706823f0260d7c63f19d64960f27f44b4e95a6a3 SHA512 ba021cf7d52c001d6ef9a54a91de93240cd7eef9f7a6d7a48ae0c58f934aaea6796979ce80e1cfa9bdc6008023108f3c226440360f8e3134fc23f7fdac0e55b1 AUX musl-1.2.4-arm64-crti-alignment.patch 847 BLAKE2B 4f652b924fd9b7a396d21cf8fef0d618c23ce14ea662290850e9a8ed78ac6303f674ac978f74e86f8671df75a7749ee54bbbe11278ae283892d1157e540a86d8 SHA512 77d6a4798a71d3593621bb8d3177b288f04bc0e5a4b2a6b91e8ad73e8a96279a4ae18344df77fafb97228931d6e6306b4b0c2adba8dded6449b7bb2565041d31 AUX musl-1.2.4-elfutils-0.190-relr.patch 2930 BLAKE2B 81bcc8932eb4ffb7cf0ae5707866d755c731e67bdcfa71e097f48ee3f13ab75fc96645bfc76e376cda700d81fbb6f7e47f83b06964ded9ea173c262965e4cb04 SHA512 47a24912f5dc16e21a0692c8f0b323dec815867dca7d65f97740a0ad2623c42cd0711e0b69609f24774db8cb26518e2ee5577b4a89d36cc2b053ba7b879cb2f8 +AUX musl-sched.h-reduce-namespace-conflicts.patch 2470 BLAKE2B 838a6f9bbb447a1b50566cff781f211ab68efaa0ed5d293cb1715936981411ac0db1a9cddb327dc47b8b37ccfaf7e96ac76c6f1328e98c0334a8f585af787a6e SHA512 c488d1035ae40c7cda01e91f90c4d47ed4afd3f4754e5476185bc7e6f19823c0f2ba01e4720763f08073fa102c31cb731d3db27b9ef27bddd5761157c8b07b71 AUX stack_chk_fail_local.c 1798 BLAKE2B 380bcbb920bd40a5185246621ba93716f27d61cd0077cd796ff267e10c534c9cc64982b2a66c89b61395dc93d67dae77e8c59908f65f2903f16016180cf94bbb SHA512 bb0bdd7f205d57771920c7ea898c1f84a55d6f90ddd1f8203bfeed98d13ccefa6f68d5fd1c0761321b2732ca928ca81b425e3fe8321c936d1316dea6f1930091 DIST getconf.c 11614 BLAKE2B ba49a573fc16d51780a0b0b81fbf7b64a1142f1dbad203c9609a59b6b07e7404f676c415383ae88c0aede95694821f6ee381bffd93cc3330501e17dc07d122bd SHA512 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d DIST iconv.c 2577 BLAKE2B 070ca87b30c90ab98c27d5faf7a2fcb64ff7c67ca212ee6072165b2146979c551f714954dbd465462a171837c59b6ea027e0206458a2df0f977e45f01be3ce48 SHA512 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf @@ -11,9 +12,9 @@ DIST musl-1.2.4.tar.gz.asc 490 BLAKE2B 2133cff9ae2c8f69213fb72a256533d0686fd1180 DIST musl-1.2.5.tar.gz 1080786 BLAKE2B 6065dc1e01874d1b96abe714147dcc0b41ca702ca9e9c44e85864185dab0b6d085a692745db0822c94a79325e1a91dad60c52f467717d9323b2b3c6ad0a17545 SHA512 7bb7f7833923cd69c7a1a9b8a5f1784bfd5289663eb6061dcd43d583e45987df8a68a1be05d75cc1c88a3f5b610653d1a70f4a9cff4d8f7fd41ae73ee058c17c DIST musl-1.2.5.tar.gz.asc 490 BLAKE2B f0d91b20aa7729449bd02a60adf17e8287904ed5971851a34b15f500011137ddc3f338d24712ff0481f1d6f9a749d87014a82b26a3bd9de660ddbf29678a8777 SHA512 c8aebf05b14abbd33ff568ca17ddd8b29e6f53cbb1cb85e00b64f15516ffc46a7a064c996a7bb1c9681a361a4921204ac58e4a1cfd7bd3ad60d7f2b0151d9229 DIST musl-getent-93a08815f8598db442d8b766b463d0150ed8e2ab.c 11656 BLAKE2B 1b7bf7102a1eb91a8cb881ed8ca65eb8eed911dd50238e97dc2952d89d4c6ebed6bfd046a2b38776c550b2872ab54ced8cb452fcc2ad56e5616f722debda761f SHA512 7f5b9d934d82deb5f8b23e16169a5d9b99ccab3a4708df06a95d685e1b24a3a3e69b3dcf4942f2f66c12a3d4bf0c5827e2ee2e8c4d7b1997359fccc2ac212dee -EBUILD musl-1.2.3-r8.ebuild 5998 BLAKE2B 3e6983a3163aee1c9cf5bde655bc9ab5b5b6c67f87c1d71d2e62df5b1bfb0c7c345b5259a2490ea919e61fda3156992613ea9ad1676758645d6d66df2126d369 SHA512 a409c93ef6d457191c9dce6bcd1f7abb2783601d65b9d352aaca43487e40f654e0cb9a7ae4a91c4710a8d773aacd49930f4a0b5ed4abb2f042f69a9fb10f2d3e +EBUILD musl-1.2.3-r9.ebuild 6073 BLAKE2B 8dcdaa5611cd2e52197920c3ba26ee2894fbb5a63e3a56c60ed091cb79d7ec42b53a20cd087d61bdd0a3f53d2334d321482e37d7e2e3c3e3171895cf1058dac4 SHA512 95fc81ec90cfb5e5d1afe3f15c1165227a94a5c217819d1455c8ca458990724a1972ce3261c17068d29c97963e263a6e9715abdfe4a4e2d065ec69f74bd15a3e EBUILD musl-1.2.4-r1.ebuild 5787 BLAKE2B dfebc31d3bbcbdb7b8a4b5769b0611c7f7b5fc6efa66349d05e75a49f86584b4ad3fd0a39cc2166c04dfd0cfea36d82b2ef1f0a9042e1b8ddd6235373bc79faf SHA512 3a175bbffd4132d9852fdc72896578e2078c9d844976fa7c99060ec2dfcbe00af281e521b916dee8d0c90334130601ac6f2d753d2f214b1c32e0fd237adc1d53 -EBUILD musl-1.2.4-r2.ebuild 5843 BLAKE2B 993b5259f592f4e7fb2e85cbccfb9053337e8d138b881fee7941cb490d6a8a09c634d1d20bf41a05fd130a6e53150c8a13e4cc3472746168c76dce53720507a0 SHA512 1d765f540d750dc5cb5a7dc309772bfd7fe555b9257b0c0927d158dc258ec97f1725fa3f5d48150f08bb958d1834f72ea10e13d4f3a9fed4c88611772fefc50a -EBUILD musl-1.2.5-r1.ebuild 5818 BLAKE2B 8e3b26eacbc64fa93a6d79ab1604b4d7ae341306d7b38ae475d0b87c76b2553a5a6667375025f061919acb953f5ca494113f943766be8bb5487f8e31a42109c1 SHA512 74271c174a8bd1aaae99f1b44fa0a95bd8ad9ebb030f3c6e184b98bf3635c7711c15a4b623ef7b847a7aaa0ba25515530ed1e9cea53ac363924532472fac2650 +EBUILD musl-1.2.4-r3.ebuild 5905 BLAKE2B f8c91bff99dfd1958bdc36dab2967e316f784f833baa0a66419893ce759bf187ef25dd17018fd5d30987a9e94af5c020284a68941713785b41c1cb69ebd56f3f SHA512 fc8cfa33a94766781b231f476b806c844f400619dfad19d18c8657542e69120b8717394a32c0808f27ad2251b2cba31571aee31a7b29da20826ca9f5970e1f70 +EBUILD musl-1.2.5-r2.ebuild 5880 BLAKE2B 9c94a3620f21b942886cf15fa7009ee43df2489fed31149c330a749e12c54a087fdeb9c0fdb46d29b6a35a13de57f001b06093bf50bf790aaa7370fa926a1a89 SHA512 a40ead1b0593aae7cc037e6ad9241c76f62fb8669b18b220b5e07add20a73845ce0f8a9832e08bc59e30727a0d4f70a6fce7fb85bffc979bead3227ddfd0dc56 EBUILD musl-9999.ebuild 5757 BLAKE2B 9672dda20ad26601410af129516f4430ecd2d635f0e16a19dbc7e0f56813a092b02dafd1ca94a7f18c148647b61c0e7120d7c3f8b3394774d69398a7f1ce325a SHA512 ccd78c27a7d4f6565ea3b7335e5b026b2c84675a3ba528b9bdf49f47e8a9af89fcb82e29c8fa8b7ac2157cd8b9fd47527d5597d91785c2dcd2c3e207d52a3cf7 MISC metadata.xml 559 BLAKE2B 8b1093a5278f716b8e21467b325e373a790f54c8ab71b92adc4c87dd569a92b20e08009372065f0f27ced39e3361c9e5e5a2e1bff271753d280439fabbddd3a4 SHA512 a35c13ea32ac8f26984bdb0d70d28a4285f34e32a2b0b17ad98fe3f357fb46c87a1e853377630d4da58fd5953de3fdeb02ee89181394e1815f5e0bbba4cd9f92 diff --git a/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch b/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch new file mode 100644 index 000000000000..d2d3b9343842 --- /dev/null +++ b/sys-libs/musl/files/musl-sched.h-reduce-namespace-conflicts.patch @@ -0,0 +1,58 @@ +commit 1a98576401ff604ff06a030a3644e2780b2a837d +Author: Rich Felker +Date: Mon Jan 13 08:31:02 2025 -0500 + + sched.h: reduce namespace conflicts in _GNU_SOURCE profile + + we have the cpuset macros call calloc/free/memset/memcmp directly so + that they don't depend on any further ABI surface. this is not + namespace-clean, but only affects the _GNU_SOURCE feature profile, + which is not intended to be namespace-clean. nonetheless, reports come + up now and then of things which are gratuitously broken, usually when + an application has wrapped malloc with macros. + + this patch parenthesizes the function names so that function-like + macros will not be expanded, and removes the unused declaration of + memcpy. this is not a complete solution, but it should improve things + for affected applications, particularly ones which are not even trying + to use the cpuset interfaces which got them just because g++ always + defines _GNU_SOURCE. + +diff --git a/include/sched.h b/include/sched.h +index 204c34f5..8c3b53f0 100644 +--- a/include/sched.h ++++ b/include/sched.h +@@ -78,11 +78,10 @@ int clone (int (*)(void *), void *, int, void *, ...); + int unshare(int); + int setns(int, int); + +-void *memcpy(void *__restrict, const void *__restrict, size_t); +-int memcmp(const void *, const void *, size_t); +-void *memset (void *, int, size_t); +-void *calloc(size_t, size_t); +-void free(void *); ++int (memcmp)(const void *, const void *, size_t); ++void *(memset)(void *, int, size_t); ++void *(calloc)(size_t, size_t); ++void (free)(void *); + + typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t; + int __sched_cpucount(size_t, const cpu_set_t *); +@@ -116,13 +115,13 @@ __CPU_op_func_S(XOR, ^) + #define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d) + + #define CPU_COUNT_S(size,set) __sched_cpucount(size,set) +-#define CPU_ZERO_S(size,set) memset(set,0,size) +-#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size)) ++#define CPU_ZERO_S(size,set) (memset)(set,0,size) ++#define CPU_EQUAL_S(size,set1,set2) (!(memcmp)(set1,set2,size)) + + #define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \ + + ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) ) +-#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n))) +-#define CPU_FREE(set) free(set) ++#define CPU_ALLOC(n) ((cpu_set_t *)(calloc)(1,CPU_ALLOC_SIZE(n))) ++#define CPU_FREE(set) (free)(set) + + #define CPU_SETSIZE 1024 + diff --git a/sys-libs/musl/musl-1.2.3-r8.ebuild b/sys-libs/musl/musl-1.2.3-r8.ebuild deleted file mode 100644 index 1aadcaab94cf..000000000000 --- a/sys-libs/musl/musl-1.2.3-r8.ebuild +++ /dev/null @@ -1,214 +0,0 @@ -# Copyright 1999-2025 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=7 - -inherit eapi8-dosym 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 ~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 -" - -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="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 [[ ${CATEGORY} == cross-* ]] ; then - IUSE="${IUSE/crypt/+crypt}" -else - RDEPEND="crypt? ( !sys-libs/libxcrypt[system] )" - PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )" -fi - -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 - 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?) - ! is_crosscompile && 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 - is_crosscompile && 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 [[ ${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 "${ED}${sysroot}"/lib/ld-musl-*) - dosym8 -r "${sysroot}/lib/${ldso}" "${sysroot}/usr/bin/ldd" - - if ! use crypt ; then - # Allow sys-libs/libxcrypt[system] to provide it instead - rm "${ED}${sysroot}/usr/include/crypt.h" || die - rm "${ED}${sysroot}/usr/$(get_libdir)/libcrypt.a" || die - fi - - 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) - - # 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 - newenvd - "00musl" <<-EOF - # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. - LDPATH="include ld.so.conf.d/*.conf" - EOF - fi - - if is_crosscompile ; 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() { - is_crosscompile && return 0 - - [ -n "${ROOT}" ] && return 0 - - ldconfig || die -} diff --git a/sys-libs/musl/musl-1.2.3-r9.ebuild b/sys-libs/musl/musl-1.2.3-r9.ebuild new file mode 100644 index 000000000000..3436d7f34687 --- /dev/null +++ b/sys-libs/musl/musl-1.2.3-r9.ebuild @@ -0,0 +1,218 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit eapi8-dosym 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 ~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 +" + +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="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 [[ ${CATEGORY} == cross-* ]] ; then + IUSE="${IUSE/crypt/+crypt}" +else + RDEPEND="crypt? ( !sys-libs/libxcrypt[system] )" + PDEPEND="!crypt? ( sys-libs/libxcrypt[system] )" +fi + +PATCHES=( + "${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.patch +) + +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 + 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?) + ! is_crosscompile && 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 + is_crosscompile && 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 [[ ${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 "${ED}${sysroot}"/lib/ld-musl-*) + dosym8 -r "${sysroot}/lib/${ldso}" "${sysroot}/usr/bin/ldd" + + if ! use crypt ; then + # Allow sys-libs/libxcrypt[system] to provide it instead + rm "${ED}${sysroot}/usr/include/crypt.h" || die + rm "${ED}${sysroot}/usr/$(get_libdir)/libcrypt.a" || die + fi + + 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) + + # 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 + newenvd - "00musl" <<-EOF + # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. + LDPATH="include ld.so.conf.d/*.conf" + EOF + fi + + if is_crosscompile ; 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() { + is_crosscompile && return 0 + + [ -n "${ROOT}" ] && return 0 + + ldconfig || die +} diff --git a/sys-libs/musl/musl-1.2.4-r2.ebuild b/sys-libs/musl/musl-1.2.4-r2.ebuild deleted file mode 100644 index 8bfb46ffef59..000000000000 --- a/sys-libs/musl/musl-1.2.4-r2.ebuild +++ /dev/null @@ -1,207 +0,0 @@ -# Copyright 1999-2025 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}${sysroot}/usr/include/crypt.h" || die - rm "${ED}${sysroot}/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 - newenvd - "00musl" <<-EOF - # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. - LDPATH="include ld.so.conf.d/*.conf" - EOF - 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.4-r3.ebuild b/sys-libs/musl/musl-1.2.4-r3.ebuild new file mode 100644 index 000000000000..3909d62c13de --- /dev/null +++ b/sys-libs/musl/musl-1.2.4-r3.ebuild @@ -0,0 +1,208 @@ +# Copyright 1999-2025 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 + "${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.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}${sysroot}/usr/include/crypt.h" || die + rm "${ED}${sysroot}/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 + newenvd - "00musl" <<-EOF + # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. + LDPATH="include ld.so.conf.d/*.conf" + EOF + 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 deleted file mode 100644 index 7fe02741839d..000000000000 --- a/sys-libs/musl/musl-1.2.5-r1.ebuild +++ /dev/null @@ -1,208 +0,0 @@ -# Copyright 1999-2025 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="-* 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}${sysroot}/usr/include/crypt.h" || die - rm "${ED}${sysroot}/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 - newenvd - "00musl" <<-EOF - # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. - LDPATH="include ld.so.conf.d/*.conf" - EOF - 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-r2.ebuild b/sys-libs/musl/musl-1.2.5-r2.ebuild new file mode 100644 index 000000000000..62c8bedc5e27 --- /dev/null +++ b/sys-libs/musl/musl-1.2.5-r2.ebuild @@ -0,0 +1,209 @@ +# Copyright 1999-2025 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="-* 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 + "${FILESDIR}"/${PN}-sched.h-reduce-namespace-conflicts.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}${sysroot}/usr/include/crypt.h" || die + rm "${ED}${sysroot}/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 + newenvd - "00musl" <<-EOF + # 00musl autogenerated by sys-libs/musl ebuild; DO NOT EDIT. + LDPATH="include ld.so.conf.d/*.conf" + EOF + 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 +} -- cgit v1.2.3