Skip to content

Commit

Permalink
Build curl to provide proxy support for Pkg.
Browse files Browse the repository at this point in the history
The curl build depends on mbedtls and libssh2
Patch for mbedtls to allow curl to build with mbedtls support
Add curl to LICENSE.md, README.md and all the other various locations
  • Loading branch information
ViralBShah committed Aug 6, 2016
1 parent 11a8e07 commit 046c6eb
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 3 deletions.
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ their own licenses:
- [FFTW](http://fftw.org/doc/License-and-Copyright.html) [GPL2+]
- [GMP](http://gmplib.org/manual/Copying.html#Copying) [LGPL3+ or GPL2+]
- [LIBGIT2](https://github.com/libgit2/libgit2/blob/development/COPYING) [GPL2+ with unlimited linking exception]
- [CURL](https://curl.haxx.se/docs/copyright.html) [MIT/X derivative]
- [LIBSSH2](https://github.com/libssh2/libssh2/blob/master/COPYING) [BSD-3]
- [MBEDTLS](https://tls.mbed.org/how-to-get) [either GPLv2 or Apache 2.0]
- [MPFR](http://www.mpfr.org/mpfr-current/mpfr.html#Copying) [LGPL3+]
Expand Down
1 change: 1 addition & 0 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ USE_SYSTEM_LIBUV:=0
USE_SYSTEM_UTF8PROC:=0
USE_SYSTEM_MBEDTLS:=0
USE_SYSTEM_LIBSSH2:=0
USE_SYSTEM_CURL:=0
USE_SYSTEM_LIBGIT2:=0
USE_SYSTEM_PATCHELF:=0

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ endif
ifeq ($(USE_SYSTEM_LIBSSH2),0)
JL_PRIVATE_LIBS += ssh2
endif
ifeq ($(USE_SYSTEM_CURL),0)
JL_PRIVATE_LIBS += curl
endif
ifeq ($(USE_SYSTEM_LIBGIT2),0)
JL_PRIVATE_LIBS += git2
endif
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ Julia uses the following external libraries, which are automatically downloaded
- **[GMP]** (>= 5.0) — GNU multiple precision arithmetic library, needed for `BigInt` support.
- **[MPFR]** (>= 3.0) — GNU multiple precision floating point library, needed for arbitrary precision floating point (`BigFloat`) support.
- **[libgit2]** (>= 0.23) — Git linkable library, used by Julia's package manager
- **[curl]** (>= 7.50) — libcurl provides download and proxy support for Julia's package manager

This comment has been minimized.

Copy link
@nalimilan

nalimilan Sep 11, 2016

Member

We don't actually require 7.50 (which is the latest version), right? Let's lower this version dependency.

This comment has been minimized.

Copy link
@ViralBShah

ViralBShah Sep 11, 2016

Author Member

That's what we use - but I have no idea how to figure out a lower bound.

This comment has been minimized.

Copy link
@nalimilan

nalimilan Sep 11, 2016

Member

If we don't know, better not list anything. I would think curl is a pretty stable tool and any reasonably recent version will do.

The only way to find out would to to try with USE_SYSTEM_CURL=1 on a very old distro like RHEL5.

This comment has been minimized.

Copy link
@ViralBShah

ViralBShah Sep 11, 2016

Author Member

I am ok. @tkelman ?

This comment has been minimized.

Copy link
@tkelman

tkelman Sep 11, 2016

Contributor

when building from source we need a curl new enough to build against mbedtls. when using system curl, need whatever minimum libgit2 assumes

This comment has been minimized.

Copy link
@ViralBShah

ViralBShah Sep 11, 2016

Author Member

Looks like it should be 7.46.0 based on checking when mbedtls was introduced into curl.

https://curl.haxx.se/changes.html

This comment has been minimized.

Copy link
@nalimilan

nalimilan Sep 11, 2016

Member

Mentioning the minimum required version to use mbedtls doesn't sound really useful, as the build process takes care of downloading the latest version anyway. People looking at minimum dependencies are more likely to use the system version. Maybe we could only mention the minimum version in the description, explaining that it's needed only for mbedtls support?

This comment has been minimized.

Copy link
@ViralBShah

ViralBShah Sep 11, 2016

Author Member

I think the build is already complex enough, and perhaps best not to encourage too many deviations as it will only lead to more issues being reported.

- **[libssh2]** (>= 1.7) — library for SSH transport, used by libgit2 for packages with SSH remotes
- **[mbedtls]** (>= 2.2) — library used for cryptography and transport layer security, used by libssh2
- **[utf8proc]** (>= 2.0) — a library for processing UTF-8 encoded Unicode strings
Expand Down
9 changes: 7 additions & 2 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include $(SRCDIR)/llvm-ver.make
# additionally all targets should be listed in the getall target for easier off-line compilation
# if you are adding a new target, it can help to copy an similar, existing target
#
# autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf libuv
# autoconf configure-driven scripts: llvm pcre arpack fftw unwind gmp mpfr patchelf libuv curl
# custom Makefile rules: openlibm dsfmt suitesparse-wrapper suitesparse lapack openblas utf8proc objconv osxunwind
# entirely custom: virtualenv
# CMake libs: libgit2 libssh2 mbedtls
Expand Down Expand Up @@ -171,6 +171,10 @@ ifeq ($(USE_SYSTEM_LIBSSH2), 0)
STAGE2_DEPS += libssh2
endif

ifeq ($(USE_SYSTEM_CURL), 0)
STAGE2_DEPS += curl
endif

ifeq ($(USE_SYSTEM_LIBGIT2), 0)
STAGE3_DEPS += libgit2
endif
Expand Down Expand Up @@ -222,7 +226,7 @@ install: $(addprefix install-, $(DEP_LIBS))
cleanall: $(addprefix clean-, $(DEP_LIBS))
distcleanall: $(addprefix distclean-, $(DEP_LIBS))
rm -rf $(build_prefix)
getall: get-llvm get-libuv get-pcre get-openlibm get-openspecfun get-dsfmt get-openblas get-lapack get-fftw get-suitesparse get-arpack get-unwind get-osxunwind get-gmp get-mpfr get-patchelf get-utf8proc get-virtualenv get-objconv get-mbedtls get-libssh2 get-libgit2
getall: get-llvm get-libuv get-pcre get-openlibm get-openspecfun get-dsfmt get-openblas get-lapack get-fftw get-suitesparse get-arpack get-unwind get-osxunwind get-gmp get-mpfr get-patchelf get-utf8proc get-virtualenv get-objconv get-mbedtls get-libssh2 get-curl get-libgit2

## PATHS ##
# sort is used to remove potential duplicates
Expand Down Expand Up @@ -271,6 +275,7 @@ include $(SRCDIR)/mpfr.mk
include $(SRCDIR)/patchelf.mk
include $(SRCDIR)/mbedtls.mk
include $(SRCDIR)/libssh2.mk
include $(SRCDIR)/curl.mk
include $(SRCDIR)/libgit2.mk
include $(SRCDIR)/virtualenv.mk

Expand Down
1 change: 1 addition & 0 deletions deps/Versions.make
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ MPFR_VER = 3.1.4
PATCHELF_VER = 0.9
VIRTUALENV_VER = 15.0.0
MBEDTLS_VER = 2.3.0
CURL_VER = 7.50.1
1 change: 1 addition & 0 deletions deps/checksums/curl-7.50.1.tar.bz2/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
015f6a0217ca6f2c5442ca406476920b
1 change: 1 addition & 0 deletions deps/checksums/curl-7.50.1.tar.bz2/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
94acd91fcf8ff2605e1ba2d086c2c366257b61eaf516b9ea44e574e315feb5b30f6e47d89051f259e026ef5dd9edde5f7b15a6af9ee6a38f641da354e1e677b1
46 changes: 46 additions & 0 deletions deps/curl.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## CURL ##

CURL_SRC_TARGET := $(BUILDDIR)/curl-$(CURL_VER)/.libs/libcurl.$(SHLIB_EXT)
CURL_OBJ_TARGET := $(build_shlibdir)/libcurl.$(SHLIB_EXT)

ifneq ($(OS),WINNT)
CURL_LDFLAGS := $(RPATH_ESCAPED_ORIGIN)
endif

$(SRCDIR)/srccache/curl-$(CURL_VER).tar.bz2: | $(SRCDIR)/srccache
$(JLDOWNLOAD) $@ https://curl.haxx.se/download/curl-$(CURL_VER).tar.bz2
$(SRCDIR)/srccache/curl-$(CURL_VER)/configure: $(SRCDIR)/srccache/curl-$(CURL_VER).tar.bz2 $(MBEDTLS_OBJ_TARGET) $(LIBSSH2_OBJ_TARGET)
$(JLCHECKSUM) $<
cd $(dir $<) && $(TAR) jxf $(notdir $<)
touch -c $@
$(BUILDDIR)/curl-$(CURL_VER)/config.status: $(SRCDIR)/srccache/curl-$(CURL_VER)/configure
mkdir -p $(dir $@)
cd $(dir $@) && \
$< $(CONFIGURE_COMMON) --includedir=$(build_includedir) --with-mbedtls=$(build_shlibdir)/.. CFLAGS="$(CFLAGS) $(CURL_CFLAGS)" LDFLAGS="$(LDFLAGS) $(CURL_LDFLAGS)"
touch -c $@
$(CURL_SRC_TARGET): $(BUILDDIR)/curl-$(CURL_VER)/config.status
$(MAKE) -C $(dir $<) $(LIBTOOL_CCLD)
touch -c $@
$(BUILDDIR)/curl-$(CURL_VER)/checked: $(CURL_SRC_TARGET)
ifeq ($(OS),$(BUILD_OS))
ifneq ($(OS),WINNT)
$(MAKE) -C $(dir $@) check -j1
endif
endif
echo 1 > $@
$(CURL_OBJ_TARGET): $(CURL_SRC_TARGET)
$(call make-install,curl-$(CURL_VER),$(LIBTOOL_CCLD))
$(INSTALL_NAME_CMD)libcurl.$(SHLIB_EXT) $@
touch -c $@

clean-curl:
-$(MAKE) -C $(BUILDDIR)/curl-$(CURL_VER) clean
-rm -f $(build_shlibdir)/libcurl*
distclean-curl:
-rm -rf $(SRCDIR)/srccache/curl-$(CURL_VER).tar.bz2 $(SRCDIR)/srccache/curl-$(CURL_VER) $(BUILDDIR)/curl-$(CURL_VER)

get-curl: $(SRCDIR)/srccache/curl-$(CURL_VER).tar.bz2
configure-curl: $(BUILDDIR)/curl-$(CURL_VER)/config.status
compile-curl: $(CURL_SRC_TARGET)
check-curl: $(BUILDDIR)/curl-$(CURL_VER)/checked
install-curl: $(CURL_OBJ_TARGET)
6 changes: 5 additions & 1 deletion deps/mbedtls.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ $(SRCDIR)/srccache/$(MBEDTLS_SRC)/mbedtls-config.patch-applied: | $(SRCDIR)/srcc
cd $(SRCDIR)/srccache/$(MBEDTLS_SRC) && patch -p0 -f < $(SRCDIR)/patches/mbedtls-config.patch
echo 1 > $@

$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/Makefile: $(SRCDIR)/srccache/$(MBEDTLS_SRC)/CMakeLists.txt $(SRCDIR)/srccache/$(MBEDTLS_SRC)/mbedtls-config.patch-applied
$(SRCDIR)/srccache/$(MBEDTLS_SRC)/mbedtls-ssl.h.patch-applied: | $(SRCDIR)/srccache/$(MBEDTLS_SRC)/CMakeLists.txt
cd $(SRCDIR)/srccache/$(MBEDTLS_SRC)/include/mbedtls && patch -p0 -f < $(SRCDIR)/patches/mbedtls-ssl.h.patch
echo 1 > $@

$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/Makefile: $(SRCDIR)/srccache/$(MBEDTLS_SRC)/CMakeLists.txt $(SRCDIR)/srccache/$(MBEDTLS_SRC)/mbedtls-config.patch-applied $(SRCDIR)/srccache/$(MBEDTLS_SRC)/mbedtls-ssl.h.patch-applied
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(MBEDTLS_OPTS)
Expand Down
12 changes: 12 additions & 0 deletions deps/patches/mbedtls-ssl.h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- ssl.h.old 2016-06-28 18:12:06.000000000 +0530
+++ ssl.h 2016-08-03 18:51:34.000000000 +0530
@@ -54,7 +54,8 @@
#endif

#if defined(MBEDTLS_HAVE_TIME)
-#include <time.h>
+//#include <time.h>
+#include "platform.h"
#endif

/*

0 comments on commit 046c6eb

Please sign in to comment.