0
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-11-26 23:16:15 +00:00
openwrt/tools/zstd/Makefile
Bryan Roessler 98cc65d9a0 tools/zstd: enable position independent code compilation
Currently, trying to compile LLVM-BPF will fail with:
[2225/3517] Linking CXX shared library lib/libLLVM-15.so
FAILED: lib/libLLVM-15.so
/usr/bin/ld: staging_dir/host/lib/libzstd.a(zstd_common.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status

So, to fix it enable PIC for the host ZSTD.

Fixes: #15247
Signed-off-by: Bryan Roessler <bryanroessler@gmail.com>
2024-04-24 12:16:48 +02:00

46 lines
1.1 KiB
Makefile

include $(TOPDIR)/rules.mk
PKG_NAME:=zstd
PKG_VERSION:=1.5.6
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/facebook/zstd/releases/download/v$(PKG_VERSION)
PKG_HASH:=8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:facebook:zstandard
HOST_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/host-build.mk
HOSTCC:= $(HOSTCC_NOCACHE)
HOST_CFLAGS += $(HOST_FPIC)
HOST_MAKE_FLAGS += \
BACKTRACE=0 \
HAVE_THREAD=1 \
HAVE_ZLIB=0 \
HAVE_LZMA=0 \
HAVE_LZ4=0 \
PREFIX=$(HOST_BUILD_PREFIX)
define Host/Compile
$(call Host/Compile/Default,lib-mt)
$(call Host/Compile/Default,zstd)
endef
define Host/Install
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib install-static install-includes PREFIX=$(HOST_BUILD_PREFIX)
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib install-pc MT=1 PREFIX=$(HOST_BUILD_PREFIX)
+$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/programs install PREFIX=$(HOST_BUILD_PREFIX)
endef
define Host/Uninstall
-$(call Host/Compile/Default,uninstall)
endef
$(eval $(call HostBuild))