summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoses Narrow2019-05-23 18:06:43 -0500
committerMoses Narrow2019-05-23 18:06:43 -0500
commitfb19305318ef096d08c044887f8492cbdcd49a22 (patch)
tree9b84fee5fba9216661a8d4f25c7b32b781d3c64a
parent75a67e735f631e9446b9a8b25f40f58da303bffb (diff)
downloadaur-fb19305318ef096d08c044887f8492cbdcd49a22.tar.gz
success building 0.7beta binary from github sources; cx chains support
-rw-r--r--.SRCINFO14
-rw-r--r--Makefile108
-rw-r--r--PKGBUILD102
3 files changed, 204 insertions, 20 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 09bf22bf30f..093deb4266a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,13 +1,17 @@
pkgbase = cx
pkgdesc = CX Skycoin Blockchain Programming Language
- pkgver = 0.7beta
+ pkgver = 20190523.1206_048278b1
pkgrel = 1
url = https://github.com/skycoin/cx
- arch = x86_64
- makedepends = unzip
- source = https://github.com/skycoin/cx/releases/download/v0.7beta/cx-0.7beta-bin-linux-x64.zip
+ arch = any
+ makedepends = git
+ makedepends = go
+ makedepends = gcc
+ source = git+https://github.com/skycoin/cx.git#branch=develop
+ source = Makefile
validpgpkeys = DE08F924EEE93832DABC642CA8DC761B1C0C0CFC
- sha256sums = aa3e7134b180b9e877e0e037d68cd27e8c8cfca2cd5baf04c5a75860f9d67470
+ sha256sums = SKIP
+ sha256sums = 40183bcce33ecc8f9dda374532efe9a303ed1490a0cc03b9fc2db8982166db74
pkgname = cx
options = !strip
diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000000..57ffadf1076
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,108 @@
+.DEFAULT_GOAL := help
+.PHONY: build-parser build test update-golden-files
+.PHONY: install-deps-Darwin install-deps-Linux install-deps install
+
+PWD := $(shell pwd)
+# PKG_NAMES_LINUX := glade xvfb libxinerama-dev libxcursor-dev libxrandr-dev libgl1-mesa-dev libxi-dev gir1.2-gtk-3.0 libgtk2.0-dev libperl-dev libcairo2-dev libpango1.0-dev libgtk-3-dev gtk+3.0 libglib2.0-dev
+PKG_NAMES_LINUX := glade xvfb libxinerama-dev libxcursor-dev libxrandr-dev libgl1-mesa-dev libxi-dev libperl-dev libcairo2-dev libpango1.0-dev libglib2.0-dev
+# PKG_NAMES_MACOS := gtk gtk-mac-integration gtk+3 glade
+UNAME_S := $(shell uname -s)
+INSTALL_DEPS := install-deps-$(UNAME_S)
+
+GLOBAL_GOPATH := ${GOPATH}
+LOCAL_GOPATH := ${HOME}/go
+CXPATH := ${CXPATH}
+
+ifdef GLOBAL_GOPATH
+ GOPATH := $(GLOBAL_GOPATH)
+else
+ GOPATH := $(LOCAL_GOPATH)
+endif
+
+ifdef CXPATH
+ CX_PATH := $(CXPATH)
+else
+ CX_PATH := ${HOME}/cx
+endif
+
+ifeq ($(UNAME_S), Linux)
+ DISPLAY := :99.0
+endif
+
+configure: ## Configure the system to build and run CX
+ if [ -z "$(GLOBAL_GOPATH)" ]; then echo "NOTE:\tGOPATH not set" ; export GOPATH="$(LOCAL_GOPATH)"; export PATH="$(LOCAL_GOPATH)/bin:${PATH}" ; fi
+ echo "GOPATH=$(GOPATH)"
+ mkdir -p $(GOPATH)/src/github.com/skycoin
+ if [ ! -e $(GOPATH)/src/github.com/skycoin/cx ]; then mkdir -p $(GOPATH)/src/github.com/skycoin ; ln -s $(PWD) $(GOPATH)/src/github.com/skycoin/cx ; fi
+
+configure-workspace: ## Configure CX workspace environment
+ mkdir -p $(CX_PATH)/{,src,bin,pkg}
+ echo "NOTE:\tCX workspace at $(CX_PATH)"
+
+build-parser: configure ## Generate lexer and parser for CX grammar
+ nex -e cxgo/cxgo0/cxgo0.nex
+ goyacc -o cxgo/cxgo0/cxgo0.go cxgo/cxgo0/cxgo0.y
+ nex -e cxgo/parser/cxgo.nex
+ goyacc -o cxgo/parser/cxgo.go cxgo/parser/cxgo.y
+
+build: configure build-parser ## Build CX from sources
+ go build -tags full -i -o $(GOPATH)/bin/cx github.com/skycoin/cx/cxgo/
+ chmod +x $(GOPATH)/bin/cx
+
+install-deps-Linux:
+ echo 'Installing dependencies for $(UNAME_S)'
+ #sudo apt-get update -qq
+ #sudo apt-get install -y $(PKG_NAMES_LINUX) --no-install-recommends
+ export DISPLAY=$(DISPLAY)
+ sudo /usr/bin/Xvfb ${DISPLAY} 2>1 > /dev/null &
+ export GTK_VERSION="$(shell pkg-config --modversion gtk+-3.0 | tr . _| cut -d '_' -f 1-2)"
+ export Glib_VERSION="$(shell pkg-config --modversion glib-2.0)"
+ export Cairo_VERSION="$(shell pkg-config --modversion cairo)"
+ export Pango_VERSION="$(shell pkg-config --modversion pango)"
+
+install-deps-Darwin:
+ # echo 'Installing dependencies for $(UNAME_S)'
+ # brew install $(PKG_NAMES_MACOS)
+
+install-deps: configure $(INSTALL_DEPS)
+ echo "Installing go package dependencies"
+ go get github.com/skycoin/skycoin/...
+ go get github.com/go-gl/gl/v2.1/gl
+ go get github.com/go-gl/glfw/v3.2/glfw
+ go get github.com/go-gl/gltext
+ go get github.com/blynn/nex
+ go get github.com/cznic/goyacc
+# go get github.com/skycoin/cx/...
+
+install: install-deps build configure-workspace ## Install CX from sources. Build dependencies
+ echo 'NOTE:\tWe recommend you to test your CX installation by running "cx ${GOPATH}/src/github.com/skycoin/cx/tests"'
+ cx -v
+
+install-linters: ## Install linters
+ go get -u github.com/FiloSottile/vendorcheck
+ # For some reason this install method is not recommended, see https://github.com/golangci/golangci-lint#install
+ # However, they suggest `curl ... | bash` which we should not do
+ go get -u github.com/golangci/golangci-lint/cmd/golangci-lint
+
+lint: ## Run linters. Use make install-linters first.
+ vendorcheck ./...
+ golangci-lint run -c .golangci.yml ./cx
+
+test: build ## Run CX test suite.
+ go test -race -tags full github.com/skycoin/cx/cxgo/
+ cx ./tests/main.cx ++wdir=./tests ++disable-tests=gui,issue
+
+update-golden-files: build ## Update golden files used in CX test suite
+ ls -1 tests/ | grep '.cx$$' | while read -r NAME; do echo "Processing $$NAME"; cx -t -co tests/testdata/tokens/$${NAME}.txt tests/$$NAME || true ; done
+
+check-golden-files: update-golden-files ## Ensure golden files are up to date
+ if [ "$(shell git diff tests/testdata | wc -l | tr -d ' ')" != "0" ] ; then echo 'Changes detected. Goden files not up to date' ; exit 2 ; fi
+
+check: check-golden-files test ## Perform self-tests
+
+format: ## Formats the code. Must have goimports installed (use make install-linters).
+ goimports -w -local github.com/skycoin/cx ./cx
+ goimports -w -local github.com/skycoin/cx ./cxgo/actions
+
+help:
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
diff --git a/PKGBUILD b/PKGBUILD
index 7361c862cde..c2df6e20264 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,34 +1,106 @@
# Maintainer: Moses Narrow <moe_narrow@use.startmail.com>
# Maintainer: Steve Skydev <steve@skycoin.net>
pkgname=cx
+pkgname1=cx
projectname=skycoin
pkgdesc="CX Skycoin Blockchain Programming Language"
-pkgver=0.7beta
-pkggopath="github.com/$projectname/$pkgname"
+pkgver=20190523.1206_048278b1
+pkggopath="github.com/$projectname/$pkgname1"
pkgrel=1
-arch=('x86_64')
+arch=('any')
url="https://${pkggopath}"
license=()
-makedepends=('unzip')
-source=("https://$pkggopath/releases/download/v$pkgver/$pkgname-$pkgver-bin-linux-x64.zip")
-sha256sums=('aa3e7134b180b9e877e0e037d68cd27e8c8cfca2cd5baf04c5a75860f9d67470')
+makedepends=('git' 'go' 'gcc')
+source=("git+${url}.git#branch=${BRANCH:-develop}"
+"Makefile")
+sha256sums=('SKIP'
+'40183bcce33ecc8f9dda374532efe9a303ed1490a0cc03b9fc2db8982166db74')
validpgpkeys=('DE08F924EEE93832DABC642CA8DC761B1C0C0CFC')
+
+export GOOS=linux
+export GOPATH="$srcdir"
+export GOROOT="$builddir"
+export GOBIN="$GOROOT"/bin
+export GOROOT_FINAL=/usr/lib/go
+
+export CGO_ENABLED=1
+
+case "$CARCH" in
+x86) export GOARCH="386" GO386="387" ;;
+x86_64) export GOARCH="amd64" ;;
+arm*) export GOARCH="arm" ;;
+armel) export GOARCH="arm" GOARM="5" ;;
+armhf) export GOARCH="arm" GOARM="6" ;;
+armv7) export GOARCH="arm" GOARM="7" ;;
+armv8) export GOARCH="arm64" ;;
+aarch64) export GOARCH="arm64" ;;
+mips) export GOARCH="mips" ;;
+mips64) export GOARCH="mips64" ;;
+mips64el) export GOARCH="mips64le" ;;
+mipsel) export GOARCH="mipsle" ;;
+*) return 1 ;;
+ esac
+
+ 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() {
-mkdir -p $srcdir/bin
-mv $pkgname-$pkgver-bin-linux-x64.zip $srcdir/bin/$pkgname-$pkgver-bin-linux-x64.zip
-cd $srcdir/bin
-unzip $pkgname-$pkgver-bin-linux-x64.zip
+ # 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 develop
+ git submodule --quiet update --init --recursive
+
+ export GOPATH="$srcdir"/go
+ export GOBIN=${GOPATH}/bin
+ export PATH=${GOPATH}/bin:${PATH}
+}
+
+build() {
+ export GOPATH=$srcdir/go
+ export GOBIN=${GOPATH}/bin
+ export PATH=${GOPATH}/bin:${PATH}
+ cp -b Makefile $srcdir/go/src/$pkggopath/Makefile
+ cd $srcdir/go/src/$pkggopath
+ make install
+
+
+# msg2 'creating cx chains setup script'
+# mkdir -p $srcdir/$pkgname1-scripts
+# cd $srcdir/$pkgname1-scripts
+# echo -e '#!/bin/bash \n #setup symlink for fiber.toml along GOPATH \n export GOBIN=/usr/lib/skycoin/go/bin \n echo "export GOBIN=/usr/lib/skycoin/go/bin" \n export GOPATH=GOBIN=/usr/lib/skycoin/go \n echo "export GOPATH=GOBIN=/usr/lib/skycoin/go" \n sudo ln -s /usr/lib/skycoin/cx/fiber.toml /usr/lib/skycoin/go/src/github.com/skycoin/cx/fiber.toml \n echo "Running: skycoin-cli addressGen" \n skycoin-cli addressGen \n echo "edit /usr/lib/skycoin/cx/fiber.toml" \n echo "export SECRET_KEY=" \n echo "export PUBLIC_KEY=" \n echo "cx --blockchain --heap-initial 100 --stack-size 100 --secret-key $SECRET_KEY --public-key $PUBLIC_KEY counter-bc.cx" \n echo "cx --blockchain --heap-initial 100 --stack-size 100 --secret-key $SECRET_KEY --public-key $PUBLIC_KEY counter-bc.cx"' > $pkgname1-chaintest
+# chmod +x $pkgname1-chaintest
}
package() {
msg2 'installing CX'
options=(!strip staticlibs)
+#make dirs
mkdir -p $pkgdir/usr/bin
mkdir -p $pkgdir/usr/lib/$projectname/go/bin
-export GOPATH=$pkgdir/usr/lib/$projectname/go
-export GOBIN=$pkgdir/usr/lib/$projectname/go/bin
-install -Dm755 $srcdir/$pkgname $pkgdir/usr/lib/$projectname/go/bin/$pkgname
-ln -rTsf $pkgdir/usr/lib/$projectname/go/bin/$pkgname $pkgdir/usr/bin/$pkgname
-chmod 755 $pkgdir/usr/bin/$pkgname
+mkdir -p $pkgdir/usr/lib/$projectname/go/src/github.com/$projectname/
+mkdir -p $pkgdir/usr/lib/$projectname/$pkgname1/
+#install sources
+cp -r $srcdir/$pkgname1 $pkgdir/usr/lib/$projectname/go/src/github.com/$projectname/$pkgname1
+#install binary
+msg2 'installing binaries'
+cxbins="$srcdir"/go/bin
+cxbin=$( ls $cxbins )
+for i in $cxbin; 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
+#install the scripts
+#cxscripts=$( ls $srcdir/$pkgname1-scripts )
+#for i in $cxscripts; do
+#cp $srcdir/$pkgname1-scripts/$i $pkgdir/usr/bin/$i
+#done
}