diff options
-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 | ||||
-rwxr-xr-x | 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..6abe2303a --- /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.01 +_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://downloads.sourceforge.net/sourceforge/${_pkgname}/${_pkgname}-${pkgver}-linux.tar.gz" + "makefile.archlinux" + "bitcoin-daemon.install" + "rc.bitcoind") + +build() { + cd $srcdir/${_pkgname}-${_bcver}/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}-${_bcver} + 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 +} +md5sums=('e10954969479c0bcee16cce5061ddb20' + 'c8676f09f2ab8e2e216cc694ff00168e' + 'a388684057de2bb543cb7f795dc693cf' + '4a9ab4997487bb5f8e3c6b1d580045af') 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..46e0edf41 --- /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-mt \ + -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 100755 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 |