Browse Source

Initial commit.

Eliezer Croitoru 7 months ago
parent
commit
83a90ce4c2
3 changed files with 90 additions and 0 deletions
  1. 52 0
      Makefile
  2. 34 0
      build.sh
  3. 4 0
      pack.sh

+ 52 - 0
Makefile

@@ -0,0 +1,52 @@
+all: linux windows macos freebsd openbsd netbsd solaris arm5 arm6 arm7 arm8 mips64 mips64le mips
+
+update:
+	go list -f '{{ join .Imports "\n" }}' |xargs -l1 -n1 go get -v -u
+clean:
+	echo "cleaning"
+	rm ./bin/*
+	rmdir ./bin
+	echo "The tar.xz archive file needs to be removed automatically"
+linux: linux64 linux86
+
+linux64:	
+	./build.sh "linux" "amd64"
+linux86:
+	./build.sh "linux" "386"
+windows:
+	./build.sh "windows" "386"
+	./build.sh "windows" "amd64"
+macos:
+	./build.sh "darwin" "amd64"
+	./build.sh "darwin" "386"
+
+freebsd:
+	./build.sh "freebsd" "386"
+	./build.sh "freebsd" "amd64"
+
+openbsd:
+	./build.sh "openbsd" "386"
+	./build.sh "openbsd" "amd64"
+
+netbsd:
+	./build.sh "netbsd" "386"
+	./build.sh "netbsd" "amd64"
+
+solaris:
+	./build.sh "solaris" "amd64"
+arm5:
+	./build.sh "linux" "arm" "5"
+arm6:
+	./build.sh "linux" "arm" "6"
+arm7:
+	./build.sh "linux" "arm" "7"
+arm8:
+	./build.sh "linux" "arm64"
+mips:
+	./build.sh "linux" "mips"
+mips64:
+	./build.sh "linux" "mips64"
+mips64le:
+	./build.sh "linux" "mips64le"
+pack:
+	./pack.sh

+ 34 - 0
build.sh

@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+# List of arches
+#darwin_386    freebsd_386   freebsd_arm   linux_amd64   netbsd_386    netbsd_arm    openbsd_386   plan9_386     windows_386
+#darwin_amd64  freebsd_amd64 linux_386     linux_arm     netbsd_amd64  obj           openbsd_amd64 tool          windows_amd64
+
+mkdir bin >/dev/null 2>&1
+export BINARY=`basename $PWD`_
+export GOOS=$1
+export GOARCH=$2
+export GOARM=$3
+export CGO_ENABLED=0
+case $GOOS in 
+	windows)
+		go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`.exe"
+	;;
+	linux)
+		case $GOARCH in 
+			arm)
+				go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH$GOARM`"
+			;;
+			*)
+				go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`"
+			;;
+		esac
+
+	;;
+	*)
+		go build -o "./bin/`echo $BINARY``echo $GOOS`_`echo $GOARCH`"
+	;;
+esac
+echo -n "finished building for: "
+echo -n $GOOS
+echo -n "_"
+echo  $GOARCH

+ 4 - 0
pack.sh

@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+
+echo "PACKING: `basename $PWD`.tar.xz"
+tar cvfJ `basename $PWD`.tar.xz bin