summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorMoses Narrow2019-03-08 14:11:19 -0600
committerMoses Narrow2019-03-08 14:11:19 -0600
commit8acb3dbfecb4a5e6cc306e779a495623a37d0ff3 (patch)
treef0e14f809a77ea7ffd2e557a8ec26c4ef3bf1348 /PKGBUILD
downloadaur-8acb3dbfecb4a5e6cc306e779a495623a37d0ff3.tar.gz
first commit; added PKGBUILD & .SRCINFO
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD112
1 files changed, 112 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 00000000000..02bc21592c3
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,112 @@
+# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
+# Maintainer: Steve Skydev <steve@skycoin.net>
+projectname=skycoin
+pkgname=skywire-mainnet
+pkgname1=skywire
+pkgdesc="Skywire: Building a New Internet. Skycoin.net"
+pkgver='autogenerated'
+pkggopath="github.com/$projectname/$pkgname1"
+pkgrel=1
+arch=('x86_64' 'i686' 'armv6h' 'armv7h' 'aarch64')
+url="https://${pkggopath}"
+license=(MIT)
+makedepends=(dep git go gcc)
+provides=('skywire')
+conflicts=('skywire')
+source=("git+${url}.git#branch=${BRANCH:-mainnet}")
+sha256sums=('SKIP')
+validpgpkeys=('DE08F924EEE93832DABC642CA8DC761B1C0C0CFC')
+
+export GOOS=linux
+case "$CARCH" in
+ x86_64) export GOARCH=amd64 ;;
+esac
+export GOROOT_FINAL=/usr/lib/go
+export GOPATH_FINAL=$HOME/go
+export GOBIN_FINAL=$HOME/go/bin
+
+pkgver() {
+ cd "$srcdir/$pkgname1"
+ local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
+ local count=$(git rev-list --count HEAD)
+ local commit=$(git rev-parse --short HEAD)
+ echo "$date.${count}_$commit"
+}
+
+prepare() {
+ # https://wiki.archlinux.org/index.php/Go_package_guidelines
+
+ mkdir -p $srcdir/go/src/${pkggopath//$pkgname1/} "$srcdir"/go/bin
+ ln -rTsf $srcdir/$pkgname1 $srcdir/go/src/$pkggopath
+ cd $srcdir/go/src/$pkggopath/
+ git checkout mainnet
+ git submodule --quiet update --init --recursive
+
+ export GOPATH="$srcdir"/go
+ export GOBIN=${GOPATH}/bin
+ export PATH=${GOPATH}/bin:${PATH}
+ msg2 'installing go dependencies'
+ dep init
+ dep ensure
+}
+
+build() {
+ export GOPATH=$srcdir/go
+ export GOBIN=${GOPATH}/bin
+ export PATH=${GOPATH}/bin:${PATH}
+ cd $srcdir/go/src/$pkggopath
+ GO111MODULE=on go install \
+ -gcflags "all=-trimpath=${GOPATH}" \
+ -asmflags "all=-trimpath=${GOPATH}" \
+ -ldflags "-extldflags $LDFLAGS" \
+ -v ./...
+ mkdir skywire
+ mkdir apps
+ # Build apps.
+ GO111MODULE=on go build -o ./apps/chat.v1.0 ./cmd/apps/chat
+ GO111MODULE=on go build -o ./apps/helloworld.v1.0 ./cmd/apps/helloworld
+ GO111MODULE=on go build -o ./apps/therealproxy.v1.0 ./cmd/apps/therealproxy
+ GO111MODULE=on go build -o ./apps/therealproxy-client.v1.0 ./cmd/apps/therealproxy-client
+ GO111MODULE=on go build -o ./apps/therealssh.v1.0 ./cmd/apps/therealssh
+ GO111MODULE=on go build -o ./apps/therealssh-client.v1.0 ./cmd/apps/therealssh-client
+
+ #user must generate default json config by running this script after install
+ echo -e '#!/bin/bash \n # this script sets up skywire after installation \n mkdir -p ~/skywire \n sudo chmod 777 ~/skywire \n sudo chmod 777 ~/apps \n cd ~/ \n ln -s /usr/lib/skycoin/skywire/apps ~/ \n skywire-cli config \n skywire-node skywire.json' > $srcdir/go/bin/$pkgname1-setup
+ chmod +x $srcdir/go/bin/$pkgname1-setup
+}
+
+package() {
+ msg2 'installing files'
+ options=(!strip staticlibs)
+ #create directory trees
+ mkdir -p $pkgdir/usr/bin
+ mkdir -p $pkgdir/usr/lib/$projectname/go/bin
+ mkdir -p $pkgdir/usr/lib/$projectname/$pkgname1/
+ #putting the sources in /usr/lib/skycoin/skywire
+ cp -r $srcdir/$pkgname1/ $pkgdir/usr/lib/$projectname/
+ #restate go envs
+ export GOPATH=$pkgdir/usr/lib/$projectname/go
+ export GOBIN=$pkgdir/usr/lib/$projectname/go/bin
+ #put all bins in /go/bin
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/chat.v1.0 $srcdir/go/bin/skywire-chat
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/helloworld.v1.0 $srcdir/go/bin/skywire-helloworld
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/therealproxy.v1.0 $srcdir/go/bin/skywire-therealproxy
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/therealproxy-client.v1.0 $srcdir/go/bin/skywire-therealproxy-client
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/therealssh.v1.0 $srcdir/go/bin/skywire-therealssh
+ cp $srcdir/go/src/github.com/skycoin/skywire/apps/therealssh-client.v1.0 $srcdir/go/bin/skywire-therealssh-client
+ #mke sure all the binaries are prepended with 'skywire-'
+ skybins="$srcdir"/go/bin
+ potentialnameconflicts=$( ls --ignore=skywire* "$skybins")
+ cd $skybins
+ for i in $potentialnameconflicts; do
+ mv $i $pkgname1-$i
+ done
+ #now symlink binaries to /usr/bin
+ skywirebins=$( ls $skybins )
+ for i in $skywirebins; do
+ install -Dm755 $srcdir/go/bin/$i $pkgdir/usr/lib/$projectname/go/bin/$i
+ ln -rTsf $pkgdir/usr/lib/$projectname/go/bin/$i $pkgdir/usr/bin/$i
+ chmod 755 $pkgdir/usr/bin/$i
+ done
+ msg2 'please run skywire-setup after installing this package'
+}