Skip to content

Commit

Permalink
#9 Build more OS and Architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
billbirchatcoles committed Apr 5, 2021
1 parent 0b04212 commit d44ded4
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 14 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
# vendor/
foo*
frangipanni
frangipanni_mac
frangipanni.tgz
frangipanni.zip
frangipanni_*_*
frangipanni*tgz
frangipanni*zip
sandbox

# IDEs
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ Having restructured the data into a tree format we can output in other formats.
{"completions" : "task.fish"}}}
```

# Download and Installation

You can download executables of `frangipanni` from the Github repository in the [Releases area.](https://github.com/birchb1024/frangipanni/releases) You will find archive files containing the binary and Lua files:

```
frangipanni_darwin_amd64.zip
frangipanni_freebsd_amd64.zip
frangipanni_js_wasm.zip
frangipanni_linux_386.tgz
frangipanni_linux_amd64.tgz
frangipanni_linux_arm64.tgz
frangipanni_netbsd_amd64.zip
frangipanni_openbsd_amd64.zip
frangipanni_windows_386.zip
frangipanni_windows_amd64.zip
```

Download the file for your operating system and hardware, then decompress the archive in a directory. Ensure the binary file is executable, and you're ready to go.

The author has tested frangipanni_linux_amd64, the others are output from the Go cross-compiler and are provided 'as-is'. RSVP if you find an issue.

# Usage
The command is a simple filter taking standard input, and output on stdout.
Expand Down
39 changes: 29 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
#!/bin/bash
set -xeuo pipefail
set -euo pipefail
scriptdir="$(readlink -f $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ))"


git describe

export CGO_ENABLED=0 # For static build without 'C'

go build -a

test/confidence.sh
function linux_compile {
: "$1" # e.g. amd64
export GOOS=linux
export GOARCH="$1"
echo "$GOOS" "$GOARCH"
rm -f frangipanni_"$GOOS"_"$GOARCH".tgz
go build -a -o frangipanni_"$GOOS"_"$GOARCH" frangipanni.go
tar zcf frangipanni_"$GOOS"_"$GOARCH".tgz frangipanni_"$GOOS"_"$GOARCH" *.lua
}

GOOS=windows GOARCH=386 go build -a -o frangipanni.exe frangipanni.go
GOOS=darwin GOARCH=amd64 go build -a -o frangipanni_mac frangipanni.go
function cross_compile {
: "$1" # e.g. linux/amd64
export GOOS="${1%/*}"
export GOARCH="${1#*/}" # This is why bash is so awful
echo "$GOOS" "$GOARCH"
rm -f frangipanni_"$GOOS"_"$GOARCH".zip
go build -a -o frangipanni_"$GOOS"_"$GOARCH" frangipanni.go
zip --quiet frangipanni_"$GOOS"_"$GOARCH".zip frangipanni_"$GOOS"_"$GOARCH" *.lua
}

rm -f frangipanni.zip rm -f frangipanni.tgz
tar zcvf frangipanni.tgz frangipanni *.lua
zip frangipanni.zip frangipanni.exe frangipanni_mac *.lua
test/confidence.sh

ls -ltr
for arch in 386 arm64 amd64
do
linux_compile $arch
done
for dist in windows/amd64 windows/386 darwin/amd64 freebsd/amd64 js/wasm netbsd/amd64 openbsd/amd64
do
cross_compile "$dist"
done
3 changes: 2 additions & 1 deletion test/confidence.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash
set -euo pipefail
#set -x
scriptdir="$(readlink -f $( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ))"
(cd "$scriptdir"/.. ; go build)
tempfile=$(mktemp)
Expand Down Expand Up @@ -29,4 +30,4 @@ done
<fixtures/log-file.txt ../frangipanni -skip 5 >> "$tempfile"

set -x
diff "$tempfile" $scriptdir/fixtures.log || meld "$tempfile" $scriptdir/fixtures.log
diff "$tempfile" $scriptdir/fixtures.log # || meld "$tempfile" $scriptdir/fixtures.log

0 comments on commit d44ded4

Please sign in to comment.