Skip to content

Commit

Permalink
build: Remove GPL libs when set USE_GPL_LIBS=0 (#54240)
Browse files Browse the repository at this point in the history
Fix #53211
  • Loading branch information
inkydragon authored Jun 8, 2024
1 parent da23114 commit 94a0ee8
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 21 deletions.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,13 @@ JL_PRIVATE_LIBS-0 += libjulia-internal libjulia-codegen
else ifeq ($(JULIA_BUILD_MODE),debug)
JL_PRIVATE_LIBS-0 += libjulia-internal-debug libjulia-codegen-debug
endif
# BSD-3-Clause
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSUITESPARSE) += libamd libcamd libccolamd libcolamd libsuitesparseconfig
# LGPL-2.1+
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSUITESPARSE) += libbtf libklu libldl
ifeq ($(USE_GPL_LIBS), 1)
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSUITESPARSE) += libamd libbtf libcamd libccolamd libcholmod libcolamd libklu libldl librbio libspqr libsuitesparseconfig libumfpack
# GPL-2.0+
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSUITESPARSE) += libcholmod librbio libspqr libumfpack
endif
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBBLASTRAMPOLINE) += libblastrampoline
JL_PRIVATE_LIBS-$(USE_SYSTEM_PCRE) += libpcre2-8
Expand Down
14 changes: 13 additions & 1 deletion THIRDPARTY.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,19 @@ Julia's `stdlib` uses the following external libraries, which have their own lic
- [OPENBLAS](https://raw.github.com/xianyi/OpenBLAS/master/LICENSE) [BSD-3]
- [LAPACK](https://netlib.org/lapack/LICENSE.txt) [BSD-3]
- [PCRE](https://www.pcre.org/licence.txt) [BSD-3]
- [SUITESPARSE](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/master/LICENSE.txt) [mix of LGPL2+ and GPL2+; see individual module licenses]
- [SUITESPARSE](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/master/LICENSE.txt) [mix of BSD-3-Clause, LGPL2.1+ and GPL2+; see individual module licenses]
- [`libamd`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/AMD/Doc/License.txt) [BSD-3-Clause]
- [`libcamd`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/CAMD/Doc/License.txt) [BSD-3-Clause]
- [`libccolamd`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/CCOLAMD/Doc/License.txt) [BSD-3-Clause]
- [`libcolamd`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/COLAMD/Doc/License.txt) [BSD-3-Clause]
- [`libsuitesparseconfig`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/SuiteSparse_config/README.txt) [BSD-3-Clause]
- [`libbtf`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/BTF/Doc/License.txt) [LGPL-2.1+]
- [`libklu`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/KLU/Doc/License.txt) [LGPL-2.1+]
- [`libldl`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/LDL/Doc/License.txt) [LGPL-2.1+]
- [`libcholmod`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/CHOLMOD/Doc/License.txt) [LGPL-2.1+ and GPL-2.0+]
- [`librbio`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/RBio/Doc/License.txt) [GPL-2.0+]
- [`libspqr`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/SPQR/Doc/License.txt) [GPL-2.0+]
- [`libumfpack`](https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/dev/UMFPACK/Doc/License.txt) [GPL-2.0+]
- [LIBBLASTRAMPOLINE](https://github.com/staticfloat/libblastrampoline/blob/main/LICENSE) [MIT]
- [NGHTTP2](https://github.com/nghttp2/nghttp2/blob/master/COPYING) [MIT]

Expand Down
4 changes: 2 additions & 2 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ ifeq ($(USE_SYSTEM_MPFR), 0)
DEP_LIBS += mpfr
endif

ifeq ($(USE_GPL_LIBS), 1)
# Only some of the modules in SuiteSparse are GPL.
# xref: `remove-libsuitesparse-gpl-lib` in libsuitesparse.mk
ifeq ($(USE_SYSTEM_LIBSUITESPARSE), 0)
DEP_LIBS += libsuitesparse
endif
endif

ifeq ($(USE_SYSTEM_UTF8PROC), 0)
DEP_LIBS += utf8proc
Expand Down
15 changes: 14 additions & 1 deletion deps/libsuitesparse.mk
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,31 @@ configure-libsuitesparse: extract-libsuitesparse
compile-libsuitesparse: $(BUILDDIR)/SuiteSparse-$(LIBSUITESPARSE_VER)/build-compiled
fastcheck-libsuitesparse: #none
check-libsuitesparse: $(BUILDDIR)/SuiteSparse-$(LIBSUITESPARSE_VER)/build-checked
install-libsuitesparse: $(build_prefix)/manifest/libsuitesparse
install-libsuitesparse: $(build_prefix)/manifest/libsuitesparse remove-libsuitesparse-gpl-lib

else # USE_BINARYBUILDER_LIBSUITESPARSE

$(eval $(call bb-install,libsuitesparse,LIBSUITESPARSE,false))

# libsuitesparse depends on blastrampoline
compile-libsuitesparse: | $(build_prefix)/manifest/blastrampoline
install-libsuitesparse: | remove-libsuitesparse-gpl-lib
endif

define manual_libsuitesparse
uninstall-libsuitesparse:
-rm -f $(build_prefix)/manifest/libsuitesparse
-rm -f $(addprefix $(build_shlibdir)/lib,$3)
endef

remove-libsuitesparse-gpl-lib:
ifeq ($(USE_GPL_LIBS),1)
@echo This build contains [GPL-2.0+] libs: libcholmod librbio libspqr libumfpack
else
@echo Removing GPL libs...
-rm -f $(build_bindir)/libcholmod*
-rm -f $(build_bindir)/libklu_cholmod*
-rm -f $(build_bindir)/librbio*
-rm -f $(build_bindir)/libspqr*
-rm -f $(build_bindir)/libumfpack*
endif
37 changes: 21 additions & 16 deletions stdlib/SuiteSparse_jll/src/SuiteSparse_jll.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,34 @@ else
end

function __init__()
# BSD-3-Clause
global libamd_handle = dlopen(libamd)
global libamd_path = dlpath(libamd_handle)
global libcamd_handle = dlopen(libcamd)
global libcamd_path = dlpath(libcamd_handle)
global libccolamd_handle = dlopen(libccolamd)
global libccolamd_path = dlpath(libccolamd_handle)
global libcolamd_handle = dlopen(libcolamd)
global libcolamd_path = dlpath(libcolamd_handle)
global libsuitesparseconfig_handle = dlopen(libsuitesparseconfig)
global libsuitesparseconfig_path = dlpath(libsuitesparseconfig_handle)

# LGPL-2.1+
global libbtf_handle = dlopen(libbtf)
global libbtf_path = dlpath(libbtf_handle)
global libklu_handle = dlopen(libklu)
global libklu_path = dlpath(libklu_handle)
global libldl_handle = dlopen(libldl)
global libldl_path = dlpath(libldl_handle)

# GPL-2.0+
if Base.USE_GPL_LIBS
global libamd_handle = dlopen(libamd)
global libamd_path = dlpath(libamd_handle)
global libbtf_handle = dlopen(libbtf)
global libbtf_path = dlpath(libbtf_handle)
global libcamd_handle = dlopen(libcamd)
global libcamd_path = dlpath(libcamd_handle)
global libccolamd_handle = dlopen(libccolamd)
global libccolamd_path = dlpath(libccolamd_handle)
global libcholmod_handle = dlopen(libcholmod)
global libcholmod_path = dlpath(libcholmod_handle)
global libcolamd_handle = dlopen(libcolamd)
global libcolamd_path = dlpath(libcolamd_handle)
global libklu_handle = dlopen(libklu)
global libklu_path = dlpath(libklu_handle)
global libldl_handle = dlopen(libldl)
global libldl_path = dlpath(libldl_handle)
global librbio_handle = dlopen(librbio)
global librbio_path = dlpath(librbio_handle)
global libspqr_handle = dlopen(libspqr)
global libspqr_path = dlpath(libspqr_handle)
global libsuitesparseconfig_handle = dlopen(libsuitesparseconfig)
global libsuitesparseconfig_path = dlpath(libsuitesparseconfig_handle)
global libumfpack_handle = dlopen(libumfpack)
global libumfpack_path = dlpath(libumfpack_handle)
end
Expand Down

0 comments on commit 94a0ee8

Please sign in to comment.