summaryrefslogtreecommitdiffstats
path: root/main/musl/APKBUILD
blob: 450d0d3d8a910a4f4dc2a638fd410b5973071cc1 (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
163
164
# Contributor: William Pitcock <nenolod@dereferenced.org>
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.1
pkgrel=3
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
license="MIT"
depends=""
depends_dev="!uclibc-dev"
makedepends="$depends_dev"
install=""
subpackages="$pkgname-dev $pkgname-utils"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
	0001-v1.1.1-to-76f440cf.patch
	0002-76f440cf-to-d85d261e.patch
	0003-d85d261e-to-2abb70c3.patch
	1001-add-basic-dns-record-parsing-functions.patch
	1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
	1003-implement-y-and-C-specifiers-in-strptime.patch
	2001-default-to-localtime-timezone-if-TZ-is-undefined.patch

	ldconfig
	getopt_long.c
	__stack_chk_fail_local.c
	getconf.c
	getent.c
	iconv.c
	"

_builddir="$srcdir"/musl-$pkgver
prepare() {
	local i
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done

	# use GNU compatible getopt() from BSD
	rm -f src/misc/getopt*.c
	cp "$srcdir"/getopt_long.c src/misc/

	# remove libintl wrappers that we don't want
	rm src/locale/intl.c include/libintl.h
}

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" ;;
	esac
	make ARCH="$ARCH" prefix=/usr DESTDIR="${CBUILDROOT}" install-headers || return 1
}

build() {
	cd "$_builddir"

	# 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

	# 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

	# note: not autotools
	LDFLAGS="$LDFLAGS -Wl,-soname,libc.musl-${CARCH}.so.1" \
	./configure \
		--host=$CHOST \
		--prefix=/usr \
		--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
	rm -f "$pkgdir"/usr/lib/*.la

	cp libssp_nonshared.a "$pkgdir"/usr/lib || return 1

	# make LDSO the be the real file, and libc the symlink (will be upstream change)
	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
}

utils() {
	depends="!uclibc-utils scanelf"
	replaces="libiconv"
	license="MIT BSD GPL2+"

	mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin
	mv "$pkgdir"/usr/bin/ldd "$subpkgdir"/usr/bin
	find "$pkgdir" -type d -delete 2>/dev/null
	install -D \
		"$_builddir"/getent \
		"$_builddir"/getconf \
		"$_builddir"/iconv \
		"$subpkgdir"/usr/bin

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

md5sums="dbc08d311148e095016d9bbf6c7ffda6  musl-1.1.1.tar.gz
d4a40fe1656115b2956065ab48e0b372  0001-v1.1.1-to-76f440cf.patch
0b0dce47217fe25eeb82a7f70e15629f  0002-76f440cf-to-d85d261e.patch
4e7a277d2aa6ca246bca81996f247379  0003-d85d261e-to-2abb70c3.patch
a3810683ef61ac27e2f6ec9801280c81  1001-add-basic-dns-record-parsing-functions.patch
83c3bd2a50b1de5ef948704d3f4e0583  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
fc3feec4104a4b25781df92dd96b9eec  1003-implement-y-and-C-specifiers-in-strptime.patch
e936297ceb484b2160a4cd8a3a4eb291  2001-default-to-localtime-timezone-if-TZ-is-undefined.patch
013be8897f27c3909ada59c62020502f  ldconfig
61c6c1e84ed1df82abbe6d75e90cf21c  getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9  __stack_chk_fail_local.c
cb82d21fed17a116b44b830adba71c5a  getconf.c
2b941c4251cac44988a4abfc50e21267  getent.c
45f92f8d59cf84d765de698a9578dbf4  iconv.c"
sha256sums="9dd75d6512e44d5a13254e246db56c90365894b05bab2b1127e44a31e4fd7c36  musl-1.1.1.tar.gz
40f241a8aa59621d8a9e6a616df27c38e0a622243bf7346cc98ec1c37454e92a  0001-v1.1.1-to-76f440cf.patch
d0f4dbc8f0e72df02fcb12e75f829d50909c6da222a5f6a13a0e0c991f91d56e  0002-76f440cf-to-d85d261e.patch
b931c40613923925ac28a010e4ffbe13380a056dfd01eeccc3a090f598edeaff  0003-d85d261e-to-2abb70c3.patch
758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1  1001-add-basic-dns-record-parsing-functions.patch
1c25880095e869b827f02997e864fdf4bf157a4e923e52d97dbd05e657aedb70  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
c22338bc33e8c0c22b280c392b37a0903e13562e671f5ebade09ed5b1d33e2ae  1003-implement-y-and-C-specifiers-in-strptime.patch
60d7aa78040ee664681e507475129f76e445291863137e568c9a3d11ae8436ce  2001-default-to-localtime-timezone-if-TZ-is-undefined.patch
398dc26ec82cc6af056c738e8ac62da212ba978229d9839eb8b61f7ce536da4a  ldconfig
d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96  getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da  __stack_chk_fail_local.c
1b540709f83b7b9a03073b39066810fdb90537d840b50c2016a84bedce038606  getconf.c
68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe  getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7  iconv.c"
sha512sums="5182deb80a35c8a4009d71098c95a16e5ab9bd03186443917652f0c521d2980183e203256493a69e8230b6a0c4848ca8e44de9e8c851a511cd37d0d41f91b14f  musl-1.1.1.tar.gz
30906a5f7a01ff05693e5a2e72f6c7e75ff7939c28a32b9e777d14d59412bb9df603a09aa8dd693e9a0b70525474a62f7bc657425032a3a5f4b339667e6f62ec  0001-v1.1.1-to-76f440cf.patch
358f3828367f5a86806ce5be5842c2be44c1a7919133ab83a7c549bc55be847fee2a938c201782db771ff6a5a994cab6ee7c2050f6ae564f4993c0b3825faa36  0002-76f440cf-to-d85d261e.patch
5bba3f6e369ae38536634cc181b629158dab515476577617024c585ad2247f17bec79b9de035063bddddad07df204654b7eae829b6deb856867907c762f5d2c7  0003-d85d261e-to-2abb70c3.patch
dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708  1001-add-basic-dns-record-parsing-functions.patch
72cf33738d2cf31f6ec02312bc494d754c17470b519172bb8bd7e2e29ac3b119023088a2b3fbc0dbc2fddd0078ccbae62096106cae361f8c31d6a9950043af25  1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
48082d2348de40bc6b455266c5552a62e1e75f926e69116c61c8a3cb35fefdff136dc771bf25ee7d43c959834921221112ed7afcc45fcadbcf07562510786916  1003-implement-y-and-C-specifiers-in-strptime.patch
8d4cae760895a18e83b5fcbdc925705a6dd98acd2270562ee6c905363096a4111cf3aa324b52a16066e30bddc9ab104883e2b25b5c68396ea27f1c50cb939f0a  2001-default-to-localtime-timezone-if-TZ-is-undefined.patch
33e13d2242063f3dc9ec199ae9528e469a52ccae4d3726faa3c866e0c7dcf546f69294f9c00307324cee05fd965f84350ae100b8b1138f9d9c8c916de04ab0d1  ldconfig
140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9  getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b  __stack_chk_fail_local.c
06064adfb4dfb45257857113b3f342f77201685f6d3b8e64e203ff618dbb254e7ecb65ecc2d108395f27154825396251b3cfbc678d197d590d93cf79ac5cb56d  getconf.c
b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2  getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf  iconv.c"