diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-libs/musl |
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-libs/musl')
-rw-r--r-- | sys-libs/musl/Manifest | 15 | ||||
-rw-r--r-- | sys-libs/musl/files/getent | 45 | ||||
-rw-r--r-- | sys-libs/musl/files/ldconfig.in | 144 | ||||
-rw-r--r-- | sys-libs/musl/files/musl-1.1.15-CVE.patch | 68 | ||||
-rw-r--r-- | sys-libs/musl/files/musl-1.1.15-assert.patch | 43 | ||||
-rw-r--r-- | sys-libs/musl/metadata.xml | 15 | ||||
-rw-r--r-- | sys-libs/musl/musl-1.1.15-r2.ebuild | 121 | ||||
-rw-r--r-- | sys-libs/musl/musl-1.1.16.ebuild | 116 | ||||
-rw-r--r-- | sys-libs/musl/musl-9999.ebuild | 116 |
9 files changed, 683 insertions, 0 deletions
diff --git a/sys-libs/musl/Manifest b/sys-libs/musl/Manifest new file mode 100644 index 000000000000..d88796c94fe7 --- /dev/null +++ b/sys-libs/musl/Manifest @@ -0,0 +1,15 @@ +AUX getent 1168 SHA256 391f5e2bf876d1a5d0ebc4bd80f15e297049cf3296252dfee6549d32e9b43f6a SHA512 60e10b9ac073e5b648b2c22c8e75a3f2c8a26e28f6d50059e4b921f17adbd0f6d7aa65d8441ebab19f07b21592425962b736071c55d0c274855bc1dbb2567382 WHIRLPOOL 4c0422d73eb5f4cfe91c49e95364778cf3453409c3948b375dc5e021be1e0186c110b9d0f674722db211f772cb4da1414ea06aaaed75cd853d31cb13bb70b5c0 +AUX ldconfig.in 2552 SHA256 a20122f108d85b4e632fcef92588561e854593a63aa67ae2b6264f3f2d33f06a SHA512 59f1b57361196363d3f127366764f05d26c23dbe3d3dbcdba9bd3c8ca26a671fd713b96d31c509d22805c57ada2b596d979a3f5795bcf0a4d3ac7d168f3bf377 WHIRLPOOL 35d6ec22820b6b02f112b102fbc56a8c38757e0d3a94798784f14de2d87bdc3c89b00fc6099736a9ede148d09a3066039b19c7ed63646b9135157f11caa0e04a +AUX musl-1.1.15-CVE.patch 2588 SHA256 21b955f86d577bd674efdfb391d00294d6c9b3b04840c6ad04eba86642810d0f SHA512 3cd3fefb47e24b82d4f08d9f4915a84e0844568d8bd94a0e94358fa1578a36dfdbe26e190c57a8e3ce4428aa75edc4f1bbae53ee859d653ced00d1cbabea2a16 WHIRLPOOL dfa39568c5fa714920273412ea76144b1bb5a3d4593d4b6e5adc9e917572bf422358b95f9614cd4c51ed3082aa8d0ec084b7b9089771f8bcb2f1b0e8f68812e5 +AUX musl-1.1.15-assert.patch 1473 SHA256 e002678e5facf04d7b74a6b53bedaa8cc212bbf54c43dbd22a801471f861ed5d SHA512 b456862f48c09d42c44705ba45e1d3a9a8dff964f8db53304da8328e926c82a090a641e20b89fe2074fba3121ee5d6dd120bdcf02afae39a6b04519d08e107b0 WHIRLPOOL 3e2199bd58b977fbd480c980636822335618fdf3335c1176f2ede1a5a5bedea91b3f0101df25d572e7b1703fc910c82903ed6a25fce216ca98a92dbf06a8e07f +DIST getconf.c 11614 SHA256 d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c SHA512 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d WHIRLPOOL 279170a21cd6d5b560b0c834236acf4989f1a7f5e9ecf9d7e594abc21b65f8aeb26a26475c49f4052d5f9b4f9d95032d22b1790dbd99e3f55c3677eb9fc6df8b +DIST getent.c 9438 SHA256 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe SHA512 b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 WHIRLPOOL 473e54a9158e70c411f4c84e590bcfd245051212a3346a3c6dd45df9f09a5fbccbc8900ad7f8691eb5ebb8cd1002caf9519abaffb1753175d4f8acb1d32236b4 +DIST iconv.c 2577 SHA256 f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 SHA512 9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf WHIRLPOOL 8b067d7f3e5b8c9862cf78cf727fa748d9b6b23be518df382251d1e3e0a6eb386b1fd7788ba3b36dadba03aa5b43e25eb25528efcadc74fa543c38a61650c5bc +DIST musl-1.1.15.tar.gz 911600 SHA256 97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa SHA512 9e923572c0d6bad3dc2d2646d4b0699c10b477ce6300ac6c6224895192a90667f581ddf6eda2ab8c4c16f47bde4bccb03bb90478638d136d9df721430f4d0163 WHIRLPOOL 68c510cf7d4216ccc5775466fa23f76ebecf1658552d613dee523bb7cc3a9f824959fe76355d1ce47326b276bf2657c9b4f3f557d81bf9c1a873f18405ad8ebf +DIST musl-1.1.16.tar.gz 927178 SHA256 937185a5e5d721050306cf106507a006c3f1f86d86cd550024ea7be909071011 SHA512 47c00e50b7605102fb4aebe1f9ba9db94d26fac64805f6d744c9c557a05b8a58dff7f9558ff7c8d66b5d7c43740cdc2dd79448bacac47f1414e6ada99c210140 WHIRLPOOL d4e84ef591a1cee0a64d4abf258b7cb2eeacfa7b11695b1bfa89bafde0404e8310a02ab04814df2d4a9ac812a640bbcf8695bab10807f8b8d64c5bdb9d468ca4 +EBUILD musl-1.1.15-r2.ebuild 3112 SHA256 d5cb6b8240cb48671c54c0c906cc5223ab8bdc01c6b295005c551d1837ad3252 SHA512 cd2729c1c59507222057f5a2c437717bbffe1ed7b1020e499db5bb70984dbaecb582aa05a17366cd99e43924a516b9846cedc5e942e756238870dabfac0e6f9b WHIRLPOOL a1f3204fae061481daa2419114b230c66d9a032df040150c65f3f001b29aced8affaa0e144b42824dbc8d660cab79405b4f823c08576cdd816177f8273cff1a2 +EBUILD musl-1.1.16.ebuild 3035 SHA256 bb5f2d4ad83a43b117974b653f4541624991d9ab717455397287517d9ee8188d SHA512 ee3070225a21e9190b4decc0e941ee459dc0e1c63e8a6b8eb3e2fe188489f3773a7495cc3df97c4f677004a256f8b4e9340496fd317ae321965656fe406af80d WHIRLPOOL 393abd3f6e99bb1b068ef5dea174bc841450fe52bdd2e01034161f6a0b95c6ec2594fec8fe51a4951c485aabdcc94ac4486e0d42cc32f3cd496fa947d5854b3a +EBUILD musl-9999.ebuild 3039 SHA256 2385034fd93004b9d1aa0de1096c5970550de8b8efd02164d072acee3722f80f SHA512 ab442afb391fdff836903fd3e4c992ed8e7dcd08f1dc0215b9d736a0ac31ce8de050aae0310a0e2936a3bf63ceb39bb6ad8cb3c8f039f0e51e3cb03c621f1627 WHIRLPOOL e78dd737b434115a01f93da36ae8c0c7debc10697eab6303f82eeef333cff68c88308f21155bee9489528799dc9ce98f6f1b510e6c0f57fbe8dbc422120291b6 +MISC ChangeLog 8991 SHA256 71210d4c919758cfbf25b3fbc793333491064e5bce9b9129000db56987d2a463 SHA512 50bd06fa95a6983bbfce3772504a1d153551af1b6a07fc578330ab8064c951bce9b310aac41ba7ca63fd7ccd365be84076843a4f062c3c2fbe07f9d9e2447cf3 WHIRLPOOL ebbf5bcddeb3a2b012d86b601bc4c207eb9b7f340ffceb13822d5c9007f7a2c14ba0d5747722ad73d3b3bcc9307635fe40a53bd7a8c2c662e1f6ba2aaca6e780 +MISC ChangeLog-2015 9169 SHA256 e19f60cbf940f7b138a478c51370443f09f0eddb00ab04cf8cf9977f67aec7ef SHA512 2c1a8f01d3e939fcf7d1e1c6781b4d09b0ab4c60c4911366d892333f62d62abdb2c8d5a7178dcb5ac3eae5a971e34a2d1c801ed44066dc2c68f0896732954dba WHIRLPOOL 137f3308e2edee1a1d836d04cc46bb00b4d2022eb3c7d882f5b54d47e91edf250a559aa9cf922fe0a3d874bf880f619230a53cdf24ac89822f358b8cd50f40d8 +MISC metadata.xml 452 SHA256 90358b6f07879cb68c7a5f476ea8e1ce1db78e286fdb5ed005963427b2267fed SHA512 676d8122179a5cb56e0b9c7aeb7f0aec8c19b5d7b604a19c9ee01aeca837a74cc4284e87cc743d0eaf527f0c79afdfeb1f238c204a8a6c1c5590b2718bbc9b03 WHIRLPOOL ed9e1e5b6ba088a271d5080803449aecfc3110ba4f0f5b373f6fb5cc089344fe2ad952d05a970ad5c3f5acaa9a187b891b89a5e0404ff9ff5949470c31173033 diff --git a/sys-libs/musl/files/getent b/sys-libs/musl/files/getent new file mode 100644 index 000000000000..b7de424354b6 --- /dev/null +++ b/sys-libs/musl/files/getent @@ -0,0 +1,45 @@ +#!/bin/sh +# This files is part of uClibc. +# Distributed under the terms of the Lesser GNU General Public License v2 +# +# Closely (not perfectly) emulate the behavior of glibc's getent utility +# +#passwd|shadow|group|aliases|hosts|networks|ethers|netgroup|protocols|services|rpc +# only returns the first match (by design) +# dns based search is not supported (hosts,networks) +# case-insensitive matches not supported (ethers; others?) +# may return false-positives (hosts,protocols,rpc,services,ethers) + +[ -z "$PATH" ] && PATH="/bin:/usr/bin" || PATH="${PATH}:/bin:/usr/bin" +export PATH + +file="/etc/$1" +case $1 in + passwd|group) + match="^$2:\|^[^:]*:[^:]*:$2:" ;; + shadow) + match="^$2:" ;; + networks|netgroup) + match="^[[:space:]]*$2\>" ;; + hosts|protocols|rpc|services|ethers) + match="\<$2\>" ;; + aliases) + match="^[[:space:]]*$2[[:space:]]*:" ;; + ""|-h|--help) + echo "USAGE: $0 database [key]" + exit 0 ;; + *) + echo "$0: Unknown database: $1" 1>&2 + exit 1 ;; +esac + +if [ ! -f "$file" ] ; then + echo "$0: Could not find database file for $1" 1>&2 + exit 1 +fi + +if [ $# -eq 1 ] ; then + exec cat "$file" +else + sed "s/#.*//; /$match/q; d" "$file" | grep . || exit 2 +fi diff --git a/sys-libs/musl/files/ldconfig.in b/sys-libs/musl/files/ldconfig.in new file mode 100644 index 000000000000..19c94d85353a --- /dev/null +++ b/sys-libs/musl/files/ldconfig.in @@ -0,0 +1,144 @@ +#!/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/musl-1.1.15-CVE.patch b/sys-libs/musl/files/musl-1.1.15-CVE.patch new file mode 100644 index 000000000000..64fbbdcd8eb1 --- /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 000000000000..d531d1727642 --- /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/metadata.xml b/sys-libs/musl/metadata.xml new file mode 100644 index 000000000000..cd4b91b3e67d --- /dev/null +++ b/sys-libs/musl/metadata.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>blueness@gentoo.org</email> + <name>Anthony G. Basile</name> + </maintainer> + <maintainer type="person"> + <email>lu_zero@gentoo.org</email> + </maintainer> +<maintainer type="project"> + <email>toolchain@gentoo.org</email> + <name>Gentoo Toolchain Project</name> + </maintainer> +</pkgmetadata> diff --git a/sys-libs/musl/musl-1.1.15-r2.ebuild b/sys-libs/musl/musl-1.1.15-r2.ebuild new file mode 100644 index 000000000000..38374a823493 --- /dev/null +++ b/sys-libs/musl/musl-1.1.15-r2.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2017 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 ~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="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} ]] +} + +just_headers() { + use crosscompile_opts_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_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 + $(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 +} + +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 +} diff --git a/sys-libs/musl/musl-1.1.16.ebuild b/sys-libs/musl/musl-1.1.16.ebuild new file mode 100644 index 000000000000..af34891af2d5 --- /dev/null +++ b/sys-libs/musl/musl-1.1.16.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2017 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 ~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="crosscompile_opts_headers-only" + +QA_SONAME="/usr/lib/libc.so" +QA_DT_NEEDED="/usr/lib/libc.so" + +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +just_headers() { + use crosscompile_opts_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_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 + $(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 +} + +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 +} diff --git a/sys-libs/musl/musl-9999.ebuild b/sys-libs/musl/musl-9999.ebuild new file mode 100644 index 000000000000..4b53b12d810a --- /dev/null +++ b/sys-libs/musl/musl-9999.ebuild @@ -0,0 +1,116 @@ +# Copyright 1999-2017 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 ~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="crosscompile_opts_headers-only" + +QA_SONAME="/usr/lib/libc.so" +QA_DT_NEEDED="/usr/lib/libc.so" + +is_crosscompile() { + [[ ${CHOST} != ${CTARGET} ]] +} + +just_headers() { + use crosscompile_opts_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_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 + $(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 +} + +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 +} |