|
1 | 1 | ifneq ($(USE_BINARYBUILDER_CSL),1)
|
2 | 2 |
|
3 |
| -# If we're not using BB-vendored CompilerSupportLibraries, then we must |
4 |
| -# build our own by stealing the libraries from the currently-running system |
5 |
| -CSL_FORTRAN_LIBDIR := $(dir $(shell $(FC) --print-file-name libgfortran.$(SHLIB_EXT))) |
6 |
| -CSL_CXX_LIBDIR := $(dir $(shell $(CXX) --print-file-name libstdc++.$(SHLIB_EXT))) |
7 |
| - |
8 |
| -CXX_LIBS := libgcc_s libstdc++ libc++ libgomp |
9 |
| -FORTRAN_LIBS := libgfortran libquadmath |
10 |
| - |
11 |
| -define cxx_src |
12 |
| -$(CSL_CXX_LIBDIR)/$(1)*.$(SHLIB_EXT)* |
13 |
| -endef |
14 |
| -define fortran_src |
15 |
| -$(CSL_FORTRAN_LIBDIR)/$(1)*.$(SHLIB_EXT)* |
16 |
| -endef |
17 |
| - |
18 |
| -CXX_LIB_PATHS := $(foreach f,$(wildcard $(foreach lib,$(CXX_LIBS),$(call cxx_src,$(lib)))),$(realpath $(f))) |
19 |
| -FORTRAN_LIB_PATHS := $(foreach f,$(wildcard $(foreach lib,$(FORTRAN_LIBS),$(call fortran_src,$(lib)))),$(realpath $(f))) |
20 |
| - |
21 |
| -UNINSTALL_compilersupportlibraries = delete-uninstaller "$(wildcard $(foreach lib,$(CXX_LIBS) $(FORTRAN_LIBS),$(build_shlibdir)/$(lib)*.$(SHLIB_EXT)*))" |
22 |
| -$(build_prefix)/manifest/compilersupportlibraries: | $(build_shlibdir) $(build_prefix)/manifest |
23 |
| - cp -va -l $(CXX_LIB_PATHS) $(build_shlibdir)/ |
24 |
| - cp -va $(FORTRAN_LIB_PATHS) $(build_shlibdir)/ |
25 |
| - echo '$(UNINSTALL_compilersupportlibraries)' > "$@" |
| 3 | +# If we're not using BB-vendored CompilerSupportLibraries, then we just generate |
| 4 | +# a stub JLL that loads whatever the system is running. The downside of this, |
| 5 | +# of course, is that this is much less backwards-compatible. The one exception |
| 6 | +# is FreeBSD, where we cannot rely upon the `libgcc_s` in `/lib`, but must |
| 7 | +# explicitly link against the `libgcc_s` that comes with GCC, which we find here: |
| 8 | + |
| 9 | +$(BUILDDIR)/csl: |
| 10 | + mkdir -p "$@" |
| 11 | + |
| 12 | +$(BUILDDIR)/csl/libgcc_finder.cc: | $(BUILDDIR)/csl |
| 13 | + @echo "int main(void) { return 0; }" >> "$@" |
| 14 | + |
| 15 | +$(BUILDDIR)/csl/libgcc_finder.$(SHLIB_EXT): $(BUILDDIR)/csl/libgcc_finder.cc |
| 16 | + @$(call PRINT_CC,$(CXX) -shared $(fPIC) -o "$@" "$<") |
| 17 | + |
| 18 | +ifeq ($(OS),FreeBSD) |
| 19 | +$(build_prefix)/manifest/compilersupportlibraries: $(build_prefix)/manifest/libwhich |
| 20 | +endif |
| 21 | + |
| 22 | +$(build_prefix)/manifest/compilersupportlibraries: $(BUILDDIR)/csl/libgcc_finder.$(SHLIB_EXT) | $(build_shlibdir) $(build_prefix)/manifest |
| 23 | +ifeq ($(OS),FreeBSD) |
| 24 | + @cp -v $$($(call spawn,$(build_depsbindir)/libwhich) -a $< | tr '\0' '\n' | grep libgcc_s) $(build_shlibdir) |
| 25 | + @echo "delete-uninstaller $(build_shlibdir)/libgcc_s*$(SHLIB_EXT)*" > "$@" |
| 26 | +endif |
| 27 | + |
| 28 | +LIBGFORTRAN_SOVER := $(subst libgfortran,,$(word 4, $(subst -, ,$(BB_TRIPLET_LIBGFORTRAN_CXXABI)))) |
| 29 | + |
| 30 | +ifeq ($(OS),Linux) |
| 31 | +LIBGCC_S_SONAME := libgcc_s.so.1 |
| 32 | +LIBGFORTRAN_SONAME := libgfortran.so.$(LIBGFORTRAN_SOVER) |
| 33 | +LIBSTDCXX_SONAME := libstdc++.so.6 |
| 34 | +CSL_LIBNAMES := libgcc_s libgfortran libstdcxx |
| 35 | +else ifeq ($(OS),Darwin) |
| 36 | +LIBGCC_S_SONAME := libgcc_s.1.dylib |
| 37 | +LIBGFORTRAN_SONAME := libgfortran.$(LIBGFORTRAN_SOVER).dylib |
| 38 | +# We're not going to load this by default, since it's built with clang |
| 39 | +#LIBSTDCXX_SONAME := libstdc++.6.dylib |
| 40 | +CSL_LIBNAMES := libgcc_s libgfortran |
| 41 | +else ifeq ($(OS),WINNT) |
| 42 | +LIBGCC_S_SONAME := libgcc_s_seh-1.dll |
| 43 | +LIBGFORTRAN_SONAME := libgfortran-$(LIBGFORTRAN_SOVER).dll |
| 44 | +LIBSTDCXX_SONAME := libstdc++-6.dll |
| 45 | +CSL_LIBNAMES := libgcc_s libgfortran libstdcxx |
| 46 | +else ifeq ($(OS),FreeBSD) |
| 47 | +LIBGCC_S_SONAME := libgcc_s.so.1 |
| 48 | +LIBGFORTRAN_SONAME := libgfortran.so.$(LIBGFORTRAN_SOVER) |
| 49 | +# We're not going to load this by default, since it's built with clang |
| 50 | +#LIBSTDCXX_SONAME := libstdc++.so.6 |
| 51 | +CSL_LIBNAMES := libgcc_s libgfortran |
| 52 | +endif |
26 | 53 |
|
27 | 54 | get-compilersupportlibraries:
|
28 | 55 | extract-compilersupportlibraries:
|
29 | 56 | configure-compilersupportlibraries:
|
30 | 57 | compile-compilersupportlibraries:
|
31 | 58 | install-compilersupportlibraries: $(build_prefix)/manifest/compilersupportlibraries
|
32 | 59 |
|
33 |
| -$(eval $(call jll-generate,CompilerSupportLibraries_jll, \ |
34 |
| - libgcc_s=\"libgcc_s\" \ |
35 |
| - libgomp=\"libgomp\" \ |
36 |
| - libgfortran=\"libgfortran\" \ |
37 |
| - libstdcxx=\"libstdc++\" \ |
38 |
| - ,,e66e0078-7015-5450-92f7-15fbd957f2ae,)) |
| 60 | +CSL_LIB_MAPPINGS := $(foreach lib,$(CSL_LIBNAMES),$(lib)=\"$($(call uppercase,$(lib))_SONAME)\") |
| 61 | +$(eval $(call jll-generate,CompilerSupportLibraries_jll,$(CSL_LIB_MAPPINGS),,e66e0078-7015-5450-92f7-15fbd957f2ae,)) |
39 | 62 | else # USE_BINARYBUILDER_CSL
|
40 | 63 |
|
41 | 64 | # Install CompilerSupportLibraries_jll into our stdlib folder
|
|
0 commit comments