~ninjin/julia-nix

1980696738dcca0963de0423c966f4ae8c13432a — Pontus Stenetorp 3 years ago 6ca7ead
nix: Patch pre-built binary dependencies from BB
1 files changed, 7 insertions(+), 0 deletions(-)

M deps/tools/bb-install.mk
M deps/tools/bb-install.mk => deps/tools/bb-install.mk +7 -0
@@ 31,6 31,8 @@ $(2)_JLL_VER_NOPLUS := $$(firstword $$(subst +,$(SPACE),$$($(2)_JLL_VER)))
$(2)_JLL_BASENAME := $$($(2)_JLL_DOWNLOAD_NAME).v$$($(2)_JLL_VER).$$($(2)_BB_TRIPLET).tar.gz
$(2)_BB_URL := https://github.com/JuliaBinaryWrappers/$$($(2)_JLL_DOWNLOAD_NAME)_jll.jl/releases/download/$$($(2)_JLL_DOWNLOAD_NAME)-v$$($(2)_JLL_VER)/$$($(2)_JLL_DOWNLOAD_NAME).v$$($(2)_JLL_VER_NOPLUS).$$($(2)_BB_TRIPLET).tar.gz

IS_NIXOS := $$(shell ([ -f /etc/NIXOS ] || ([ -f /etc/os-release ] && grep '^ID=nixos$$$$' /etc/os-release > /dev/null)) && echo 1 || echo 0)

$$(SRCCACHE)/$$($(2)_JLL_BASENAME): | $$(SRCCACHE)
	$$(JLDOWNLOAD) $$@ $$($(2)_BB_URL)



@@ 54,6 56,11 @@ ifneq (bsdtar,$(findstring bsdtar,$(TAR_TEST)))
	$(TAR) -tzf $$< | xargs -n 1 dirname | sort -u | (cd $$(build_prefix) && xargs -t mkdir -p)
endif
	$(UNTAR) $$< -C $$(build_prefix)
ifeq ($(IS_NIXOS), 1)
	@# Patch not only the interpreter, but also `rpath` since Binary Builder
	@# allows binaries to reference shared libraries shipped with Julia.
	$(TAR) -tf $$< | (cd $$(build_prefix) && xargs file --mime | grep 'application/x-executable' | cut -f 1 -d ':' | xargs -r patchelf --set-interpreter "$$$$(cat $$$$NIX_CC/nix-support/dynamic-linker)" --set-rpath '$$$$ORIGIN/../lib' )
endif
	echo '$$(UNINSTALL_$(strip $1))' > $$@

# Special "checksum-foo" target to speed up `contrib/refresh_checksums.sh`