| 1 | # Contributor: Thomas Mudrunka <harvie@@email..cz> |
| 2 | # Maintainer: Thomas Mudrunka <harvie@@email..cz> |
| 3 | # You can also contact me on http://blog.harvie.cz/ |
| 4 | |
| 5 | pkgname=riak |
| 6 | pkgver=0.11.0 |
| 7 | pkgrel=1 |
| 8 | pkgdesc="NOSQL database engine providing decentralized key-value store, flexible map/reduce engine and HTTP/JSON query interface" |
| 9 | arch=(i686 x86_64) |
| 10 | license=('Apache 2') |
| 11 | url='http://riak.basho.com/' |
| 12 | makedepends=(erlang make gcc pacman) |
| 13 | pkgbigver=$( echo $pkgver | grep -o ^[0-9]*.[0-9]* ) #get x.x version from x.x.x version |
| 14 | backup=('opt/riak/etc/app.config' 'opt/riak/etc/vm.args') |
| 15 | install="${pkgname}.install" |
| 16 | source=("http://downloads.basho.com/riak/${pkgname}-${pkgbigver}/${pkgname}-${pkgver}.tar.gz" 'riak.rc') |
| 17 | md5sums=('5792ac2b91ad71ccaee91d1ef9632348' |
| 18 | '942e198d5dfa52ac36360e3f79b65930') |
| 19 | prefixpath="/opt/${pkgname}" |
| 20 | #prefixpath="/usr/lib/erlang" |
| 21 | #prefixpath="/usr/lib/erlang/lib/${pkgname}-${pkgver}" |
| 22 | |
| 23 | build() { |
| 24 | cd ${srcdir}/riak-${pkgver} || return 1 |
| 25 | msg Cleaning...; |
| 26 | make distclean |
| 27 | msg Building...; |
| 28 | LDFLAGS='' make rel || return 1 |
| 29 | |
| 30 | cd rel/riak || return 1 |
| 31 | #cd rel/overlay || return 1 |
| 32 | mkdir -p ${pkgdir}${prefixpath} |
| 33 | |
| 34 | msg Packing...; |
| 35 | cp -r ./* ${pkgdir}${prefixpath} || return 1 |
| 36 | |
| 37 | [ -d "${pkgdir}/usr/lib/erlang" ] && { |
| 38 | msg 'Removing files already shipped with erlang package...'; |
| 39 | pacman -Ql erlang | cut -d ' ' -f 2- | while read i; do |
| 40 | [ -d "$i" ] || { |
| 41 | rm -f ${pkgdir}/"$i"; |
| 42 | echo -ne "$i \r"; |
| 43 | } |
| 44 | done; echo; |
| 45 | } |
| 46 | |
| 47 | chmod -R 755 ${pkgdir}${prefixpath}/bin |
| 48 | |
| 49 | msg 'ArchLinux integration...'; |
| 50 | |
| 51 | mkdir -p ${pkgdir}/var/log |
| 52 | ln -s ${prefixpath}/log ${pkgdir}/var/log/riak |
| 53 | mkdir -p ${pkgdir}/etc/rc.d |
| 54 | ln -s ${prefixpath}/etc ${pkgdir}/etc/riak |
| 55 | mkdir -p ${pkgdir}/usr/share/doc/ |
| 56 | cp -r ${srcdir}/riak-${pkgver}/doc/man ${pkgdir}/usr/share/ |
| 57 | cp -r ${srcdir}/riak-${pkgver}/doc ${pkgdir}/usr/share/doc/riak |
| 58 | rm -r ${pkgdir}/usr/share/doc/riak/man |
| 59 | |
| 60 | mkdir -p ${pkgdir}/usr/bin/ |
| 61 | for i in riak riak-admin; do |
| 62 | cat > ${pkgdir}/usr/bin/$i <<EOF |
| 63 | #!/bin/sh |
| 64 | su riak -c "${prefixpath}/bin/$i \$@" |
| 65 | EOF |
| 66 | done |
| 67 | |
| 68 | cp ${srcdir}/riak.rc ${pkgdir}/etc/rc.d/riak |
| 69 | |
| 70 | chmod -R 755 ${pkgdir}/usr/bin/ ${pkgdir}/etc/rc.d/ |
| 71 | } |