aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-08-03 21:29:37 +0300
committerCem Keylan <cem@ckyln.com>2020-08-03 21:29:37 +0300
commit452372b3f917edeea71d250b228d2cf673bb4f70 (patch)
tree487624d8080a46df23f8e55f3fed1ec2d982a952
parent7f2e3be5544a74bb0d5207897dff3d21ec1b512a (diff)
downloadrepository-452372b3f917edeea71d250b228d2cf673bb4f70.tar.gz
libelf: switch to elfutils
-rwxr-xr-xcore/libelf/build22
-rw-r--r--core/libelf/checksums4
-rw-r--r--core/libelf/depends1
-rw-r--r--core/libelf/files/error.h27
-rw-r--r--core/libelf/patches/musl-decls.patch20
-rw-r--r--core/libelf/sources4
-rw-r--r--core/libelf/version2
7 files changed, 72 insertions, 8 deletions
diff --git a/core/libelf/build b/core/libelf/build
index 94916479..bd5cf230 100755
--- a/core/libelf/build
+++ b/core/libelf/build
@@ -1,11 +1,23 @@
#!/bin/sh -e
-sed 's/-I/-isystem /g' libelf.pc.in > _
-cat _ > libelf.pc.in; rm -f _
+patch -p1 < musl-decls.patch
+
+# Build sometimes forces -Werror.
+export CFLAGS="$CFLAGS -Wno-error"
+
+# Disable configure error for missing argp.
+sed -i 's/as_fn_error.*libargp/: "/g' configure
+
+# Don't compile two unrelated C files which require argp.
+sed -i 's/color.*printversion../#/g' lib/Makefile.in
./configure \
--prefix=/usr \
- --enable-nls=auto
+ --disable-symbol-versioning \
+ --disable-debuginfod \
+ --disable-nls
-make
-make prefix="$1/usr" install
+# Skip the default make target and build only what we need.
+make -C lib
+make -C libelf
+make -C libelf DESTDIR="$1" install
diff --git a/core/libelf/checksums b/core/libelf/checksums
index 46a6d9a8..e978fe84 100644
--- a/core/libelf/checksums
+++ b/core/libelf/checksums
@@ -1 +1,3 @@
-591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d libelf-0.8.13.tar.gz
+b827b6e35c59d188ba97d7cf148fa8dc6f5c68eb6c5981888dfdbb758c0b569d elfutils-0.180.tar.bz2
+fd98976f5112b49f6469e7bd2e97d390cf90dc68392218dc713ac0449fc3e395 musl-decls.patch
+bf11b56670c7919b44e33b5b0f3a216b7f20cf2859b74bf5e2e837532f8e0579 error.h
diff --git a/core/libelf/depends b/core/libelf/depends
new file mode 100644
index 00000000..f22003e8
--- /dev/null
+++ b/core/libelf/depends
@@ -0,0 +1 @@
+zlib
diff --git a/core/libelf/files/error.h b/core/libelf/files/error.h
new file mode 100644
index 00000000..ef06827a
--- /dev/null
+++ b/core/libelf/files/error.h
@@ -0,0 +1,27 @@
+#ifndef _ERROR_H_
+#define _ERROR_H_
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
+
+static unsigned int error_message_count = 0;
+
+static inline void error(int status, int errnum, const char* format, ...)
+{
+ va_list ap;
+ fprintf(stderr, "%s: ", program_invocation_name);
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+ fprintf(stderr, "\n");
+ error_message_count++;
+ if (status)
+ exit(status);
+}
+
+#endif /* _ERROR_H_ */
diff --git a/core/libelf/patches/musl-decls.patch b/core/libelf/patches/musl-decls.patch
new file mode 100644
index 00000000..e3705695
--- /dev/null
+++ b/core/libelf/patches/musl-decls.patch
@@ -0,0 +1,20 @@
+--- a/libelf/elf.h 2015-08-21 14:22:37.000000000 +0200
++++ b/libelf/elf.h 2015-11-20 04:54:33.948081321 +0100
+@@ -21,6 +21,17 @@
+
+ #include <features.h>
+
++#if !defined(__GLIBC__)
++/* C++ needs to know that types and declarations are C, not C++. */
++#ifdef __cplusplus
++# define __BEGIN_DECLS extern "C" {
++# define __END_DECLS }
++#else
++# define __BEGIN_DECLS
++# define __END_DECLS
++#endif
++#endif
++
+ __BEGIN_DECLS
+
+ /* Standard ELF types. */
diff --git a/core/libelf/sources b/core/libelf/sources
index d8f130e7..91cdad42 100644
--- a/core/libelf/sources
+++ b/core/libelf/sources
@@ -1 +1,3 @@
-https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz
+https://sourceware.org/elfutils/ftp/0.180/elfutils-0.180.tar.bz2
+patches/musl-decls.patch
+files/error.h lib
diff --git a/core/libelf/version b/core/libelf/version
index 5af15bd9..fd3e36c9 100644
--- a/core/libelf/version
+++ b/core/libelf/version
@@ -1 +1 @@
-0.8.13 2
+0.180 1