From 1185a2fb46ded816abfd73725beef23edcdc25b0 Mon Sep 17 00:00:00 2001 From: Matthew Versluys Date: Sat, 24 Oct 2015 13:42:54 -0700 Subject: [PATCH 1/3] Fixes for Mac OSX --start-group and --end-group aren't available in the clang that ships with Xcode 7 Moved the build/link options for -mmacosx-version-min from the project to the solution so that the settings are applied to the contrib libraries. Eliminates link spam that the libraries were built with newer versions of the compiler. --- premake5.lua | 6 ++++-- src/tools/gcc.lua | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/premake5.lua b/premake5.lua index 6622a100..4a7eb04a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -90,6 +90,10 @@ configurations { "Release", "Debug" } location ( _OPTIONS["to"] ) + configuration { "macosx", "gmake" } + buildoptions { "-mmacosx-version-min=10.4" } + linkoptions { "-mmacosx-version-min=10.4" } + project "Premake5" targetname "premake5" language "C" @@ -161,8 +165,6 @@ configuration { "macosx", "gmake" } toolset "clang" - buildoptions { "-mmacosx-version-min=10.4" } - linkoptions { "-mmacosx-version-min=10.4" } configuration { "solaris" } linkoptions { "-Wl,--export-dynamic" } diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index 0f05d2b4..55b8480b 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -304,9 +304,11 @@ end end - if #result > 1 then - table.insert(result, 1, "-Wl,--start-group") - table.insert(result, "-Wl,--end-group") + if cfg.system ~= premake.MACOSX then + if #result > 1 then + table.insert(result, 1, "-Wl,--start-group") + table.insert(result, "-Wl,--end-group") + end end -- The "-l" flag is fine for system libraries From 192aa8216b73f7a1248f5e407a0a9c4138d5c655 Mon Sep 17 00:00:00 2001 From: Matthew Versluys Date: Sat, 24 Oct 2015 13:53:04 -0700 Subject: [PATCH 2/3] SSL Support on Mac Utilizes Darwin SSL (rather than OpenSSL). The configuration file that was built appears to be for Linux. Had to remove the CURL_CA_BUNDLE for certificate lookup to work. --- contrib/curl/lib/curl_config.h | 2 +- contrib/curl/premake5.lua | 2 +- premake5.lua | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/curl/lib/curl_config.h b/contrib/curl/lib/curl_config.h index fe05c2b8..6c5818f4 100644 --- a/contrib/curl/lib/curl_config.h +++ b/contrib/curl/lib/curl_config.h @@ -2,7 +2,7 @@ /* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ /* Location of default ca bundle */ -#define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt" +/* #define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt" */ /* Location of default ca path */ /* #undef CURL_CA_PATH */ diff --git a/contrib/curl/premake5.lua b/contrib/curl/premake5.lua index 1e56fed9..30946de9 100644 --- a/contrib/curl/premake5.lua +++ b/contrib/curl/premake5.lua @@ -20,7 +20,7 @@ project "curl-lib" defines {"HAVE_CONFIG_H", "CURL_HIDDEN_SYMBOLS"} configuration { 'macosx' } - defines { 'HAVE_CONFIG_H' } + defines { 'HAVE_CONFIG_H', 'USE_SSL', 'USE_DARWINSSL' } configuration "Release" defines {"NDEBUG"} diff --git a/premake5.lua b/premake5.lua index 4a7eb04a..0bc85159 100644 --- a/premake5.lua +++ b/premake5.lua @@ -162,6 +162,9 @@ configuration "macosx" defines { "LUA_USE_MACOSX" } links { "CoreServices.framework" } + if not _OPTIONS["no-curl"] then + links { "Security.framework" } + end configuration { "macosx", "gmake" } toolset "clang" From 1175f0df2539777b871cb14605d4eda13b1223a4 Mon Sep 17 00:00:00 2001 From: Matthew Versluys Date: Mon, 26 Oct 2015 08:46:26 -0700 Subject: [PATCH 3/3] SSL support for Linux using OpenSSL CURL_CA_BUNDLE is deteceted during premake. Feels like the header that was generated by configure should be removed and move all curl build options into premake. --- contrib/curl/lib/curl_config.h | 2 +- contrib/curl/premake5.lua | 23 ++++++++++++++++++++++- premake5.lua | 6 ++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/contrib/curl/lib/curl_config.h b/contrib/curl/lib/curl_config.h index 6c5818f4..23534669 100644 --- a/contrib/curl/lib/curl_config.h +++ b/contrib/curl/lib/curl_config.h @@ -2,7 +2,7 @@ /* lib/curl_config.h.in. Generated from configure.ac by autoheader. */ /* Location of default ca bundle */ -/* #define CURL_CA_BUNDLE "/etc/pki/tls/certs/ca-bundle.crt" */ +/* #undef CURL_CA_BUNDLE */ /* Location of default ca path */ /* #undef CURL_CA_PATH */ diff --git a/contrib/curl/premake5.lua b/contrib/curl/premake5.lua index 30946de9..be00a757 100644 --- a/contrib/curl/premake5.lua +++ b/contrib/curl/premake5.lua @@ -17,7 +17,28 @@ project "curl-lib" defines {"USE_SSL", "USE_SCHANNEL", "USE_WINDOWS_SSPI"} configuration { 'linux' } - defines {"HAVE_CONFIG_H", "CURL_HIDDEN_SYMBOLS"} + + defines {"HAVE_CONFIG_H", "CURL_HIDDEN_SYMBOLS" } + if os.findlib("ssl") then + defines { "USE_SSL", "USE_OPENSSL", "USE_SSLEAY" } + + -- find the location of the ca bundle + local ca = nil + for _, f in ipairs { + '/etc/ssl/certs/ca-certificates.crt', + '/etc/pki/tls/certs/ca-bundle.crt', + '/usr/share/ssl/certs/ca-bundle.crt', + '/usr/local/share/certs/ca-root.crt', + '/etc/ssl/cert.pem' } do + if os.isfile(f) then + ca = f + break + end + end + if ca then + defines { 'CURL_CA_BUNDLE=\\"' .. ca .. '\\"' } + end + end configuration { 'macosx' } defines { 'HAVE_CONFIG_H', 'USE_SSL', 'USE_DARWINSSL' } diff --git a/premake5.lua b/premake5.lua index 0bc85159..a1f08f24 100644 --- a/premake5.lua +++ b/premake5.lua @@ -159,6 +159,11 @@ configuration "linux or hurd" links { "dl", "rt" } + configuration "linux" + if not _OPTIONS["no-curl"] and os.findlib("ssl") then + links { "ssl", "crypto" } + end + configuration "macosx" defines { "LUA_USE_MACOSX" } links { "CoreServices.framework" } @@ -176,6 +181,7 @@ defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } links { "m" } + -- optional 3rd party libraries group "contrib" if not _OPTIONS["no-zlib"] then