irc/ircd-ratbox: Fix OpenSSL linking and simplify

- Fix linking with ports' ssl libs
  - Fix `contrib` build (used base openssl headers)
  - Re-work EGD detection
  - Use options helpers
  - Simplify REINPLACE with :U defaults

PR:		195796
Reviewed by:	feld (mentor)
Approved by:	feld (mentor)
Differential Revision:	D5286
This commit is contained in:
Bernard Spil 2016-02-15 19:19:24 +00:00
parent 038edc612e
commit cba5094fe4
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=408952
5 changed files with 38 additions and 162 deletions

View file

@ -3,7 +3,7 @@
PORTNAME= ircd-ratbox
PORTVERSION= 3.0.8
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= irc ipv6
MASTER_SITES= http://www.ratbox.org/download/ \
http://www.ratbox.org/download/old/
@ -61,59 +61,20 @@ SHORTCUTS_DESC= Build with ircd-shortcut commands
OPTIONS_DEFAULT= OPENSSL IPV6 ZIPLINKS SHARED_MODS
OPTIONS_EXCLUDE= NLS EXAMPLES
#----------------------------------------------------------------------
OPTIONS_SUB= yes
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MOPENSSL}
USE_OPENSSL= yes
CONFIGURE_ARGS+= --enable-openssl
.else
CONFIGURE_ARGS+= --disable-openssl
.endif
.if ${PORT_OPTIONS:MIPV6}
CONFIGURE_ARGS+= --enable-ipv6
.else
CONFIGURE_ARGS+= --disable-ipv6
.endif
.if ${PORT_OPTIONS:MZIPLINKS}
CONFIGURE_ARGS+= --enable-zlib
.else
CONFIGURE_ARGS+= --disable-zlib
.endif
.if ${PORT_OPTIONS:MSHARED_MODS}
CONFIGURE_ARGS+= --disable-static
.else
CONFIGURE_ARGS+= --enable-static
.endif
.if ${PORT_OPTIONS:MASSERT}
CONFIGURE_ARGS+= --enable-assert
.else
CONFIGURE_ARGS+= --disable-assert
.endif
.if ${PORT_OPTIONS:MSMALL_NET}
CONFIGURE_ARGS+= --enable-small-net
.endif
.if ${PORT_OPTIONS:MSERVICES}
CONFIGURE_ARGS+= --enable-services
PLIST_SUB+= SERVICES=""
.else
PLIST_SUB+= SERVICES="@comment "
.endif
.if ${PORT_OPTIONS:MSHORTCUTS}
USES+= perl5
USE_PERL5= build
PLIST_SUB+= SHORTCUTS=""
.else
PLIST_SUB+= SHORTCUTS="@comment "
.endif
ASSERT_CONFIGURE_ENABLE= assert
IPV6_CONFIGURE_ENABLE= ipv6
OPENSSL_USE= openssl=yes
OPENSSL_CONFIGURE_ON= --enable-openssl=${OPENSSLBASE}
OPENSSL_CONFIGURE_OFF= --disable-openssl
SERVICES_CONFIGURE_ENABLE= services
SHARED_MODS_CONFIGURE_ON= --disable-static
SHARED_MODS_CONFIGURE_OFF= --enable-static
SHORTCUTS_USES= perl5
SHORTCUTS_USE= perl5=build
SMALL_NET_CONFIGURE_ENABLE= small-net
ZIPLINKS_CONFIGURE_ENABLE= zlib
#-- User Configuration -------------------------------------------------
@ -159,48 +120,17 @@ pre-build:
${WRKSRC}/doc/example.efnet.conf
@${REINPLACE_CMD} -e "s#%%RUNDIR%%#${RUNDIR}#g" ${WRKSRC}/include/config.h
@${REINPLACE_CMD} -e "s#%%DBDIR%%#${DBDIR}#g" ${WRKSRC}/include/config.h
@${REINPLACE_CMD} -e "s#%%WRKSRC%%#${WRKSRC}#g" ${WRKSRC}/contrib/ircd-shortcut.pl
#-- ircd-shortcut.pl ratbox-services commands --------------------------------------
.if !empty(SERVER_NAME)
@${REINPLACE_CMD} -e "s#services.ircd-ratbox.org#${SERVER_NAME}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(USER_SERV)
@${REINPLACE_CMD} -e "s#USERSERV#${USER_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(CHAN_SERV)
@${REINPLACE_CMD} -e "s#CHANSERV#${CHAN_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(NICK_SERV)
@${REINPLACE_CMD} -e "s#NICKSERV#${NICK_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(ALIS_SERV)
@${REINPLACE_CMD} -e "s#ALIS#${ALIS_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(OPER_BOT)
@${REINPLACE_CMD} -e "s#OPERBOT#${OPER_BOT}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(OPER_SERV)
@${REINPLACE_CMD} -e "s#OPERSERV#${OPER_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(JUPE_SERV)
@${REINPLACE_CMD} -e "s#JUPESERV#${JUPE_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
.if !empty(GLOBAL_SERV)
@${REINPLACE_CMD} -e "s#GLOBAL#${GLOBAL_SERV}#" \
${WRKSRC}/contrib/ircd-shortcut.pl
.endif
@${REINPLACE_CMD} -e "s#ALIS#${ALIS_SERV:UALIS}#" \
-e "s#CHANSERV#${CHAN_SERV:UCHANSERV}#" -e "s#GLOBAL#${GLOBAL_SERV:UGLOBAL}#" \
-e "s#JUPESERV#${JUPE_SERV:UJUPESERV}#" -e "s#NICKSERV#${NICK_SERV:UNICKSERV}#" \
-e "s#OPERBOT#${OPER_BOT:UOPERBOT}#" -e "s#USERSERV#${USER_SERV:UUSERSERV}#" \
-e "s#services.ircd-ratbox.org#${SERVER_NAME:Uservices.ircd-ratbox.org}#" \
-e "s#%%WRKSRC%%#${WRKSRC}#g" ${WRKSRC}/contrib/ircd-shortcut.pl
# ----- Execute ircd-shortcut perl script to generate the .c file. -----
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MSHORTCUTS}
@${ECHO_MSG} "Executing ircd-shortcut.pl for ircd-shortcuts generation."
${PERL} ${WRKSRC}/contrib/ircd-shortcut.pl

View file

@ -1,53 +0,0 @@
--- configure.orig 2012-03-11 00:34:21 UTC
+++ configure
@@ -13659,6 +13659,50 @@ else
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for RAND_egd in -lcrypto" >&5
+$as_echo_n "checking for RAND_egd in -lcrypto... " >&6; }
+if ${ac_cv_lib_crypto_RAND_egd+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char RAND_egd ();
+int
+main ()
+{
+return RAND_egd ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_crypto_RAND_egd=yes
+else
+ ac_cv_lib_crypto_RAND_egd=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_RAND_egd" >&5
+$as_echo "$ac_cv_lib_crypto_RAND_egd" >&6; }
+if test "x$ac_cv_lib_crypto_RAND_egd" = xyes; then :
+
+$as_echo "#define HAVE_RAND_EGD 1" >>confdefs.h
+
+
+fi
+
+
if test "$cf_enable_openssl" != no; then

View file

@ -1,13 +0,0 @@
--- configure.ac.orig 2012-03-11 01:34:21.000000000 +0100
+++ configure.ac 2015-03-10 20:48:02.040440133 +0100
@@ -244,6 +244,10 @@
cf_enable_openssl="no"
fi
unset cf_openssl_basedir
+
+ AC_CHECK_LIB(crypto, RAND_egd, AC_DEFINE(HAVE_RAND_EGD, 1,
+ [Define if the libcrypto has RAND_egd]))
+
else
dnl If --disable-openssl was specified
AC_MSG_RESULT(disabled)

View file

@ -1,6 +1,18 @@
--- contrib/Makefile.in.orig 2012-03-11 01:12:06.000000000 +0100
+++ contrib/Makefile.in 2014-07-02 01:22:20.963771475 +0200
@@ -429,8 +429,8 @@
Fix linking ssl, used /usr/include/openssl even when --enable-openssl=%LOCALBASE%
was used
--- contrib/Makefile.in.orig 2012-03-11 00:12:06 UTC
+++ contrib/Makefile.in
@@ -202,7 +202,7 @@ coredir = @moduledir@
servicesdir = @moduledir@/autoload
libmodulesdir = @moduledir@
contribdir = @moduledir@/contrib
-INCLUDES = -I../include -I../libratbox/include $(INCLTDL)
+INCLUDES = -I../include -I../libratbox/include $(INCLTDL) $(SSL_INCLUDES)
AM_CFLAGS = $(WARNFLAGS)
SRCS = \
example_module.c \
@@ -429,8 +429,8 @@ clean-generic:
$(LIBTOOL) --mode=clean $(RB_RM) -f $(S_OBJS) $(S_CORE_OBJS) $(ST_OBJS)
install_modules: $(S_OBJS)

View file

@ -4,7 +4,7 @@
switch (seed_type)
{
+#ifdef HAVE_RAND_EGD
+#ifndef OPENSSL_NO_EGD
case RB_PRNG_EGD:
if(RAND_egd(path) == -1)
return -1;