2015-12-02 21:35:17 +00:00
|
|
|
#!/bin/bash
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
set -e
|
|
|
|
|
2014-03-15 17:40:35 +00:00
|
|
|
# This uses gox from https://github.com/mitchellh/gox
|
2015-08-28 08:40:46 +00:00
|
|
|
# Make sure you've run gox -build-toolchain - not required for go >= 1.5
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
if [ "$1" == "" ]; then
|
|
|
|
echo "Syntax: $0 Version"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
VERSION="$1"
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
rm -rf build
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2016-06-03 19:09:34 +00:00
|
|
|
# Disable CGO and dynamic builds on all platforms (including build patform)
|
|
|
|
export CGO_ENABLED=0
|
|
|
|
|
2016-06-09 14:33:26 +00:00
|
|
|
# Arch pairs we build for
|
2015-08-28 08:40:46 +00:00
|
|
|
# gox -osarch-list for definitive list
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2016-06-09 14:33:26 +00:00
|
|
|
OSARCH="\
|
|
|
|
windows/386
|
|
|
|
windows/amd64
|
|
|
|
darwin/386
|
|
|
|
darwin/amd64
|
|
|
|
linux/386
|
|
|
|
linux/amd64
|
|
|
|
linux/arm
|
|
|
|
freebsd/386
|
|
|
|
freebsd/amd64
|
|
|
|
freebsd/arm
|
|
|
|
netbsd/386
|
|
|
|
netbsd/amd64
|
|
|
|
netbsd/arm
|
|
|
|
openbsd/386
|
|
|
|
openbsd/amd64
|
|
|
|
plan9/386
|
|
|
|
plan9/amd64
|
|
|
|
solaris/amd64"
|
|
|
|
|
|
|
|
# Make space separated
|
|
|
|
OSARCH=${OSARCH//$'\n'/ }
|
|
|
|
|
|
|
|
gox --ldflags "-s -X github.com/ncw/rclone/fs.Version=${VERSION}" -output "build/{{.Dir}}-${VERSION}-{{.OS}}-{{.Arch}}/{{.Dir}}" -osarch "${OSARCH}"
|
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
mv build/rclone-${VERSION}-darwin-amd64 build/rclone-${VERSION}-osx-amd64
|
|
|
|
mv build/rclone-${VERSION}-darwin-386 build/rclone-${VERSION}-osx-386
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
cd build
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
for d in `ls`; do
|
2015-06-06 09:05:21 +00:00
|
|
|
cp -a ../MANUAL.txt $d/README.txt
|
|
|
|
cp -a ../MANUAL.html $d/README.html
|
2014-04-24 17:11:08 +00:00
|
|
|
cp -a ../rclone.1 $d/
|
|
|
|
zip -r9 $d.zip $d
|
2015-08-27 19:11:11 +00:00
|
|
|
d_current=${d/-${VERSION}/-current}
|
|
|
|
ln $d.zip $d_current.zip
|
2014-04-24 17:11:08 +00:00
|
|
|
rm -rf $d
|
|
|
|
done
|
2014-03-15 17:40:35 +00:00
|
|
|
|
2014-04-24 17:11:08 +00:00
|
|
|
cd ..
|