From 2771f79232c273bc2a57d23bf335dd81ccf6af28 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 5 Dec 2021 02:47:11 +0000 Subject: gentoo resync : 05.12.2021 --- sys-libs/musl/Manifest | 8 +- sys-libs/musl/files/ldconfig.in-r1 | 155 ++++++++++++++++++++++++++++++++++ sys-libs/musl/files/ldconfig.in-r2 | 157 ++++++++++++++++++++++++++++++++++ sys-libs/musl/musl-1.2.2-r4.ebuild | 8 +- sys-libs/musl/musl-1.2.2-r6.ebuild | 167 +++++++++++++++++++++++++++++++++++++ sys-libs/musl/musl-1.2.2-r7.ebuild | 167 +++++++++++++++++++++++++++++++++++++ sys-libs/musl/musl-9999.ebuild | 8 +- 7 files changed, 660 insertions(+), 10 deletions(-) create mode 100644 sys-libs/musl/files/ldconfig.in-r1 create mode 100644 sys-libs/musl/files/ldconfig.in-r2 create mode 100644 sys-libs/musl/musl-1.2.2-r6.ebuild create mode 100644 sys-libs/musl/musl-1.2.2-r7.ebuild (limited to 'sys-libs/musl') diff --git a/sys-libs/musl/Manifest b/sys-libs/musl/Manifest index f466dd442839..f3b72199bd96 100644 --- a/sys-libs/musl/Manifest +++ b/sys-libs/musl/Manifest @@ -1,4 +1,6 @@ AUX ldconfig.in 2552 BLAKE2B c94f9900e8582d707519171c4b61079c801b60c555677b1740b04adbdec9645578b9a8fc91f11413072568f316c795e46a332970f3d2dde5272b0c49a5d60a78 SHA512 59f1b57361196363d3f127366764f05d26c23dbe3d3dbcdba9bd3c8ca26a671fd713b96d31c509d22805c57ada2b596d979a3f5795bcf0a4d3ac7d168f3bf377 +AUX ldconfig.in-r1 2930 BLAKE2B a0b0d4715d9b4c83c4e7036d466dae854c2da1e2393a48cf1c05789a59426f6809118d5ac266a7eb558010c8c47d344b93c8c86847d9d0158d3885b6076e3bf6 SHA512 7e5b5e396965c7e677168f0974460565dd0302639835ca7b0fbf1198e911dc2818dd64424e0e217a710545cbeeb4c31877f05034f16737a822eb02520c258c4e +AUX ldconfig.in-r2 2970 BLAKE2B a6b93ebbbe0caa07a1d32af07d810e1d95d47f2246573e77dfd14edba4403a9d90fd92a7428754c68036ffdbc7e82b926d95538f6617a76a247ab5c9a3c3ba1b SHA512 5b97f473ead0def43656b42511af77c427237e6c36f8d2afad8241ef4e948ed5f0a58dc9e65205c393b530ac810ee1e9f2db008534707283bca0fac2951fe4f9 AUX musl-1.2.2-gethostid.patch 1028 BLAKE2B fbe554e681c8f0e4bff6ec6fe97c88fd3c7f84ac07580b5f6cfef13b6b27c985f4f0e1d7722f397c59e655b8cd864fa845f9af2aa0eaa9287349f41e71f7a257 SHA512 d2959ef272e3a2742efec3983a41705cfa6424110dbc1eb53a912492cf067881cdbcb8cd864757e6450dda9b47e0cca7dbe3a86d3e6e74e7f33fb7d1723edfde AUX stack_chk_fail_local.c 1798 BLAKE2B 380bcbb920bd40a5185246621ba93716f27d61cd0077cd796ff267e10c534c9cc64982b2a66c89b61395dc93d67dae77e8c59908f65f2903f16016180cf94bbb SHA512 bb0bdd7f205d57771920c7ea898c1f84a55d6f90ddd1f8203bfeed98d13ccefa6f68d5fd1c0761321b2732ca928ca81b425e3fe8321c936d1316dea6f1930091 DIST getconf.c 11614 BLAKE2B ba49a573fc16d51780a0b0b81fbf7b64a1142f1dbad203c9609a59b6b07e7404f676c415383ae88c0aede95694821f6ee381bffd93cc3330501e17dc07d122bd SHA512 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d @@ -6,6 +8,8 @@ DIST iconv.c 2577 BLAKE2B 070ca87b30c90ab98c27d5faf7a2fcb64ff7c67ca212ee6072165b DIST musl-1.2.2.tar.gz 1055220 BLAKE2B a000357ed52e417d8cebe5537df658dc0f8f02f2da3efcd79125544ad63e11e05fa96136551d0bfeb09a3f6c9a2260bffcfbd329ea92e6a7b62aa690f48968aa SHA512 5344b581bd6463d71af8c13e91792fa51f25a96a1ecbea81e42664b63d90b325aeb421dfbc8c22e187397ca08e84d9296a0c0c299ba04fa2b751d6864914bd82 DIST musl-getent-93a08815f8598db442d8b766b463d0150ed8e2ab.c 11656 BLAKE2B 1b7bf7102a1eb91a8cb881ed8ca65eb8eed911dd50238e97dc2952d89d4c6ebed6bfd046a2b38776c550b2872ab54ced8cb452fcc2ad56e5616f722debda761f SHA512 7f5b9d934d82deb5f8b23e16169a5d9b99ccab3a4708df06a95d685e1b24a3a3e69b3dcf4942f2f66c12a3d4bf0c5827e2ee2e8c4d7b1997359fccc2ac212dee EBUILD musl-1.2.2-r3.ebuild 3814 BLAKE2B 037af7d810ace77441369b4dc9a8513298167bbe7af7a010ad22f6ff7e99aba2cac0b6b8befd51f080fb3c695452ec7a3cecbdeb46cbfd06d2aef2415a96c28e SHA512 48cb68039a1cc61b230d2c9b549f01c40607ef2a0726589e558e412311f7e1ae988c7328f86b61b148ba88f2f107c72b2829ccd8ba16567a52a3840f2286d477 -EBUILD musl-1.2.2-r4.ebuild 4448 BLAKE2B 36bf867d0b6484bbba80c83df074cc0915612ce447925b03343da441f55e53d1ea10210e7f30e36ae0ad5c36e8bcc2333eba04e5534c0db94af784ad27a3223b SHA512 18fa3cf43fd4f9c29eece8b61f6db7dcf6781122ef81860d84af7e9689095f32afc54bce63692436b4736362710d974220d0f69357d454d13bce1b8352dee5f6 -EBUILD musl-9999.ebuild 4320 BLAKE2B e0a1b35cd77bbd0e0187c15680dd2d0d6925d66901d0c087787eaa226435dfd085211277138dda7299723a2c96a52431323b23f3a90c9562441c2f1a05a1dd25 SHA512 3d6e61bb736907e4420dff142055040d85fbf4f06ed181290a779245be7b30be8c02016d2ac241b10475fecfbd408c7b6f5f9289af22bbf3c41c8e43a5180a3d +EBUILD musl-1.2.2-r4.ebuild 4442 BLAKE2B 1cfdf66f7c975e164161cb90d98f20187c2d3ae0a24914206222c7255714a2cd10c4034a6b34018e3c79a2ec6385012c29f39d525ab83ab9b737a04453232e65 SHA512 340f60f7f73702510251a1df1af6a38af715678bad3606aab1e29c132bf5bb5805c39d916a1ff95c5e492a38b1d9a2ba3ae24560287d2fca647aa338eede2de7 +EBUILD musl-1.2.2-r6.ebuild 4457 BLAKE2B 9fde176fc9b78c29480eb8aa85a1b9decd777976c6c44ca298762fb1dd71ee8144a6dede69d82b69eebad48990b8da4522df2818370aac5dc8c7a1436172154c SHA512 fedb1929ffd0f6282c9103567b1f7813b4da523fdfe678cdce3792c8bdb2b866decccb57c4850eb92e6161894ad9409fb3b9b0fe477f8520cefecb3844bbc5b3 +EBUILD musl-1.2.2-r7.ebuild 4463 BLAKE2B 783ce34e051c909cca45ac6577e79e81e113b2e4741ddbd579633faad3e0064ad7a82c45aa100b2f4c2a85cdaf5a8cdeefdf1f832e91e5262a786c7ac556d284 SHA512 03f6e12bf862699aa36b84461341e820099e0bc5fa8115c346cdf95f8ddf4863a12807ebb62116c6fe48072e1dd9738b4a937e2ef60ec8701b1d36c387e8b44b +EBUILD musl-9999.ebuild 4335 BLAKE2B 4b7c55d401e0587f0443050725d6d4dcdce87391eb6963f1078a77eb51af3240431bdb473cac170cd189c55a12c63081391963b3de728cdfa4357968497d66ad SHA512 ef20494c520d27827074899dca61691e722921fecadc83c021b6cf0ec4f73a709d072adb2ccd0590bfa3f0371888afc32b0a6a61a3a9aae6a995f9a12ccf676d MISC metadata.xml 559 BLAKE2B 8b1093a5278f716b8e21467b325e373a790f54c8ab71b92adc4c87dd569a92b20e08009372065f0f27ced39e3361c9e5e5a2e1bff271753d280439fabbddd3a4 SHA512 a35c13ea32ac8f26984bdb0d70d28a4285f34e32a2b0b17ad98fe3f357fb46c87a1e853377630d4da58fd5953de3fdeb02ee89181394e1815f5e0bbba4cd9f92 diff --git a/sys-libs/musl/files/ldconfig.in-r1 b/sys-libs/musl/files/ldconfig.in-r1 new file mode 100644 index 000000000000..7bf254dfd91c --- /dev/null +++ b/sys-libs/musl/files/ldconfig.in-r1 @@ -0,0 +1,155 @@ +#!/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/files/ldconfig.in-r2 b/sys-libs/musl/files/ldconfig.in-r2 new file mode 100644 index 000000000000..72a2f58bc744 --- /dev/null +++ b/sys-libs/musl/files/ldconfig.in-r2 @@ -0,0 +1,157 @@ +#!/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-r4.ebuild b/sys-libs/musl/musl-1.2.2-r4.ebuild index 0fe2c8c9a67b..868577f61ad2 100644 --- a/sys-libs/musl/musl-1.2.2-r4.ebuild +++ b/sys-libs/musl/musl-1.2.2-r4.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" @@ -128,7 +128,7 @@ src_install() { # and print $(ARCH)$(SUBARCH). local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak) - if [[ ! -e "${D}"/lib/ld-musl-${arch}.so.1 ]] ; then + 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. @@ -138,10 +138,10 @@ src_install() { # 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.1 /lib/ld-musl-${arch}.so.1 + 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 "${D}"/lib/ld-musl-${arch}.so.1 ]] || die + [[ -e "${ED}"/lib/ld-musl-${arch}.so.1 ]] || die fi cp "${FILESDIR}"/ldconfig.in "${T}" || die diff --git a/sys-libs/musl/musl-1.2.2-r6.ebuild b/sys-libs/musl/musl-1.2.2-r6.ebuild new file mode 100644 index 000000000000..79a60682c79f --- /dev/null +++ b/sys-libs/musl/musl-1.2.2-r6.ebuild @@ -0,0 +1,167 @@ +# 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 +} diff --git a/sys-libs/musl/musl-1.2.2-r7.ebuild b/sys-libs/musl/musl-1.2.2-r7.ebuild new file mode 100644 index 000000000000..dac76c213424 --- /dev/null +++ b/sys-libs/musl/musl-1.2.2-r7.ebuild @@ -0,0 +1,167 @@ +# 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-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 + + [ "${ROOT}" != "/" ] && return 0 + + ldconfig || die +} diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild index 5736eadc0fb4..6a5e2688dd5a 100644 --- a/sys-libs/musl/musl-9999.ebuild +++ b/sys-libs/musl/musl-9999.ebuild @@ -121,7 +121,7 @@ src_install() { # and print $(ARCH)$(SUBARCH). local arch=$(awk '{ k[$1] = $3 } END { printf("%s%s", k["ARCH"], k["SUBARCH"]); }' config.mak) - if [[ ! -e "${D}"/lib/ld-musl-${arch}.so.1 ]] ; then + 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. @@ -131,13 +131,13 @@ src_install() { # 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.1 /lib/ld-musl-${arch}.so.1 + 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 "${D}"/lib/ld-musl-${arch}.so.1 ]] || die + [[ -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 -- cgit v1.2.3