tools/elfutils: organize gnulib import build stage
[openwrt/staging/pepe2k.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 --import
40
41 PKG_GNULIB_MODS = \
42 argp \
43 dirname \
44 fts \
45 obstack \
46 progname \
47 strchrnul \
48 tsearch
49
50 include $(INCLUDE_DIR)/host-build.mk
51
52 ifeq ($(HOST_OS),Darwin)
53 HOST_CFLAGS += -I/opt/homebrew/include
54 endif
55
56 HOST_CFLAGS += -Wno-error -fPIC
57
58 HOST_CONFIGURE_ARGS += \
59 --without-libintl-prefix \
60 --without-libiconv-prefix \
61 --disable-debuginfod \
62 --disable-libdebuginfod \
63 --disable-nls \
64 --disable-shared \
65 --enable-static \
66 --without-lzma \
67 --without-bzlib \
68 --without-zstd
69
70 ifeq ($(HOST_OS),Darwin)
71 HOST_CONFIGURE_ARGS += --disable-symbol-versioning
72 endif
73
74 Hooks/HostConfigure/Pre := Host/Gnulib $(Hooks/HostConfigure/Pre)
75 define Host/Gnulib
76 $(STAGING_DIR_HOST)/bin/gnulib-tool $(PKG_GNULIB_ARGS) $(PKG_GNULIB_MODS);
77 ln -sf ../lib/eu-config.h $(HOST_BUILD_DIR)/libgnu/;
78 endef
79
80 define Host/Compile
81 $(call Host/Compile/Default,SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))')
82 endef
83
84 define Host/Install
85 $(call Host/Compile/Default,install SUBDIRS='$$$$(wildcard $(PKG_SUBDIRS))')
86 endef
87
88 define Host/Uninstall
89 -$(call Host/Compile/Default,uninstall)
90 endef
91
92 $(eval $(call HostBuild))