aboutsummaryrefslogtreecommitdiffstats
path: root/main/eglibc/APKBUILD
blob: 4d7711f3ed5cfe021d4dc2b7111a0382f43d9655 (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer:
pkgname=eglibc
pkgver=2.17_svn20121226
pkgrel=3
pkgdesc="Embedded GLIBC is a variant of the GNU C Library that is designed to work well on embedded systems"
url="http://www.eglibc.org"
arch="all"
license="GPL"
depends="linux-headers=>3.2.7"
depends_dev=""
makedepends="$depends_dev gawk perl bash"
install=""
options="!strip ldpath-recursive"
triggers="$pkgname-utils.trigger=/lib:/usr/lib"
subpackages="$pkgname-dev $pkgname-lang $pkgname-locales $pkgname-scripts $pkgname-pic
	$pkgname-nscd libthread_db $pkgname-gconv $pkgname-mtrace $pkgname-utils"
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.bz2
	ld.so.conf nscd.initd ldd-sh.patch"
svnurl="svn://svn.eglibc.org/branches/eglibc-2_17/libc"
disturl="dev.alpinelinux.org:/archive/$pkgname/"
verbase="2.17"

[ "$ALPINE_LIBC" != "eglibc" ] && arch=

_builddir="$srcdir"/eglibc-$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
	# set lib dir
	echo "slibdir=/lib" >> configparms
	# ldconfig does not need to look in lib64 or libx32
	sed -i "s#add_system_dir#do_not_add_system_dir#" \
		sysdeps/unix/sysv/linux/x86_64/dl-cache.h || return 1
	mkdir -p eglibc-build
}

build() {
	cd "$_builddir"/eglibc-build
	export CFLAGS="$CFLAGS -fno-stack-protector"
	../configure \
		--build $CBUILD \
		--host $CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--mandir=/usr/share/info \
		--infodir=/usr/share/info \
		--libdir=/usr/lib \
		--libexecdir=/usr/lib \
		--with-headers=/usr/include \
		--enable-kernel=3.2.7 \
		--enable-add-ons=nptl,libidn \
		--disable-profile \
		--enable-bind-now \
		--without-gd \
		--enable-stackguard-randomization \
		--enable-obsolete-rpc \
		--with-bugurl=http://bugs.alpinelinux.org \
		|| return 1
	make || return 1
}

package() {
        cd "$_builddir"/eglibc-build
        local i

	install -D -m644 "$srcdir"/ld.so.conf \
		"$pkgdir"/etc/ld.so.conf || return 1
        
	make -j1 install_root="$pkgdir" install
	
	# multiarch compat (not working on current apk-tools)
	if [ "$CARCH" = "x86_64" ]; then
		cd $pkgdir
		# multiarch compat (not working on current apk-tools)
		ln -sf /lib "$pkgdir"/lib64
		# fix ldd to use /lib dir
		sed -i '/RTLDLIST/s%lib64%lib%' \
			"$pkgdir"/usr/bin/ldd || return 1
	fi

	# strip all
	for i in ldconfig sln gencat getconf getent iconv locale localedef makedb \
		pcprofiledump pldd rpcgen sprof iconvconfig nscd; do
			find "$pkgdir" -type f -name "$i" -exec strip --strip-all '{}' \;
	done
	strip --strip-all "$pkgdir"/usr/lib/getconf/*

	# strip unneeded
	for i in libanl-*.so libBrokenLocale-*.so libcidn-*.so libcrypt-*.so \
		libnss_compat-*.so libnss_db-*.so libnss_dns-*.so libnss_files-*.so \
		libnss_hesiod-*.so libnss_nis-*.so libnss_nisplus-*.so \
		libdl-*.so libm-*.so libnsl-*.so libresolv-*.so librt-*.so libutil-*.so \
		libmemusage.so libpcprofile.so libSegFault.so sotruss-lib.so pt_chown; do
			find "$pkgdir" -type f -name "$i" -exec strip --strip-unneeded '{}' \;
	done
	strip --strip-unneeded "$pkgdir"/usr/lib/gconv/*.so
	
	# strip debug
	strip --strip-debug "$pkgdir"/usr/lib/*.a
}

gconv() {
	pkgdesc="gconv character modules"
	mkdir -p "$subpkgdir"/usr/lib/
	mv "$pkgdir"/usr/lib/gconv \
		"$subpkgdir"/usr/lib/ || return 1
}

scripts() {
        pkgdesc="eglibc scripts sotruss tzselect and xtrace based on bash"
        depends="bash"
        local i
        mkdir -p "$subpkgdir"/usr/bin
        for i in sotruss xtrace; do
                mv "$pkgdir"/usr/bin/$i \
			"$subpkgdir"/usr/bin/ || return 1
        done
}

mtrace() {
	pkgdesc="eglibc mtrace based on perl"
	depends="perl"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/mtrace \
		"$subpkgdir"/usr/bin/ || return 1
}

utils() {
        pkgdesc="eglibc utility programs"
        replaces="uclibc-utils libiconv eglibc"
        mkdir -p "$subpkgdir"/usr/bin \
		"$subpkgdir"/sbin \
		"$subpkgdir"/usr/sbin \
		"$subpkgdir"/usr/lib
        mv "$pkgdir"/sbin/* \
		"$subpkgdir"/sbin/ || return 1
        mv "$pkgdir"/usr/bin/* \
		"$subpkgdir"/usr/bin/ || return 1
	mv "$pkgdir"/usr/sbin/* \
		"$subpkgdir"/usr/sbin/ || return 1
	mv "$pkgdir"/usr/lib/pt_chown \
		"$subpkgdir"/usr/lib/ || return 1
	# remove tzselect in favor of tzdata implementation
	rm -f "$subpkgdir"/usr/bin/tzselect
}

pic() {
	pkgdesc="eglibc PIC archive library"
	mkdir -p "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/*pic.map \
		"$subpkgdir"/usr/lib/ || return 1
}

locales() {
	pkgdesc="Common files for locale support"
	mkdir -p "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/share/* \
		"$subpkgdir"/usr/share/ || return 1
}

nscd() {
	pkgdesc="eglibc name service cache daemon"
        mkdir -p "$subpkgdir"/var/db/nscd \
		"$subpkgdir"/var/run/nscd \
		"$subpkgdir"/usr/sbin || return 1
	install -Dm 755 "$srcdir"/nscd.initd \
		"$subpkgdir"/etc/init.d/nscd || return 1
	install -Dm 644 "$_builddir"/nscd/nscd.conf \
		"$subpkgdir"/etc/nscd.conf || return 1
	mv "$pkgdir"/usr/sbin/nscd \
		"$subpkgdir"/usr/sbin/ || return 1
}

libthread_db() {
        pkgdesc="eglibc thread debugging library"
        mkdir -p "$subpkgdir"/lib
        mv "$pkgdir"/lib/libthread_db* \
		"$subpkgdir"/lib/ || return 1
}

dev() {
	default_dev
	# do not depends on $pkgname-scripts and $pkgname-mtrace
	# so we do not pull in bash and perl with eglibc-dev
	depends="$pkgname $pkgname-lang $pkgname-locales $pkgname-nscd
	libthread_db $pkgname-gconv $pkgname-utils $pkgname-pic"
}

md5sums="41acb18d9024e1bc4a576bdebaf989ce  eglibc-2.17_svn20121226.tar.bz2
08ec272b104e35cd420e26ad09b63bad  ld.so.conf
137fe99a6bc1786da759fb99bfeddb1f  nscd.initd
340a91bc354854bc70a5bb4973367e6a  ldd-sh.patch"