Skip to content

Commit

Permalink
added libmbedtls build script
Browse files Browse the repository at this point in the history
  • Loading branch information
wildart committed Jun 28, 2016
1 parent 9c63d77 commit 5d0de3e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
50 changes: 50 additions & 0 deletions deps/mbedtls.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## mbedtls

MBEDTLS_GIT_URL := git://github.com/ARMmbed/mbedtls.git
MBEDTLS_TAR_URL = https://api.github.com/repos/ARMmbed/mbedtls/tarball/$1
$(eval $(call git-external,mbedtls,MBEDTLS,CMakeLists.txt,build/libmbedtls.$(SHLIB_EXT),$(SRCDIR)/srccache))

This comment has been minimized.

Copy link
@tkelman

tkelman Jun 30, 2016

Contributor

we should use their normal tarball, not a git-external, so we can switch between the gpl licensed tarball when USE_GPL_LIBS is true, or the apache licensed one when it isn't.

This comment has been minimized.

Copy link
@wildart

wildart Jul 1, 2016

Author Member

what about checksums? different tarballs will give different checksums.

This comment has been minimized.

Copy link
@tkelman

tkelman Jul 1, 2016

Contributor

add both, they'll have different names

This comment has been minimized.

Copy link
@wildart

wildart Jul 2, 2016

Author Member

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_TARGET := $(build_shlibdir)/libmbedtls.$(SHLIB_EXT) $(build_shlibdir)/libmbedx509.$(SHLIB_EXT) $(build_shlibdir)/libmbedcrypto.$(SHLIB_EXT)

#-DCMAKE_PREFIX_PATH=$(build_prefix)
MBEDTLS_OPTS := $(CMAKE_COMMON) -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DENABLE_PROGRAMS=OFF -DENABLE_ZLIB_SUPPORT=ON -DENABLE_TESTING=OFF
ifeq ($(OS),WINNT)
MBEDTLS_OPTS += -DCMAKE_BUILD_TYPE=RelWithDebInfo
else
MBEDTLS_OPTS += -DCMAKE_BUILD_TYPE=Release
endif

$(BUILDDIR)/$(MBEDTLS_SRC_DIR)/Makefile: $(SRCDIR)/srccache/$(MBEDTLS_SRC_DIR)/CMakeLists.txt
mkdir -p $(dir $@)
cd $(dir $@) && \
$(CMAKE) $(dir $<) $(MBEDTLS_OPTS)
touch -c $@

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

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

$(MBEDTLS_OBJ_TARGET): $(MBEDTLS_OBJ_SOURCE) | $(build_shlibdir)
$(call make-install,$(MBEDTLS_SRC_DIR),)
touch -c $(MBEDTLS_OBJ_TARGET)

clean-mbedtls:
-rm -rf $(BUILDDIR)/$(MBEDTLS_SRC_DIR)
-rm -f $(MBEDTLS_OBJ_TARGET)
distclean-mbedtls:
-rm -rf $(SRCDIR)/srccache/mbedtls-$(MBEDTLS_SHA1).tar.gz \
$(SRCDIR)/srccache/mbedtls-$(MBEDTLS_SHA1) \
$(BUILDDIR)/mbedtls-$(MBEDTLS_SHA1)

get-mbedtls: $(MBEDTLS_SRC_FILE)
configure-mbedtls: $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/Makefile
compile-mbedtls: $(MBEDTLS_OBJ_SOURCE)
check-mbedtls: $(BUILDDIR)/$(MBEDTLS_SRC_DIR)/checked
install-mbedtls: $(MBEDTLS_OBJ_TARGET)
2 changes: 2 additions & 0 deletions deps/mbedtls.version
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
MBEDTLS_BRANCH=master
MBEDTLS_SHA1=bfafadb45daf8d2114e3109e2f9021fc72ee36bb

0 comments on commit 5d0de3e

Please sign in to comment.