pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

i2pd: rewritten Makefile to fit pkgsrc's guidelines



Module Name:	pkgsrc-wip
Committed By:	Jake Slazenger <jake.slazenger%yandex.com@localhost>
Pushed By:	jakeSlaz
Date:		Fri Mar 16 16:47:20 2018 +0300
Changeset:	2d7a04d9c97794b5794d060e0c6cfc4bbb85dfcf

Modified Files:
	i2pd/Makefile
	i2pd/PLIST
Added Files:
	i2pd/files/i2pd.conf.NetBSD
	i2pd/files/i2pd.sh

Log Message:
i2pd: rewritten Makefile to fit pkgsrc's guidelines

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2d7a04d9c97794b5794d060e0c6cfc4bbb85dfcf

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 i2pd/Makefile               |  66 +++++++++++------
 i2pd/PLIST                  |   4 +-
 i2pd/files/i2pd.conf.NetBSD | 172 ++++++++++++++++++++++++++++++++++++++++++++
 i2pd/files/i2pd.sh          |  30 ++++++++
 4 files changed, 249 insertions(+), 23 deletions(-)

diffs:
diff --git a/i2pd/Makefile b/i2pd/Makefile
index c4ff1151c9..f47ccadfa9 100644
--- a/i2pd/Makefile
+++ b/i2pd/Makefile
@@ -2,52 +2,74 @@
 .include	"../../wip/libi2pd/Makefile.common"
 
 PKGNAME=	i2pd-${I2PD_VERSION}
-
 COMMENT=	Full-featured C++ implementation of I2P client
 
+CONFLICTS+= i2pd-git-*
+
+BUILD_DEFS+=	VARBASE PKG_SYSCONFBASE
+USE_TOOLS+=		pax
+
 CMAKE_ARGS+=	-DWITH_BINARY=yes
 CMAKE_ARGS+=	-DWITH_LIBRARY=no
 
+I2PD_SOURCESDIR=${WRKSRC}/..
+EGDIR=			share/examples/i2pd
+
 I2PD_USER=		i2pd
 I2PD_GROUP=		i2pd
-PKG_GECOS.${I2PD_USER}=	i2pd user
-
-CONFLICTS+= i2pd-git-*
-
+PKG_HOME.${I2PD_USER}= ${PREFIX}/var/i2pd
 PKG_USERS=	${I2PD_USER}:${I2PD_GROUP}
 PKG_GROUPS=	${I2PD_GROUP}
+PKG_GECOS.${I2PD_USER}=	i2pd user
 
-I2PD_SOURCESDIR=${WRKSRC}/..
 PKG_SYSCONFSUBDIR=i2pd
-I2PD_CONFDIR=${DESTDIR}/${PKG_SYSCONFBASE}/i2pd
-
-MAKE_DIRS+=${VARBASE}/db/i2pd
-MAKE_DIRS+=${VARBASE}/log/i2pd
-MAKE_DIRS+=${VARBASE}/run/i2pd
 
 INSTALLATION_DIRS+=	bin
-INSTALLATION_DIRS+=	share/examples/i2pd
+INSTALLATION_DIRS+=	${EGDIR}
 INSTALLATION_DIRS+=	${PKGMANDIR}/man1
 INSTALLATION_DIRS+=	${PKG_SYSCONFBASE}/i2pd
-INSTALLATION_DIRS+=	var/i2pd/
+INSTALLATION_DIRS+=	var/i2pd
+INSTALLATION_DIRS+=	var/i2pd/certificates
+
+.if ${OPSYS} == "NetBSD" # NetBSD-specific config
+CONF_FILES+= ${EGDIR}/i2pd.conf.NetBSD \
+			 ${PREFIX}/${PKG_SYSCONFDIR}/i2pd.conf
+.else
+CONF_FILES+= ${EGDIR}/i2pd.conf \
+			 ${PREFIX}/${PKG_SYSCONFDIR}/i2pd.conf
+.endif
+
+RCD_SCRIPTS+=i2pd
+
+MAKE_DIRS+=${VARBASE}/log/i2pd
+MAKE_DIRS+=${VARBASE}/run/i2pd
 
-MAKE_DIRS_PERMS+=${I2PD_CONFDIR} \
-				 ${I2PD_USER} ${I2PD_GROUP} 0755
-MAKE_DIRS_PERMS+=${VARBASE}/db/i2pd \
-				 ${I2PD_USER} ${I2PD_GROUP} 0755
 MAKE_DIRS_PERMS+=${VARBASE}/log/i2pd \
 				 ${I2PD_USER} ${I2PD_GROUP} 0755
+
 MAKE_DIRS_PERMS+=${VARBASE}/run/i2pd \
 				 ${I2PD_USER} ${I2PD_GROUP} 0755
 
+MAKE_DIRS_PERMS+=${PREFIX}/var/i2pd \
+				 ${I2PD_USER} ${I2PD_GROUP} 0755
+
+MAKE_DIRS_PERMS+=${PREFIX}/var/i2pd/certificates \
+				 ${I2PD_USER} ${I2PD_GROUP} 0755
+
 post-install:
 	${INSTALL_MAN} ${I2PD_SOURCESDIR}/debian/i2pd.1 \
 		${DESTDIR}/${PREFIX}/${PKGMANDIR}/man1/
-	${INSTALL_DATA} ${I2PD_SOURCESDIR}/contrib/i2pd.conf \
-		${I2PD_CONFDIR}/
+
+	cd ${I2PD_SOURCESDIR}/contrib/certificates && \
+		pax -wr * ${DESTDIR}/${PREFIX}/var/i2pd/certificates/
+
 	${INSTALL_DATA} ${I2PD_SOURCESDIR}/contrib/tunnels.conf \
-		${DESTDIR}/${PREFIX}/share/examples/i2pd/
-	cp -Rv ${I2PD_SOURCESDIR}/contrib/certificates \
-		${DESTDIR}/${PREFIX}/var/i2pd
+		${DESTDIR}/${PREFIX}/${EGDIR}/tunnels.conf
+
+	${INSTALL_DATA} ${I2PD_SOURCESDIR}/contrib/i2pd.conf \
+		${DESTDIR}/${PREFIX}/${EGDIR}/i2pd.conf
+
+	${INSTALL_DATA} ${FILESDIR}/i2pd.conf.NetBSD \
+		${DESTDIR}/${PREFIX}/${EGDIR}/i2pd.conf.NetBSD
 
 .include "../../mk/bsd.pkg.mk"
diff --git a/i2pd/PLIST b/i2pd/PLIST
index 06f8ed839e..9d8b08fd10 100644
--- a/i2pd/PLIST
+++ b/i2pd/PLIST
@@ -1,7 +1,8 @@
 @comment $NetBSD$
 bin/i2pd
-etc/i2pd/i2pd.conf
 man/man1/i2pd.1
+share/examples/i2pd/i2pd.conf
+share/examples/i2pd/i2pd.conf.NetBSD
 share/examples/i2pd/tunnels.conf
 var/i2pd/certificates/family/gostcoin.crt
 var/i2pd/certificates/family/i2p-dev.crt
@@ -19,3 +20,4 @@ var/i2pd/certificates/reseed/meeh_at_mail.i2p.crt
 var/i2pd/certificates/reseed/r4sas-reseed_at_mail.i2p.crt
 var/i2pd/certificates/reseed/zmx_at_mail.i2p.crt
 var/i2pd/certificates/router/orignal_at_mail.i2p.crt
+@pkgdir etc/i2pd
diff --git a/i2pd/files/i2pd.conf.NetBSD b/i2pd/files/i2pd.conf.NetBSD
new file mode 100644
index 0000000000..b5ec367122
--- /dev/null
+++ b/i2pd/files/i2pd.conf.NetBSD
@@ -0,0 +1,172 @@
+## Configuration file for a typical i2pd user
+## See https://i2pd.readthedocs.org/en/latest/configuration.html
+## for more options you can use in this file.
+
+## Lines that begin with "## " try to explain what's going on. Lines
+## that begin with just "#" are disabled commands: you can enable them
+## by removing the "#" symbol.
+
+## Tunnels config file
+## Default: ~/.i2pd/tunnels.conf or /var/lib/i2pd/tunnels.conf
+# tunconf = /var/lib/i2pd/tunnels.conf
+
+## Where to write pidfile (don't write by default)
+pidfile = /var/run/i2pd/i2pd.pid
+
+## Logging configuration section
+## By default logs go to stdout with level 'info' and higher
+##
+## Logs destination (valid values: stdout, file, syslog)
+##  * stdout - print log entries to stdout
+##  * file - log entries to a file
+##  * syslog - use syslog, see man 3 syslog
+log = file
+## Path to logfile (default - autodetect)
+logfile = /var/log/i2pd/i2pd.log
+## Log messages above this level (debug, *info, warn, error, none)
+## If you set it to none, logging will be disabled
+loglevel = info
+
+## Path to storage of i2pd data (RI, keys, peer profiles, ...)
+## Default: ~/.i2pd or /var/lib/i2pd
+datadir = /usr/pkg/var/i2pd
+
+## Daemon mode. Router will go to background after start
+daemon = true
+## Run as a service. Router will use system folders like ‘/var/lib/i2pd’
+service = true
+
+## Specify a family, router belongs to (default - none)
+# family =
+
+## External IP address to listen for connections
+## By default i2pd sets IP automatically
+# host = 1.2.3.4
+
+## Port to listen for connections
+## By default i2pd picks random port. You MUST pick a random number too,
+## don't just uncomment this
+# port = 4567
+
+## Enable communication through ipv4
+ipv4 = true
+## Enable communication through ipv6
+ipv6 = false
+
+## Network interface to bind to
+# ifname =
+
+## Enable NTCP transport (default = true)
+# ntcp = true
+## Enable SSU transport (default = true)
+# ssu = true
+
+## Should we assume we are behind NAT? (false only in MeshNet)
+# nat = true
+
+## Bandwidth configuration
+## L limit bandwidth to 32KBs/sec, O - to 256KBs/sec, P - to 2048KBs/sec,
+## X - unlimited
+## Default is X for floodfill, L for regular node
+# bandwidth = L
+
+## Router will not accept transit tunnels, disabling transit traffic completely
+## (default = false)
+# notransit = true
+
+## Router will be floodfill
+# floodfill = true
+
+[limits]
+## Maximum active transit sessions (default:2500)
+# transittunnels = 2500
+
+[precomputation]
+## Enable or disable elgamal precomputation table
+## By default, enabled on i386 hosts
+# elgamal = true
+
+[upnp]
+## Enable or disable UPnP: automatic port forwarding (enabled by default in WINDOWS, ANDROID)
+# enabled = false
+
+## Name i2pd appears in UPnP forwardings list (default = I2Pd)
+# name = I2Pd
+
+[reseed]
+## Enable or disable reseed data verification.
+verify = true
+## URLs to request reseed data from, separated by comma
+## Default: "mainline" I2P Network reseeds
+# urls = https://reseed.i2p-projekt.de/,https://i2p.mooo.com/netDb/,https://netdb.i2p2.no/
+## Path to local reseed data file (.su3) for manual reseeding
+# file = /path/to/i2pseeds.su3
+## or HTTPS URL to reseed from
+# file = https://legit-website.com/i2pseeds.su3
+
+[addressbook]
+## AddressBook subscription URL for initial setup
+## Default: inr.i2p at "mainline" I2P Network
+# defaulturl = http://joajgazyztfssty4w2on5oaqksz6tqoxbduy553y34mf4byv6gpq.b32.i2p/export/alive-hosts.txt
+## Optional subscriptions URLs, separated by comma
+# subscriptions = http://inr.i2p/export/alive-hosts.txt,http://stats.i2p/cgi-bin/newhosts.txt,http://rus.i2p/hosts.txt
+
+[http]
+## Uncomment and set to 'false' to disable Web Console
+# enabled = true
+## Address and port service will listen on
+address = 127.0.0.1
+port = 7070
+
+[httpproxy]
+## Uncomment and set to 'false' to disable HTTP Proxy
+# enabled = true
+## Address and port service will listen on
+address = 127.0.0.1
+port = 4444
+## Optional keys file for proxy local destination
+# keys = http-proxy-keys.dat
+
+[socksproxy]
+## Uncomment and set to 'false' to disable SOCKS Proxy
+# enabled = true
+## Address and port service will listen on
+address = 127.0.0.1
+port = 4447
+## Optional keys file for proxy local destination
+# keys = socks-proxy-keys.dat
+
+## Socks outproxy. Example below is set to use Tor for all connections except i2p
+## Uncomment and set to 'true' to enable using of SOCKS outproxy
+# outproxy.enabled = false
+## Address and port of outproxy
+# outproxy = 127.0.0.1
+# outproxyport = 9050
+
+[sam]
+## Uncomment and set to 'true' to enable SAM Bridge
+enabled = true
+## Address and port service will listen on
+# address = 127.0.0.1
+# port = 7656
+
+[bob]
+## Uncomment and set to 'true' to enable BOB command channel
+# enabled = false
+## Address and port service will listen on
+# address = 127.0.0.1
+# port = 2827
+
+[i2cp]
+## Uncomment and set to 'true' to enable I2CP protocol
+# enabled = false
+## Address and port service will listen on
+# address = 127.0.0.1
+# port = 7654
+
+[i2pcontrol]
+## Uncomment and set to 'true' to enable I2PControl protocol
+# enabled = false
+## Address and port service will listen on
+# address = 127.0.0.1
+# port = 7650
diff --git a/i2pd/files/i2pd.sh b/i2pd/files/i2pd.sh
new file mode 100644
index 0000000000..ed48bc14cd
--- /dev/null
+++ b/i2pd/files/i2pd.sh
@@ -0,0 +1,30 @@
+#!@RCD_SCRIPTS_SHELL@
+#
+# $NetBSD $
+#
+# PROVIDE: i2pd
+# REQUIRE: DAEMON NETWORKING
+# KEYWORD: shutdown
+#
+# Variables in rc.conf to enable i2pd:
+# 
+# i2pd=YES
+
+if test -f /etc/rc.subr
+then
+	. /etc/rc.subr
+fi
+
+name="i2pd"
+rcvar=$name
+command="@PREFIX@/bin/i2pd"
+required_files="@PKG_SYSCONFIG@/i2pd.conf"
+i2pd_user="i2pd"
+i2pd_group="i2pd"
+i2pd_flags="--conf=@PKG_SYSCONFIG@/i2pd.conf"
+stop_cmd="i2pd_stop"
+
+i2pd_stop()
+{
+	kill -INT `cat /var/run/i2pd/i2pd.pid`
+}


Home | Main Index | Thread Index | Old Index