aboutsummaryrefslogtreecommitdiffstats
path: root/testing/namecoin
diff options
context:
space:
mode:
Diffstat (limited to 'testing/namecoin')
-rw-r--r--testing/namecoin/10-use-latest-UPnP-lib.patch11
-rw-r--r--testing/namecoin/20-boost-multithread-dynamic.patch37
-rw-r--r--testing/namecoin/30-set-default-env.patch38
-rw-r--r--testing/namecoin/APKBUILD79
-rw-r--r--testing/namecoin/namecoin.conf13
-rw-r--r--testing/namecoin/namecoin.initd38
-rw-r--r--testing/namecoin/namecoin.post-install35
-rw-r--r--testing/namecoin/namecoin.pre-install5
8 files changed, 256 insertions, 0 deletions
diff --git a/testing/namecoin/10-use-latest-UPnP-lib.patch b/testing/namecoin/10-use-latest-UPnP-lib.patch
new file mode 100644
index 0000000000..70607bdcaf
--- /dev/null
+++ b/testing/namecoin/10-use-latest-UPnP-lib.patch
@@ -0,0 +1,11 @@
+--- a/src/net.cpp
++++ b/src/net.cpp
+@@ -1087,7 +1087,7 @@
+
+ #ifndef __WXMSW__
+ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
+- port, port, lanaddr, 0, "TCP", 0);
++ port, port, lanaddr, 0, "TCP", 0, "0");
+ #else
+ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype,
+ port, port, lanaddr, 0, "TCP", 0, "0");
diff --git a/testing/namecoin/20-boost-multithread-dynamic.patch b/testing/namecoin/20-boost-multithread-dynamic.patch
new file mode 100644
index 0000000000..d6cdc2f043
--- /dev/null
+++ b/testing/namecoin/20-boost-multithread-dynamic.patch
@@ -0,0 +1,37 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -9,27 +9,23 @@
+ DEFS += -DBOOST_THREAD_USE_LIB
+
+ INCLUDEPATHS= \
+- -I../libs/openssl-1.0.1e/include \
+- -I../libs/db-4.7.25.NC/build_unix \
+- -I../libs/boost_1_50_0
++ -I/usr/include
+
+ LIBPATHS= \
+- -L../libs/openssl-1.0.1e \
+- -L../libs/db-4.7.25.NC/build_unix \
+- -L../libs/boost_1_50_0/stage/lib
++ -L/usr/lib
+
+ LIBBOOST_SUFFIX=
+
+ LIBS= \
+- -Wl,-Bstatic \
++ -Wl,-Bdynamic \
+ -l boost_system$(LIBBOOST_SUFFIX) \
+ -l boost_filesystem$(LIBBOOST_SUFFIX) \
+- -l boost_program_options$(LIBBOOST_SUFFIX) \
+- -l boost_thread$(LIBBOOST_SUFFIX) \
+- -l boost_chrono$(LIBBOOST_SUFFIX) \
++ -l boost_program_options-mt$(LIBBOOST_SUFFIX) \
++ -l boost_thread-mt$(LIBBOOST_SUFFIX) \
++ -l boost_chrono-mt$(LIBBOOST_SUFFIX) \
+ -l db_cxx \
+ -l ssl \
+- -l crypto
++ -l crypto
+
+ namecoin: USE_UPNP:=1
+ ifdef USE_UPNP
diff --git a/testing/namecoin/30-set-default-env.patch b/testing/namecoin/30-set-default-env.patch
new file mode 100644
index 0000000000..5ff0162dc9
--- /dev/null
+++ b/testing/namecoin/30-set-default-env.patch
@@ -0,0 +1,38 @@
+--- a/src/init.cpp
++++ b/src/init.cpp
+@@ -98,6 +98,16 @@
+ #ifndef GUI
+ int main(int argc, char* argv[])
+ {
++ #ifndef WIN32
++ try
++ {
++ boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
++ } catch(std::runtime_error &e)
++ {
++ setenv("LC_ALL", "C", 1); // Force C locale
++ }
++ #endif
++
+ bool fRet = false;
+ fRet = AppInit(argc, argv);
+
+--- a/src/qt/bitcoin.cpp
++++ b/src/qt/bitcoin.cpp
+@@ -122,6 +122,16 @@
+ #ifndef BITCOIN_QT_TEST
+ int main(int argc, char *argv[])
+ {
++ #ifndef WIN32
++ try
++ {
++ boost::filesystem::path::codecvt(); // Raises runtime error if current locale is invalid
++ } catch(std::runtime_error &e)
++ {
++ setenv("LC_ALL", "C", 1); // Force C locale
++ }
++ #endif
++
+ // Command-line options take precedence:
+ ParseParameters(argc, argv);
+
diff --git a/testing/namecoin/APKBUILD b/testing/namecoin/APKBUILD
new file mode 100644
index 0000000000..f852378963
--- /dev/null
+++ b/testing/namecoin/APKBUILD
@@ -0,0 +1,79 @@
+# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
+# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
+pkgname=namecoin
+pkgver=3.72
+pkgrel=0
+pkgdesc="Namecoin is a peer to peer DNS based on bitcoin"
+url="https://github.com/namecoin/namecoin"
+arch="all"
+license="GPL"
+depends=""
+depends_dev="openssl-dev db-dev boost-dev miniupnpc-dev glib-dev qt-dev"
+makedepends="$depends_dev"
+install="$pkgname.post-install $pkgname.pre-install"
+subpackages="$pkgname-qt"
+source="$pkgname-$pkgver.tar.gz::https://github.com/namecoin/namecoin/archive/vQ.$pkgver.tar.gz
+ 10-use-latest-UPnP-lib.patch
+ 20-boost-multithread-dynamic.patch
+ 30-set-default-env.patch
+ $pkgname.initd
+ $pkgname.conf
+ "
+
+_builddir="$srcdir"/namecoin-vQ.$pkgver
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"/src
+ # build namecoind
+ make USE_UPNP=1 USE_SSL=1 || return 1
+ cd ..
+ # build namecoin-qt
+ qmake
+ # Fix boost_multi thread linking in the GUI too
+ sed -i 's/-lboost_thread/-lboost_thread-mt/g' ./Makefile
+ sed -i 's/-lboost_program_options/-lboost_program_options-mt/g' ./Makefile
+ sed -i 's/-lboost_chrono/-lboost_chrono-mt/g' ./Makefile
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"/src
+ install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname || return 1
+ install -m600 -D "$srcdir"/$pkgname.conf "$pkgdir"/etc/$pkgname.conf || return 1
+ install -Dm755 namecoind "$pkgdir"/usr/bin/namecoind || return 1
+}
+
+qt() {
+ pkgdesc="Namecoin with a Qt frontend"
+ cd "$_builddir"
+ mkdir -p "$subpkgdir"/usr/bin
+ install -Dm755 namecoin-qt "$subpkgdir"/usr/bin/namecoin-qt || return 1
+}
+
+md5sums="dc1cc80bcf0833f0bf7239e7ae6c1399 namecoin-3.72.tar.gz
+d7fdd69e1918b3ab7887e55043807aed 10-use-latest-UPnP-lib.patch
+c77c66d690ba5d1c35e5362809737c75 20-boost-multithread-dynamic.patch
+a1dde84304c5792a39264b5a02f902e8 30-set-default-env.patch
+9ecdbd9e17240075d064498a80fd50bd namecoin.initd
+59b2e0e765738ba48f632051fb6917ae namecoin.conf"
+sha256sums="8c30214186bf0baf4f779235e82715a99686c8c358524ffa352b88e2a3d98725 namecoin-3.72.tar.gz
+08eebd4cd4c021fafcb90146661950214c07aaf420cb6d14f76bb853712344f2 10-use-latest-UPnP-lib.patch
+a605ee805cd2de213188bbe87b43929134538646797daf9a8635fa7824b5c20e 20-boost-multithread-dynamic.patch
+e05690acce74a1eb0a2f28d45b6190218b61f4a759f0e53e2837816da3a6ba09 30-set-default-env.patch
+04ae66115343aa8ed7343139a2370b1e570c8ab4397d09457f5f157dd906a204 namecoin.initd
+4b413833527929ea863351469a5a4fc1e0ac365fe9df5e8a8304d8667acf8cea namecoin.conf"
+sha512sums="fac3b0cb3d02ccb438869752581ab57df6dd8e47201e613e73c64459009d9d20358f6595400938e61bf795f679466a098bbc77f1b2940591ec93d04cc387ea32 namecoin-3.72.tar.gz
+f33c9080c462550030a559f0a5564d67150712151ffcb2be75474b56e0083c561dbe4d9f5d6699fe1fb915f54bda342c0e217502594035da6afd3c92cf9ab0b2 10-use-latest-UPnP-lib.patch
+c98027c1f51f411053c64279a9740ee66002f7dc13618363ec64b9f9a77a47ee535b95d810c50057a86d63c370b86bb7108f46cf6db5dfb627da80fdd1cb38ab 20-boost-multithread-dynamic.patch
+b3a074f3c3e5a0e4c22e75894b0b2d3152b4b22853b27621aa2e325ba274adec4562577779d63dd795ef0fd543699ecb3474329cec6e20347f6122446746a77b 30-set-default-env.patch
+3048248b3da7300b0b3cb5667283badc17b41e6c90573604fd9ea9eb9933e93f9b1d6288846793b4e7a001a4cae5e52d2ce42e4bdc83e48f72aca6ee0e8ddd43 namecoin.initd
+3f92cb9a5f66d0e9e3792691b2e62b929c092030273bb87ebd9564e0c02196a5a9f69c458162f1b35099ac28e9b79b1c4035144b9d2dae4ad3e87d05a40d7ed4 namecoin.conf"
diff --git a/testing/namecoin/namecoin.conf b/testing/namecoin/namecoin.conf
new file mode 100644
index 0000000000..dd48332259
--- /dev/null
+++ b/testing/namecoin/namecoin.conf
@@ -0,0 +1,13 @@
+### Namecoin configuration for Alpine Linux ###
+# #
+##### data directory is /var/lib/namecoin #####
+##### & set in /etc/init.d/namecoin not here ##
+#
+#proxy=127.0.0.1:9050 #use TOR Socks Proxy
+rpcallowip=127.0.0.1
+rpcuser=changeme
+rpcpassword=changeme
+rpcport=changeme
+daemon=1
+#gen=1 #generate namecoins
+
diff --git a/testing/namecoin/namecoin.initd b/testing/namecoin/namecoin.initd
new file mode 100644
index 0000000000..9bdeea0893
--- /dev/null
+++ b/testing/namecoin/namecoin.initd
@@ -0,0 +1,38 @@
+#!/sbin/runscript
+
+# Namecoin init.d file for Alpine Linux.
+
+name=namecoind
+daemon=/usr/bin/$name
+config=/etc/namecoin.conf
+user=namecoin
+group=namecoin
+## supercedes datadir set in $config ##
+datadir=/var/lib/namecoin
+pidfile=/var/run/namecoin/$name.pid
+
+depend() {
+ need net
+ after logger firewall
+}
+
+start() {
+ ebegin "Starting ${name}"
+ # enforce permissions
+ checkpath -q -d ${pidfile%/*} -o ${user}:${group}
+ checkpath -q -d ${datadir} -m 0700 -o ${user}:${group}
+ checkpath -q -f ${config} -m 0600 -o ${user}:${group}
+ start-stop-daemon --start --quiet \
+ --pidfile ${pidfile} \
+ --user ${user}:${group} \
+ --exec ${daemon} -- -conf=${config} -datadir=${datadir} -pid=${pidfile}
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping ${name}"
+ start-stop-daemon --stop --quiet \
+ --pidfile ${pidfile} \
+ --exec ${daemon}
+ eend $?
+}
diff --git a/testing/namecoin/namecoin.post-install b/testing/namecoin/namecoin.post-install
new file mode 100644
index 0000000000..78fa9e6103
--- /dev/null
+++ b/testing/namecoin/namecoin.post-install
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+NORMAL="\033[1;0m"
+STRONG="\033[1;1m"
+GREEN="\033[1;32m"
+
+config=$(grep -F 'config=' /etc/init.d/namecoin |sed 's/config=//')
+
+randgen() {
+ output=$(cat /dev/urandom | tr -dc '0-9a-zA-Z!@#$%^&*_+-' | head -c${1:-$1}) 2>/dev/null
+ echo $output
+}
+
+findRandomTcpPort(){
+ port=$(( 1024 + $(( $RANDOM % $(( 65534 - 1024 )) )) ))
+ while netstat -atn | grep -q :$port; do port=$(expr $port + 1); done; echo $port
+}
+
+GenPasswd(){
+ sed -i "/rpcuser=/ c \rpcuser=USER-"$(randgen 32)"" $config
+ sed -i "/rpcpassword=/ c \rpcpassword=PW-"$(randgen 64)"" $config
+ sed -i "/rpcport=/ c \rpcport="$(findRandomTcpPort)"" $config
+ print_green "Generated random user / password / port in:" " $config\n"
+}
+
+print_green() {
+ local prompt="${STRONG}$1${GREEN}$2${NORMAL}"
+ printf "${prompt}%s"
+}
+
+if grep -Fz "changeme" $config; then
+ GenPasswd
+fi
+
+exit 0
diff --git a/testing/namecoin/namecoin.pre-install b/testing/namecoin/namecoin.pre-install
new file mode 100644
index 0000000000..33c72d1463
--- /dev/null
+++ b/testing/namecoin/namecoin.pre-install
@@ -0,0 +1,5 @@
+#!/bin/sh
+addgroup -S namecoin 2>/dev/null
+adduser -S -h /var/lib/namecoin -g namecoin -G namecoin -D -s /sbin/nologin namecoin 2>/dev/null
+exit 0
+