|
| 1 | +## Zstd ## |
| 2 | +ifneq ($(USE_BINARYBUILDER_ZSTD), 1) |
| 3 | +ZSTD_GIT_URL := https://github.com/facebook/zstd.git |
| 4 | +ZSTD_TAR_URL = https://api.github.com/repos/facebook/zstd/tarball/$1 |
| 5 | +$(eval $(call git-external,zstd,ZSTD,,,$(BUILDDIR))) |
| 6 | + |
| 7 | +ZSTD_BUILD_OPTS := MOREFLAGS="-DZSTD_MULTITHREAD $(fPIC)" bindir=$(build_private_libexecdir) |
| 8 | + |
| 9 | +$(BUILDDIR)/$(ZSTD_SRC_DIR)/build-configured: $(BUILDDIR)/$(ZSTD_SRC_DIR)/source-extracted |
| 10 | + echo 1 > $@ |
| 11 | + |
| 12 | +$(BUILDDIR)/$(ZSTD_SRC_DIR)/build-compiled: $(BUILDDIR)/$(ZSTD_SRC_DIR)/build-configured |
| 13 | + $(MAKE) -C $(dir $<) $(MAKE_COMMON) $(ZSTD_BUILD_OPTS) |
| 14 | + echo 1 > $@ |
| 15 | + |
| 16 | +$(eval $(call staged-install, \ |
| 17 | + zstd,$(ZSTD_SRC_DIR), \ |
| 18 | + MAKE_INSTALL,$(ZSTD_BUILD_OPTS) MT=1,, \ |
| 19 | + $(INSTALL_NAME_CMD)libzstd.$(SHLIB_EXT) $(build_private_libexecdir)/libzstd.$(SHLIB_EXT))) |
| 20 | + |
| 21 | +clean-zstd: |
| 22 | + -rm -f $(BUILDDIR)/$(ZSTD_SRC_DIR)/build-configured $(BUILDDIR)/$(ZSTD_SRC_DIR)/build-compiled |
| 23 | + -$(MAKE) -C $(BUILDDIR)/$(ZSTD_SRC_DIR) $(MAKE_COMMON) $(ZSTD_BUILD_OPTS) clean |
| 24 | + |
| 25 | +get-zstd: $(ZSTD_SRC_FILE) |
| 26 | +extract-zstd: $(BUILDDIR)/$(ZSTD_SRC_DIR)/source-extracted |
| 27 | +configure-zstd: $(BUILDDIR)/$(ZSTD_SRC_DIR)/build-configured |
| 28 | +compile-zstd: $(BUILDDIR)/$(ZSTD_SRC_DIR)/build-compiled |
| 29 | +fastcheck-zstd: check-zstd |
| 30 | +check-zstd: compile-zstd |
| 31 | + |
| 32 | +else # USE_BINARYBUILDER_ZSTD |
| 33 | + |
| 34 | +$(eval $(call bb-install,zstd,ZSTD,false)) |
| 35 | +# move from bindir to shlibdir, where we expect to install it |
| 36 | +install-zstd: post-install-zstd |
| 37 | +uninstall-zstd: pre-uninstall-zstd |
| 38 | +post-install-zstd: $(build_prefix)/manifest/zstd $(PATCHELF_MANIFEST) |
| 39 | + mkdir -p $(build_private_libexecdir)/ |
| 40 | + [ ! -e $(build_bindir)/zstdmt$(EXE) ] || mv $(build_bindir)/zstdmt$(EXE) $(build_private_libexecdir)/zstdmt$(EXE) |
| 41 | + [ ! -e $(build_bindir)/zstd$(EXE) ] || mv $(build_bindir)/zstd$(EXE) $(build_private_libexecdir)/zstd$(EXE) |
| 42 | + [ -e $(build_private_libexecdir)/zstd$(EXE) ] |
| 43 | + [ -e $(build_private_libexecdir)/zstdmt$(EXE) ] |
| 44 | +ifeq ($(OS), Darwin) |
| 45 | + for j in zstd zstdmt ; do \ |
| 46 | + [ -L $(build_private_libexecdir)/$$j ] && continue; \ |
| 47 | + install_name_tool -rpath @executable_path/$(reverse_build_private_libexecdir_rel) @loader_path/$(build_libdir_rel) $(build_private_libexecdir)/$$j 2>/dev/null || true; \ |
| 48 | + install_name_tool -rpath @loader_path/$(build_libdir_rel) @executable_path/$(reverse_build_private_libexecdir_rel) $(build_private_libexecdir)/$$j || exit 1; \ |
| 49 | + done |
| 50 | +else ifneq (,$(findstring $(OS),Linux FreeBSD)) |
| 51 | + for j in zstd zstdmt ; do \ |
| 52 | + [ -L $(build_private_libexecdir)/$$j ] && continue; \ |
| 53 | + $(PATCHELF) $(PATCHELF_SET_RPATH_ARG) '$$ORIGIN/$(reverse_build_private_libexecdir_rel)' $(build_private_libexecdir)/$$j || exit 1; \ |
| 54 | + done |
| 55 | +endif |
| 56 | + |
| 57 | +pre-uninstall-zstd: |
| 58 | + -rm -f $(build_private_libexecdir)/zstd$(EXE) $(build_private_libexecdir)/zstdmt$(EXE) |
| 59 | + |
| 60 | +endif # USE_BINARYBUILDER_ZSTD |
0 commit comments