APKBUILD 8 KB
Newer Older
Ariadne Conill's avatar
Ariadne Conill committed
1
# Contributor: William Pitcock <nenolod@dereferenced.org>
Timo Teräs's avatar
Timo Teräs committed
2
# Maintainer: Timo Teräs <timo.teras@iki.fi>
Ariadne Conill's avatar
Ariadne Conill committed
3
pkgname=musl
Timo Teräs's avatar
Timo Teräs committed
4
pkgver=1.1.14
5
pkgrel=5
Ariadne Conill's avatar
Ariadne Conill committed
6 7
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
8
arch="all"
Ariadne Conill's avatar
Ariadne Conill committed
9 10
license="MIT"
depends=""
11
depends_dev="!uclibc-dev"
Ariadne Conill's avatar
Ariadne Conill committed
12
makedepends="$depends_dev"
13
subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg libc6-compat:compat"
Timo Teräs's avatar
Timo Teräs committed
14
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
15 16 17
	0001-handle-non-matching-address-family-entries-in-hosts-.patch
	0002-fix-at-the-start-of-a-BRE-subexpression.patch
	0003-fix-at-the-start-of-a-complete-BRE.patch
18 19
	0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch
	0005-env-avoid-leaving-dangling-pointers-in-__env_map.patch
20 21
	0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
	1001-fix-gethostbyaddr_r-to-fill-struct-hostent.h_length-.patch
22

23
	ldconfig
Timo Teräs's avatar
Timo Teräs committed
24
	__stack_chk_fail_local.c
25
	getconf.c
26
	getent.c
27
	iconv.c
Timo Teräs's avatar
Timo Teräs committed
28
	"
Ariadne Conill's avatar
Ariadne Conill committed
29 30 31

_builddir="$srcdir"/musl-$pkgver

32 33 34 35 36 37 38 39 40 41
install_sysroot_headers() {
	cd "$_builddir"
	if [ -z "${CBUILDROOT}" ]; then
		echo "CBUILDROOT not must be set!"
		return 1
	fi
	case "$CARCH" in
	arm*) ARCH="arm" ;;
	x86) ARCH="i386" ;;
	x86_64) ARCH="x86_64" ;;
42
	mips*) ARCH="mips" ;;
43
	esac
44
	make ARCH="$ARCH" prefix=/usr DESTDIR="${CBUILDROOT}" install-headers || return 1
45 46
}

Ariadne Conill's avatar
Ariadne Conill committed
47 48
build() {
	cd "$_builddir"
Timo Teräs's avatar
Timo Teräs committed
49 50 51 52 53

	# provide minimal libssp_nonshared.a so we don't need libssp from gcc
	${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS -c "$srcdir"/__stack_chk_fail_local.c -o __stack_chk_fail_local.o || return 1
	${CROSS_COMPILE}ar r libssp_nonshared.a __stack_chk_fail_local.o || return 1

54 55 56 57 58
	# getconf/getent/iconv
	local i
	for i in getconf getent iconv ; do
		${CROSS_COMPILE}gcc $CPPFLAGS $CFLAGS "$srcdir"/$i.c -o $i || return 1
	done
59

Timo Teräs's avatar
Timo Teräs committed
60
	# note: not autotools
61
	LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \
Timo Teräs's avatar
Timo Teräs committed
62 63 64
	./configure \
		--host=$CHOST \
		--prefix=/usr \
Ariadne Conill's avatar
Ariadne Conill committed
65 66 67 68 69 70 71 72 73 74 75
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		|| return 1
	make || return 1
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
76

Timo Teräs's avatar
Timo Teräs committed
77 78
	cp libssp_nonshared.a "$pkgdir"/usr/lib || return 1

Timo Teräs's avatar
Timo Teräs committed
79
	# make LDSO the be the real file, and libc the symlink
80 81 82 83 84 85
	local LDSO=$(make -f Makefile --eval "$(echo -e 'print-ldso:\n\t@echo $$(basename $(LDSO_PATHNAME))')" print-ldso)
	mv -f "$pkgdir"/usr/lib/libc.so "$pkgdir"/lib/"$LDSO" || return 1
	ln -sf "$LDSO" "$pkgdir"/lib/libc.musl-${CARCH}.so.1 || return 1
	ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/lib/libc.so || return 1
	mkdir -p "$pkgdir"/usr/bin
	ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/bin/ldd || return 1
Timo Teräs's avatar
Timo Teräs committed
86 87 88 89 90

	# remove libintl.h, 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.
	rm "$pkgdir"/usr/include/libintl.h || return 1
Ariadne Conill's avatar
Ariadne Conill committed
91 92
}

93
utils() {
94
	depends="!uclibc-utils scanelf"
95
	replaces="libiconv uclibc-utils"
96 97
	license="MIT BSD GPL2+"

98
	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin
99 100
	mv "$pkgdir"/usr/bin/ldd "$subpkgdir"/usr/bin
	find "$pkgdir" -type d -delete 2>/dev/null
101 102 103 104 105
	install -D \
		"$_builddir"/getent \
		"$_builddir"/getconf \
		"$_builddir"/iconv \
		"$subpkgdir"/usr/bin
106 107

	install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin
108 109
}

110 111 112 113 114 115 116 117 118 119 120
compat() {
	pkgdesc="compatibility libraries for glibc"

	case "$CARCH" in
	arm*) _ld="ld-linux-armhf.so.3" ;;
	x86) _ld="ld-linux.so.2" ;;
	x86_64) _ld="ld-linux-x86-64.so.2" ;;
	mips*) _ld="ld.so.1" ;;
	esac

	mkdir -p "$subpkgdir"/lib
121
	ln -sf "/lib/libc.musl-${CARCH}.so.1" "$subpkgdir/lib/$_ld"
122 123

	for i in libc.so.6 libm.so.6 libpthread.so.0 librt.so.1 libutil.so.1; do
124
		ln -sf "/lib/libc.musl-${CARCH}.so.1" "$subpkgdir/lib/$i"
125 126 127
	done
}

Timo Teräs's avatar
Timo Teräs committed
128
md5sums="d529ce4a2f7f79d8c3fd4b8329417b57  musl-1.1.14.tar.gz
129 130 131
c683094384c5726a99d1047f01aeb331  0001-handle-non-matching-address-family-entries-in-hosts-.patch
3b9089a017ac90b303fad94a6aa71219  0002-fix-at-the-start-of-a-BRE-subexpression.patch
6cee220f293754cd1e7126f3d4db5b43  0003-fix-at-the-start-of-a-complete-BRE.patch
132 133
476dc9157a7ac6de5bb6f7c5a5ef7a2d  0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch
a372031134c17cefb9aad3c9c0e6bb19  0005-env-avoid-leaving-dangling-pointers-in-__env_map.patch
134 135
d85fdb4d80c8372d8e63cf4382e4012a  0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
366e32f17cbe18b4d4855eda6b4f82cb  1001-fix-gethostbyaddr_r-to-fill-struct-hostent.h_length-.patch
136
830d01f7821b978df770b06db3790921  ldconfig
Timo Teräs's avatar
Timo Teräs committed
137
0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
138
57ef2c63b9ec6a2041694ace97d4ffa2  getconf.c
139
2b941c4251cac44988a4abfc50e21267  getent.c
140
45f92f8d59cf84d765de698a9578dbf4  iconv.c"
Timo Teräs's avatar
Timo Teräs committed
141
sha256sums="35f6c00c84a6091bd5dab29eedde7508dae755ead92dcc0239f3677d1055b9b5  musl-1.1.14.tar.gz
142 143 144
87d3161c69b347c1cb826a886d098bc03a17a00172c5839c4e30ed1745fb92ec  0001-handle-non-matching-address-family-entries-in-hosts-.patch
0bd21cab29a7a2f6644d1046e7bd91dd5aadf6748e207ddda3ff99e353548775  0002-fix-at-the-start-of-a-BRE-subexpression.patch
13d285aba7e5e33dca32e6adbb5ada69f0f88f0320968b201d03fe02f1a70d4c  0003-fix-at-the-start-of-a-complete-BRE.patch
145 146
e4e36277864e1445295be1397c930c649905ddfa32f1ed65c6defb67f78dd0e8  0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch
02cd2b0c92ab04a7e39ab4bf53687bc3354b8fffe3cb4aba9cb630532ce43d4a  0005-env-avoid-leaving-dangling-pointers-in-__env_map.patch
147 148
6037fa5aee8dba3d3b01ded5752d876954c23da3a53ed5a734f0816a2ef1d4bd  0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
4b54d17049582fa11b9e28406412ec0538af70476f9e2331e083e6ae37d938b9  1001-fix-gethostbyaddr_r-to-fill-struct-hostent.h_length-.patch
149
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7  ldconfig
Timo Teräs's avatar
Timo Teräs committed
150
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
151
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c  getconf.c
152
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c
153
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7  iconv.c"
Timo Teräs's avatar
Timo Teräs committed
154
sha512sums="9016246b44a7e6ef51477f0a246373c79f3e796c70031c3323be1b6c4c0518a2d4578f1aa712adfd9a80cdc1d71918bd7a35855052a0452b854755bf0cc2424e  musl-1.1.14.tar.gz
155 156 157
8546b31b04effe8d863e26ecd1677890e925b0f65f46e09f03804024c36595c944c3d7e758160f57862b9e6c85e431139ff8b2412a29c57eb9773cce327647a5  0001-handle-non-matching-address-family-entries-in-hosts-.patch
18b2f436de9e1c3b8720c93d4a013f069f1f7bb8d71203c157a4670b4fa5749347fd2eba74b47e527f9bb7d98442eaf69837ee69ea1840bf6d1577f14029f089  0002-fix-at-the-start-of-a-BRE-subexpression.patch
51a16e88f602d1db175d82d8276273006b74dc7e87340207e26db80820bab368c50f4d1539175bf3b5b3b23ae6da2e452e81f858029bfef49c54f548bc1a4674  0003-fix-at-the-start-of-a-complete-BRE.patch
158 159
bae8e0f4a1f73be42450945058c1106957da56dc7fa087515dd51bcac3c7099c4cfe4e8c44fb8efc059944d0675858b747396d60c884b031663983912262e992  0004-math-fix-expf-NAN-and-exp2f-NAN-to-return-NAN-instea.patch
202f21518ca75373712430fb547662e7a4936c6947cb61fe97fd5dbd9f48217ca38f90439d51b03cafce9a2bfd90e360182a454f3b941abae033d90f2bffe50c  0005-env-avoid-leaving-dangling-pointers-in-__env_map.patch
160 161
fb30c3d1113e3cdaf575b37257b1184f2d5cc7cea0eb0ee94a71e861f9c72fe924de5f63826701584f68c9e1c9c4c1357a967ebe00f637312193e268f7a7cf94  0006-fix-padding-string-formats-to-width-in-wide-printf-v.patch
e3e0ebc19362e93ed1a278688e3acc082c23993daf0eb14ba011917ad076b2348bbe3fc9a939011884223f2dada3280b63fb7e7cb50373bebff0cf857899acaa  1001-fix-gethostbyaddr_r-to-fill-struct-hostent.h_length-.patch
162
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f  ldconfig
Timo Teräs's avatar
Timo Teräs committed
163
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
164
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d  getconf.c
165
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c
166
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"