Skip to content

Commit

Permalink
mbedtls build configuration without git-external
Browse files Browse the repository at this point in the history
  • Loading branch information
wildart committed Jul 2, 2016
1 parent 620373e commit 4ae5893
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 21 deletions.
1 change: 1 addition & 0 deletions deps/Versions.make
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ PATCHELF_VER = 0.9
GIT_VER = 1.8.5.6
VIRTUALENV_VER = 15.0.0
RMATH_JULIA_VER = 0.1
MBEDTLS_VER = 2.2.1
1 change: 1 addition & 0 deletions deps/checksums/mbedtls-2.2.1-apache.tgz/md5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
77751c0e370ed2ab01934e4c5e1d380f
1 change: 1 addition & 0 deletions deps/checksums/mbedtls-2.2.1-apache.tgz/sha512
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6a74abc4ea225eb6bcf20894bb1a6faa82dbaff11129c41849151e2654570609efeee70d0644ce63c4d2c11e6142b2db262b88f3a22fdceff0a215a64a5d6eb0
File renamed without changes.
File renamed without changes.
52 changes: 33 additions & 19 deletions deps/mbedtls.mk
Original file line number Diff line number Diff line change
@@ -1,64 +1,78 @@
## mbedtls

MBEDTLS_GIT_URL := git://github.com/ARMmbed/mbedtls.git
ifeq ($(USE_GPL_LIBS), 1)
MBEDTLS_TAR_URL = https://tls.mbed.org/download/mbedtls-2.2.1-gpl.tgz
MBEDTLS_SRC = mbedtls-$(MBEDTLS_VER)-gpl
else
MBEDTLS_TAR_URL = https://tls.mbed.org/download/mbedtls-2.2.1-apache.tgz
MBEDTLS_SRC = mbedtls-$(MBEDTLS_VER)-apache
endif
$(eval $(call git-external,mbedtls,MBEDTLS,CMakeLists.txt,build/libmbedtls.$(SHLIB_EXT),$(SRCDIR)/srccache))
MBEDTLS_URL = https://tls.mbed.org/download/$(MBEDTLS_SRC).tgz

MBEDTLS_OBJ_SOURCE := $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/library/libmbedtls.$(SHLIB_EXT) \
$(BUILDDIR)/$(MBEDTLS_SRC_DIR)/library/libmbedx509.$(SHLIB_EXT) \
$(BUILDDIR)/$(MBEDTLS_SRC_DIR)/library/libmbedcrypto.$(SHLIB_EXT)
MBEDTLS_OBJ_SOURCE := $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/library/libmbedtls.$(SHLIB_EXT) \
$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/library/libmbedx509.$(SHLIB_EXT) \
$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/library/libmbedcrypto.$(SHLIB_EXT)
MBEDTLS_OBJ_TARGET := $(build_shlibdir)/libmbedtls.$(SHLIB_EXT) \
$(build_shlibdir)/libmbedx509.$(SHLIB_EXT) \
$(build_shlibdir)/libmbedcrypto.$(SHLIB_EXT)

MBEDTLS_OPTS := $(CMAKE_COMMON) -DUSE_SHARED_MBEDTLS_LIBRARY=ON \
-DENABLE_PROGRAMS=OFF -DCMAKE_BUILD_TYPE=Release \
-DENABLE_PROGRAMS=OFF -DENABLE_TESTING=ON -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_RPATH=$(build_prefix) -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE

ifeq ($(OS),WINNT)
MBEDTLS_OPTS += -DENABLE_ZLIB_SUPPORT=OFF -DENABLE_TESTING=OFF
MBEDTLS_OPTS += -DENABLE_ZLIB_SUPPORT=OFF
ifeq ($(BUILD_OS),WINNT)
MBEDTLS_OPTS += -G"MSYS Makefiles"
endif
else
MBEDTLS_OPTS += -DENABLE_ZLIB_SUPPORT=ON
endif

$(BUILDDIR)/$(MBEDTLS_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(MBEDTLS_SRC_DIR)/CMakeLists.txt
-cd $(SRCDIR)/srccache/$(MBEDTLS_SRC_DIR) && patch -p0 -f < $(SRCDIR)/patches/mbedtls.patch
$(SRCDIR)/srccache/$(MBEDTLS_SRC).tgz: | $(SRCDIR)/srccache
$(JLDOWNLOAD) $@ $(MBEDTLS_URL)

$(SRCDIR)/srccache/$(MBEDTLS_SRC)/CMakeLists.txt: $(SRCDIR)/srccache/$(MBEDTLS_SRC).tgz
$(JLCHECKSUM) $<
mkdir -p $(dir $@) && \
$(TAR) -C $(dir $@) --strip-components 1 -xf $<
touch -c $@

$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/Makefile: $(SRCDIR)/srccache/$(MBEDTLS_SRC)/CMakeLists.txt
-cd $(SRCDIR)/srccache/$(SRCDIR)/srccache/mbedtls-$(MBEDTLS_VER) && patch -p0 -f < $(SRCDIR)/patches/mbedtls.patch

This comment has been minimized.

Copy link
@tkelman

tkelman Jul 2, 2016

Contributor

this shouldn't run every time you configure

mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(MBEDTLS_OPTS)
touch -c $@

$(MBEDTLS_OBJ_SOURCE): $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/Makefile
$(MBEDTLS_OBJ_SOURCE): $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/Makefile
$(MAKE) -C $(dir $<)
touch -c $@

$(BUILDDIR)/$(MBEDTLS_SRC_DIR)/checked: $(MBEDTLS_OBJ_SOURCE)
$(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/checked: $(MBEDTLS_OBJ_SOURCE)
ifeq ($(OS),$(BUILD_OS))
-$(MAKE) -C $(dir $@) test
$(MAKE) -C $(dir $@) test
endif
echo 1 > $@

$(MBEDTLS_OBJ_TARGET): $(MBEDTLS_OBJ_SOURCE) | $(build_shlibdir)
ifeq ($(OS), WINNT)
cp $^ $(build_shlibdir)
else
$(call make-install,$(MBEDTLS_SRC_DIR),)
$(call make-install,mbedtls-$(MBEDTLS_VER),)
endif
touch -c $(MBEDTLS_OBJ_TARGET)

clean-mbedtls:
-rm -rf $(BUILDDIR)/$(MBEDTLS_SRC_DIR)
-rm -rf $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)
-rm -f $(MBEDTLS_OBJ_TARGET)

get-mbedtls: $(MBEDTLS_SRC_FILE)
configure-mbedtls: $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/Makefile
distclean-mbedtls:
-rm -rf $(SRCDIR)/srccache/$(MBEDTLS_SRC).tgz
-rm -rf $(SRCDIR)/srccache/$(MBEDTLS_SRC)
-rm -rf $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)


get-mbedtls: $(SRCDIR)/srccache/$(MBEDTLS_SRC).tgz
configure-mbedtls: $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/Makefile
compile-mbedtls: $(MBEDTLS_OBJ_SOURCE)
check-mbedtls: $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/checked
check-mbedtls: $(BUILDDIR)/mbedtls-$(MBEDTLS_VER)/checked
install-mbedtls: $(MBEDTLS_OBJ_TARGET)
2 changes: 0 additions & 2 deletions deps/mbedtls.version

This file was deleted.

0 comments on commit 4ae5893

Please sign in to comment.