aboutsummaryrefslogblamecommitdiffstats
path: root/main/eglibc/APKBUILD
blob: 4d7711f3ed5cfe021d4dc2b7111a0382f43d9655 (plain) (tree)
1
2
3
4
5



                                                     
        









                                                                                                            
                                                                                      





































































































                                                                                              



                                                                          
                                   















                                                         



                                       



                                                 



                                                  

                                                           






                                                 

































                                                                      
                                                                





                                                                          
# 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"