aboutsummaryrefslogtreecommitdiffstats
path: root/community/bitcoin
diff options
context:
space:
mode:
authorStuart Cardall <developer@it-offshore.co.uk>2016-08-18 20:46:53 +0000
committerCarlo Landmeter <clandmeter@gmail.com>2016-08-21 22:24:04 +0200
commit5c9f3ca3e307be53b45beeed2ce1626f38008625 (patch)
tree919836fe454e953f46685adf8228b0401280d4b6 /community/bitcoin
parent6a00a953ba02bab6440a2c784e7db37c6eaeace1 (diff)
downloadaports-5c9f3ca3e307be53b45beeed2ce1626f38008625.tar.bz2
aports-5c9f3ca3e307be53b45beeed2ce1626f38008625.tar.xz
testing/[various]: move to community
albatross-themes apk-post-messages autossh bitcoin btrbk entr ffmpegthumbnailer firejail firetools fwsnort gnome-colors imapsync inetutils-syslogd inotify-tools-inc isync junit ktsuss letsencrypt-nosudo libmbim libndp libqmi libteam mini-sendmail modemmanager namecoin networkmanager nginx-naxsi numix-themes nxapi opencl-headers opencl-icd-loader opus-tools perl-authen-ntlm perl-bit-vector perl-data-uniqid perl-file-copy-recursive perl-getopt-argvfile perl-io-tee perl-iptables-chainmgr perl-iptables-parse perl-module-scandeps perl-par-dist perl-par-packer perl-par perl-uri-escape psad py-crcmod py-graphviz py-lz4 py-opencl py-opengl-accelerate runit secpwgen secure-delete socklog spacefm tinyssh udevil virt-viewer virtualbricks whois wrk xpra zram-init
Diffstat (limited to 'community/bitcoin')
-rw-r--r--community/bitcoin/APKBUILD102
-rw-r--r--community/bitcoin/bitcoin.conf13
-rw-r--r--community/bitcoin/bitcoin.initd38
-rw-r--r--community/bitcoin/bitcoin.post-install35
-rw-r--r--community/bitcoin/bitcoin.pre-install6
-rw-r--r--community/bitcoin/ssize_t.patch12
6 files changed, 206 insertions, 0 deletions
diff --git a/community/bitcoin/APKBUILD b/community/bitcoin/APKBUILD
new file mode 100644
index 0000000000..59101b5005
--- /dev/null
+++ b/community/bitcoin/APKBUILD
@@ -0,0 +1,102 @@
+# Contributor: Natanael Copa <ncopa@alpinelinux.org>
+# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
+pkgname=bitcoin
+pkgver=0.13.0_rc2
+_ver=${pkgver/_/}
+pkgrel=1
+pkgdesc="decentralized P2P electronic cash system"
+url="http://www.bitcoin.org/"
+arch="all"
+license="MIT"
+depends_dev=""
+makedepends="$depends_dev autoconf automake libtool boost-dev openssl-dev db-dev miniupnpc-dev qt5-qtbase-dev
+ qt5-qttools-dev protobuf-dev libqrencode-dev libevent-dev chrpath"
+install="$pkgname.post-install $pkgname.pre-install"
+subpackages="$pkgname-dev $pkgname-qt $pkgname-cli $pkgname-tx $pkgname-tests"
+source="$pkgname-$_ver.tar.gz::https://github.com/bitcoin/bitcoin/archive/v${_ver}.tar.gz
+ ssize_t.patch
+ $pkgname.initd
+ $pkgname.conf
+ "
+
+_builddir="$srcdir"/bitcoin-$_ver
+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
+ ./autogen.sh
+}
+
+build() {
+ cd "$_builddir"
+ ./configure \
+ --build=$CBUILD \
+ --host=$CHOST \
+ --prefix=/usr \
+ --mandir=/usr/share/man \
+ --with-incompatible-bdb \
+ --with-gui=qt5 \
+ --with-utils \
+ --disable-ccache \
+ --disable-static \
+ --enable-hardening \
+ || return 1
+ make || return 1
+}
+
+package() {
+ cd "$_builddir"
+ make install DESTDIR="$pkgdir" || return 1
+ 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
+ rm -f "$pkgdir"/usr/lib/*.la
+}
+
+qt() {
+ pkgdesc="Bitcoin with a Qt frontend & QR Code support"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/bitcoin-qt "$subpkgdir"/usr/bin/ || return 1
+}
+
+cli() {
+ pkgdesc="Bitcoin CLI"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/bitcoin-cli "$subpkgdir"/usr/bin/ || return 1
+}
+
+tx() {
+ pkgdesc="Bitcoin TX (Transaction Tool)"
+ mkdir -p "$subpkgdir"/usr/bin
+ mv "$pkgdir"/usr/bin/bitcoin-tx "$subpkgdir"/usr/bin/ || return 1
+}
+
+tests() {
+ pkgdesc="Bitcoin & Bitcoin-QT Unit Tests)"
+ mkdir -p "$subpkgdir"/usr/bin
+ chrpath -d "$pkgdir"/usr/bin/test_bitcoin || return 1
+ mv "$pkgdir"/usr/bin/test_bitcoin-qt "$subpkgdir"/usr/bin/ || return 1
+ mv "$pkgdir"/usr/bin/test_bitcoin "$subpkgdir"/usr/bin/ || return 1
+}
+
+dev() {
+ mkdir -p "$subpkgdir"/usr
+ mv "$pkgdir"/usr/lib "$subpkgdir"/usr/ || return 1
+ mv "$pkgdir"/usr/include "$subpkgdir"/usr/ || return 1
+}
+
+md5sums="f85ff5ce0dd0253e07179bc5a562e128 bitcoin-0.13.0rc2.tar.gz
+716a88e668729e89d3eb929da86f7f04 ssize_t.patch
+70a29202a5fa77e50e92083b014909c9 bitcoin.initd
+3e9b4a37bb46e6cd83b6824870c58484 bitcoin.conf"
+sha256sums="163d2b6af8b34a200d884a89a678cb9f12269f596bcaa37da28bd68f06d1c85b bitcoin-0.13.0rc2.tar.gz
+f0a094c7b374338ad153ee06b7dd2369dad6b97b1f1bb0252da12c9aaace5321 ssize_t.patch
+432b769f9e7cc2e728d72dd38c20ef54132da4a36134988e3401c8451f31bc42 bitcoin.initd
+b7a31bf251f1011ab6584b610acac8494612c2012e9771985228c36c08a315ac bitcoin.conf"
+sha512sums="bc7b87e2d3acaba46159e4b8a360adc5efa0bf7cc75dfa7a653cb4099efe7325304ebed8774ee8da9d380f548dbdc94e407c693d54ecf85cb076be9405350c64 bitcoin-0.13.0rc2.tar.gz
+98aa5ad81bdb4ae961b791bc978c39117cdf2d83c2181f92bebbb0db107d9b6e86eda265fb3f93ff8a5ca8a7754d7148818b98095d57201dff9363d60b97e7dd ssize_t.patch
+cb2454c353014213bd25fbb938affe79639aa82542c560eaa910e4d9fc01d1cbfec6d8ff004aab9a123ca62e26ed2ebeb264b052a36d3d7154758061065664ab bitcoin.initd
+48abce0f0a5b088c957aa5cb2bcf9bb520593caa7a20019bdf785e43f7d2459968240d4529dfa30be2fca92891bf50c1253a513530511e99d8ee471d9ff6bd95 bitcoin.conf"
diff --git a/community/bitcoin/bitcoin.conf b/community/bitcoin/bitcoin.conf
new file mode 100644
index 0000000000..4f070b19ec
--- /dev/null
+++ b/community/bitcoin/bitcoin.conf
@@ -0,0 +1,13 @@
+### Bitcoin configuration for Alpine Linux ####
+# #
+##### data directory is /var/lib/bitcoin ######
+##### & set in /etc/init.d/bitcoin 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 bitcoins
+
diff --git a/community/bitcoin/bitcoin.initd b/community/bitcoin/bitcoin.initd
new file mode 100644
index 0000000000..393ea45374
--- /dev/null
+++ b/community/bitcoin/bitcoin.initd
@@ -0,0 +1,38 @@
+#!/sbin/openrc-run
+
+# Bitcoin init.d file for Alpine Linux.
+
+name=bitcoind
+daemon=/usr/bin/$name
+config=/etc/bitcoin.conf
+user=bitcoin
+group=bitcoin
+## supercedes datadir set in $config ##
+datadir=/var/lib/bitcoin
+pidfile=/var/run/bitcoin/$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/community/bitcoin/bitcoin.post-install b/community/bitcoin/bitcoin.post-install
new file mode 100644
index 0000000000..9d2510fb2d
--- /dev/null
+++ b/community/bitcoin/bitcoin.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/bitcoin |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 -F "changeme" $config 1>/dev/null; then
+ GenPasswd
+fi
+
+exit 0
diff --git a/community/bitcoin/bitcoin.pre-install b/community/bitcoin/bitcoin.pre-install
new file mode 100644
index 0000000000..3f83b3810a
--- /dev/null
+++ b/community/bitcoin/bitcoin.pre-install
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+addgroup -S bitcoin 2>/dev/null
+adduser -S -D -H -h /var/lib/bitcoin -s /sbin/nologin -G bitcoin -g bitcoin bitcoin 2>/dev/null
+
+exit 0
diff --git a/community/bitcoin/ssize_t.patch b/community/bitcoin/ssize_t.patch
new file mode 100644
index 0000000000..2c21854ea3
--- /dev/null
+++ b/community/bitcoin/ssize_t.patch
@@ -0,0 +1,12 @@
+diff --git a/src/leveldb/db/db_iter.cc b/src/leveldb/db/db_iter.cc
+index 071a54e..68a18f2 100644
+--- a/src/leveldb/db/db_iter.cc
++++ b/src/leveldb/db/db_iter.cc
+@@ -2,6 +2,7 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file. See the AUTHORS file for names of contributors.
+
++#include <sys/types.h>
+ #include "db/db_iter.h"
+
+ #include "db/filename.h"