diff --git a/README.md b/README.md index 572cf5a..693afe8 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/bin/coquelicot/build.sh b/bin/coquelicot/build.sh index 4283247..dddbfe8 100755 --- a/bin/coquelicot/build.sh +++ b/bin/coquelicot/build.sh @@ -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 @@ -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