changeset 132:5f0dfff1e37a

core/elfutils: add necessary changes to build with musl
author David Demelier <markand@malikania.fr>
date Sun, 10 Mar 2019 19:15:49 +0100
parents adb183e19426
children 91db31a8996e
files core/bzip2/bzip2.sh core/elfutils/elfutils.info core/elfutils/elfutils.sh core/elfutils/musl.patch lib/argp-standalone/argp-standalone.sh
diffstat 5 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/core/bzip2/bzip2.sh	Sun Mar 10 18:53:35 2019 +0100
+++ b/core/bzip2/bzip2.sh	Sun Mar 10 19:15:49 2019 +0100
@@ -36,6 +36,7 @@
 make install DESTDIR=$DESTDIR PREFIX=/usr
 install -D libbz2.so.$PKGVERSION $DESTDIR/usr/lib/libbz2.so.$PKGVERSION
 ln -s libbz2.so.$PKGVERSION $DESTDIR/usr/lib/libbz2.so
+ln -s libbz2.so.$PKGVERSION $DESTDIR/usr/lib/libbz2.so.${PKGVERSION%.*}
 ln -s libbz2.so.$PKGVERSION $DESTDIR/usr/lib/libbz2.so.${PKGVERSION%%.*}
 rm -f $DESTDIR/usr/lib/libbz2.a
 
--- a/core/elfutils/elfutils.info	Sun Mar 10 18:53:35 2019 +0100
+++ b/core/elfutils/elfutils.info	Sun Mar 10 19:15:49 2019 +0100
@@ -22,8 +22,3 @@
 PKGSUMMARY="utilities to inspect ELF files"
 PKGDOWNLOAD="https://sourceware.org/$PKGNAME/ftp/$PKGVERSION/$PKGNAME-$PKGVERSION.tar.bz2"
 PKGDEPENDS="lib/zlib lib/musl-fts lib/musl-obstack"
-PKGOPTIONS="NLS"
-
-if [ "$NLS" = "yes" ]; then
-	PKGDEPENDS="core/gettext $PKGDEPENDS"
-fi
--- a/core/elfutils/elfutils.sh	Sun Mar 10 18:53:35 2019 +0100
+++ b/core/elfutils/elfutils.sh	Sun Mar 10 19:15:49 2019 +0100
@@ -19,24 +19,22 @@
 : ${CBUILD:=$(uname -m)-linux-musl}
 : ${CC:=gcc}
 : ${CFLAGS:=-O2 -Wno-error}
-: ${NLS:=yes}
 
 source ./elfutils.info
 
 set -ex
 
-if [ "$NLS" = "yes" ]; then
-	with_nls="--enable-nls"
-else
-	with_nls="--disable-nls"
-fi
-
 rm -rf $PKGNAME-$PKGVERSION
 tar xvaf $PKGNAME-$PKGVERSION.tar.bz2
 pushd $PKGNAME-$PKGVERSION
 
-# credits to void linux.
+if [ "$(uname -m)" = "x86_64" ]; then
+	CFLAGS="-fPIC $CFLAGS"
+fi
+
+# credits to void linux and alpine linux.
 # https://github.com/void-linux/void-packages/tree/master/srcpkgs/elfutils
+# https://git.alpinelinux.org/aports/tree/main/elfutils/
 patch -p0 < ../musl.patch
 autoreconf -fi
 CC="$CC" \
@@ -46,7 +44,7 @@
 	--host=$CHOST \
 	--prefix=/usr \
 	--program-prefix="eu-" \
-	${with_nls}
+	--disable-nls
 make
 make install DESTDIR=$DESTDIR
 rm -f $DESTDIR/usr/lib/lib{asm,dw,ebl,elf}.a
--- a/core/elfutils/musl.patch	Sun Mar 10 18:53:35 2019 +0100
+++ b/core/elfutils/musl.patch	Sun Mar 10 19:15:49 2019 +0100
@@ -389,3 +389,12 @@
 +}
 +
 +#endif	/* _ERROR_H_ */
+--- /dev/null	2019-03-10 12:27:13.816667173 +0100
++++ lib/libintl.h	2019-03-10 19:04:03.646840388 +0100
+@@ -0,0 +1,6 @@
++#ifndef LIBINTL_H
++#define LIBINTL_H
++
++#define _(x) (x)
++
++#endif
--- a/lib/argp-standalone/argp-standalone.sh	Sun Mar 10 18:53:35 2019 +0100
+++ b/lib/argp-standalone/argp-standalone.sh	Sun Mar 10 19:15:49 2019 +0100
@@ -28,6 +28,10 @@
 tar xvaf $PKGNAME-$PKGVERSION.tar.gz
 pushd $PKGNAME-$PKGVERSION
 
+if [ "$(uname -m)" = "x86_64" ]; then
+	CFLAGS="-fPIC $CFLAGS"
+fi
+
 # TODO: build as shared instead of static.
 patch -p1 < ../gnu89-inline.patch
 patch -p1 < ../throw-in-funcdef.patch