diff options
Diffstat (limited to 'scripts/builder.sh')
-rwxr-xr-x | scripts/builder.sh | 108 |
1 files changed, 87 insertions, 21 deletions
diff --git a/scripts/builder.sh b/scripts/builder.sh index 876e6d1..6a143e3 100755 --- a/scripts/builder.sh +++ b/scripts/builder.sh @@ -6,21 +6,34 @@ # requirements - # see http://mxe.cc for required tools (scons, perl, yasm, etc etc etc) -# todo - auto update webpage to link to proper snapshot -# -# todo - 64 bit windows (needs mxe 64 bit stable) -# # todo - can we build 32 bit linux from within 64 bit linux? # # todo - make linux work # # todo - detect failure and stop -DRYRUN= +init_variables() +{ + STARTPATH=$PWD + export STARTPATH + if [ "`echo $* | grep uploadonly`" ]; then + UPLOADONLY=1 + DATECODE=`date +"%Y.%m.%d"` + else + UPLOADONLY= + fi + if [ "`echo $* | grep dry`" ]; then + DRYRUN=1 + else + DRYRUN= + fi + export UPLOADONLY + export DRYRUN + export DATECODE +} check_starting_path() { - STARTPATH=$PWD if [ -e openscad.pro ]; then echo 'please start from a clean directory outside of openscad' exit @@ -32,38 +45,57 @@ get_source_code() git clone http://github.com/openscad/openscad.git cd openscad git submodule update --init # MCAD + #git checkout branch ##debugging } build_win32() { + . ./scripts/setenv-mingw-xbuild.sh clean . ./scripts/setenv-mingw-xbuild.sh ./scripts/mingw-x-build-dependencies.sh ./scripts/release-common.sh mingw32 + DATECODE=`date +"%Y.%m.%d"` + export DATECODE +} + +build_win64() +{ + . ./scripts/setenv-mingw-xbuild.sh clean + . ./scripts/setenv-mingw-xbuild.sh 64 + ./scripts/mingw-x-build-dependencies.sh 64 + ./scripts/release-common.sh mingw64 + DATECODE=`date +"%Y.%m.%d"` + export DATECODE } build_lin32() { - . ./scripts/setenv-unibuild.sh clang + . ./scripts/setenv-unibuild.sh ./scripts/uni-build-dependencies.sh ./scripts/release-common.sh + DATECODE=`date +"%Y.%m.%d"` + export DATECODE } upload_win_generic() { - # 1=file summary, 2 = username, 3 = filename - if [ -e $3 ]; then - echo $3 found + summary="$1" + username=$2 + filename=$3 + if [ -f $filename ]; then + echo 'file "'$filename'" found' else - echo $3 not found + echo 'file "'$filename'" not found' fi opts= opts="$opts -p openscad" - opts="$opts -u $2" - opts="$opts $3" - if [ ! $DRYRUN ]; then - python ./scripts/googlecode_upload.py -s "$1" $opts - else + opts="$opts -u $username" + opts="$opts $filename" + if [ $DRYRUN ]; then echo dry run, not uploading to googlecode + echo cmd - python ./scripts/googlecode_upload.py -s '"'$summary'"' $opts + else + python ./scripts/googlecode_upload.py -s "$summary" $opts fi } @@ -87,8 +119,28 @@ upload_win32() export WIN32_PACKAGEFILE2_SIZE } +upload_win64() +{ + SUMMARY1="Windows x86-64 Snapshot Zipfile" + SUMMARY2="Windows x86-64 Snapshot Installer" + BASEDIR=./mingw64/ + WIN64_PACKAGEFILE1=OpenSCAD-$DATECODE-x86-64-Installer.exe + WIN64_PACKAGEFILE2=OpenSCAD-$DATECODE-x86-64.zip + upload_win_generic "$SUMMARY1" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE1 + upload_win_generic "$SUMMARY2" $USERNAME $BASEDIR/$WIN64_PACKAGEFILE2 + export WIN64_PACKAGEFILE1 + export WIN64_PACKAGEFILE2 + WIN64_PACKAGEFILE1_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE1 | awk ' {print $1} ';` + WIN64_PACKAGEFILE2_SIZE=`ls -sh $BASEDIR/$WIN64_PACKAGEFILE2 | awk ' {print $1} ';` + WIN64_PACKAGEFILE1_SIZE=`echo "$WIN64_PACKAGEFILE1_SIZE""B"` + WIN64_PACKAGEFILE2_SIZE=`echo "$WIN64_PACKAGEFILE2_SIZE""B"` + export WIN64_PACKAGEFILE1_SIZE + export WIN64_PACKAGEFILE2_SIZE +} + read_username_from_user() { + if [ $DRYRUN ]; then USERNAME=none;export USERNAME; return; fi echo 'Please enter your username for https://code.google.com/hosting/settings' echo -n 'Username:' read USERNAME @@ -97,6 +149,7 @@ read_username_from_user() read_password_from_user() { + if [ $DRYRUN ]; then return; fi echo 'Please enter your password for https://code.google.com/hosting/settings' echo -n 'Password:' read -s PASSWORD1 @@ -112,7 +165,7 @@ read_password_from_user() export OSUPL_PASSWORD } -update_www_download_links() +update_win_www_download_links() { cd $STARTPATH git clone git@github.com:openscad/openscad.github.com.git @@ -123,6 +176,13 @@ update_www_download_links() DATECODE=`date +"%Y.%m.%d"` rm win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_URL'] = '$BASEURL$WIN64_PACKAGEFILE1'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_URL'] = '$BASEURL$WIN64_PACKAGEFILE2'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT1_SIZE'] = '$WIN64_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js + echo "snapinfo['WIN64_SNAPSHOT2_SIZE'] = '$WIN64_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js + echo "snapinfo['WIN32_SNAPSHOT1_URL'] = '$BASEURL$WIN32_PACKAGEFILE1'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT2_URL'] = '$BASEURL$WIN32_PACKAGEFILE2'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT1_NAME'] = 'OpenSCAD $DATECODE'" >> win_snapshot_links.js @@ -130,12 +190,11 @@ update_www_download_links() echo "snapinfo['WIN32_SNAPSHOT1_SIZE'] = '$WIN32_PACKAGEFILE1_SIZE'" >> win_snapshot_links.js echo "snapinfo['WIN32_SNAPSHOT2_SIZE'] = '$WIN32_PACKAGEFILE2_SIZE'" >> win_snapshot_links.js echo 'modified win_snapshot_links.js' - cat win_snapshot_links.js PAGER=cat git diff if [ ! $DRYRUN ]; then git commit -a -m 'builder.sh - updated snapshot links' - git push origin + git push origin master else echo dry run, not updating www links fi @@ -143,6 +202,7 @@ update_www_download_links() check_ssh_agent() { + if [ $DRYRUN ]; then echo 'skipping ssh, dry run'; return; fi if [ ! $SSH_AUTH_SOCK ]; then echo 'please start an ssh-agent for github.com/openscad/openscad.github.com uploads' echo 'for example:' @@ -152,14 +212,20 @@ check_ssh_agent() fi } +init_variables $* check_ssh_agent check_starting_path read_username_from_user read_password_from_user get_source_code -build_win32 + +if [ ! $UPLOADONLY ]; then + build_win32 + build_win64 +fi upload_win32 -update_www_download_links +upload_win64 +update_win_www_download_links |