blob: 1b6dc2df824e47d516e436664567f4a638d44a1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
# Contributor: Ariadne Conill <ariadne@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.2.4_git20230717
pkgrel=4
pkgdesc="the musl c library (libc) implementation"
url="https://musl.libc.org/"
arch="all"
license="MIT"
options="lib64"
subpackages="
$pkgname-dbg
$pkgname-libintl:libintl:noarch
$pkgname-dev
"
case "$BOOTSTRAP" in
nocc) pkgname="musl-dev"; subpackages="";;
nolibc) ;;
*) subpackages="$subpackages $pkgname-utils";;
esac
_commit="83b858f83b658bd34eca5d8ad4d145f673ae7e5e"
source="musl-$_commit.tar.gz::https://git.musl-libc.org/cgit/musl/snapshot/$_commit.tar.gz
handle-aux-at_base.patch
remove-dns-63-records-limit.patch
0001-elf.h-add-typedefs-for-Elf-_Relr.patch
ldconfig
__stack_chk_fail_local.c
getconf.c
getent.c
iconv.c
"
# secfixes:
# 1.2.2_pre2-r0:
# - CVE-2020-28928
# 1.1.23-r2:
# - CVE-2019-14697
# 1.1.15-r4:
# - CVE-2016-8859
builddir="$srcdir"/$_commit
prepare() {
default_prepare
echo "$pkgver" > VERSION
}
build() {
[ "$BOOTSTRAP" = "nocc" ] && return 0
# provide minimal libssp_nonshared.a so we don't need libssp from gcc
${CROSS_COMPILE}cc $CFLAGS -c "$srcdir"/__stack_chk_fail_local.c -o __stack_chk_fail_local.o
${CROSS_COMPILE}ar r libssp_nonshared.a __stack_chk_fail_local.o
if [ "$BOOTSTRAP" != "nolibc" ]; then
# getconf/getent/iconv
local i
for i in getconf getent iconv ; do
${CROSS_COMPILE}cc $CPPFLAGS $CFLAGS "$srcdir"/$i.c -o $i
done
fi
# musl sets a sane default for flags that they tune based on -O2 with alignment things turned off.
# see https://git.musl-libc.org/cgit/musl/commit/?id=b90841e2583237a4132bbbd74752e0e9563660cd ,
# and the discussion in https://www.openwall.com/lists/musl/2023/05/22/2
# this makes libc.so about 5% bigger in itself, but should yield an overall improved libc.so for general use.
# NB: if musl detects an -O it skips its own, so remove just the O value
export CFLAGS="${CFLAGS/-O* /}"
# note: not autotools
# shellcheck disable=2153
LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-$CARCH.so.1" \
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
--enable-debug
make
}
package() {
case "$CARCH" in
aarch64*) ARCH="aarch64" ;;
arm*) ARCH="arm" ;;
x86) ARCH="i386" ;;
x86_64) ARCH="x86_64" ;;
ppc) ARCH="powerpc" ;;
ppc64*) ARCH="powerpc64" ;;
s390*) ARCH="s390x" ;;
mips64*) ARCH="mips64" ;;
mips*) ARCH="mips" ;;
riscv64) ARCH="riscv64" ;;
esac
if [ "$BOOTSTRAP" = "nocc" ]; then
make ARCH="$ARCH" prefix=/usr DESTDIR="$pkgdir" install-headers
else
make DESTDIR="$pkgdir" install
cp libssp_nonshared.a "$pkgdir"/usr/lib
# make LDSO the be the real file, and libc the symlink
local rule="$(printf "%s\n\t%s\n" 'print-ldso:' '@echo $$(basename $(LDSO_PATHNAME))')"
local LDSO=$(make -f Makefile --eval "$rule" print-ldso)
mv -f "$pkgdir"/usr/lib/libc.so "$pkgdir"/lib/"$LDSO"
ln -sf "$LDSO" "$pkgdir"/lib/libc.musl-$CARCH.so.1
ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/lib/libc.so
mkdir -p "$pkgdir"/usr/bin
cat >>"$pkgdir"/usr/bin/ldd <<-EOF
#!/bin/sh
exec /lib/$LDSO --list "\$@"
EOF
chmod 755 "$pkgdir"/usr/bin/ldd
fi
}
utils() {
depends="scanelf"
replaces="libiconv"
license="MIT AND BSD-2-Clause AND GPL-2.0-or-later"
mkdir -p "$subpkgdir"/usr "$subpkgdir"/sbin
mv "$pkgdir"/usr/bin "$subpkgdir"/usr/
install -D \
"$builddir"/getent \
"$builddir"/getconf \
"$builddir"/iconv \
"$subpkgdir"/usr/bin
install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin
}
# currently we don't want by default any NLS
# and use GNU gettext where needed. the plan is to migrate to
# musl gettext() later on as fully as possible.
libintl() {
pkgdesc="musl libintl.h header"
mkdir -p "$subpkgdir"/usr/include
mv "$pkgdir"/usr/include/libintl.h \
"$subpkgdir"/usr/include/
}
sha512sums="
29c8b33565f2f7aeacf274e8029b94dc515c569f2e3fc27acb0cf8254e22d6248bf0948076f2c2887ba0495ff2e2db59f760d69d2b4ee6697fea4cda1adf9136 musl-83b858f83b658bd34eca5d8ad4d145f673ae7e5e.tar.gz
a76f79b801497ad994746cf82bb6eaf86f9e1ae646e6819fbae8532a7f4eee53a96ac1d4e789ec8f66aea2a68027b0597f7a579b3369e01258da8accfce41370 handle-aux-at_base.patch
088620aeeea1a407a103728f839d21c10c830820e1dae970edd70282534758d7fdb6d1d2d2761ccecac7a3e56ffb79c7b7085f3fe80a01d324d7bc0d94bb15f7 remove-dns-63-records-limit.patch
b1f5c1b849f7ec8de6a5f619476f560ea6bf02aad2becfb4e35873d05e01777d5447992b96b0c7f2903c2d8ff094c06927a6ff85f2f006e2441af52fe98c5c42 0001-elf.h-add-typedefs-for-Elf-_Relr.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
7f5b9d934d82deb5f8b23e16169a5d9b99ccab3a4708df06a95d685e1b24a3a3e69b3dcf4942f2f66c12a3d4bf0c5827e2ee2e8c4d7b1997359fccc2ac212dee getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c
"
|