diff options
author | Alexander F Rødseth | 2015-06-10 14:48:42 +0200 |
---|---|---|
committer | Alexander F Rødseth | 2015-06-10 14:48:42 +0200 |
commit | 9ad776d5e56823d35e91b7cfdc3fd6c21c1dfe6d (patch) | |
tree | 80048751495c2b51c62d2cc54bd97ea32135942c /PKGBUILD | |
download | aur-dcpu16-kballard.tar.gz |
Initial import
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..dd103063f54f --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,103 @@ +# Maintainer: Alexander Rødseth <rodseth@gmail.com> + +pkgname=dcpu16-kballard +pkgver=0.5 +pkgrel=1 +pkgdesc='Cycle-accurate implementation of the DCPU-16 CPU' +arch=('x86_64' 'i686') +url='http://github.com/kballard/dcpu16' +license=('MIT') +makedepends=('go' 'git') +options=('!strip' '!emptydirs') +_gourl=github.com/kballard/dcpu16 + +build() { + cd "$srcdir" + source /etc/profile.d/go.sh + + rm -rf build + mkdir -p build/go + cd build/go + + for f in "$GOROOT/"*; do + ln -s "$f" + done + + rm pkg + mkdir pkg + cd pkg + + for f in "$GOROOT/pkg/"*; do + ln -s "$f" + done + + platform=`for f in "$GOROOT/pkg/"*; do echo \`basename $f\`; done|grep linux` + + rm "$platform" + mkdir "$platform" + cd "$platform" + + for f in "$GOROOT/pkg/$platform/"*.h; do + ln -s "$f" + done + + export GOROOT="$srcdir/build/go" + export GOPATH="$srcdir/build" + + # Prepare library + go get -fix "$_gourl" + + # Prepare executable + if [ -d "$srcdir/build/src" ]; then + cd "$srcdir/build/src/$_gourl" + go build -o "$srcdir/build/$pkgname" + else + echo 'Old sources for a previous version of this package are already present!' + echo 'Build in a chroot or uninstall the previous version.' + return 1 + fi +} + +package() { + cd "$srcdir" + source /etc/profile.d/go.sh + + # Package go package files + for f in "$srcdir/build/go/pkg/"* "$srcdir/build/pkg/"*; do + # If it's a directory + if [ -d "$f" ]; then + cd "$f" + mkdir -p "$pkgdir/$GOROOT/pkg/`basename $f`" + for z in *; do + # Check if the directory name matches + if [ "$z" == `echo $_gourl | cut -d/ -f1` ]; then + cp -r $z "$pkgdir/$GOROOT/pkg/`basename $f`" + fi + done + cd .. + fi + done + + # Package source files + if [ -d "$srcdir/build/src" ]; then + mkdir -p "$pkgdir/$GOROOT/src/pkg" + cp -r "$srcdir/build/src/"* "$pkgdir/$GOROOT/src/pkg/" + find "$pkgdir" -depth -type d -name .git -exec rm -r {} \; + fi + + # Package executables + if [ -e "$srcdir/build/$pkgname" ]; then + install -Dm755 "$srcdir/build/$pkgname" \ + "$pkgdir/usr/bin/$pkgname" + fi + + # Package license (if available) + for f in LICENSE COPYING; do + if [ -e "$srcdir/build/src/$_gourl/$f" ]; then + install -Dm644 "$srcdir/build/src/$_gourl/$f" \ + "$pkgdir/usr/share/licenses/$pkgname/$f" + fi + done +} + +# vim:set ts=2 sw=2 et: |