tools/elfutils: use locally declared static reallocarray()
[openwrt/staging/nbd.git] / tools / elfutils / Makefile
1 # SPDX-License-Identifier: GPL-2.0-only
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=elfutils
6 PKG_VERSION:=0.191
7 PKG_RELEASE:=1
8
9 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
10 PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
11 PKG_HASH:=df76db71366d1d708365fc7a6c60ca48398f14367eb2b8954efc8897147ad871
12
13 PKG_LICENSE:=GPL-3.0-or-later
14 PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
15 PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils
16
17 PKG_FIXUP:=autoreconf
18 PKG_INSTALL:=1
19
20 PKG_SUBDIRS := \
21 libgnu \
22 config \
23 lib \
24 libelf \
25 libcpu \
26 backends \
27 libebl \
28 libdwelf \
29 libdwfl \
30 libdw
31
32 PKG_GNULIB_BASE:=libgnu
33
34 PKG_GNULIB_ARGS = \
35 --dir=$(HOST_BUILD_DIR) \
36 --local-dir=$(STAGING_DIR_HOST)/share/gnulib \
37 --source-base=$(PKG_GNULIB_BASE) \
38 --libtool \
39 --avoid=reallocarray \
40 --import
41
42 PKG_GNULIB_MODS = \
43 argp \
44 dirname \
45 fts \
46 obstack \
47 progname \
48 strchrnul \
49 tsearch
50
51 include $(INCLUDE_DIR)/host-build.mk
52
53 ifeq ($(HOST_OS),Darwin)
54 HOST_CFLAGS += -I/opt/homebrew/include
55 endif
56
57 HOST_CFLAGS += -Wno-error -fPIC
58
59 HOST_CONFIGURE_ARGS += \
60 --without-libintl-prefix \
61 --without-libiconv-prefix \
62 --disable-debuginfod \
63 --disable-libdebuginfod \
64 --disable-nls \
65 --disable-shared \
66 --enable-static \
67 --without-lzma \
68 --without-bzlib \
69 --without-zstd
70
71 ifeq ($(HOST_OS),Darwin)
72 HOST_CONFIGURE_ARGS += --disable-symbol-versioning
73 endif
74
75 Hooks/HostConfigure/Pre := Host/Gnulib $(Hooks/HostConfigure/Pre)
76 define Host/Gnulib
77 $(STAGING_DIR_HOST)/bin/gnulib-tool $(PKG_GNULIB_ARGS) $(PKG_GNULIB_MODS);
78 ln -sf ../lib/eu-config.h $(HOST_BUILD_DIR)/libgnu/;
79 endef
80
81 define Host/Compile
82 $(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))')
83 endef
84
85 define Host/Install
86 $(call Host/Compile/Default,install SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))')
87 endef
88
89 define Host/Uninstall
90 -$(call Host/Compile/Default,uninstall)
91 endef
92
93 $(eval $(call HostBuild))