#!/bin/bash syntax() { echo "usage: $0 { --help | -? | -h | platform | option value | switch }+ " echo "platform: all | cygwin | linux | macosx | mingw | mingw32 | msvc" echo "switch: --2015 | --2017 | --publish | --status | --clone" echo "option: --branch x | --server x | --user x" } announce() { if [ "$status" != "1" ]; then echo ++++++++++++++++++++++++++++++++ echo $* echo ++++++++++++++++++++++++++++++++ fi } bomb() { echo "*** $1 requires an argument ***" >&2 exit 1 } unixBuild() { announce $1 $2 if [ "$status" == "1" ]; then ! ssh $1 ${command} </dev/null fi ! ssh $1 < ${cd}buildserver\\\\build\\\\tag EOF fi } ## # assign defaults cygwin=0 linux=0 macosx=0 mingw=0 mingw32=0 msvc=0 help=0 publish=0 verbose=0 static=0 edition=2017 branch=RC1 dryrun=0 clone=0 server=rmillsmm user=rmills status=0 all=0 tag=$(date '+%Y:%m:%d_%H:%M:%S') if [ "$#" == "0" ]; then help=1; fi ## # parse command line while [ "$#" != "0" ]; do arg="$1" shift case "$arg" in -h|--help|-\?) help=1 ;; all) all=1 ;; cygwin) cygwin=1 ;; linux) linux=1 ;; macosx) macosx=1 ;; mingw) mingw=1 ;; mingw32) mingw32=1 ;; msvc) msvc=1 ;; --publish) publish=1 ;; --clone) clone=1 ;; --static) static=1 ;; --2017) edition=2017 ;; --2015) edition=2015 ;; --status) status=1 ;; --server) if [ $# -gt 0 ]; then server=$1; shift; else bomb $arg ; fi ;; --branch) if [ $# -gt 0 ]; then branch=$1; shift; else bomb $arg ; fi ;; --user) if [ $# -gt 0 ]; then user=$1 ; shift; else bomb $arg ; fi ;; *) echo "*** invalid option: $arg ***" 1>&2; help=1; ;; esac done if [ $help == 1 ]; then syntax; exit 0; fi if [ "$all" == "1" ]; then cygwin=1; linux=1; macosx=1; mingw=1; mingw32=1;msvc=1; fi publishBundle() { # $1 = server (eg rmillsmm-w7) # $2 = path (eg /c/msys32/home/rmills/gnu/github/exiv2/buildserver/build) # $3 = extension (eg tar.gz or zip) # find the build tag left during the build tag_saved=$tag if [ -e tag ]; then rm -rf tag ; fi scp -q "$user@$1:$2/tag" . 2>/dev/null # silently collect build tag file if [ -e tag ]; then source tag fi file=$(ssh $user@$1 "ls -1 $2/*$3" 2>/dev/null) if [ ! -z $file ]; then scp -p "$user@$1:$file" $dest/$(basename $file $3)-$tag$3 fi tag=$tag_saved } if [ $publish == 1 ]; then dest=/Users/rmills/Jenkins/builds/new publishBundle $server-w7 /c/msys32/home/$user/gnu/github/exiv2/buildserver/build '.tar.gz' publishBundle $server-w7 /c/msys64/home/$user/gnu/github/exiv2/buildserver/build '.tar.gz' publishBundle $server-w7 /c/cygwin64/home/$user/gnu/github/exiv2/buildserver/build '.tar.gz' publishBundle $server-w7 /c/users/$user/gnu/github/exiv2/buildserver/build '.zip' publishBundle $server-ubuntu /home/$user/gnu/github/exiv2/buildserver/build '.tar.gz' publishBundle $server /Users/$user/gnu/github/exiv2/buildserver/build '.tar.gz' exit 0 fi ## # perform builds if [ $cygwin == 1 ]; then cd=/home/rmills/gnu/github/exiv2/ command='c:\\cygwin64\\bin\\bash.exe' unixBuild ${user}@${server}-w7 Cygwin fi if [ $linux == 1 ]; then cd=/home/rmills/gnu/github/exiv2/ command='' unixBuild ${user}@${server}-ubuntu Linux fi if [ $macosx == 1 ]; then cd=/Users/rmills/gnu/github/exiv2/ command='' unixBuild ${user}@${server} MacOSX fi if [ $mingw == 1 ]; then cd=/home/rmills/gnu/github/exiv2/ command='msys64' unixBuild ${user}@${server}-w7 MinGW/64 fi if [ $mingw32 == 1 ]; then cd=/home/rmills/gnu/github/exiv2/ command='msys32' unixBuild ${user}@${server}-w7 MinGW/32 fi if [ $msvc == 1 ]; then command='' msvcBuild ${user}@${server}-w7 fi # That's all Folks ##