From 873f15d70d4bbdefa87c847bfe36b183320a8872 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Sun, 25 Mar 2018 23:47:15 +0100 Subject: [PATCH 1/6] Make DLEXT var configurable in library/Makefile --- library/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/library/Makefile b/library/Makefile index 65a102f3a..633038efc 100644 --- a/library/Makefile +++ b/library/Makefile @@ -35,9 +35,8 @@ SOEXT_TLS=so.10 SOEXT_X509=so.0 SOEXT_CRYPTO=so.1 -DLEXT=so -# OSX shared library extension: -# DLEXT=dylib +# Set DLEXT=dylib to compile as a shared library for Mac OS X +DLEXT ?= so # Windows shared library extension: ifdef WINDOWS_BUILD From ceed91b72c307d6aa27afb770e38786d27651b96 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Sun, 25 Mar 2018 23:48:39 +0100 Subject: [PATCH 2/6] Allow overriding ar param prefix in library/Makefile --- library/Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/library/Makefile b/library/Makefile index 633038efc..39bc24d78 100644 --- a/library/Makefile +++ b/library/Makefile @@ -38,6 +38,10 @@ SOEXT_CRYPTO=so.1 # Set DLEXT=dylib to compile as a shared library for Mac OS X DLEXT ?= so +# Set AR_DASH= (empty string) to use an ar implentation that does not accept +# the - prefix for command line options (e.g. llvm-ar) +AR_DASH ?= - + # Windows shared library extension: ifdef WINDOWS_BUILD DLEXT=dll @@ -90,9 +94,9 @@ shared: libmbedcrypto.$(DLEXT) libmbedx509.$(DLEXT) libmbedtls.$(DLEXT) # tls libmbedtls.a: $(OBJS_TLS) echo " AR $@" - $(AR) -rc $@ $(OBJS_TLS) + $(AR) $(AR_DASH)rc $@ $(OBJS_TLS) echo " RL $@" - $(AR) -s $@ + $(AR) $(AR_DASH)s $@ libmbedtls.$(SOEXT_TLS): $(OBJS_TLS) libmbedx509.so echo " LD $@" @@ -113,9 +117,9 @@ libmbedtls.dll: $(OBJS_TLS) libmbedx509.dll # x509 libmbedx509.a: $(OBJS_X509) echo " AR $@" - $(AR) -rc $@ $(OBJS_X509) + $(AR) $(AR_DASH)rc $@ $(OBJS_X509) echo " RL $@" - $(AR) -s $@ + $(AR) $(AR_DASH)s $@ libmbedx509.$(SOEXT_X509): $(OBJS_X509) libmbedcrypto.so echo " LD $@" @@ -136,9 +140,9 @@ libmbedx509.dll: $(OBJS_X509) libmbedcrypto.dll # crypto libmbedcrypto.a: $(OBJS_CRYPTO) echo " AR $@" - $(AR) -rc $@ $(OBJS_CRYPTO) + $(AR) $(AR_DASH)rc $@ $(OBJS_CRYPTO) echo " RL $@" - $(AR) -s $@ + $(AR) $(AR_DASH)s $@ libmbedcrypto.$(SOEXT_CRYPTO): $(OBJS_CRYPTO) echo " LD $@" From ea5a8a418b4fe4b463a5cc0a08e2193a38105950 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Sun, 25 Mar 2018 23:57:09 +0100 Subject: [PATCH 3/6] Add ChangeLog entry for library/makefile changes --- ChangeLog | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index c0759b2b2..4985bcc1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,10 @@ Changes * Remove some redundant code in bignum.c. Contributed by Alexey Skalozub. * Support cmake build where Mbed TLS is a subproject. Fix contributed independently by Matthieu Volat and Arne Schwabe. + * Allow configuring the prefix operator for the archiver tool when compiling + the library using the makefile. Found and fixed by Alex Hixon. + * Allow configuring the shared library extension by setting the DLEXT + variable when using the project makefile. = mbed TLS 2.8.0 branch released 2018-03-16 From d1b1788b40ef8dd5e3393a32eea439a68f9fc6a1 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Tue, 27 Mar 2018 19:14:24 +0100 Subject: [PATCH 4/6] Improve ChangeLog for DLEXT and AR_DASH changes --- ChangeLog | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4985bcc1a..cd6ca5557 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,10 +10,11 @@ Changes * Remove some redundant code in bignum.c. Contributed by Alexey Skalozub. * Support cmake build where Mbed TLS is a subproject. Fix contributed independently by Matthieu Volat and Arne Schwabe. - * Allow configuring the prefix operator for the archiver tool when compiling - the library using the makefile. Found and fixed by Alex Hixon. + * Add an option in the makefile to support ar utilities where the operation + letter must not be prefixed by '-', such as LLVM. Found and fixed by + Alex Hixon. * Allow configuring the shared library extension by setting the DLEXT - variable when using the project makefile. + environment variable when using the project makefiles. = mbed TLS 2.8.0 branch released 2018-03-16 From 420f0ccdfd97fdba2047c3f219a3dfbdc5c2f6a0 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Tue, 27 Mar 2018 19:17:21 +0100 Subject: [PATCH 5/6] Make DLEXT var configurable in programs and tests makefiles --- programs/Makefile | 2 +- tests/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/programs/Makefile b/programs/Makefile index 443689b1b..25f184f8c 100644 --- a/programs/Makefile +++ b/programs/Makefile @@ -35,7 +35,7 @@ ifdef SHARED SHARED_SUFFIX=.$(DLEXT) endif else -DLEXT=so +DLEXT ?= so EXEXT= SHARED_SUFFIX= endif diff --git a/tests/Makefile b/tests/Makefile index 4787f2508..d85617fdc 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -35,7 +35,7 @@ ifdef SHARED SHARED_SUFFIX=.$(DLEXT) endif else -DLEXT=so +DLEXT ?= so EXEXT= SHARED_SUFFIX= endif From 79db933fb605e5d3594a42c162b7a6eb9f3de3a7 Mon Sep 17 00:00:00 2001 From: Andres Amaya Garcia Date: Tue, 27 Mar 2018 19:57:58 +0100 Subject: [PATCH 6/6] Fix shared library lookup on Mac OS X when running tests --- tests/scripts/run-test-suites.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/scripts/run-test-suites.pl b/tests/scripts/run-test-suites.pl index 1f73a545e..7e2974bbc 100755 --- a/tests/scripts/run-test-suites.pl +++ b/tests/scripts/run-test-suites.pl @@ -41,6 +41,7 @@ die "$0: no test suite found\n" unless @suites; # in case test suites are linked dynamically $ENV{'LD_LIBRARY_PATH'} = '../library'; +$ENV{'DYLD_LIBRARY_PATH'} = '../library'; my $prefix = $^O eq "MSWin32" ? '' : './';