Skip to content

Commit fcfa6b9

Browse files
committed
deps: build openssl
1 parent a2dde2f commit fcfa6b9

File tree

7 files changed

+116
-4
lines changed

7 files changed

+116
-4
lines changed

Make.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ USE_SYSTEM_MPFR:=0
5757
USE_SYSTEM_LIBSUITESPARSE:=0
5858
USE_SYSTEM_LIBUV:=0
5959
USE_SYSTEM_UTF8PROC:=0
60+
USE_SYSTEM_OPENSSL:=0
6061
USE_SYSTEM_MBEDTLS:=0
6162
USE_SYSTEM_LIBSSH2:=0
6263
USE_SYSTEM_NGHTTP2:=0
@@ -1268,7 +1269,7 @@ CSL_NEXT_GLIBCXX_VERSION=GLIBCXX_3\.4\.33|GLIBCXX_3\.5\.|GLIBCXX_4\.
12681269
# Note: we explicitly _do not_ define `CSL` here, since it requires some more
12691270
# advanced techniques to decide whether it should be installed from a BB source
12701271
# or not. See `deps/csl.mk` for more detail.
1271-
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD LIBTRACYCLIENT
1272+
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS OPENSSL LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD LIBTRACYCLIENT
12721273
define SET_BB_DEFAULT
12731274
# First, check to see if BB is disabled on a global setting
12741275
ifeq ($$(USE_BINARYBUILDER),0)

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ JL_PRIVATE_LIBS-$(USE_SYSTEM_MPFR) += libmpfr
213213
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBSSH2) += libssh2
214214
JL_PRIVATE_LIBS-$(USE_SYSTEM_NGHTTP2) += libnghttp2
215215
JL_PRIVATE_LIBS-$(USE_SYSTEM_MBEDTLS) += libmbedtls libmbedcrypto libmbedx509
216+
JL_PRIVATE_LIBS-$(USE_SYSTEM_OPENSSL) += libcrypto libssl
216217
JL_PRIVATE_LIBS-$(USE_SYSTEM_CURL) += libcurl
217218
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBGIT2) += libgit2
218219
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUV) += libuv

base/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ $(eval $(call symlink_system_library,MPFR,libmpfr))
267267
$(eval $(call symlink_system_library,MBEDTLS,libmbedtls))
268268
$(eval $(call symlink_system_library,MBEDTLS,libmbedcrypto))
269269
$(eval $(call symlink_system_library,MBEDTLS,libmbedx509))
270+
$(eval $(call symlink_system_library,OPENSSL,libcrypto))
271+
$(eval $(call symlink_system_library,OPENSSL,libssl))
270272
$(eval $(call symlink_system_library,LIBSSH2,libssh2))
271273
$(eval $(call symlink_system_library,NGHTTP2,libnghttp2))
272274
$(eval $(call symlink_system_library,CURL,libcurl))

contrib/refresh_checksums.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CLANG_TRIPLETS=$(filter %-darwin %-freebsd,$(TRIPLETS))
2424
NON_CLANG_TRIPLETS=$(filter-out %-darwin %-freebsd,$(TRIPLETS))
2525

2626
# These are the projects currently using BinaryBuilder; both GCC-expanded and non-GCC-expanded:
27-
BB_PROJECTS=mbedtls libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind llvmunwind dsfmt objconv p7zip zlib libsuitesparse openlibm blastrampoline libtracyclient
27+
BB_PROJECTS=mbedtls openssl libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind llvmunwind dsfmt objconv p7zip zlib libsuitesparse openlibm blastrampoline libtracyclient
2828
BB_GCC_EXPANDED_PROJECTS=openblas csl
2929
BB_CXX_EXPANDED_PROJECTS=gmp llvm clang llvm-tools lld
3030
# These are non-BB source-only deps

deps/Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ BUILDDIR := $(BUILDDIR)$(MAYBE_HOST)
2222
# additionally all targets should be listed in the getall target for easier off-line compilation
2323
# if you are adding a new target, it can help to copy an similar, existing target
2424
#
25-
# autoconf configure-driven scripts: pcre unwind gmp mpfr patchelf libuv curl
25+
# autoconf configure-driven scripts: pcre unwind gmp mpfr openssl patchelf libuv curl
2626
# custom Makefile rules: openlibm dsfmt libsuitesparse lapack blastrampoline openblas utf8proc objconv libwhich
2727
# CMake libs: llvm llvmunwind libgit2 libssh2 mbedtls libtracyclient
2828
#
@@ -143,6 +143,10 @@ ifeq ($(USE_SYSTEM_MPFR), 0)
143143
DEP_LIBS += mpfr
144144
endif
145145

146+
ifeq ($(USE_SYSTEM_OPENSSL), 0)
147+
DEP_LIBS += openssl
148+
endif
149+
146150
ifeq ($(USE_GPL_LIBS), 1)
147151
ifeq ($(USE_SYSTEM_LIBSUITESPARSE), 0)
148152
DEP_LIBS += libsuitesparse
@@ -192,7 +196,7 @@ DEP_LIBS_STAGED := $(DEP_LIBS)
192196

193197
# list all targets
194198
DEP_LIBS_STAGED_ALL := llvm llvm-tools clang llvmunwind unwind libuv pcre \
195-
openlibm dsfmt blastrampoline openblas lapack gmp mpfr patchelf utf8proc \
199+
openlibm dsfmt blastrampoline openblas lapack gmp mpfr openssl patchelf utf8proc \
196200
objconv mbedtls libssh2 nghttp2 curl libgit2 libwhich zlib p7zip csl \
197201
sanitizers libsuitesparse lld libtracyclient ittapi JuliaSyntax
198202
DEP_LIBS_ALL := $(DEP_LIBS_STAGED_ALL)
@@ -245,6 +249,7 @@ include $(SRCDIR)/zlib.mk
245249
include $(SRCDIR)/unwind.mk
246250
include $(SRCDIR)/gmp.mk
247251
include $(SRCDIR)/mpfr.mk
252+
include $(SRCDIR)/openssl.mk
248253
include $(SRCDIR)/patchelf.mk
249254
include $(SRCDIR)/mbedtls.mk
250255
include $(SRCDIR)/libssh2.mk

deps/openssl.mk

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
## OpenSSL ##
2+
include $(SRCDIR)/openssl.version
3+
4+
ifneq ($(USE_BINARYBUILDER_OPENSSL),1)
5+
6+
ifeq ($(OS),Darwin)
7+
ifeq ($(APPLE_ARCH),arm64)
8+
OPENSSL_TARGET := darwin64-arm64-cc
9+
else
10+
OPENSSL_TARGET := darwin64-x86_64-cc
11+
endif
12+
else ifeq ($(OS),WINNT)
13+
ifeq ($(ARCH),x86_64)
14+
OPENSSL_TARGET := mingw64
15+
else
16+
OPENSSL_TARGET := mingw
17+
endif
18+
else ifeq ($(OS),FreeBSD)
19+
OPENSSL_TARGET := BSD-x86_64
20+
else ifeq ($(OS),Linux)
21+
ifeq ($(ARCH),x86_64)
22+
OPENSSL_TARGET := linux-x86_64
23+
else ifeq ($(ARCH),i686)
24+
OPENSSL_TARGET := linux-x86
25+
else ifeq ($(ARCH),arm)
26+
OPENSSL_TARGET := linux-armv4
27+
else ifeq ($(ARCH),aarch64)
28+
OPENSSL_TARGET := linux-aarch64
29+
else ifeq ($(ARCH),ppc64le)
30+
OPENSSL_TARGET := linux-ppc64le
31+
else ifeq ($(ARCH),powerpc64le)
32+
OPENSSL_TARGET := linux-ppc64le
33+
endif
34+
else
35+
OPENSSL_TARGET := unknown
36+
endif
37+
38+
$(SRCCACHE)/openssl-$(OPENSSL_VER).tar.gz: | $(SRCCACHE)
39+
$(JLDOWNLOAD) $@ https://www.openssl.org/source/$(notdir $@)
40+
41+
$(SRCCACHE)/openssl-$(OPENSSL_VER)/source-extracted: $(SRCCACHE)/openssl-$(OPENSSL_VER).tar.gz
42+
$(JLCHECKSUM) $<
43+
cd $(dir $<) && $(TAR) -zxf $<
44+
touch -c $(SRCCACHE)/openssl-$(OPENSSL_VER)/configure # old target
45+
echo 1 > $@
46+
47+
checksum-openssl: $(SRCCACHE)/openssl-$(OPENSSL_VER).tar.gz
48+
$(JLCHECKSUM) $<
49+
50+
# We cannot use $(CONFIGURE_COMMON) in this step, because openssl's Configure scripts is picky
51+
# and does not like that we pass make variables as arguments, it wants them in the environment
52+
$(BUILDDIR)/openssl-$(OPENSSL_VER)/build-configured: $(SRCCACHE)/openssl-$(OPENSSL_VER)/source-extracted
53+
mkdir -p $(dir $@)
54+
cd $(dir $@) && \
55+
CC="$(CC) $(SANITIZE_OPTS)" CXX="$(CXX) $(SANITIZE_OPTS)" LDFLAGS="$(LDFLAGS) $(RPATH_ESCAPED_ORIGIN) $(SANITIZE_LDFLAGS)" \
56+
$(dir $<)/Configure shared --prefix=$(abspath $(build_prefix)) $(OPENSSL_TARGET)
57+
echo 1 > $@
58+
59+
$(BUILDDIR)/openssl-$(OPENSSL_VER)/build-compiled: $(BUILDDIR)/openssl-$(OPENSSL_VER)/build-configured
60+
$(MAKE) -C $(dir $<)
61+
echo 1 > $@
62+
63+
$(BUILDDIR)/openssl-$(OPENSSL_VER)/build-checked: $(BUILDDIR)/openssl-$(OPENSSL_VER)/build-compiled
64+
ifeq ($(OS),$(BUILD_OS))
65+
$(MAKE) -C $(dir $@) test
66+
endif
67+
echo 1 > $@
68+
69+
$(eval $(call staged-install, \
70+
openssl,openssl-$(OPENSSL_VER), \
71+
MAKE_INSTALL,,, \
72+
$$(WIN_MAKE_HARD_LINK) $(build_bindir)/libcrypto-*.dll $(build_bindir)/libcrypto.dll && \
73+
$$(WIN_MAKE_HARD_LINK) $(build_bindir)/libssl-*.dll $(build_bindir)/libssl.dll && \
74+
$$(INSTALL_NAME_CMD)libcrypto.$$(SHLIB_EXT) $$(build_shlibdir)/libcrypto.$$(SHLIB_EXT) && \
75+
$$(INSTALL_NAME_CMD)libssl.$$(SHLIB_EXT) $$(build_shlibdir)/libssl.$$(SHLIB_EXT) && \
76+
$$(INSTALL_NAME_CHANGE_CMD) $$(build_shlibdir)/libcrypto.3.dylib @rpath/libcrypto.$$(SHLIB_EXT) $$(build_shlibdir)/libssl.$$(SHLIB_EXT)))
77+
78+
clean-openssl:
79+
-rm -f $(BUILDDIR)/-openssl-$(OPENSSL_VER)/build-configured $(BUILDDIR)/-openssl-$(OPENSSL_VER)/build-compiled
80+
-$(MAKE) -C $(BUILDDIR)/-openssl-$(OPENSSL_VER) clean
81+
82+
distclean-openssl:
83+
rm -rf $(SRCCACHE)/-openssl-$(OPENSSL_VER).tar.gz \
84+
$(SRCCACHE)/-openssl-$(OPENSSL_VER) \
85+
$(BUILDDIR)/-openssl-$(OPENSSL_VER)
86+
87+
get-openssl: $(SRCCACHE)/openssl-$(OPENSSL_VER).tar.gz
88+
extract-openssl: $(SRCCACHE)/openssl-$(OPENSSL_VER)/source-extracted
89+
configure-openssl: $(BUILDDIR)/openssl-$(OPENSSL_VER)/build-configured
90+
compile-openssl: $(BUILDDIR)/openssl-$(OPENSSL_VER)/build-compiled
91+
fastcheck-openssl: check-openssl
92+
check-openssl: $(BUILDDIR)/openssl-$(OPENSSL_VER)/build-checked
93+
94+
else # USE_BINARYBUILDER_OPENSSL
95+
96+
$(eval $(call bb-install,openssl,OPENSSL,false))
97+
98+
endif

deps/openssl.version

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## jll artifact
2+
OPENSSL_JLL_NAME := OpenSSL
3+
4+
## source build
5+
OPENSSL_VER := 3.0.13

0 commit comments

Comments
 (0)