Build ipv6 and ipv4 versions together and package both.

Based on a suggestion by mat to have the flavours not conflict.

PR:		ports/239987
Reported by:	papadavecn@gmail.com
This commit is contained in:
Chris Rees
2019-12-09 19:07:42 +00:00
parent f300596439
commit 2caa69a9e5
5 changed files with 71 additions and 17 deletions

View File

@@ -2,6 +2,7 @@
PORTNAME= opentracker
PORTVERSION= 0.2017.08.13
PORTREVISION= 2
CATEGORIES= net
MASTER_SITES= http://www.bayofrum.net/dist/${PORTNAME}/ \
@@ -11,9 +12,9 @@ COMMENT= Free lightweight bittorrent tracker using libowfat
BUILD_DEPENDS= ${LOCALBASE}/lib/libowfat.a:devel/libowfat
USES= tar:bzip2
USE_RC_SUBR= ${PORTNAME}
USE_RC_SUBR= ${PORTNAME} ${PORTNAME}-ipv6
OPTIONS_DEFINE= COMPRESSION_GZIP DEBUG_HTTPERROR FULLSCRAPE RESTRICT_STATS IPV6
OPTIONS_DEFINE= COMPRESSION_GZIP DEBUG_HTTPERROR FULLSCRAPE RESTRICT_STATS
OPTIONS_SINGLE= ACCESSLIST
OPTIONS_SINGLE_ACCESSLIST= ACCESSLIST_OPEN ACCESSLIST_BLACK \
ACCESSLIST_WHITE
@@ -48,10 +49,6 @@ FEATURES+=-D_DEBUG_HTTPERROR
FEATURES+=-DWANT_FULLSCRAPE
.endif
.if ${PORT_OPTIONS:MIPV6}
FEATURES+=-DWANT_V6
.endif
.if ${PORT_OPTIONS:MRESTRICT_STATS}
FEATURES+=-DWANT_RESTRICT_STATS
.endif
@@ -60,11 +57,21 @@ MAKE_ENV+=FEATURES="${FEATURES}"
post-patch:
@${FIND} ${WRKSRC} -name "*.orig" -delete
${LN} ${WRKSRC}/opentracker.c ${WRKSRC}/opentracker-ipv6.c
do-build:
${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${BUILD_WRKSRC} -DWANT_V6 \
BINARY=opentracker-ipv6
${MAKE_CMD} -C ${BUILD_WRKSRC} clean
${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${BUILD_WRKSRC}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin/
${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME}-ipv6 ${STAGEDIR}${PREFIX}/bin/
${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.conf.sample \
${STAGEDIR}${ETCDIR}/${PORTNAME}.conf.sample
${INSTALL_DATA} ${WRKSRC}/${PORTNAME}.conf.sample \
${STAGEDIR}${ETCDIR}/${PORTNAME}-ipv6.conf.sample
.include <bsd.port.mk>

View File

@@ -0,0 +1,33 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: opentracker_ipv6
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local to
# enable opentracker:
# opentracker_ipv6_enable (bool): Set to "NO" by default.
# opentracker_ipv6_config (path): Set to
# "%%PREFIX%%/etc/opentracker/opentracker-ipv6.conf"
# by default
. /etc/rc.subr
name=opentracker_ipv6
rcvar=opentracker_ipv6_enable
desc="Lightweight Bittorrent tracker"
load_rc_config $name
: ${opentracker_ipv6_enable:=NO}
: ${opentracker_ipv6_config:="%%PREFIX%%/etc/opentracker/opentracker-ipv6.conf"}
command=/usr/sbin/daemon
pidfile=/var/run/opentracker-ipv6.pid
command_args="-p $pidfile %%PREFIX%%/bin/opentracker-ipv6 -f ${opentracker_ipv6_config}"
procname="%%PREFIX%%/bin/opentracker-ipv6"
required_files=${opentracker_ipv6_config}
run_rc_command $1

View File

@@ -1,29 +1,33 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: opentracker
# REQUIRE: LOGIN
# KEYWORD: shutdown
# Add the following lines to /etc/rc.conf or /etc/rc.conf.local to
# enable opentracker:
# opentracker_enable (bool): Set to "NO" by default.
# opentracker_config (path): Set to
# "%%PREFIX%%/etc/opentracker/opentracker.conf"
# by default
# "%%PREFIX%%/etc/opentracker/opentracker.conf"
# by default
. /etc/rc.subr
name="opentracker"
name=opentracker
rcvar=opentracker_enable
desc="Lightweight Bittorrent tracker"
load_rc_config $name
: ${opentracker_enable="NO"}
: ${opentracker_config="%%PREFIX%%/etc/opentracker/opentracker.conf"}
: ${opentracker_enable:=NO}
: ${opentracker_config:="%%PREFIX%%/etc/opentracker/opentracker-ipv6.conf"}
command="/usr/sbin/daemon"
command_args="-p /var/run/opentracker.pid %%PREFIX%%/bin/opentracker -f ${opentracker_config}"
command=/usr/sbin/daemon
pidfile=/var/run/opentracker.pid
command_args="-p $pidfile %%PREFIX%%/bin/opentracker -f ${opentracker_config}"
procname="%%PREFIX%%/bin/opentracker"
pidfile="/var/run/opentracker.pid"
required_files=${opentracker_config}
run_rc_command "$1"
run_rc_command $1

View File

@@ -16,5 +16,13 @@ sysctl kern.ipc.nmbclusters=32768
sysctl net.inet.tcp.msl=10000
sysctl kern.maxfiles=10240
EOM
In order to enable opentracker at boot time;
# sysrc opentracker_enable=yes
Or
# sysrc opentracker_ipv6_enable=yes
}
]

View File

@@ -1,2 +1,4 @@
bin/opentracker
bin/opentracker-ipv6
@sample %%ETCDIR%%/opentracker.conf.sample
@sample %%ETCDIR%%/opentracker-ipv6.conf.sample