Skip to content

Commit

Permalink
build: fix various makefile bugs
Browse files Browse the repository at this point in the history
Trying for cross-compile and disabling CSL and realized both of those
configurations were broken now.
  • Loading branch information
vtjnash committed Jul 18, 2023
1 parent 5eddb81 commit 9dc1380
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,15 @@ endif

ifeq ($(OS),WINNT)
define versioned_libname
$$(if $(2),$(1)-$(2).$(SHLIB_EXT),$(1).$(SHLIB_EXT))
$(if $(2),$(1)-$(2).$(SHLIB_EXT),$(1).$(SHLIB_EXT))
endef
else ifeq ($(OS),Darwin)
define versioned_libname
$$(if $(2),$(1).$(2).$(SHLIB_EXT),$(1).$(SHLIB_EXT))
$(if $(2),$(1).$(2).$(SHLIB_EXT),$(1).$(SHLIB_EXT))
endef
else
define versioned_libname
$$(if $(2),$(1).$(SHLIB_EXT).$(2),$(1).$(SHLIB_EXT))
$(if $(2),$(1).$(SHLIB_EXT).$(2),$(1).$(SHLIB_EXT))
endef
endif

Expand Down
8 changes: 4 additions & 4 deletions deps/csl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ ifeq ($(USE_SYSTEM_CSL),1)
USE_BINARYBUILDER_CSL ?= 0
else
# If it's not, see if we should disable it due to `libstdc++` being newer:
LIBSTDCXX_PATH := $(eval $(call pathsearch,libstdc++,$(STD_LIB_PATH)))
ifneq (,$(and $(LIBSTDCXX_PATH),$(shell objdump -p $(LIBSTDCXX_PATH) | grep $(CSL_NEXT_GLIBCXX_VERSION))))
LIBSTDCXX_PATH := $(call pathsearch,$(call versioned_libname,libstdc++,6),$(STD_LIB_PATH))
ifneq (,$(and $(LIBSTDCXX_PATH),$(shell objdump -p '$(LIBSTDCXX_PATH)' | grep '$(CSL_NEXT_GLIBCXX_VERSION)')))
# Found `libstdc++`, grepped it for strings and found a `GLIBCXX` symbol
# that is newer that whatever we have in CSL. Default to not using BB.
USE_BINARYBUILDER_CSL ?= 0
Expand All @@ -50,8 +50,8 @@ ifeq ($(USE_BINARYBUILDER_CSL),0)
define copy_csl
install-csl: | $$(build_shlibdir) $$(build_shlibdir)/$(1)
$$(build_shlibdir)/$(1): | $$(build_shlibdir)
-@SRC_LIB=$$(call pathsearch,$(1),$$(STD_LIB_PATH)); \
[ -n "$$$${SRC_LIB}" ] && cp $$$${SRC_LIB} $$(build_shlibdir)
-@SRC_LIB='$$(call pathsearch,$(1),$$(STD_LIB_PATH))'; \
[ -n "$$$${SRC_LIB}" ] && cp "$$$${SRC_LIB}" '$$(build_shlibdir)'
endef

# libgfortran has multiple names; we're just going to copy any version we can find
Expand Down
4 changes: 2 additions & 2 deletions deps/sanitizers.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ SANITIZER_LIB_PATH := $(dir $(shell LANG=C $(CC) -print-file-name=libasan.so))
endif

# Given a colon-separated list of paths in $(2), find the location of the library given in $(1)
define pathsearch
define pathsearch_all
$(wildcard $(addsuffix /$(1),$(subst :, ,$(2))))
endef

define copy_sanitizer_lib
install-sanitizers: $$(addprefix $$(build_libdir)/, $$(notdir $$(call pathsearch,$(1),$$(SANITIZER_LIB_PATH)))) | $$(build_shlibdir)
install-sanitizers: $$(addprefix $$(build_libdir)/, $$(notdir $$(call pathsearch_all,$(1),$$(SANITIZER_LIB_PATH)))) | $$(build_shlibdir)
$$(addprefix $$(build_shlibdir)/,$(2)): $$(addprefix $$(SANITIZER_LIB_PATH)/,$(2)) | $$(build_shlibdir)
-cp $$< $$@
endef
Expand Down

0 comments on commit 9dc1380

Please sign in to comment.