diff --git a/Makefile b/Makefile index efce521a..9b9425b1 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,22 @@ else include Makefile.linux endif +all: obj i2p + +i2p: $(OBJECTS:obj/%=obj/%) + $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) + +.SUFFIXES: +.SUFFIXES: .c .cc .C .cpp .o + +obj/%.o : %.cpp + $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) + +obj: + mkdir -p obj + +clean: + rm -fr obj i2p + +.PHONY: all +.PHONY: clean diff --git a/Makefile.bsd b/Makefile.bsd index be8396e6..517016ca 100644 --- a/Makefile.bsd +++ b/Makefile.bsd @@ -4,24 +4,3 @@ include filelist.mk INCFLAGS = -I/usr/include/ -I/usr/local/include/ LDFLAGS = -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread LIBS = - -all: obj i2p - -i2p: $(OBJECTS:obj/%=obj/%) - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -obj/%.o : %.cpp - $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) - -obj: - mkdir -p obj - -clean: - rm -fr obj i2p - -.PHONY: all -.PHONY: clean - diff --git a/Makefile.linux b/Makefile.linux index 6a0405c9..e7d33048 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -1,9 +1,8 @@ - CC = g++ -CFLAGS = -g -Wall -std=c++0x +CFLAGS = -g -Wall -std=c++11 include filelist.mk INCFLAGS = -LDFLAGS = -Wl,-rpath,/usr/local/lib -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread +LDFLAGS = -lcryptopp -lboost_system -lboost_date_time -lboost_filesystem -lboost_regex -lboost_program_options -lpthread LIBS = #check if AES-NI is supported by CPU @@ -11,23 +10,3 @@ ifneq ($(shell grep -c aes /proc/cpuinfo),0) CPU_FLAGS = -maes -DAESNI endif -all: obj i2p - -i2p: $(OBJECTS:obj/%=obj/%) - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -obj/%.o : %.cpp - $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) - -obj: - mkdir -p obj - -clean: - rm -fr obj i2p - -.PHONY: all -.PHONY: clean - diff --git a/Makefile.osx b/Makefile.osx index 5aa22e52..fb4d5a45 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -9,30 +9,9 @@ LIBS = # http://www.hutsby.net/2011/08/macs-with-aes-ni.html # Seems like all recent Mac's have AES-NI, after firmware upgrade 2.2 # Found no good way to detect it from command line. TODO: Might be some osx sysinfo magic -CPU_FLAGS = -DAESNI +CFLAGS += -DAESNI # Apple Mac OSX UNAME_S := $(shell uname -s) ifeq ($(UNAME_S),Darwin) endif - -all: obj i2p - -i2p: $(OBJECTS:obj/%=obj/%) - $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) - -.SUFFIXES: -.SUFFIXES: .c .cc .C .cpp .o - -obj/%.o : %.cpp - $(CC) -o $@ $< -c $(CFLAGS) $(INCFLAGS) $(CPU_FLAGS) - -obj: - mkdir -p obj - -clean: - rm -fr obj i2p - -.PHONY: all -.PHONY: clean - diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..23e93bd4 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,11 @@ +i2pd (20140919-2) unstable; urgency=low + + * updated to latest sources + + -- hagen Fri, 19 Sep 2014 05:16:12 +0000 + +i2pd (20140919-1) unstable; urgency=low + + * Initial release (Closes: #nnnn) + + -- hagen Mon, 19 Sep 2014 00:00:00 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 00000000..45a4fb75 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +8 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..0808cb74 --- /dev/null +++ b/debian/control @@ -0,0 +1,21 @@ +Source: i2pd +Section: net +Priority: extra +Maintainer: hagen +Build-Depends: debhelper (>= 8.0.0), cmake, dpkg-dev (>= 1.16.1~), + libboost-regex-dev, + libboost-system-dev (>= 1.46), + libboost-date-time-dev, + libboost-filesystem-dev, + libboost-program-options-dev, + libcrypto++-dev +Standards-Version: 3.9.3 +Homepage: https://github.com/PrivacySolutions/i2pd +Vcs-Git: git://github.com/PrivacySolutions/i2pd.git +Vcs-Browser: https://github.com/PrivacySolutions/i2pd.git + +Package: i2pd +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: i2p router written in C++ + Mainly runs on linux, but also supports OSX, BSD and Windows diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..ec52d972 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,28 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: i2pd +Source: https://github.com/PrivacySolutions + +Files: * +Copyright: 2013-2014 PrivacySolutions +License: GPL-2.0+ + +Files: debian/* +Copyright: 2014 hagen +License: GPL-2.0+ + +License: GPL-2.0+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". diff --git a/debian/docs b/debian/docs new file mode 100644 index 00000000..b43bf86b --- /dev/null +++ b/debian/docs @@ -0,0 +1 @@ +README.md diff --git a/debian/i2pd.default b/debian/i2pd.default new file mode 100644 index 00000000..b76000ab --- /dev/null +++ b/debian/i2pd.default @@ -0,0 +1,7 @@ +# Defaults for i2pd initscript +# sourced by /etc/init.d/i2pd +# installed at /etc/default/i2pd by the maintainer scripts + +# Additional options that are passed to the Daemon. +DAEMON_OPTS="--host=1.2.3.4 --port=4567" +# change ip and port above to your external address and port diff --git a/debian/i2pd.install b/debian/i2pd.install new file mode 100644 index 00000000..66af1abd --- /dev/null +++ b/debian/i2pd.install @@ -0,0 +1 @@ +i2pd usr/sbin/ diff --git a/debian/init.d b/debian/init.d new file mode 100644 index 00000000..79dea50a --- /dev/null +++ b/debian/init.d @@ -0,0 +1,116 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: i2pd +# Required-Start: $network $local_fs $remote_fs +# Required-Stop: $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: i2p router written in C++ +### END INIT INFO + +# Author: hagen + +PATH=/sbin:/usr/sbin:/bin:/usr/bin +DESC=i2pd # Introduce a short description here +NAME=i2pd # Introduce the short server's name here +DAEMON=/usr/sbin/i2pd # Introduce the server's location here +DAEMON_OPTS="" # Arguments to run the daemon with +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +# Exit if the package is not installed +[ -x $DAEMON ] || exit 0 + +[ -r /etc/default/$NAME ] && . /etc/default/$NAME +. /lib/init/vars.sh +. /lib/lsb/init-functions + +# Function that starts the daemon/service +do_start() +{ + # Return + # 0 if daemon has been started + # 1 if daemon was already running + # 2 if daemon could not be started + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \ + || return 1 + start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \ + --daemon=1 --log=1 $DAEMON_OPTS \ + || return 2 +} + +# Function that stops the daemon/service +do_stop() +{ + # Return + # 0 if daemon has been stopped + # 1 if daemon was already stopped + # 2 if daemon could not be stopped + # other if a failure occurred + start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME + RETVAL="$?" + [ "$RETVAL" = 2 ] && return 2 + start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON + [ "$?" = 2 ] && return 2 + rm -f $PIDFILE + return "$RETVAL" +} + +# Function that sends a SIGHUP to the daemon/service +#do_reload() { +# start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME +# return 0 +#} + +case "$1" in + start) + [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME" + do_start + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + stop) + [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" + do_stop + case "$?" in + 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; + 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; + esac + ;; + status) + status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? + ;; + #reload|force-reload) + #log_daemon_msg "Reloading $DESC" "$NAME" + #do_reload + #log_end_msg $? + #;; + restart|force-reload) + # If the "reload" option is implemented then remove the + # 'force-reload' alias + log_daemon_msg "Restarting $DESC" "$NAME" + do_stop + case "$?" in + 0|1) + do_start + case "$?" in + 0) log_end_msg 0 ;; + 1) log_end_msg 1 ;; # Old process is still running + *) log_end_msg 1 ;; # Failed to start + esac + ;; + *) + # Failed to stop + log_end_msg 1 + ;; + esac + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 + exit 3 + ;; +esac + +: diff --git a/debian/patches/rename-binary.patch b/debian/patches/rename-binary.patch new file mode 100644 index 00000000..5c74f388 --- /dev/null +++ b/debian/patches/rename-binary.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile b/Makefile +index 9b9425b..84de72f 100644 +--- a/Makefile ++++ b/Makefile +@@ -8,9 +8,9 @@ else + include Makefile.linux + endif + +-all: obj i2p ++all: obj i2pd + +-i2p: $(OBJECTS:obj/%=obj/%) ++i2pd: $(OBJECTS:obj/%=obj/%) + $(CC) -o $@ $^ $(LDFLAGS) $(LIBS) + + .SUFFIXES: +@@ -23,7 +23,7 @@ obj: + mkdir -p obj + + clean: +- rm -fr obj i2p ++ rm -fr obj i2pd + + .PHONY: all + .PHONY: clean diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 00000000..714c2e62 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +rename-binary.patch diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..000a1532 --- /dev/null +++ b/debian/rules @@ -0,0 +1,14 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +DPKG_EXPORT_BUILDFLAGS = 1 +include /usr/share/dpkg/buildflags.mk +CFLAGS+=$(CPPFLAGS) +CXXFLAGS+=$(CPPFLAGS) +PREFIX=/usr + +%: + dh $@ diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..f3faedd2 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts=filenamemangle=s/.+\/v?(\d\S*)\.tar\.gz/i2pd-$1\.tar\.gz/ \ + https://github.com/PrivacySolutions/i2pd/tags .*/v?(\d\S*)\.tar\.gz