elfutils: fix build and enable on non-linux systems
[openwrt/openwrt.git] / tools / elfutils / Makefile
index f9c6272719c89094a347ee20a7fe9d3cfe75a455..2605bc61cb7e61834108a38817c42b559af747c7 100644 (file)
@@ -19,16 +19,32 @@ PKG_INSTALL:=1
 
 include $(INCLUDE_DIR)/host-build.mk
 
+ifeq ($(HOST_OS),Darwin)
+  HOST_CFLAGS += -I/opt/homebrew/include
+endif
+
+HOST_CFLAGS += -Wno-error
+
 HOST_CONFIGURE_ARGS += \
+       --without-libintl-prefix \
+       --without-libiconv-prefix \
        --disable-debuginfod \
        --disable-libdebuginfod \
        --disable-nls \
        --disable-shared \
+       --enable-static \
        --without-lzma \
        --without-zstd
 
-HOST_MAKE_FLAGS += \
-       SUBDIRS="lib libelf libcpu backends libebl libdwelf libdwfl libdw"
+ifeq ($(HOST_OS),Darwin)
+  HOST_CONFIGURE_ARGS += --disable-symbol-versioning
+endif
+
+Hooks/HostConfigure/Pre := Host/Gnulib $(Hooks/HostConfigure/Pre)
+define Host/Gnulib
+       cd $(HOST_BUILD_DIR); $(STAGING_DIR_HOST)/bin/gnulib-tool --libtool --source-base=libgnu --import argp obstack fts strchrnul progname tsearch;
+       ln -sf ../lib/eu-config.h $(HOST_BUILD_DIR)/libgnu/;
+endef
 
 define Host/Uninstall
        -$(call Host/Compile/Default,uninstall)