From 1948a4672972707b2ec3f10aecf10a663ad741df Mon Sep 17 00:00:00 2001 From: Thierry Thomas Date: Sun, 22 Jun 2014 13:39:24 +0000 Subject: [PATCH] Adding twister, a fully decentralized P2P microblogging platform leveraging from the free software implementations of Bitcoin and BitTorrent protocols. --- net-p2p/Makefile | 1 + net-p2p/twister/Makefile | 68 +++++++++++++++++++ net-p2p/twister/distinfo | 2 + .../files/patch-libtorrent_m4_ax_pthread.m4 | 20 ++++++ net-p2p/twister/files/patch-src_makefile.unix | 38 +++++++++++ net-p2p/twister/files/patch-src_scrypt.cpp | 19 ++++++ net-p2p/twister/files/patch-src_scrypt.h | 17 +++++ net-p2p/twister/pkg-descr | 24 +++++++ 8 files changed, 189 insertions(+) create mode 100644 net-p2p/twister/Makefile create mode 100644 net-p2p/twister/distinfo create mode 100644 net-p2p/twister/files/patch-libtorrent_m4_ax_pthread.m4 create mode 100644 net-p2p/twister/files/patch-src_makefile.unix create mode 100644 net-p2p/twister/files/patch-src_scrypt.cpp create mode 100644 net-p2p/twister/files/patch-src_scrypt.h create mode 100644 net-p2p/twister/pkg-descr diff --git a/net-p2p/Makefile b/net-p2p/Makefile index 9540ec73c00c..8e9674179ca0 100644 --- a/net-p2p/Makefile +++ b/net-p2p/Makefile @@ -97,6 +97,7 @@ SUBDIR += transmission-qt4 SUBDIR += transmission-remote-gui SUBDIR += tribler + SUBDIR += twister SUBDIR += uhub SUBDIR += unworkable SUBDIR += valknut diff --git a/net-p2p/twister/Makefile b/net-p2p/twister/Makefile new file mode 100644 index 000000000000..d41d668b783f --- /dev/null +++ b/net-p2p/twister/Makefile @@ -0,0 +1,68 @@ +# Created by: Thierry Thomas +# $FreeBSD$ + +PORTNAME= twister-core +PORTVERSION= 0.140621 +CATEGORIES= net-p2p + +MAINTAINER= thierry@FreeBSD.org +COMMENT= Experimental peer-to-peer microblogging software + +LICENSE= BSD3CLAUSE MIT +LICENSE_COMB= dual +LICENSE_FILE= ${WRKSRC}/COPYING + +LIB_DEPENDS= libboost_system.so:${PORTSDIR}/devel/boost-libs \ + libleveldb.so:${PORTSDIR}/databases/leveldb \ + libicui18n.so:${PORTSDIR}/devel/icu + +OPTIONS_DEFINE= UPNP +OPTIONS_DEFAULT= UPNP +UPNP_DESC= UPnP port mapping +UPNP_LIB_DEPENDS= libminiupnpc.so:${PORTSDIR}/net/miniupnpc + +USE_GITHUB= yes +GH_ACCOUNT= miguelfreitas +GH_PROJECT= ${PORTNAME} +GH_TAGNAME= ${GH_COMMIT} +GH_COMMIT= 2d23677 + +USE_BDB= yes +WANT_BDB_VER= 48 +USE_OPENSSL= yes +USES= gmake iconv + +USE_AUTOTOOLS= libtoolize:env aclocal:env autoconf:env autoheader:env automake:env +GNU_CONFIGURE= yes +CONFIGURE_WRKSRC=${WRKSRC}/libtorrent +CONFIGURE_ARGS= --with-libiconv \ + --with-boost=${LOCALBASE} \ + --with-boost-system=boost_system +CONFIGURE_ENV= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" \ + PTHREAD_LIBS="${PTHREAD_LIBS}" +MAKEFILE= makefile.unix +BUILD_WRKSRC= ${WRKSRC}/src +MAKE_ENV= BOOST_INCLUDE_PATH=${LOCALBASE}/include \ + BOOST_LIB_PATH=${LOCALBASE}/lib \ + BDB_INCLUDE_PATH=${BDB_INCLUDE_DIR} \ + BDB_LIB_PATH=${BDB_LIB_DIR} + +PLIST_FILES= bin/twisterd +PORTDOCS= README.md + +.include + +pre-configure: + (cd ${CONFIGURE_WRKSRC} && ./autotool.sh) +.if ${PORT_OPTIONS:MUPNP} + ${REINPLACE_CMD} -e 's|USE_UPNP:=1|USE_UPNP:=|' ${BUILD_WRKSRC}/${MAKEFILE} +.endif + +do-install: + ${INSTALL_PROGRAM} ${BUILD_WRKSRC}/twisterd ${STAGEDIR}${PREFIX}/bin +.if ${PORT_OPTIONS:MDOCS} + ${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} +.endif + +.include diff --git a/net-p2p/twister/distinfo b/net-p2p/twister/distinfo new file mode 100644 index 000000000000..4bc15ea53025 --- /dev/null +++ b/net-p2p/twister/distinfo @@ -0,0 +1,2 @@ +SHA256 (twister-core-0.140621.tar.gz) = fc3fc95d32c615e97599ecf22de230a9c31ad5e0faf5d17dbb076002284dca07 +SIZE (twister-core-0.140621.tar.gz) = 6268064 diff --git a/net-p2p/twister/files/patch-libtorrent_m4_ax_pthread.m4 b/net-p2p/twister/files/patch-libtorrent_m4_ax_pthread.m4 new file mode 100644 index 000000000000..c587a90f2e97 --- /dev/null +++ b/net-p2p/twister/files/patch-libtorrent_m4_ax_pthread.m4 @@ -0,0 +1,20 @@ +--- libtorrent/m4/ax_pthread.m4.orig 2014-06-20 21:38:49.000000000 +0200 ++++ libtorrent/m4/ax_pthread.m4 2014-06-21 16:58:22.000000000 +0200 +@@ -318,7 +318,7 @@ + # + if test x"$done" = xno; then + AC_MSG_CHECKING([whether -lpthread fixes that]) +- LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" ++ LIBS="$PTHREAD_LIBS $save_LIBS" + AC_TRY_LINK([#include ], + [pthread_t th; pthread_join(th, 0); + pthread_attr_init(0); pthread_cleanup_push(0, 0); +@@ -327,7 +327,7 @@ + + if test "x$done" = xyes; then + AC_MSG_RESULT([yes]) +- PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" ++ PTHREAD_LIBS="$PTHREAD_LIBS" + else + AC_MSG_RESULT([no]) + fi diff --git a/net-p2p/twister/files/patch-src_makefile.unix b/net-p2p/twister/files/patch-src_makefile.unix new file mode 100644 index 000000000000..3e0bada38ae2 --- /dev/null +++ b/net-p2p/twister/files/patch-src_makefile.unix @@ -0,0 +1,38 @@ +--- src/makefile.unix.orig 2014-06-20 21:38:49.000000000 +0200 ++++ src/makefile.unix 2014-06-21 16:53:52.000000000 +0200 +@@ -63,7 +63,6 @@ + LIBS+= \ + -Wl,-B$(LMODE2) \ + -l z \ +- -l dl \ + -l pthread + + +@@ -105,7 +104,7 @@ + + # CXXFLAGS can be specified on the make command line, so we use xCXXFLAGS that only + # adds some defaults in front. Unfortunately, CXXFLAGS=... $(CXXFLAGS) does not work. +-xCXXFLAGS=-O2 -pthread -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ ++xCXXFLAGS= -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter \ + $(DEBUGFLAGS) $(DEFS) $(HARDENING) $(CXXFLAGS) + + # LDFLAGS can be specified on the make command line, so we use xLDFLAGS that only +@@ -113,7 +112,6 @@ + xLDFLAGS=$(LDHARDENING) $(LDFLAGS) + + OBJS= \ +- leveldb/libleveldb.a \ + ../libtorrent/src/.libs/libtorrent-rasterbar.a \ + obj/alert.o \ + obj/version.o \ +@@ -169,9 +167,7 @@ + # LevelDB support + # + MAKEOVERRIDES = +-LIBS += $(CURDIR)/leveldb/libleveldb.a $(CURDIR)/leveldb/libmemenv.a +-DEFS += $(addprefix -I,$(CURDIR)/leveldb/include) +-DEFS += $(addprefix -I,$(CURDIR)/leveldb/helpers) ++LIBS += -l leveldb -l memenv + leveldb/libleveldb.a: + @echo "Building LevelDB ..." && cd leveldb && $(MAKE) CC="$(CC)" CXX="$(CXX)" OPT="$(xCXXFLAGS)" libleveldb.a libmemenv.a && cd .. + diff --git a/net-p2p/twister/files/patch-src_scrypt.cpp b/net-p2p/twister/files/patch-src_scrypt.cpp new file mode 100644 index 000000000000..370265aae275 --- /dev/null +++ b/net-p2p/twister/files/patch-src_scrypt.cpp @@ -0,0 +1,19 @@ +--- src/scrypt.cpp.orig 2014-06-03 22:36:01.000000000 +0200 ++++ src/scrypt.cpp 2014-06-15 23:01:59.000000000 +0200 +@@ -34,6 +34,8 @@ + #include + #include + ++#ifndef __FreeBSD__ ++/* Allready defined in sys/endian.h */ + static inline uint32_t be32dec(const void *pp) + { + const uint8_t *p = (uint8_t const *)pp; +@@ -49,6 +51,7 @@ + p[1] = (x >> 16) & 0xff; + p[0] = (x >> 24) & 0xff; + } ++#endif + + typedef struct HMAC_SHA256Context { + SHA256_CTX ictx; diff --git a/net-p2p/twister/files/patch-src_scrypt.h b/net-p2p/twister/files/patch-src_scrypt.h new file mode 100644 index 000000000000..220acdb732b5 --- /dev/null +++ b/net-p2p/twister/files/patch-src_scrypt.h @@ -0,0 +1,17 @@ +--- src/scrypt.h.orig 2014-06-03 22:36:01.000000000 +0200 ++++ src/scrypt.h 2014-06-15 22:44:40.000000000 +0200 +@@ -17,6 +17,8 @@ + PBKDF2_SHA256(const uint8_t *passwd, size_t passwdlen, const uint8_t *salt, + size_t saltlen, uint64_t c, uint8_t *buf, size_t dkLen); + ++# ifndef __FreeBSD__ ++/* Allready defined in sys/endian.h */ + static inline uint32_t le32dec(const void *pp) + { + const uint8_t *p = (uint8_t const *)pp; +@@ -32,4 +34,5 @@ + p[2] = (x >> 16) & 0xff; + p[3] = (x >> 24) & 0xff; + } ++# endif + #endif diff --git a/net-p2p/twister/pkg-descr b/net-p2p/twister/pkg-descr new file mode 100644 index 000000000000..a9c5590b5603 --- /dev/null +++ b/net-p2p/twister/pkg-descr @@ -0,0 +1,24 @@ +twister is an experimental decentralized P2P microblogging platform leveraging +from the free software implementations of Bitcoin and BitTorrent protocols. + +User registration and authentication is provided by a bitcoin-like network, so +it is completely distributed (does not depend on any central authority). + +Post distribution uses kademlia DHT network and bittorrent-like swarms, both are +provided by libtorrent. + +Both Bitcoin and libtorrent versions included here are highly patched and do not +interoperate with existing networks (on purpose). + +Warning! This is alpha software! In other words: this software is probably +difficult to compile, it is not feature-complete, it can be unstable, and it may +crash causing data loss. You have been warned. + +If you choose to continue you probably must fall into one of the following +categories: + + You are a developer. + You are an early adopter (who wants to reserve your nickname). + You are a masochist. + +WWW: http://twister.net.co/