summaryrefslogtreecommitdiff
path: root/pcr/bitcoin-daemon
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/bitcoin-daemon')
-rw-r--r--pcr/bitcoin-daemon/PKGBUILD56
-rw-r--r--pcr/bitcoin-daemon/bitcoin-daemon.install20
-rw-r--r--pcr/bitcoin-daemon/makefile.parabola86
-rw-r--r--pcr/bitcoin-daemon/rc.bitcoind35
4 files changed, 197 insertions, 0 deletions
diff --git a/pcr/bitcoin-daemon/PKGBUILD b/pcr/bitcoin-daemon/PKGBUILD
new file mode 100644
index 000000000..8815eae9f
--- /dev/null
+++ b/pcr/bitcoin-daemon/PKGBUILD
@@ -0,0 +1,56 @@
+# Maintainer: fauno <fauno@kiwwwi.com.ar>
+# Contributor (Arch): Artefact2 <artefact2@gmail.com>
+# Contributor (Arch): shahid <helllamer@gmail.com>
+# Based on bitcoin by
+# Maintainer (Arch): shahid <helllamer@gmail.com>
+
+pkgname=bitcoin-daemon
+_pkgname=bitcoin
+pkgver=0.5.2
+pkgrel=1
+pkgdesc="Bitcoin is a peer-to-peer network based digital currency (daemon with JSON-RPC interface)."
+arch=('i686' 'x86_64' 'mips64el')
+url="http://www.bitcoin.org/"
+depends=('expat' 'boost-libs>=1.46' 'miniupnpc>=1.6' 'openssl')
+makedepends=('boost' 'gcc' 'make')
+conflicts=('bitcoin')
+license=('MIT')
+install="bitcoin-daemon.install"
+source=("http://downloads.sourceforge.net/sourceforge/${_pkgname}/${_pkgname}-${pkgver}-linux.tar.gz"
+ bitcoin-daemon.install
+ rc.bitcoind)
+
+s1=$srcdir/${_pkgname}-${pkgver}-linux
+src=$s1/src/src
+makefile_unix=makefile.unix
+md5sums=('6d40f645ddc042de26d64e83656f38e0'
+ '0375ba4d6c3425eee350dc8b7575403d'
+ '7faa439885f3adbba5847ae75aac5484')
+
+build() {
+ cd $src
+
+ msg "Patching $makefile_unix..."
+ sed -i $makefile_unix \
+ -e 's/\(-DNOPCH\)/\1 -DBOOST_FILESYSTEM_VERSION=2/' \
+ -e 's/-Bstatic/--as-needed ${LDFLAGS}/g' \
+ -e 's/\(USE_UPNP:=\)0/\11/' \
+ -e 's/$(DEBUGFLAGS)//g' \
+ -e 's/CXXFLAGS/CPPFLAGS/g' \
+ -e 's/-O[0-3]/${CXXFLAGS}/g'
+
+ # make bitcoind
+ make $MAKEFLAGS -f $makefile_unix bitcoind
+}
+
+package() {
+ # get compiled binaries
+ mkdir -p ${pkgdir}/{var/lib/${pkgname},usr/{share/licenses/${pkgname},bin},etc/rc.d}
+
+ install -D -m755 ${src}/bitcoind ${pkgdir}/usr/bin/
+
+ install -D -m755 ${srcdir}/rc.bitcoind ${pkgdir}/etc/rc.d/
+
+ install -D -m 644 ${s1}/COPYING \
+ ${pkgdir}/usr/share/licenses/${pkgname}/
+}
diff --git a/pcr/bitcoin-daemon/bitcoin-daemon.install b/pcr/bitcoin-daemon/bitcoin-daemon.install
new file mode 100644
index 000000000..5b2ffec92
--- /dev/null
+++ b/pcr/bitcoin-daemon/bitcoin-daemon.install
@@ -0,0 +1,20 @@
+post_install() {
+ echo "==> Creating the bitcoin user…"
+ groupadd -g 8333 bitcoin
+ useradd -d /var/lib/bitcoin-daemon -g 8333 -u 8333 -s /bin/false -N bitcoin
+
+ pw="$RANDOM$RANDOM$RANDOM"
+ echo "==> Setting the default RPC password to $pw"
+ echo "rpcpassword=$pw" >> /var/lib/bitcoin-daemon/bitcoin.conf
+
+ chown 8333:8333 /var/lib/bitcoin-daemon/bitcoin.conf
+ chmod 400 /var/lib/bitcoin-daemon/bitcoin.conf
+ echo "==> You can add bitcoind to your DAEMONS array in rc.conf."
+}
+
+post_remove() {
+ echo "==> Deleting the bitcoin user…"
+ groupdel bitcoin
+ userdel bitcoin
+ echo "==> Your configuration file and wallet is still in /opt/bitcoin-daemon."
+}
diff --git a/pcr/bitcoin-daemon/makefile.parabola b/pcr/bitcoin-daemon/makefile.parabola
new file mode 100644
index 000000000..984750982
--- /dev/null
+++ b/pcr/bitcoin-daemon/makefile.parabola
@@ -0,0 +1,86 @@
+# Copyright (c) 2009-2010 Satoshi Nakamoto
+# Rewritten for Archlinux by shahid
+# Distributed under the MIT/X11 software license, see the accompanying
+# file license.txt or http://www.opensource.org/licenses/mit-license.php.
+
+CXX=g++
+
+INCLUDEPATHS= \
+ -I"/usr/include" \
+
+LIBPATHS= \
+ -L"/usr/lib" \
+ -L"/usr/local/lib"
+
+DEFS=-DNOPCH -DFOURWAYSSE2 -DUSE_SSL
+
+USE_UPNP:=1
+
+# --as-needed lazy linking set as default behavior of ld because i guess, there are useless libs here
+# Of couse, this may be overriden by LDFLAGS in makepkg.conf
+LIBS= \
+ -Wl,--as-needed \
+ ${LDFLAGS} \
+ -l boost_system \
+ -l boost_filesystem \
+ -l boost_program_options \
+ -l boost_thread \
+ -l db_cxx \
+
+ifdef USE_UPNP
+ LIBS += -l miniupnpc
+ DEFS += -DUSE_UPNP=$(USE_UPNP)
+endif
+
+LIBS+= \
+ -l gthread-2.0 \
+ -l z \
+ -l dl \
+ -l ssl \
+ -l crypto
+
+#DEBUGFLAGS=-g -D__WXDEBUG__
+CCFLAGS=${CXXFLAGS} -DBOOST_FILESYSTEM_DEPRECATED -Wno-invalid-offsetof -Wformat $(WXDEFS) $(INCLUDEPATHS) $(DEFS)
+HEADERS=headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \
+ script.h db.h net.h irc.h main.h rpc.h uibase.h ui.h noui.h init.h
+
+OBJS= \
+ obj/util.o \
+ obj/script.o \
+ obj/db.o \
+ obj/net.o \
+ obj/irc.o \
+ obj/main.o \
+ obj/rpc.o \
+ obj/init.o \
+ cryptopp/obj/sha.o \
+ cryptopp/obj/cpu.o
+
+
+all: bitcoin
+
+
+headers.h.gch: headers.h $(HEADERS)
+ $(CXX) -c $(CCFLAGS) -DGUI -o $@ $<
+
+obj/%.o: %.cpp $(HEADERS) headers.h.gch
+ $(CXX) -c $(CCFLAGS) -DGUI -o $@ $<
+
+# -DCRYPTOPP_DISABLE_SSE2
+cryptopp/obj/%.o: cryptopp/%.cpp
+ $(CXX) -c $(CCFLAGS) -O3 -o $@ $<
+
+bitcoin: $(OBJS) obj/ui.o obj/uibase.o
+ $(CXX) $(CCFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) $(WXLIBS)
+
+obj/nogui/%.o: %.cpp $(HEADERS)
+ $(CXX) -c $(CCFLAGS) -o $@ $<
+
+bitcoind: $(OBJS:obj/%=obj/nogui/%)
+ $(CXX) $(CCFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS)
+
+clean:
+ -rm -f obj/*.o
+ -rm -f obj/nogui/*.o
+ -rm -f cryptopp/obj/*.o
+ -rm -f headers.h.gch
diff --git a/pcr/bitcoin-daemon/rc.bitcoind b/pcr/bitcoin-daemon/rc.bitcoind
new file mode 100644
index 000000000..be09251d1
--- /dev/null
+++ b/pcr/bitcoin-daemon/rc.bitcoind
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+case "$1" in
+ start)
+ stat_busy "Starting bitcoind"
+ su -s /bin/bash -c "nohup bitcoind -gen=0 -datadir=/var/lib/bitcoin-daemon &" bitcoin > /dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon bitcoind
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping bitcoind"
+ su -s /bin/bash -c "bitcoind -datadir=/var/lib/bitcoin-daemon stop" bitcoin &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon bitcoind
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 1
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0