diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-04-05 14:26:38 +0000 |
commit | 415856bdd4f48ab4f2732996f0bae58595092bbe (patch) | |
tree | ede2018b591f6dfb477fe9341ba17b9bc000fab9 /social/bitcoin-daemon |
Tue Apr 5 14:26:38 UTC 2011
Diffstat (limited to 'social/bitcoin-daemon')
-rw-r--r-- | social/bitcoin-daemon/PKGBUILD | 55 | ||||
-rw-r--r-- | social/bitcoin-daemon/bitcoin-daemon.install | 18 | ||||
-rw-r--r-- | social/bitcoin-daemon/makefile.archlinux | 72 | ||||
-rw-r--r-- | social/bitcoin-daemon/rc.bitcoind | 35 |
4 files changed, 180 insertions, 0 deletions
diff --git a/social/bitcoin-daemon/PKGBUILD b/social/bitcoin-daemon/PKGBUILD new file mode 100644 index 000000000..4728160d0 --- /dev/null +++ b/social/bitcoin-daemon/PKGBUILD @@ -0,0 +1,55 @@ +# Maintainer: fauno <fauno@kiwwwi.com.ar> +# Contributor: Artefact2 <artefact2@gmail.com> +# Contributor: shahid <helllamer@gmail.com> + +pkgname=bitcoin-daemon +_pkgname=bitcoin +pkgver=0.3.20.2 +_bcver=0.3.20 +pkgrel=1 +pkgdesc="Bitcoin is a peer-to-peer network based digital currency." +arch=('i686' 'x86_64') +url="http://www.bitcoin.org/" +depends=('expat' 'boost-libs>=1.43') +makedepends=('boost') +conflicts=('bitcoin-bin' 'bitcoin') +license=('MIT') +install="bitcoin-daemon.install" +source=(http://ufpr.dl.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-$_bcver/bitcoin-$pkgver-linux.tar.gz + makefile.archlinux + bitcoin-daemon.install + rc.bitcoind) +md5sums=('f527a2669f4cfe82abf1fe9bea070c64' + '8e2ff558c2538e53c177513ad7d8b9a5' + 'a388684057de2bb543cb7f795dc693cf' + '4a9ab4997487bb5f8e3c6b1d580045af') + +build() { + cd $srcdir/${_pkgname}-${pkgver}/src + + # copy correct makefile to src dir + cp $srcdir/makefile.archlinux Makefile + + # fixes... + mkdir -p obj/nogui 2>/dev/null + rm -f cryptopp/obj/* + + # to build (single-threaded make due to OOM issues) + make bitcoind +} + +package() { + cd $srcdir/${_pkgname}-${pkgver} + mkdir -p $pkgdir/{usr/bin,usr/share/licenses/$pkgname,etc/rc.d,var/lib/$pkgname} + + install -D -m755 ./src/bitcoind $pkgdir/usr/bin/ + install -D -m755 $srcdir/rc.bitcoind $pkgdir/etc/rc.d/bitcoind + install -m 644 ./license.txt $pkgdir/usr/share/licenses/$pkgname/ + + # strip shit from executables + find $pkgdir/usr/bin/ -type f | xargs -L1 strip + + # the bitcoin data directory should not readable by others (wallet is sensitive data) + chown -R 8333:8333 $pkgdir/var/lib/$pkgname + chmod -R 700 $pkgdir/var/lib/$pkgname +} diff --git a/social/bitcoin-daemon/bitcoin-daemon.install b/social/bitcoin-daemon/bitcoin-daemon.install new file mode 100644 index 000000000..2eea98e2c --- /dev/null +++ b/social/bitcoin-daemon/bitcoin-daemon.install @@ -0,0 +1,18 @@ +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/social/bitcoin-daemon/makefile.archlinux b/social/bitcoin-daemon/makefile.archlinux new file mode 100644 index 000000000..062a29d82 --- /dev/null +++ b/social/bitcoin-daemon/makefile.archlinux @@ -0,0 +1,72 @@ +# 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. + + +INCLUDEPATHS= \ + -I"/usr/include" \ + +LIBPATHS= \ + -L"/usr/lib" \ + -L"/usr/local/lib" + +LIBS= \ + -Wl,-Bstatic \ + -l boost_system \ + -l boost_filesystem \ + -l boost_program_options \ + -l boost_thread \ + -l db_cxx \ + -l crypto \ + -Wl,-Bdynamic \ + -l gthread-2.0 \ + ${LDFLAGS} + +DEBUGFLAGS=-g -D__WXDEBUG__ +CCFLAGS=${CXXFLAGS} -Wno-invalid-offsetof -Wformat $(WXDEFS) $(INCLUDEPATHS) +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) + g++ -c $(CCFLAGS) -DGUI -o $@ $< + +obj/%.o: %.cpp $(HEADERS) headers.h.gch + g++ -c $(CCFLAGS) -DGUI -o $@ $< + +# -DCRYPTOPP_DISABLE_SSE2 +cryptopp/obj/%.o: cryptopp/%.cpp + g++ -c $(CCFLAGS) -O3 -o $@ $< + +bitcoin: $(OBJS) obj/ui.o obj/uibase.o + g++ $(CCFLAGS) -o $@ $(LIBPATHS) $^ $(WXLIBS) $(LIBS) + + +obj/nogui/%.o: %.cpp $(HEADERS) + g++ -c $(CCFLAGS) -o $@ $< + +bitcoind: $(OBJS:obj/%=obj/nogui/%) + g++ $(CCFLAGS) -o $@ $(LIBPATHS) $^ $(LIBS) -ldl -lz + + +clean: + -rm -f obj/*.o + -rm -f obj/nogui/*.o + -rm -f cryptopp/obj/*.o + -rm -f headers.h.gch diff --git a/social/bitcoin-daemon/rc.bitcoind b/social/bitcoin-daemon/rc.bitcoind new file mode 100644 index 000000000..98d713ffd --- /dev/null +++ b/social/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 -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 |