Skip to content

Commit

Permalink
Add support for cross-compiling releases (go1.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
matm committed Sep 14, 2015
1 parent 2b639dc commit 65d9f3f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ You can use a binary release or get the project if you have a working Go install

#### Binary Release

Grab the latest [binary release](https://github.com/gotsunami/coquelicot/releases) for you system.
Grab the latest [binary release](https://github.com/gotsunami/coquelicot/releases) for you system. Unzip it
and run

```
$ ./coquelicot -storage /tmp/files -host localhost:9073
```

to store uploaded files into `/tmp/files` and make the application listen on the loopback interface port 9073
(run `coquelicot.exe` on Windows).

### jQuery-File-Upload Setup (Client)

Expand Down
28 changes: 27 additions & 1 deletion bin/coquelicot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

COMMIT=$(git log --format="%h" -n 1)
TAG=$(git describe --all --exact-match $COMMIT)
BIN=coquelicot

cat > version.go << EOF
package main
Expand All @@ -14,4 +15,29 @@ const (
)
EOF

go build && rm -f version.go
ARCH=amd64
OSLIST=$(uname -s|tr '[:upper:]' '[:lower:]')

if [ "$1" = "-a" ]; then
OSLIST="linux windows freebsd darwin"
fi

rm -f /tmp/$BIN*.zip

RTAG=$(git tag|tail -1)
if [ -z "$RTAG" ]; then
RTAG=$COMMIT
fi

for OS in $OSLIST; do
echo "Building for $OS ..."
TMP=/tmp/c$OS$ARCH
rm -rf $TMP
GOOS=$OS GOARCH=$ARCH go build -o $TMP/$BIN
if [ "$OS" = "windows" ]; then
mv $TMP/$BIN $TMP/$BIN.exe
fi
zip -j /tmp/$BIN-$RTAG-$OS-$ARCH.zip $TMP/$BIN* && rm -rf $TMP
done

rm -f version.go

0 comments on commit 65d9f3f

Please sign in to comment.