aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Thomas <thierry@FreeBSD.org>2023-11-15 10:26:36 +0000
committerThierry Thomas <thierry@FreeBSD.org>2023-11-15 20:36:09 +0000
commit47322ff8ea597f8c6bddcbb0bd33e9dcbc584492 (patch)
tree800fb032255069e6bffe27484f40e2c18ffd26a5
parentf0cbed4d889d2e4bff2d1c797c05008314dd786a (diff)
downloadports-47322ff8ea597f8c6bddcbb0bd33e9dcbc584492.tar.gz
ports-47322ff8ea597f8c6bddcbb0bd33e9dcbc584492.zip
lang/julia: partly remove the dependency on gfortran
Theoretically this port should not depend on gfortran, because we do not build the bundled OpenBLAS (use the system package) nor SuiteSparse (GPL libraries are deactivated). It is certainly possible to totally remove the dependency on gfortran, but this would require some more intrusive patches: this one only removes the linkage with the libraries provided by GCC (among them libgomp). Remark: this does not fix the failure reported at <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273219#c37>.
-rw-r--r--lang/julia/Makefile13
-rw-r--r--lang/julia/files/patch-Make.inc122
-rw-r--r--lang/julia/files/patch-Makefile18
-rw-r--r--lang/julia/files/patch-base_Makefile12
-rw-r--r--lang/julia/files/patch-stdlib_LinearAlgebra_src_lbt.jl6
-rw-r--r--lang/julia/pkg-plist7
6 files changed, 157 insertions, 21 deletions
diff --git a/lang/julia/Makefile b/lang/julia/Makefile
index 6041ae0c0d10..ab4b36654b5e 100644
--- a/lang/julia/Makefile
+++ b/lang/julia/Makefile
@@ -1,7 +1,7 @@
PORTNAME= julia
DISTVERSION= 1.9.3
-PORTREVISION= 4
DISTVERSIONSUFFIX= -full
+PORTREVISION= 5
CATEGORIES= lang math
MASTER_SITES= https://github.com/JuliaLang/${PORTNAME}/releases/download/v${DISTVERSION}/
@@ -19,6 +19,7 @@ MY_DEPENDS= 7zz:archivers/7-zip
BUILD_DEPENDS= patchelf:sysutils/patchelf \
cmake:devel/cmake-core \
ittapi>0:devel/ittapi \
+ gfortran${_GCC_VER}:lang/gcc${_GCC_VER} \
${MY_DEPENDS}
LIB_DEPENDS= libcurl.so:ftp/curl \
libdSFMT.so:math/dsfmt \
@@ -32,9 +33,12 @@ LIB_DEPENDS= libcurl.so:ftp/curl \
libnghttp2.so:www/libnghttp2 \
libunwind.so:devel/libunwind \
libopenlibm.so:math/openlibm
-RUN_DEPENDS= ${MY_DEPENDS}
+RUN_DEPENDS= ${MY_DEPENDS} \
+ gfortran${_GCC_VER}:lang/gcc${_GCC_VER}
-USES= gmake cpe fortran python perl5 blaslapack:openblas
+# Do not set USES=fortran to avoid extra-linkage
+USES= gmake cpe python perl5 blaslapack:openblas
+_GCC_VER= ${GCC_DEFAULT:S/.//}
CPE_VENDOR= julialang
@@ -98,7 +102,7 @@ pre-configure:
# unset ARCH for auto-detection
# Julia build script uses the name x86_86/x86, which are different from ports framework
echo "ARCH=" >> ${WRKSRC}/Make.user
- echo "LIBBLAS=-lopenblas -L${LOCALBASE}/lib" >> ${WRKSRC}/Make.user
+ echo "LIBBLAS= -L${LOCALBASE}/lib -lopenblas" >> ${WRKSRC}/Make.user
echo "LIBBLASNAME=libopenblas" >> ${WRKSRC}/Make.user
echo 'LIBLAPACK= $$(LIBBLAS)' >> ${WRKSRC}/Make.user
echo 'LIBLAPACKNAME= $$(LIBBLASNAME)' >> ${WRKSRC}/Make.user
@@ -132,7 +136,6 @@ post-install-DEBUG-off:
.for bin in lld dsymutil
${STRIP_CMD} ${STAGEDIR}${PREFIX}/libexec/julia/${bin}
.endfor
- ${FIND} ${STAGEDIR}${PREFIX}/share/julia/compiled -name "*.so" | ${XARGS} ${STRIP_CMD}
post-install-DOCS-off:
${RM} -r ${STAGEDIR}${PREFIX}/${INSTALLDIR}/share/doc
diff --git a/lang/julia/files/patch-Make.inc b/lang/julia/files/patch-Make.inc
index f496531f6e90..8f1475d40a13 100644
--- a/lang/julia/files/patch-Make.inc
+++ b/lang/julia/files/patch-Make.inc
@@ -1,4 +1,4 @@
---- Make.inc.orig 2023-05-09 10:49:55 UTC
+--- Make.inc.orig 2023-08-24 16:20:21 UTC
+++ Make.inc
@@ -268,7 +268,7 @@ docdir := $(datarootdir)/doc/julia
libexecdir := $(prefix)/libexec
@@ -18,3 +18,123 @@
build_man1dir := $(build_mandir)/man1
build_includedir := $(build_prefix)/include
build_sysconfdir := $(build_prefix)/etc
+@@ -654,33 +654,6 @@ endif
+ include $(BUILDROOT)/$(MAKE_USER_FNAME)
+ endif
+
+-# A bit of a kludge to work around libraries linking to FreeBSD's outdated system libgcc_s
+-# Instead, let's link to the libgcc_s corresponding to the installation of gfortran
+-ifeq ($(OS),FreeBSD)
+-ifneq (,$(findstring gfortran,$(FC)))
+-
+-# First let's figure out what version of GCC we're dealing with
+-_GCCMAJOR := $(shell $(FC) -dumpversion 2>/dev/null | cut -d'.' -f1)
+-_GCCMINOR := $(shell $(FC) -dumpversion 2>/dev/null | cut -d'.' -f2)
+-
+-# The ports system uses major and minor for GCC < 5 (e.g. gcc49 for GCC 4.9), otherwise major only
+-ifeq ($(_GCCMAJOR),4)
+- _GCCVER := $(_GCCMAJOR)$(_GCCMINOR)
+-else
+- _GCCVER := $(_GCCMAJOR)
+-endif
+-
+-# Allow the user to specify this in Make.user
+-GCCPATH ?= $(LOCALBASE)/lib/gcc$(_GCCVER)
+-
+-# We're going to copy over the libraries we need from GCCPATH into build_libdir, then
+-# tell everyone to look for them there. At install time, the build_libdir added into
+-# the RPATH here is removed by patchelf.
+-LDFLAGS += -L$(build_libdir) -Wl,-rpath,$(build_libdir)
+-
+-endif # gfortran
+-endif # FreeBSD
+-
+ ifneq ($(CC_BASE)$(CXX_BASE),$(shell echo $(CC) | cut -d' ' -f1)$(shell echo $(CXX) | cut -d' ' -f1))
+ $(error Forgot override directive on CC or CXX in Make.user? Cowardly refusing to build)
+ endif
+@@ -1295,14 +1268,8 @@ JLDFLAGS += -Wl,-Bdynamic
+
+ ifeq ($(OS), FreeBSD)
+ JLDFLAGS += -Wl,-Bdynamic
+-OSLIBS += -lelf -lkvm -lrt -lpthread -latomic
++OSLIBS += -lelf -lkvm -lrt -lpthread
+
+-# Tweak order of libgcc_s in DT_NEEDED,
+-# make it loaded first to
+-# prevent from linking to outdated system libs.
+-# See #21788
+-OSLIBS += -lgcc_s
+-
+ OSLIBS += -Wl,--export-dynamic -Wl,--version-script=$(JULIAHOME)/src/julia.expmap \
+ $(NO_WHOLE_ARCHIVE)
+ endif
+@@ -1511,30 +1478,6 @@ LIBJULIACODEGEN_DEBUG_INSTALL_DEPLIB := $(call dep_lib
+ LIBJULIACODEGEN_DEBUG_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/libjulia-codegen-debug.$(JL_MAJOR_SHLIB_EXT))
+ LIBJULIACODEGEN_DEBUG_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/libjulia-codegen-debug.$(JL_MAJOR_SHLIB_EXT))
+
+-ifeq ($(OS),WINNT)
+-ifeq ($(BINARY),32)
+-LIBGCC_NAME := libgcc_s_sjlj-1.$(SHLIB_EXT)
+-else
+-LIBGCC_NAME := libgcc_s_seh-1.$(SHLIB_EXT)
+-endif
+-endif
+-# On macOS, libgcc_s has soversion 1.1 always on aarch64 and only for GCC 12+
+-# (-> libgfortran 5) on x86_64
+-ifeq ($(OS),Darwin)
+-ifeq ($(ARCH),aarch64)
+-LIBGCC_NAME := libgcc_s.1.1.$(SHLIB_EXT)
+-else
+-ifeq ($(LIBGFORTRAN_VERSION),5)
+-LIBGCC_NAME := libgcc_s.1.1.$(SHLIB_EXT)
+-else
+-LIBGCC_NAME := libgcc_s.1.$(SHLIB_EXT)
+-endif
+-endif
+-endif
+-ifneq ($(findstring $(OS),Linux FreeBSD),)
+-LIBGCC_NAME := libgcc_s.$(SHLIB_EXT).1
+-endif
+-
+ # USE_SYSTEM_CSL causes it to get symlinked into build_private_shlibdir
+ ifeq ($(USE_SYSTEM_CSL),1)
+ LIBGCC_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_private_shlibdir)/$(LIBGCC_NAME))
+@@ -1567,7 +1510,6 @@ LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$
+ LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
+
+ # We list:
+-# * libgcc_s, because FreeBSD needs to load ours, not the system one.
+ # * libopenlibm, because Windows has an untrustworthy libm, and we want to use ours more than theirs
+ # * libstdc++, because while performing `libstdc++` probing we need to
+ # know the path to the bundled `libstdc++` library.
+@@ -1589,7 +1531,6 @@ LOADER_BUILD_DEP_LIBS = $(call build_deplibs, \
+ endef
+
+ LOADER_BUILD_DEP_LIBS = $(call build_deplibs, \
+- $(LIBGCC_BUILD_DEPLIB) \
+ $(LIBM_BUILD_DEPLIB) \
+ @$(LIBSTDCXX_BUILD_DEPLIB) \
+ @$(LIBJULIAINTERNAL_BUILD_DEPLIB) \
+@@ -1597,7 +1538,6 @@ LOADER_DEBUG_BUILD_DEP_LIBS = $(call build_deplibs, \
+ )
+
+ LOADER_DEBUG_BUILD_DEP_LIBS = $(call build_deplibs, \
+- $(LIBGCC_BUILD_DEPLIB) \
+ $(LIBM_BUILD_DEPLIB) \
+ @$(LIBSTDCXX_BUILD_DEPLIB) \
+ @$(LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB) \
+@@ -1605,14 +1545,12 @@ LOADER_INSTALL_DEP_LIBS = $(call build_deplibs, \
+ )
+
+ LOADER_INSTALL_DEP_LIBS = $(call build_deplibs, \
+- $(LIBGCC_INSTALL_DEPLIB) \
+ $(LIBM_INSTALL_DEPLIB) \
+ @$(LIBSTDCXX_INSTALL_DEPLIB) \
+ @$(LIBJULIAINTERNAL_INSTALL_DEPLIB) \
+ @$(LIBJULIACODEGEN_INSTALL_DEPLIB) \
+ )
+ LOADER_DEBUG_INSTALL_DEP_LIBS = $(call build_deplibs, \
+- $(LIBGCC_INSTALL_DEPLIB) \
+ $(LIBM_INSTALL_DEPLIB) \
+ @$(LIBSTDCXX_INSTALL_DEPLIB) \
+ @$(LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB) \
diff --git a/lang/julia/files/patch-Makefile b/lang/julia/files/patch-Makefile
index e339d0dd603e..f3091dff5517 100644
--- a/lang/julia/files/patch-Makefile
+++ b/lang/julia/files/patch-Makefile
@@ -1,6 +1,14 @@
---- Makefile.orig 2023-05-09 10:51:38 UTC
+--- Makefile.orig 2023-08-24 16:20:21 UTC
+++ Makefile
-@@ -236,7 +236,7 @@ endef
+@@ -210,7 +210,6 @@ endif
+ JL_PRIVATE_LIBS-$(USE_SYSTEM_LAPACK) += $(LIBLAPACKNAME)
+ endif
+
+-JL_PRIVATE_LIBS-$(USE_SYSTEM_CSL) += libgfortran libquadmath libstdc++ libgcc_s libgomp libssp libatomic
+ ifeq ($(OS),Darwin)
+ JL_PRIVATE_LIBS-$(USE_SYSTEM_CSL) += libc++
+ endif
+@@ -236,7 +235,7 @@ endef
endef
@@ -9,7 +17,7 @@
@$(MAKE) $(QUIET_MAKE) $(JULIA_BUILD_MODE)
@for subdir in $(bindir) $(datarootdir)/julia/stdlib/$(VERSDIR) $(docdir) $(man1dir) $(includedir)/julia $(libdir) $(private_libdir) $(sysconfdir) $(private_libexecdir); do \
mkdir -p $(DESTDIR)$$subdir; \
-@@ -339,8 +339,6 @@ endif
+@@ -339,8 +338,6 @@ endif
cp -R -L $(JULIAHOME)/base/* $(DESTDIR)$(datarootdir)/julia/base
cp -R -L $(JULIAHOME)/test/* $(DESTDIR)$(datarootdir)/julia/test
cp -R -L $(build_datarootdir)/julia/* $(DESTDIR)$(datarootdir)/julia
@@ -18,7 +26,7 @@
# Remove various files which should not be installed
-rm -f $(DESTDIR)$(datarootdir)/julia/base/version_git.sh
-rm -f $(DESTDIR)$(datarootdir)/julia/test/Makefile
-@@ -350,12 +348,6 @@ endif
+@@ -350,12 +347,6 @@ endif
-rm -f $(DESTDIR)$(datarootdir)/julia/stdlib/$(VERSDIR)/*/build-checked
# Copy in beautiful new man page
$(INSTALL_F) $(build_man1dir)/julia.1 $(DESTDIR)$(man1dir)/
@@ -31,7 +39,7 @@
# Update RPATH entries and JL_SYSTEM_IMAGE_PATH if $(private_libdir_rel) != $(build_private_libdir_rel)
ifneq ($(private_libdir_rel),$(build_private_libdir_rel))
-@@ -430,26 +422,16 @@ endif
+@@ -430,26 +421,16 @@ endif
endif
endif
diff --git a/lang/julia/files/patch-base_Makefile b/lang/julia/files/patch-base_Makefile
new file mode 100644
index 000000000000..99a5ca8d82bc
--- /dev/null
+++ b/lang/julia/files/patch-base_Makefile
@@ -0,0 +1,12 @@
+--- base/Makefile.orig 2023-08-24 16:20:21 UTC
++++ base/Makefile
+@@ -242,9 +242,6 @@ $(eval $(call symlink_system_library,CSL,libstdc++,6))
+ $(eval $(call symlink_system_library,CSL,libquadmath,0))
+ $(eval $(call symlink_system_library,CSL,libstdc++,6))
+ # We allow libssp, libatomic and libgomp to fail as they are not available on all systems
+-$(eval $(call symlink_system_library,CSL,libssp,0,ALLOW_FAILURE))
+-$(eval $(call symlink_system_library,CSL,libatomic,1,ALLOW_FAILURE))
+-$(eval $(call symlink_system_library,CSL,libgomp,1,ALLOW_FAILURE))
+ $(eval $(call symlink_system_library,PCRE,libpcre2-8))
+ $(eval $(call symlink_system_library,DSFMT,libdSFMT))
+ $(eval $(call symlink_system_library,LIBBLASTRAMPOLINE,libblastrampoline))
diff --git a/lang/julia/files/patch-stdlib_LinearAlgebra_src_lbt.jl b/lang/julia/files/patch-stdlib_LinearAlgebra_src_lbt.jl
index ef9f481a9987..a6823905f426 100644
--- a/lang/julia/files/patch-stdlib_LinearAlgebra_src_lbt.jl
+++ b/lang/julia/files/patch-stdlib_LinearAlgebra_src_lbt.jl
@@ -1,6 +1,6 @@
---- stdlib/LinearAlgebra/src/lbt.jl.orig 2022-11-23 20:37:29 UTC
+--- stdlib/LinearAlgebra/src/lbt.jl.orig 2023-08-24 16:20:21 UTC
+++ stdlib/LinearAlgebra/src/lbt.jl
-@@ -181,7 +181,7 @@ function lbt_get_num_threads()
+@@ -210,7 +210,7 @@ function lbt_set_num_threads(nthreads)
end
function lbt_set_num_threads(nthreads)
@@ -8,4 +8,4 @@
+ return
end
- function lbt_forward(path; clear::Bool = false, verbose::Bool = false, suffix_hint::Union{String,Nothing} = nothing)
+ function lbt_forward(path::AbstractString; clear::Bool = false, verbose::Bool = false, suffix_hint::Union{String,Nothing} = nothing)
diff --git a/lang/julia/pkg-plist b/lang/julia/pkg-plist
index e84a4af10d95..1a4bfc516581 100644
--- a/lang/julia/pkg-plist
+++ b/lang/julia/pkg-plist
@@ -38,18 +38,14 @@ include/julia/uv/unix.h
include/julia/uv/version.h
lib/julia/libLLVM-14jl.so
lib/julia/libLLVM.so
-lib/julia/libatomic.so.1
lib/julia/libblastrampoline.so
lib/julia/libblastrampoline.so.5
lib/julia/libblastrampoline.so.5.4.0
lib/julia/libccalltest.so
lib/julia/libcurl.so
lib/julia/libdSFMT.so
-lib/julia/libgcc_s.so.1
-lib/julia/libgfortran.so.5
lib/julia/libgit2.so
lib/julia/libgmp.so
-lib/julia/libgomp.so.1
lib/julia/libjulia-codegen.so
lib/julia/libjulia-codegen.so.1
lib/julia/libjulia-codegen.so.%%VERSION%%
@@ -65,10 +61,7 @@ lib/julia/libnghttp2.so
lib/julia/libopenblas.so
lib/julia/libopenlibm.so
lib/julia/libpcre2-8.so
-lib/julia/libquadmath.so.0
lib/julia/libssh2.so
-lib/julia/libssp.so.0
-lib/julia/libstdc++.so.6
lib/julia/libuv.so
lib/julia/libuv.so.2
lib/julia/libuv.so.2.0.0