Support building against LibreSSL and OpenSSL from ports.

Also fixes building against iconv from ports.

PR:		203163
Approved by:	mentors (implicit)
This commit is contained in:
Michael Gmelin 2015-09-16 23:38:56 +00:00
parent a73518bcca
commit f0a68f6868
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397092
7 changed files with 162 additions and 13 deletions

View file

@ -3,6 +3,7 @@
PORTNAME= Ice PORTNAME= Ice
PORTVERSION= 3.6.0 PORTVERSION= 3.6.0
PORTREVISION= 1
DISTVERSIONPREFIX= v DISTVERSIONPREFIX= v
CATEGORIES= devel CATEGORIES= devel
@ -102,29 +103,37 @@ post-patch:
s|%%DOCSDIR%%|${STAGEDIR}${DOCSDIR}|g; \ s|%%DOCSDIR%%|${STAGEDIR}${DOCSDIR}|g; \
s|%%ICONV_LIB%%|${ICONV_LIB}|g; \ s|%%ICONV_LIB%%|${ICONV_LIB}|g; \
s|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \ s|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \
s|%%INSTALL_DATA%%|${INSTALL_DATA}|g' \ s|%%INSTALL_DATA%%|${INSTALL_DATA}|g; \
s|%%OPENSSLLIB%%|${OPENSSLLIB}|g; \
s|%%OPENSSLINC%%|${OPENSSLINC}|g; \
s|%%OPENSSLRPATH%%|${OPENSSLRPATH}|g;' \
${FILESDIR}/Make.rules.FreeBSD > ${WRKSRC}/cpp/config/Make.rules.FreeBSD ${FILESDIR}/Make.rules.FreeBSD > ${WRKSRC}/cpp/config/Make.rules.FreeBSD
@${REINPLACE_CMD} 's|%%BDB_LIB_CXX_NAME%%|${BDB_LIB_CXX_NAME}|g; \ @${REINPLACE_CMD} 's|%%BDB_LIB_CXX_NAME%%|${BDB_LIB_CXX_NAME}|g; \
s|%%BDB_LIB_DIR%%|${BDB_LIB_DIR}|g; \ s|%%BDB_LIB_DIR%%|${BDB_LIB_DIR}|g; \
s|%%BDB_INCLUDE_DIR%%|${BDB_INCLUDE_DIR}|g; \ s|%%BDB_INCLUDE_DIR%%|${BDB_INCLUDE_DIR}|g; \
s|%%OPENSSLLIB%%|${OPENSSLLIB}|g; \
s|%%OPENSSLINC%%|${OPENSSLINC}|g; \
s|%%OPENSSLRPATH%%|${OPENSSLRPATH}|g; \
/install_docdir/d' \ /install_docdir/d' \
${WRKSRC}/cpp/config/Make.rules ${WRKSRC}/cpp/config/Make.rules
@${REINPLACE_CMD} 's|%%OPENSSLBASE%%|${OPENSSLBASE}|g;' \
${WRKSRC}/cpp/test/IceSSL/configuration/run.py
@${REINPLACE_CMD} '/install_configdir/d' \ @${REINPLACE_CMD} '/install_configdir/d' \
${WRKSRC}/cpp/config/Make.rules ${WRKSRC}/cpp/config/Make.rules
@${REINPLACE_CMD} '/LICENSE/s/prefix/install_slicedir/; \ @${REINPLACE_CMD} '/LICENSE/s/prefix/install_slicedir/; \
s|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; ' \ s|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g;' \
${WRKSRC}/config/Make.common.rules ${WRKSRC}/config/Make.common.rules
@${REINPLACE_CMD} 's|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \ @${REINPLACE_CMD} 's|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \
s|%%INSTALL_DATA%%|${INSTALL_DATA}|g; \ s|%%INSTALL_DATA%%|${INSTALL_DATA}|g; \
s|%%ICONV_LIB%%|${ICONV_LIB}|g; \ s|%%ICONV_LIB%%|${ICONV_LIB}|g; \
s|%%PYTHON_CMD%%|${PYTHON_CMD}|g; \ s|%%PYTHON_CMD%%|${PYTHON_CMD}|g; \
s|%%PYTHON_SITELIBDIR%%|${STAGEDIR}${PYSITEDIR}|g; \ s|%%PYTHON_SITELIBDIR%%|${STAGEDIR}${PYSITEDIR}|g; \
s|%%PREFIX%%|${PREFIX}|g ; \ s|%%PREFIX%%|${PREFIX}|g; \
s|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/python/config/Make.rules s|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/python/config/Make.rules
@${REINPLACE_CMD} 's|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \ @${REINPLACE_CMD} 's|%%INSTALL_PROGRAM%%|${INSTALL_PROGRAM}|g; \
s|%%INSTALL_DATA%%|${INSTALL_DATA}|g; \ s|%%INSTALL_DATA%%|${INSTALL_DATA}|g; \
s|%%PREFIX%%|${PREFIX}|g ; \ s|%%PREFIX%%|${PREFIX}|g; \
s|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/php/config/Make.rules.php s|%%LOCALBASE%%|${LOCALBASE}|g;' ${WRKSRC}/php/config/Make.rules.php
.if ${PORT_OPTIONS:MTESTS} .if ${PORT_OPTIONS:MTESTS}
TEST_CMD= @cd ${BUILD_WRKSRC} && ${PYTHON_CMD} ./allTests.py TEST_CMD= @cd ${BUILD_WRKSRC} && ${PYTHON_CMD} ./allTests.py

View file

@ -4,7 +4,8 @@ BASELIBS = -lIceUtil -pthread -L$(LOCALBASE)/lib %%ICONV_LIB%%
LIBS = -lIce $(BASELIBS) LIBS = -lIce $(BASELIBS)
CRYPT_OS_LIBS = -lcrypt CRYPT_OS_LIBS = -lcrypt
ICEUTIL_OS_LIBS = -pthread -lcrypto ICEUTIL_OS_LIBS = -pthread $(OPENSSL_RPATH_LINK) -L%%OPENSSLLIB%% -lcrypto
ICEUTIL_FLAGS += $(OPENSSL_FLAGS)
PLATFORM_HAS_READLINE := yes PLATFORM_HAS_READLINE := yes
@ -20,3 +21,4 @@ INSTALL = %%INSTALL_DATA%%
INSTALL_PROGRAM = %%INSTALL_PROGRAM%% INSTALL_PROGRAM = %%INSTALL_PROGRAM%%
MCPP_HOME = $(LOCALBASE) MCPP_HOME = $(LOCALBASE)
override DESTDIR = override DESTDIR =
rpathlink = -Wl,-rpath,$(1)

View file

@ -1,5 +1,20 @@
--- cpp/config/Make.rules.orig 2015-06-23 15:30:20.000000000 +0000 --- cpp/config/Make.rules.orig 2015-06-23 15:30:20.000000000 +0000
+++ cpp/config/Make.rules 2015-06-27 10:26:42.692387147 +0000 +++ cpp/config/Make.rules 2015-09-14 21:31:28.253993994 +0000
@@ -203,11 +201,11 @@
ICEUTIL_FLAGS = -DICE_PRIO_INHERIT
endif
-OPENSSL_FLAGS += $(if $(OPENSSL_HOME),-I$(OPENSSL_HOME)/include)
+OPENSSL_FLAGS += -I%%OPENSSLINC%%
ifeq ($(OPENSSL_LIBS),)
- OPENSSL_LIBS = $(if $(OPENSSL_HOME),-L$(OPENSSL_HOME)/$(libsubdir)) -lssl -lcrypto
+ OPENSSL_LIBS = -L%%OPENSSLLIB%% -lssl -lcrypto
endif
-OPENSSL_RPATH_LINK = $(if $(OPENSSL_HOME),$(call rpathlink,$(OPENSSL_HOME)/$(libsubdir)))
+OPENSSL_RPATH_LINK = $(if %%OPENSSLRPATH%%,$(call rpathlink,%%OPENSSLRPATH%%))
ifeq ($(SSL_OS_LIBS),)
SSL_OS_LIBS = $(OPENSSL_LIBS)
@@ -240,7 +240,9 @@ @@ -240,7 +240,9 @@
DB_FLAGS = -I/usr/local/include/db53 DB_FLAGS = -I/usr/local/include/db53
DB_LIBS = -L/usr/local/$(libsubdir)/db53 -ldb_cxx DB_LIBS = -L/usr/local/$(libsubdir)/db53 -ldb_cxx
@ -11,3 +26,12 @@
endif endif
endif endif
endif endif
@@ -381,7 +381,7 @@
.cpp.o:
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $<
@mkdir -p .depend
- @$(CXX) -DMAKEDEPEND -MM $(CPPFLAGS) $< > .depend/$(*F).d
+ @$(CXX) -DMAKEDEPEND -MM $(CPPFLAGS) $(CXXFLAGS) $< > .depend/$(*F).d
.c.o:
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<

View file

@ -0,0 +1,11 @@
--- cpp/src/IceSSL/Makefile.orig 2015-09-14 22:49:55.236652991 +0000
+++ cpp/src/IceSSL/Makefile 2015-09-14 22:50:11.419995991 +0000
@@ -55,7 +55,7 @@
CPPFLAGS := -I.. $(CPPFLAGS) -DICE_SSL_API_EXPORTS $(OPENSSL_FLAGS)
SLICE2CPPFLAGS := --ice --include-dir IceSSL --dll-export ICE_SSL_API $(SLICE2CPPFLAGS)
-LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(SSL_OS_LIBS) $(CXXLIBS)
+LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(OPENSSL_RPATH_LINK) $(SSL_OS_LIBS) $(CXXLIBS)
ifeq ($(STATICLIBS),yes)
$(libdir)/$(LIBNAME): $(OBJS)

View file

@ -0,0 +1,12 @@
--- cpp/src/IceSSL/OpenSSLEngine.cpp.orig 2015-09-14 23:12:17.842563990 +0000
+++ cpp/src/IceSSL/OpenSSLEngine.cpp 2015-09-14 23:13:21.929560990 +0000
@@ -267,7 +267,9 @@
string entropyDaemon = properties->getProperty("IceSSL.EntropyDaemon");
if(!entropyDaemon.empty())
{
+# ifndef OPENSSL_NO_EGD
if(RAND_egd(entropyDaemon.c_str()) <= 0)
+# endif
{
throw PluginInitializationException(__FILE__, __LINE__,
"IceSSL: EGD failure using file " + entropyDaemon);

View file

@ -1,6 +1,80 @@
--- cpp/test/IceSSL/configuration/AllTests.cpp.orig 2015-06-27 18:39:22.443351407 +0000 --- cpp/test/IceSSL/configuration/AllTests.cpp.orig 2015-06-23 15:30:20.000000000 +0000
+++ cpp/test/IceSSL/configuration/AllTests.cpp 2015-06-27 18:40:30.619349872 +0000 +++ cpp/test/IceSSL/configuration/AllTests.cpp 2015-09-15 00:15:34.865304987 +0000
@@ -3164,6 +3164,7 @@ @@ -7,6 +7,7 @@
//
// **********************************************************************
+#include <openssl/ssl.h>
#include <Ice/Ice.h>
#include <IceSSL/Plugin.h>
#include <TestCommon.h>
@@ -1292,14 +1293,22 @@
InitializationData initData;
initData.properties = createClientProps(defaultProps, defaultDir, defaultHost, p12, "c_rsa_ca1", "cacert1");
initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+# ifdef SSL_TXT_TLSV1_1
+ initData.properties->setProperty("IceSSL.Protocols", "tlsv1_1");
+# else
initData.properties->setProperty("IceSSL.Protocols", "ssl3");
+# endif
CommunicatorPtr comm = initialize(initData);
Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
test(fact);
Test::Properties d = createServerProps(defaultProps, defaultDir, defaultHost, p12, "s_rsa_ca1", "cacert1");
d["IceSSL.VerifyPeer"] = "0";
+# ifdef SSL_TXT_TLSV1_1
+ d["IceSSL.Protocols"] = "tlsv1_0";
+# else
d["IceSSL.Protocols"] = "tls";
+# endif
Test::ServerPrx server = fact->createServer(d);
try
{
@@ -1329,7 +1340,11 @@
test(fact);
d = createServerProps(defaultProps, defaultDir, defaultHost, p12, "s_rsa_ca1", "cacert1");
d["IceSSL.VerifyPeer"] = "0";
+# ifdef SSL_TXT_TLSV1_1
+ d["IceSSL.Protocols"] = "tlsv1_1, tlsv1_0";
+# else
d["IceSSL.Protocols"] = "tls, ssl3";
+# endif
server = fact->createServer(d);
try
{
@@ -1351,6 +1362,7 @@
InitializationData initData;
initData.properties = createClientProps(defaultProps, defaultDir, defaultHost, p12, "c_rsa_ca1", "cacert1");
initData.properties->setProperty("IceSSL.VerifyPeer", "0");
+ // on modern openssl this simply fails as ssl3 is not supported by the client
initData.properties->setProperty("IceSSL.Protocols", "ssl3");
CommunicatorPtr comm = initialize(initData);
@@ -1386,14 +1398,22 @@
{
InitializationData initData;
initData.properties = createClientProps(defaultProps, defaultDir, defaultHost, p12, "", "cacert1");
+# ifdef SSL_TXT_TLSV1_1
+ initData.properties->setProperty("IceSSL.Protocols", "tlsv1_1");
+# else
initData.properties->setProperty("IceSSL.Protocols", "ssl3");
+# endif
CommunicatorPtr comm = initialize(initData);
Test::ServerFactoryPrx fact = Test::ServerFactoryPrx::checkedCast(comm->stringToProxy(factoryRef));
test(fact);
Test::Properties d = createServerProps(defaultProps, defaultDir, defaultHost, p12, "s_rsa_ca1", "");
d["IceSSL.VerifyPeer"] = "0";
+# ifdef SSL_TXT_TLSV1_1
+ d["IceSSL.Protocols"] = "tls, tls1_1, tls1_2";
+# else
d["IceSSL.Protocols"] = "ssl3, tls, tls1_1, tls1_2";
+# endif
Test::ServerPrx server = fact->createServer(d);
try
{
@@ -3164,6 +3184,7 @@
#endif #endif
} }
@ -8,7 +82,7 @@
cout << "testing system CAs... " << flush; cout << "testing system CAs... " << flush;
{ {
InitializationData initData; InitializationData initData;
@@ -3208,6 +3209,7 @@ @@ -3208,6 +3229,7 @@
comm->destroy(); comm->destroy();
} }
cout << "ok" << endl; cout << "ok" << endl;

View file

@ -1,5 +1,14 @@
--- cpp/test/IceSSL/configuration/run.py.orig 2015-06-27 13:03:48.260735765 +0000 --- cpp/test/IceSSL/configuration/run.py.orig 2015-06-23 15:30:20.000000000 +0000
+++ cpp/test/IceSSL/configuration/run.py 2015-06-27 13:03:54.559736750 +0000 +++ cpp/test/IceSSL/configuration/run.py 2015-09-16 18:16:01.933879982 +0000
@@ -33,7 +33,7 @@
elif TestUtil.isLinux():
for c in ["cacert1.pem", "cacert2.pem"]:
pem = os.path.join(certsPath, c)
- os.system("rm -f {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
+ os.system("rm -f {dir}/`%%OPENSSLBASE%%/bin/openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
cleanup()
atexit.register(cleanup)
@@ -43,7 +43,7 @@ @@ -43,7 +43,7 @@
os.system("security create-keychain -p password %s" % keychainPath) os.system("security create-keychain -p password %s" % keychainPath)
for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]: for cert in ["s_rsa_ca1.p12", "c_rsa_ca1.p12"]:
@ -9,3 +18,11 @@
# #
# Create copies of the CA certificates named after the subject # Create copies of the CA certificates named after the subject
# hash. This is used by the tests to find the CA certificates in # hash. This is used by the tests to find the CA certificates in
@@ -51,6 +51,6 @@
#
for c in ["cacert1.pem", "cacert2.pem"]:
pem = os.path.join(certsPath, c)
- os.system("cp {pem} {dir}/`openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
+ os.system("cp {pem} {dir}/`%%OPENSSLBASE%%/bin/openssl x509 -subject_hash -noout -in {pem}`.0".format(pem=pem, dir=certsPath))
TestUtil.clientServerTest(additionalClientOptions = '"%s"' % os.getcwd())