Bug 185459 - New port: net-p2p/namecoin (ver Q.3.72)
Summary: New port: net-p2p/namecoin (ver Q.3.72)
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Steve Wills
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-04 07:10 UTC by Chad Jacob Milios
Modified: 2014-02-12 18:50 UTC (History)
0 users

See Also:


Attachments
file.shar (9.61 KB, text/plain)
2014-01-04 07:10 UTC, Chad Jacob Milios
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chad Jacob Milios 2014-01-04 07:10:00 UTC
This is a port of namecoin stable release Q.3.72 and a slave port namecoin-daemon. QT4 user interface is supported including the new integrated name registration. The daemon can be installed by opting out of the GUI option OR by using the included slave port so as to allow namecoin-qt and namecoind to easily coexist as packaged a system.

If you use this I'd appreciate your feedback. This is my first released port so go easy on me when you tell me how foolish I did it. :) I'd like some testing and community input, etc before this gets committed. This works great for my uses and limited testing and I don't think it should eat any of your coins but I wouldn't transfer hundreds of NMC into it just yet. :)

This is just the standard Namecoin software and does not have any OPTIONS to automatically integrate with DNS resolution yet. Once I get this port to a satisfactory place I'll be adding integration with resolver(s). I have much more experience with the DNS system than I do with QT and Qmake. This port was my little holiday learning project so maybe I did everything wrong. I'm open to any input about which of the many ways there are to do it that people would prefer to have made simple via the port or the ways people are doing resolution of the .bit TLD already using FreeBSD.

Fix: Patch attached with submission follows:
How-To-Repeat: In particular, I'm out of my depth when it comes to getting a gcc from ports to properly play nice with qmake, and I resorted to a libconf.d config in this port that I'm hoping someone will teach my how to avoid. Maybe it's not terrible but my gut tells me I'm doing it wrong. The compilation output that starts:

g++47 -Wl,-rpath=/usr/lib:/usr/local/lib -Wl,-rpath=/usr/local/lib/gcc47 -L/usr/local/lib/gcc47 -fstack-protector-all -Wl,-O1 -pthread -Wl,-rpath,/usr/local/lib/qt4 -o namecoin-qt

seems to have too many -Wl,-rpath='s in it for my taste and without the included libmap.d hack results in a namecoin-qt that simply gasps as it dies:

/usr/lib/libstdc++.so.6: version GLIBCXX_3.4.11 required by /usr/local/bin/namecoin-qt not found

If anyone knows how to eliminate the need for the libconf.d/namecoin-qt.conf I included in this port, or how to eliminate the USE_GCC=yes altogether, your help would be much appreciated. I may be totally off base but hopefully this will start us off toward having a usable and stable namecoin client and rpc server on FreeBSD!
Comment 1 Steve Wills freebsd_committer freebsd_triage 2014-01-16 19:10:11 UTC
Responsible Changed
From-To: freebsd-ports-bugs->swills

I'll take it.
Comment 2 dfilter service freebsd_committer freebsd_triage 2014-02-12 18:44:59 UTC
Author: swills
Date: Wed Feb 12 18:44:49 2014
New Revision: 343950
URL: http://svnweb.freebsd.org/changeset/ports/343950
QAT: https://qat.redports.org/buildarchive/r343950/

Log:
  Namecoin is an open source decentralized key/value registration and transfer
  system based on Bitcoin technology (a decentralized cryptocurrency).
  
  It allows you to:
  
      * Securely register and transfer arbitrary names (keys), no possible
        censorship!
      * Attach values (data) to the names (currently up to 520 bytes, will be
        extended)
      * Trade and transact namecoins, the digital currency NMC
  
  To register a name, you must own some namecoins (NMC, the internal
  cryptocurrency used by the software).
  
  WWW: http://namecoin.info/
  
  PR:		ports/185459
  Submitted by:	Chad J. Milios <milios@ccsys.com>

Added:
  head/net-p2p/namecoin/
  head/net-p2p/namecoin/Makefile   (contents, props changed)
  head/net-p2p/namecoin/distinfo   (contents, props changed)
  head/net-p2p/namecoin/files/
  head/net-p2p/namecoin/files/makefile.unix   (contents, props changed)
  head/net-p2p/namecoin/files/patch-src__main.h   (contents, props changed)
  head/net-p2p/namecoin/files/patch-src__net.cpp   (contents, props changed)
  head/net-p2p/namecoin/files/patch-src__qt__configurenamedialog.h   (contents, props changed)
  head/net-p2p/namecoin/files/patch-src__qt__managenamespage.h   (contents, props changed)
  head/net-p2p/namecoin/files/patch-src__serialize.h   (contents, props changed)
  head/net-p2p/namecoin/pkg-descr   (contents, props changed)
Modified:
  head/net-p2p/Makefile

Modified: head/net-p2p/Makefile
==============================================================================
--- head/net-p2p/Makefile	Wed Feb 12 18:41:27 2014	(r343949)
+++ head/net-p2p/Makefile	Wed Feb 12 18:44:49 2014	(r343950)
@@ -64,6 +64,7 @@
     SUBDIR += mldonkey-perlreactor
     SUBDIR += mldonkey-urlslave
     SUBDIR += museekplus
+    SUBDIR += namecoin
     SUBDIR += napshare
     SUBDIR += ncdc
     SUBDIR += opendchub

Added: head/net-p2p/namecoin/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/Makefile	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,98 @@
+# Created by: Chad J. Milios <milios@ccsys.com>
+# $FreeBSD$
+
+PORTNAME=	namecoin
+PORTVERSION=	Q.3.72
+CATEGORIES=	net-p2p dns
+MASTER_SITES=	GH
+
+MAINTAINER=	milios@ccsys.com
+COMMENT=	Decentralized, open DNS system and general purpose key/value store
+
+LIB_DEPENDS=	libboost_date_time.so:${PORTSDIR}/devel/boost-libs
+
+OPTIONS_DEFINE=	X11 UPNP QRCODES DBUS
+OPTIONS_DEFAULT=	X11 QRCODES
+
+UPNP_DESC=	Build with UPNP support
+QRCODES_DESC=	Build with QR code display
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	namecoinq
+GH_PROJECT=	namecoinq
+GH_COMMIT=	cdf052b
+GH_TAGNAME=	v${PORTVERSION}
+
+USES=		gmake compiler:c++11-lib
+USE_OPENSSL=	yes
+USE_BDB=	yes
+WANT_BDB_VER=	48
+
+CXXFLAGS+=	-I${LOCALBASE}/include -I${BDB_INCLUDE_DIR}
+CXXFLAGS+=	-L${LOCALBASE}/lib -L${BDB_LIB_DIR}
+CXXFLAGS+=	-DCRYPTOPP_DISABLE_ASM
+
+.include <bsd.port.options.mk>
+
+.if ${PORT_OPTIONS:MX11}
+USE_QT4=	corelib network gui qmake_build linguist_build uic_build moc_build rcc_build
+
+BINARY=		namecoin-qt
+LIB_DEPENDS+=	libprotobuf.so:${PORTSDIR}/devel/protobuf
+.else
+BINARY=		namecoind
+MAKE_ARGS+=	-C ${WRKSRC}/src
+USE_GNOME=	glib20
+.endif
+
+.if ${PORT_OPTIONS:MQRCODES}
+LIB_DEPENDS+=	libqrencode.so:${PORTSDIR}/graphics/libqrencode
+QMAKE_USE_QRCODE=1
+.else
+QMAKE_USE_QRCODE=0
+.endif
+
+.if ${PORT_OPTIONS:MDBUS}
+USE_QT4+=	dbus
+QMAKE_USE_DBUS=	1
+.else
+QMAKE_USE_DBUS=	0
+.endif
+
+PLIST_FILES+=	bin/${BINARY}
+
+.if ${PORT_OPTIONS:MUPNP}
+LIB_DEPENDS+=	libminiupnpc.so:${PORTSDIR}/net/miniupnpc
+QMAKE_USE_UPNP=	1
+.else
+QMAKE_USE_UPNP=	-
+.endif
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+.if !${PORT_OPTIONS:MX11}
+	@cd ${WRKSRC}/src && ${CP} ${FILESDIR}/makefile.unix Makefile
+	@${REINPLACE_CMD} \
+		-e 's|^USE_UPNP.*$$|USE_UPNP=${QMAKE_USE_UPNP}|' \
+		-e 's|-l pthread|${PTHREAD_LIBS}|g' \
+		${WRKSRC}/src/Makefile
+.endif
+
+do-configure:
+.if ${PORT_OPTIONS:MX11}
+	cd ${WRKSRC} && ${SETENV} ${QMAKE_ENV} \
+		${QMAKE} ${QMAKE_ARGS} USE_UPNP=${QMAKE_USE_UPNP} USE_QRCODE=${QMAKE_USE_QRCODE} \
+		QMAKE_LRELEASE=${LRELEASE} INCLUDEPATH+=${BDB_INCLUDE_DIR} \
+		QMAKE_LIBDIR+=${BDB_LIB_DIR} ${BINARY}.pro
+.endif
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/bin
+.if ${PORT_OPTIONS:MX11}
+	${INSTALL_PROGRAM} ${WRKSRC}/${BINARY} ${STAGEDIR}${PREFIX}/bin/
+.else
+	${INSTALL_PROGRAM} ${WRKSRC}/src/${BINARY} ${STAGEDIR}${PREFIX}/bin/
+.endif
+
+.include <bsd.port.post.mk>

Added: head/net-p2p/namecoin/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/distinfo	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,2 @@
+SHA256 (namecoin-Q.3.72.tar.gz) = 426b6c10b999ed11f436b2d8a56715a4355d30af41e13a1fd6e6ee5dd8348775
+SIZE (namecoin-Q.3.72.tar.gz) = 1453900

Added: head/net-p2p/namecoin/files/makefile.unix
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/makefile.unix	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,76 @@
+CXX?=g++
+DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
+
+LIBS= \
+ -Wl,-Bstatic \
+   -l boost_system \
+   -l boost_filesystem \
+   -l boost_program_options \
+   -l boost_thread \
+   -l boost_chrono \
+   -l db_cxx \
+   -l ssl \
+   -l crypto
+
+USE_UPNP:=0
+ifneq (${USE_UPNP}, -)
+	LIBS += -l miniupnpc
+	DEFS += -DUSE_UPNP=$(USE_UPNP)
+endif
+
+LIBS+= \
+ -Wl,-Bdynamic \
+   -l gthread-2.0 \
+   -l z \
+   -l pthread
+
+CXXFLAGS+=-O2 -Wno-invalid-offsetof -Wformat $(DEFS)
+HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
+    script.h allocators.h db.h walletdb.h crypter.h net.h irc.h keystore.h main.h \
+    wallet.h bitcoinrpc.h uibase.h ui.h noui.h init.h auxpow.h
+
+BASE_OBJS= \
+    obj/auxpow.o \
+    obj/util.o \
+    obj/key.o \
+    obj/script.o \
+    obj/db.o \
+    obj/walletdb.o \
+    obj/crypter.o \
+    obj/net.o \
+    obj/irc.o \
+    obj/keystore.o \
+    obj/main.o \
+    obj/wallet.o \
+    obj/bitcoinrpc.o \
+    obj/init.o \
+    cryptopp/obj/sha.o \
+    cryptopp/obj/cpu.o
+
+OBJS = \
+    $(BASE_OBJS) \
+    obj/hook.o
+
+all: namecoind
+
+cryptopp/obj/%.o: cryptopp/%.cpp
+	$(CXX) -c $(CXXFLAGS) -O3 -o $@ $<
+
+obj/nogui/%.o: %.cpp $(HEADERS)
+	$(CXX) -c $(CXXFLAGS) -o $@ $<
+
+obj/test/%.o: test/%.cpp $(HEADERS)
+	$(CXX) -c $(CFLAGS) -o $@ $<
+
+obj/nogui/namecoin.o: namecoin.h
+
+namecoind: $(BASE_OBJS:obj/%=obj/nogui/%) obj/nogui/namecoin.o
+	$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
+
+clean:
+	-rm -f namecoin namecoind
+	-rm -f obj/*.o
+	-rm -f obj/nogui/*.o
+	-rm -f obj/test/*.o
+	-rm -f cryptopp/obj/*.o
+	-rm -f headers.h.gch

Added: head/net-p2p/namecoin/files/patch-src__main.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/patch-src__main.h	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,10 @@
+--- ./src/main.h.orig	2013-10-29 13:38:10.000000000 +0000
++++ ./src/main.h	2014-01-18 23:12:20.871138275 +0000
+@@ -16,7 +16,6 @@
+ #ifdef __WXMSW__
+ #include <io.h> /* for _commit */
+ #elif !defined(MAC_OSX)
+-#include <sys/prctl.h>
+ #endif
+ 
+ class CBlock;

Added: head/net-p2p/namecoin/files/patch-src__net.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/patch-src__net.cpp	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,25 @@
+--- ./src/net.cpp.orig	2013-10-29 13:38:10.000000000 +0000
++++ ./src/net.cpp	2014-01-18 23:12:20.911138205 +0000
+@@ -51,7 +51,7 @@
+ CAddress addrLocalHost("0.0.0.0", 0, false, nLocalServices);
+ CNode* pnodeLocalHost = NULL;
+ uint64 nLocalHostNonce = 0;
+-array<int, 10> vnThreadsRunning;
++boost::array<int, 10> vnThreadsRunning;
+ SOCKET hListenSocket = INVALID_SOCKET;
+ 
+ vector<CNode*> vNodes;
+@@ -1094,13 +1094,8 @@
+         char intClient[16];
+         char intPort[6];
+ 
+-#if !defined(__WXMSW__) && !defined(MAC_OSX)
+-        r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
+-	                        port, port, lanaddr, 0, "TCP", 0);
+-#else
+         r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
+ 	                        port, port, lanaddr, 0, "TCP", 0, "0");
+-#endif
+         if(r!=UPNPCOMMAND_SUCCESS)
+             printf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
+                 port, port, lanaddr, r, strupnperror(r));

Added: head/net-p2p/namecoin/files/patch-src__qt__configurenamedialog.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/patch-src__qt__configurenamedialog.h	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,12 @@
+--- ./src/qt/configurenamedialog.h.orig	2013-10-29 13:38:10.000000000 +0000
++++ ./src/qt/configurenamedialog.h	2014-01-18 23:12:20.925138619 +0000
+@@ -1,6 +1,9 @@
+ #ifndef CONFIGURENAMEDIALOG_H
+ #define CONFIGURENAMEDIALOG_H
+ 
++#include <sys/socket.h>
++#include <netinet/in.h>
++
+ #include <QDialog>
+ 
+ namespace Ui {

Added: head/net-p2p/namecoin/files/patch-src__qt__managenamespage.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/patch-src__qt__managenamespage.h	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,12 @@
+--- ./src/qt/managenamespage.h.orig	2013-10-29 13:38:10.000000000 +0000
++++ ./src/qt/managenamespage.h	2014-01-18 23:12:20.965138391 +0000
+@@ -1,6 +1,9 @@
+ #ifndef MANAGENAMESPAGE_H
+ #define MANAGENAMESPAGE_H
+ 
++#include <sys/socket.h>
++#include <netinet/in.h>
++
+ #include <QDialog>
+ #include <QSortFilterProxyModel>
+ 

Added: head/net-p2p/namecoin/files/patch-src__serialize.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/files/patch-src__serialize.h	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,21 @@
+--- src/serialize.h.orig	2014-01-19 03:49:23.000000000 +0000
++++ src/serialize.h	2014-01-19 03:52:10.000000000 +0000
+@@ -858,18 +858,6 @@
+     iterator insert(iterator it, const char& x=char()) { return vch.insert(it, x); }
+     void insert(iterator it, size_type n, const char& x) { vch.insert(it, n, x); }
+ 
+-    void insert(iterator it, const_iterator first, const_iterator last)
+-    {
+-        if (it == vch.begin() + nReadPos && last - first <= nReadPos)
+-        {
+-            // special case for inserting at the front when there's room
+-            nReadPos -= (last - first);
+-            memcpy(&vch[nReadPos], &first[0], last - first);
+-        }
+-        else
+-            vch.insert(it, first, last);
+-    }
+-
+     void insert(iterator it, std::vector<char>::const_iterator first, std::vector<char>::const_iterator last)
+     {
+         if (it == vch.begin() + nReadPos && last - first <= nReadPos)

Added: head/net-p2p/namecoin/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net-p2p/namecoin/pkg-descr	Wed Feb 12 18:44:49 2014	(r343950)
@@ -0,0 +1,15 @@
+Namecoin is an open source decentralized key/value registration and transfer
+system based on Bitcoin technology (a decentralized cryptocurrency).
+
+It allows you to:
+
+    * Securely register and transfer arbitrary names (keys), no possible
+      censorship!
+    * Attach values (data) to the names (currently up to 520 bytes, will be
+      extended)
+    * Trade and transact namecoins, the digital currency NMC
+
+To register a name, you must own some namecoins (NMC, the internal
+cryptocurrency used by the software).
+
+WWW: http://namecoin.info/
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Steve Wills freebsd_committer freebsd_triage 2014-02-12 18:45:04 UTC
State Changed
From-To: open->closed

New port added, with minor changes. Thanks!