diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check-dependencies.sh | 506 | ||||
| -rwxr-xr-x | scripts/fedora-build-dependencies.sh | 29 | ||||
| -rwxr-xr-x | scripts/freebsd-build-dependencies.sh | 28 | ||||
| -rwxr-xr-x | scripts/googlecode_upload.py | 296 | ||||
| -rw-r--r-- | scripts/installer.nsi | 1 | ||||
| -rwxr-xr-x | scripts/linux-build-dependencies.sh | 332 | ||||
| -rwxr-xr-x | scripts/macosx-build-dependencies.sh | 142 | ||||
| -rwxr-xr-x | scripts/mingw-x-build-dependencies.sh | 3 | ||||
| -rwxr-xr-x | scripts/opensuse-build-dependencies.sh | 8 | ||||
| -rwxr-xr-x | scripts/publish-macosx.sh | 15 | ||||
| -rwxr-xr-x | scripts/publish-mingw-x.sh | 2 | ||||
| -rwxr-xr-x | scripts/release-common.sh | 53 | ||||
| -rw-r--r-- | scripts/setenv-freebsdbuild.sh | 6 | ||||
| -rw-r--r-- | scripts/setenv-linbuild-clang.sh | 12 | ||||
| -rw-r--r-- | scripts/setenv-linbuild.sh | 34 | ||||
| -rw-r--r-- | scripts/setenv-unibuild.sh | 134 | ||||
| -rwxr-xr-x | scripts/ubuntu-build-dependencies.sh | 33 | ||||
| -rwxr-xr-x | scripts/uni-build-dependencies.sh | 446 | ||||
| -rwxr-xr-x | scripts/uni-get-dependencies.sh | 90 | 
19 files changed, 1639 insertions, 531 deletions
| diff --git a/scripts/check-dependencies.sh b/scripts/check-dependencies.sh new file mode 100755 index 0000000..eaed556 --- /dev/null +++ b/scripts/check-dependencies.sh @@ -0,0 +1,506 @@ +# Parse the minimum versions of dependencies from README.md, and compare +# with what is found on the system. Print results. +# +# usage +#  check-dependencies.sh                # check version of all dependencies +#  check-dependencies.sh debug          # debug this script +# +# output +#   a table displaying the minimum version from README, the found version, +#   and whether it is OK or not. +# +# design +#   stage 1. search by parsing header files and/or binary output (_sysver) +#   stage 2. search with pkg-config +# +#  Code style is portability and simplicity. Plain sed, awk, grep, sh. +#  Functions return strings under $function_name_result variable. +#  tmp variables are named funcname_abbreviated_tmp. +#  Local vars are not used. +# +# todo +#  testing of non-bash shells +#  if /usr/ and /usr/local/ on linux both hit, throw a warning +#  print location found, how found??? +#  look at pkgconfig --exists & --modversion +#  deal with deps like GLEW that don't have proper version strings? +# + +DEBUG= + +debug() +{ +  if [ $DEBUG ]; then echo check-dependencies.sh: $* ; fi +} + + +eigen_sysver() +{ +  debug eigen +  eigpath= +  eig3path=$1/include/eigen3/Eigen/src/Core/util/Macros.h +  eig2path=$1/include/eigen2/Eigen/src/Core/util/Macros.h +  if [ -e $eig3path ]; then eigpath=$eig3path; fi +  if [ -e $eig2path ]; then eigpath=$eig2path; fi +  debug $eig2path +  if [ ! $eigpath ]; then return; fi +  eswrld=`grep "define  *EIGEN_WORLD_VERSION  *[0-9]*" $eigpath | awk '{print $3}'` +  esmaj=`grep "define  *EIGEN_MAJOR_VERSION  *[0-9]*" $eigpath | awk '{print $3}'` +  esmin=`grep "define  *EIGEN_MINOR_VERSION  *[0-9]*" $eigpath | awk '{print $3}'` +  eigen_sysver_result="$eswrld.$esmaj.$esmin" +} + +opencsg_sysver() +{ +  debug opencsg_sysver +  if [ ! -e $1/include/opencsg.h ]; then return; fi +  ocsgver=`grep "define  *OPENCSG_VERSION_STRING *[0-9x]*" $1/include/opencsg.h` +  ocsgver=`echo $ocsgver | awk '{print $4}' | sed s/'"'//g | sed s/[^1-9.]//g` +  opencsg_sysver_result=$ocsgver +} + +cgal_sysver() +{ +  cgalpath=$1/include/CGAL/version.h +  if [ ! -e $cgalpath ]; then return; fi +  cgal_sysver_result=`grep "define  *CGAL_VERSION  *[0-9.]*" $cgalpath | awk '{print $3}'` +} + +boost_sysver() +{ +  boostpath=$1/include/boost/version.hpp +  if [ ! -e $boostpath ]; then return; fi +  bsver=`grep 'define  *BOOST_LIB_VERSION *[0-9_"]*' $boostpath | awk '{print $3}'` +  bsver=`echo $bsver | sed s/'"'//g | sed s/'_'/'.'/g` +  boost_sysver_result=$bsver +} + +mpfr_sysver() +{ +  mpfrpath=$1/include/mpfr.h +  if [ ! -e $mpfrpath ]; then return; fi +  mpfrsver=`grep 'define  *MPFR_VERSION_STRING  *' $mpfrpath | awk '{print $3}'` +  mpfrsver=`echo $mpfrsver | sed s/"-.*"// | sed s/'"'//g` +  mpfr_sysver_result=$mpfrsver +} + +gmp_sysver() +{ +  # on some systems you have VERSION in gmp-$arch.h not gmp.h. use gmp*.h +  if [ ! -e $1/include ]; then return; fi +  gmppaths=`ls $1/include | grep ^gmp` +  if [ ! "$gmppaths" ]; then return; fi +  for gmpfile in $gmppaths; do +    gmppath=$1/include/$gmpfile +    if [ "`grep __GNU_MP_VERSION $gmppath`" ]; then +      gmpmaj=`grep "define  *__GNU_MP_VERSION  *[0-9]*" $gmppath | awk '{print $3}'` +      gmpmin=`grep "define  *__GNU_MP_VERSION_MINOR  *[0-9]*" $gmppath | awk '{print $3}'` +      gmppat=`grep "define  *__GNU_MP_VERSION_PATCHLEVEL  *[0-9]*" $gmppath | awk '{print $3}'` +    fi +  done +  gmp_sysver_result="$gmpmaj.$gmpmin.$gmppat" +} + +qt4_sysver() +{ +  qt4path=$1/include/qt4/QtCore/qglobal.h +  if [ ! -e $qt4path ]; then +    qt4path=$1/include/QtCore/qglobal.h +  fi +  if [ ! -e $qt4path ]; then +    # netbsd +    qt4path=$1/qt4/include/QtCore/qglobal.h  +  fi +  if [ ! -e $qt4path ]; then return; fi +  qt4ver=`grep 'define  *QT_VERSION_STR  *' $qt4path | awk '{print $3}'` +  qt4ver=`echo $qt4ver | sed s/'"'//g` +  qt4_sysver_result=$qt4ver +} + +glew_sysver() +{ +  glewh=$1/include/GL/glew.h +  if [ -e $glewh ]; then +    # glew has no traditional version number in it's headers +    # so we either test for what we need and 'guess', or assign it to 0.0 +    # the resulting number is a 'lower bound', not exactly what is installed +    if [ "`grep __GLEW_VERSION_4_2 $glewh`" ]; then +      glew_sysver_result=1.7.0 +    fi +    if [ ! $glew_sysver_result ]; then +      if [ "`grep __GLEW_ARB_occlusion_query2 $glewh`" ]; then +        glew_sysver_result=1.5.4 +      fi +    fi +    if [ ! $glew_sysver_result ]; then +      glew_sysver_result=0.0 +    fi +  fi +} + +imagemagick_sysver() +{ +  if [ ! -x $1/bin/convert ]; then return; fi +  imver=`$1/bin/convert --version | grep -i version` +  imagemagick_sysver_result=`echo $imver | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` +} + +flex_sysver() +{ +  flexbin=$1/bin/flex +  if [ -x $1/bin/gflex ]; then flexbin=$1/bin/gflex; fi # openbsd +  if [ ! -x $flexbin ]; then return ; fi +  flex_sysver_result=`$flexbin --version | sed s/"[^0-9.]"/" "/g` +} + +bison_sysver() +{ +  if [ ! -x $1/bin/bison ]; then return ; fi +  bison_sysver_result=`$1/bin/bison --version | grep bison | sed s/"[^0-9.]"/" "/g` +} + +gcc_sysver() +{ +  bingcc=$1/bin/g++ +  if [ ! -x $1/bin/g++ ]; then +    if [ "`command -v g++`" ]; then # fallback to $PATH +      bingcc=g++; +    fi +  fi +  debug using bingcc: $bingcc +  if [ ! -x $bingcc ]; then return; fi +  if [ ! "`$bingcc --version`" ]; then return; fi +  gccver=`$bingcc --version| grep -i g++ | awk -F "(" ' { print $2 } '` +  debug g++ output1: $gccver +  gccver=`echo $gccver | awk -F ")" ' { print $2 } '` +  debug g++ output2: $gccver +  gccver=`echo $gccver | awk ' { print $1 } '` +  debug g++ output3: $gccver +  gcc_sysver_result=$gccver +} + +git_sysver() +{ +  if [ ! -x $1/bin/git ]; then return ; fi +  git_sysver_result=`$1/bin/git --version | grep git | sed s/"[^0-9.]"/" "/g` +} + +curl_sysver() +{ +  if [ ! -x $1/bin/curl ]; then return; fi +  curl_sysver_result=`$1/bin/curl --version | grep curl | sed s/"[^0-9. ]"/" "/g | awk '{print $1}'` +} + +cmake_sysver() +{ +  if [ ! -x $1/bin/cmake ]; then return ; fi +  cmake_sysver_result=`$1/bin/cmake --version | grep cmake | sed s/"[^0-9.]"/" "/g | awk '{ print $1 }'` +} + +make_sysver() +{ +  make_sysver_tmp= +  binmake=$1/bin/make +  if [ -x $1/bin/gmake ]; then binmake=$1/bin/gmake ;fi +  if [ ! -x $binmake ]; then return ;fi +  make_sysver_tmp=`$binmake --version 2>&1` + +  debug finding gnu make: raw make response: $make_sysver_tmp +  if [ ! "`echo $make_sysver_tmp | grep -i gnu`" ]; then +    return; +  fi + +  make_sysver_tmp=`$binmake --version 2>&1 | grep -i 'gnu make' | sed s/"[^0-9.]"/" "/g` +  if [ "`echo $make_sysver_tmp | grep [0-9]`" ]; then +    make_sysver_result=$make_sysver_tmp +  fi +} + +bash_sysver() +{ +  if [ -x /bin/bash ]; then binbash=/bin/bash ;fi +  if [ -x /usr/bin/bash ]; then binbash=/usr/bin/bash ;fi +  if [ -x $1/bin/bash ]; then binbash=$1/bin/bash ;fi +  if [ ! -x $binbash ]; then return; fi +  bash_sysver_result=`$binbash --version | grep bash | sed s/"[^0-9. ]"/" "/g|awk '{print $1}'` +} + +python_sysver() +{ +  if [ ! -x $1/bin/python ]; then return; fi +  python_sysver_result=`$1/bin/python --version 2>&1 | awk '{print $2}'` +} + +pkg_config_search() +{ +  debug pkg_config_search $* +  pkg_config_search_result= +  pcstmp= +  if [ ! $1 ]; then return; fi +  pkgname=$1 + +  pkg-config --exists $pkgname 2>&1 +  if [ $? = 0 ]; then +    pkg_config_search_result=`pkg-config --modversion $pkgname` +  else +    debug pkg_config_search failed on $*, result of run was: $pcstmp +  fi +} + +get_minversion_from_readme() +{ +  if [ -e README.md ]; then READFILE=README.md; fi +  if [ -e ../README.md ]; then READFILE=../README.md; fi +  if [ ! $READFILE ]; then +    if [ "`command -v dirname`" ]; then +      READFILE=`dirname $0`/../README.md +    fi +  fi +  if [ ! $READFILE ]; then echo "cannot find README.md"; exit 1; fi +  debug get_minversion_from_readme $* +  if [ ! $1 ]; then return; fi +  depname=$1 +  local grv_tmp= +  debug $depname +  # example-->     * [CGAL (3.6 - 3.9)] (www.cgal.org)  becomes 3.6 +  # steps: eliminate *, find left (, find -, make 'x' into 0, delete junk +  grv_tmp=`grep -i ".$depname.*([0-9]" $READFILE | sed s/"*"//` +  debug $grv_tmp +  grv_tmp=`echo $grv_tmp | awk -F"(" '{print $2}'` +  debug $grv_tmp +  grv_tmp=`echo $grv_tmp | awk -F"-" '{print $1}'` +  debug $grv_tmp +  grv_tmp=`echo $grv_tmp | sed s/"x"/"0"/g` +  debug $grv_tmp +  grv_tmp=`echo $grv_tmp | sed s/"[^0-9.]"//g` +  debug $grv_tmp +  get_minversion_from_readme_result=$grv_tmp +} + +find_min_version() +{ +  find_min_version_result= +  fmvtmp= +  if [ ! $1 ] ; then return; fi +  fmvdep=$1 +  get_minversion_from_readme $fmvdep +  fmvtmp=$get_minversion_from_readme_result + +  # items not included in README.md +  if [ $fmvdep = "git" ]; then fmvtmp=1.5 ; fi +  if [ $fmvdep = "curl" ]; then fmvtmp=6 ; fi +  if [ $fmvdep = "make" ]; then fmvtmp=3 ; fi +  if [ $fmvdep = "python" ]; then fmvtmp=2 ; fi + +  find_min_version_result=$fmvtmp +} + +vers_to_int() +{ +  # change x.y.z.p into an integer that can be compared using -lt or -gt +  # 1.2.3.4 into 1020304 +  # 1.11.0.12 into 1110012 +  # 2011.2.3 into 20110020300 +  # it will work as long as the resulting int is less than 2.147 billion +  # and y z and p are less than 99 +  vers_to_int_result= +  if [ ! $1 ] ; then return ; fi +  vtoi_ver=$1 +  vtoi_test=`echo $vtoi_ver | sed s/"[^0-9.]"//g` +  debug vers_to_int $* :: vtoi_ver: $vtoi_ver vtoi_test: $vtoi_test +  if [ ! "$vtoi_test" = "$vtoi_ver" ]; then +    debug failure in version-to-integer conversion. +    debug '"'$vtoi_ver'"' has letters, etc in it. setting to 0 +    vtoi_ver="0" +  fi +  vers_to_int_result=`echo $vtoi_ver | awk -F. '{print $1*1000000+$2*10000+$3*100+$4}'` +  vtoi_ver= +  vtoi_test= +} + + +version_less_than_or_equal() +{ +  if [ ! $1 ]; then return; fi +  if [ ! $2 ]; then return; fi +  v1=$1 +  v2=$2 +  vers_to_int $v1 +  v1int=$vers_to_int_result +  vers_to_int $v2 +  v2int=$vers_to_int_result +  debug "v1, v2, v1int, v2int" , $v1, $v2, $v1int, $v2int +  if [ $v1int -le $v2int ]; then +    debug "v1 <= v2" +    return 0 +  else +    debug "v1 > v2" +    return 1 +  fi +  v1= +  v2= +  v1int= +  v2int= +} + +compare_version() +{ +  debug compare_version $* +  compare_version_result="NotOK" +  if [ ! $1 ] ; then return; fi +  if [ ! $2 ] ; then return; fi +  cvminver=$1 +  cvinstver=$2 +  cvtmp= +  version_less_than_or_equal $cvminver $cvinstver +  if [ $? = 0 ]; then +    cvtmp="OK" +  else +    cvtmp="NotOK" +  fi +  compare_version_result=$cvtmp +  cvtmp= +} + +pretty_print() +{ +  # there are four columns, passed as $1 $2 $3 and $4 +  # 1 = name of dependency +  # 2 = version found in README +  # 3 = version found on system +  # 4 = whether it is OK or not + +  debug pretty_print $* + +  brightred="\033[40;31m" +  red="\033[40;31m" +  brown="\033[40;33m" +  yellow="\033[40;33m" +  white="\033[40;37m" +  purple="\033[40;35m" +  green="\033[40;32m" +  cyan="\033[40;36m" +  gray="\033[40;37m" +  nocolor="\033[0m" + +  ppstr="%s%-12s" +  pp_format='{printf("'$ppstr$ppstr$ppstr$ppstr$nocolor'\n",$1,$2,$3,$4,$5,$6,$7,$8)}' +  pp_title="$gray depname $gray minimum $gray found $gray OKness" +  if [ $1 ]; then pp_depname=$1; fi +  if [ $pp_depname = "title" ]; then +    echo -e $pp_title | awk $pp_format +    return ; +  fi + +  if [ $2 ]; then pp_minver=$2; else pp_minver="unknown"; fi +  if [ $3 ]; then pp_foundver=$3; else pp_foundver="unknown"; fi +  if [ $4 ]; then pp_okness=$4; else pp_okness="NotOK"; fi + +  if [ $pp_okness = "NotOK" ]; then +    pp_foundcolor=$purple; +    pp_cmpcolor=$purple; +  else +    pp_foundcolor=$gray; +    pp_cmpcolor=$green; +  fi +  echo -e $cyan $pp_depname $gray $pp_minver $pp_foundcolor $pp_foundver $pp_cmpcolor $pp_okness | awk $pp_format +  pp_depname= +  pp_minver= +  pp_foundver= +  pp_okness= +} + +find_installed_version() +{ +  debug find_installed_version $* +  find_installed_version_result=unknown +  fsv_tmp= +  depname=$1 + +  # try to find/parse headers and/or binary output +  if [ ! $fsv_tmp ]; then +    for syspath in "/opt" "/usr/pkg" "/usr" "/usr/local" $OPENSCAD_LIBRARIES; do +      if [ -e $syspath ]; then +        debug $depname"_sysver" $syspath +        eval $depname"_sysver" $syspath +        fsv_tmp=`eval echo "$"$depname"_sysver_result"` +      fi +    done +  fi + +  # use pkg-config to search +  if [ ! $fsv_tmp ]; then +    if [ "`command -v pkg-config`" ]; then +      debug plain search failed. trying pkg_config... +      pkg_config_search $depname +      fsv_tmp=$pkg_config_search_result +    fi +  fi + +  if [ $fsv_tmp ]; then +    find_installed_version_result=$fsv_tmp +  else +    debug all searches failed. unknown version. +  fi +} + +check_old_local() +{ +  warnon= +  if [ "`uname | grep -i linux`" ]; then +    header_list="opencsg.h CGAL boost GL/glew.h gmp.h mpfr.h eigen2 eigen3" +    liblist="libboost libopencsg libCGAL libglew" +    for i in $header_list $liblist; do +      if [ -e /usr/local/include/$i ]; then +        echo "Warning: you have a copy of "$i" under /usr/local/include" +        warnon=1 +      fi +      if [ -e /usr/local/lib/$i.so ]; then +        echo "Warning: you have a copy of "$i" under /usr/local/lib" +        warnon=1 +      fi +    done +  fi +  if [ $warnon ]; then +    echo "Please verify these local copies don't conflict with the system" +  fi +} + +check_misc() +{ +  if [ "`uname -a|grep -i netbsd`" ]; then +    echo "NetBSD: Please manually verify the X Sets have been installed" +  fi +} + +checkargs() +{ +  for i in $*; do +    if [ $i = "debug" ]; then DEBUG=1 ; fi +  done +} + +main() +{ +  deps="qt4 cgal gmp mpfr boost opencsg glew eigen gcc bison flex make" +  #deps="$deps curl git" # not technically necessary for build +  #deps="$deps python cmake imagemagick" # only needed for tests +  pretty_print title +  for depname in $deps; do +    debug "processing $dep" +    find_installed_version $depname +    dep_sysver=$find_installed_version_result +    find_min_version $depname +    dep_minver=$find_min_version_result +    compare_version $dep_minver $dep_sysver +    dep_compare=$compare_version_result +  	pretty_print $depname $dep_minver $dep_sysver $dep_compare +  done +  check_old_local +  check_misc +} + +checkargs $* +main +exit 0 + diff --git a/scripts/fedora-build-dependencies.sh b/scripts/fedora-build-dependencies.sh deleted file mode 100755 index 7481a63..0000000 --- a/scripts/fedora-build-dependencies.sh +++ /dev/null @@ -1,29 +0,0 @@ -echo "Tested on Fedora 17. If this fails try 'old linux' build (see README.md)" -sleep 2 - -# Fedora 17 has CGAL 4 -#if [ "`yum list installed | grep -i cgal`" ]; then -#	echo "Please make sure you have removed all cgal packages and retry" -#	exit -#fi - -if [ "`yum list installed | grep -i opencsg`" ]; then -	echo "Please make sure you have removed all opencsg packages and retry" -	exit -fi - -sudo yum install qt-devel bison flex eigen2-devel \ - boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git - -#echo "now copy/paste the following to install CGAL and OpenCSG from source:" -#echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" - -echo -echo "Now copy/paste the following to install OpenCSG from source:" -echo -# https://bugzilla.redhat.com/show_bug.cgi?id=144967 -echo "sudo echo /usr/local/lib | sudo tee -a /etc/ld.so.conf.d/local.conf" -echo "sudo ldconfig" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" -echo - diff --git a/scripts/freebsd-build-dependencies.sh b/scripts/freebsd-build-dependencies.sh deleted file mode 100755 index 4ea61de..0000000 --- a/scripts/freebsd-build-dependencies.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/local/bin/bash -e - -echo "Tested on FreeBSD 9. Please see README.md for info on older systems." - -if [ "`pkg_info | grep -i cgal `" ]; then -	echo Stopping. Please remove any CGAL packages you have installed and restart -	exit -fi - -if [ "`pkg_info | grep -i opencsg`" ]; then -	echo Stopping. Please remove any OpenCSG packages you have installed and restart -	exit -fi - -OPENSCADDIR=$PWD -if [ ! -f $OPENSCADDIR/openscad.pro ]; then -  echo "Must be run from the OpenSCAD source root directory" -  exit 0 -fi - -. ./scripts/setenv-freebsdbuild.sh - -pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr  -pkg_add -r xorg libGLU libXmu libXi xorg-vfbserver glew -pkg_add -r qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic - -BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs -BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg diff --git a/scripts/googlecode_upload.py b/scripts/googlecode_upload.py new file mode 100755 index 0000000..188dd6c --- /dev/null +++ b/scripts/googlecode_upload.py @@ -0,0 +1,296 @@ +#!/usr/bin/env python +# Google Code binary package uploader +# with Insturctions for uploading packages for OpenSCAD +# +# OpenSCAD Usage: +# +# 1. get a google account, get it added to the Google Code OpenSCAD project +# 2. go to https://code.google.com/hosting/settings for username & password +# ----- +# +#              security note -  +# +#              it's not advisable to use a ~/.netrc file to store your password +#              keep your googlecode password secret +#              only upload from a secure machine +#              user's personal data can be at risk if your account  +#              is compromised and a fake openscad were to be uploaded. +#              notify the OpenSCAD maintainer if your computer is stolen or  +#              your google account is ever compromised.  +# ----- +# 4. if you are making a Stable Release, check 'docs/release_checklist.txt' +# 5. create an OpenSCAD package (linux dev snapshot: ./scripts/release-common.sh) +# 6. Run this to do the upload: +#  export SUMMARY="Linux x86-64 Snapshot" # replace as appropriate +#  export PACKAGEFILE=openscad-2013.01.10.x86-64.tar.gz # replace as appropriate +#  python ./scripts/googlecode_upload.py -s '$SUMMARY' -p openscad $PACKAGEFILE +# 7. It will ask for username. Use user.name@gmail.com (include the @ mail address) +# 8. It will ask for password. Copy/paste the password from the https google code settings page above +#   Don't use the big bold password, use the 'plain font' password from the 'machine' line +# 9. Wait.... (there is no progress meter). It should say 'success' eventually. +# +# The rest of this file is original from Google with slight modifications by the +# OpenSCAD team. Modifications licensed under the same license as the +# original code from google - the Apache Software License 2.0: +#  http://www.apache.org/licenses/LICENSE-2.0 + + +# +# Copyright 2006, 2007 Google Inc. All Rights Reserved. +# Author: danderson@google.com (David Anderson) +# +# Script for uploading files to a Google Code project. +# +# This is intended to be both a useful script for people who want to +# streamline project uploads and a reference implementation for +# uploading files to Google Code projects. +# +# To upload a file to Google Code, you need to provide a path to the +# file on your local machine, a small summary of what the file is, a +# project name, and a valid account that is a member or owner of that +# project.  You can optionally provide a list of labels that apply to +# the file.  The file will be uploaded under the same name that it has +# in your local filesystem (that is, the "basename" or last path +# component).  Run the script with '--help' to get the exact syntax +# and available options. +# +# Note that the upload script requests that you enter your +# googlecode.com password.  This is NOT your Gmail account password! +# This is the password you use on googlecode.com for committing to +# Subversion and uploading files.  You can find your password by going +# to http://code.google.com/hosting/settings when logged in with your +# Gmail account. If you have already committed to your project's +# Subversion repository, the script will automatically retrieve your +# credentials from there (unless disabled, see the output of '--help' +# for details). +# +# If you are looking at this script as a reference for implementing +# your own Google Code file uploader, then you should take a look at +# the upload() function, which is the meat of the uploader.  You +# basically need to build a multipart/form-data POST request with the +# right fields and send it to https://PROJECT.googlecode.com/files . +# Authenticate the request using HTTP Basic authentication, as is +# shown below. +# +# Licensed under the terms of the Apache Software License 2.0: +#  http://www.apache.org/licenses/LICENSE-2.0 +# +# Questions, comments, feature requests and patches are most welcome. +# Please direct all of these to the Google Code users group: +#  http://groups.google.com/group/google-code-hosting + +"""Google Code file uploader script. +""" + +__author__ = 'danderson@google.com (David Anderson)' + +import httplib +import os.path +import optparse +import getpass +import base64 +import sys + + +def upload(file, project_name, user_name, password, summary, labels=None): +  """Upload a file to a Google Code project's file server. + +  Args: +    file: The local path to the file. +    project_name: The name of your project on Google Code. +    user_name: Your Google account name. +    password: The googlecode.com password for your account. +              Note that this is NOT your global Google Account password! +    summary: A small description for the file. +    labels: an optional list of label strings with which to tag the file. + +  Returns: a tuple: +    http_status: 201 if the upload succeeded, something else if an +                 error occured. +    http_reason: The human-readable string associated with http_status +    file_url: If the upload succeeded, the URL of the file on Google +              Code, None otherwise. +  """ +  # The login is the user part of user@gmail.com. If the login provided +  # is in the full user@domain form, strip it down. +  if user_name.endswith('@gmail.com'): +    user_name = user_name[:user_name.index('@gmail.com')] + +  form_fields = [('summary', summary)] +  if labels is not None: +    form_fields.extend([('label', l.strip()) for l in labels]) + +  content_type, body = encode_upload_request(form_fields, file) + +  upload_host = '%s.googlecode.com' % project_name +  upload_uri = '/files' +  auth_token = base64.b64encode('%s:%s'% (user_name, password)) +  headers = { +    'Authorization': 'Basic %s' % auth_token, +    'User-Agent': 'Googlecode.com uploader v0.9.4', +    'Content-Type': content_type, +    } + +  server = httplib.HTTPSConnection(upload_host) +  server.request('POST', upload_uri, body, headers) +  resp = server.getresponse() +  server.close() + +  if resp.status == 201: +    location = resp.getheader('Location', None) +  else: +    location = None +  return resp.status, resp.reason, location + + +def encode_upload_request(fields, file_path): +  """Encode the given fields and file into a multipart form body. + +  fields is a sequence of (name, value) pairs. file is the path of +  the file to upload. The file will be uploaded to Google Code with +  the same file name. + +  Returns: (content_type, body) ready for httplib.HTTP instance +  """ +  BOUNDARY = '----------Googlecode_boundary_reindeer_flotilla' +  CRLF = '\r\n' + +  body = [] + +  # Add the metadata about the upload first +  for key, value in fields: +    body.extend( +      ['--' + BOUNDARY, +       'Content-Disposition: form-data; name="%s"' % key, +       '', +       value, +       ]) + +  # Now add the file itself +  file_name = os.path.basename(file_path) +  f = open(file_path, 'rb') +  file_content = f.read() +  f.close() + +  body.extend( +    ['--' + BOUNDARY, +     'Content-Disposition: form-data; name="filename"; filename="%s"' +     % file_name, +     # The upload server determines the mime-type, no need to set it. +     'Content-Type: application/octet-stream', +     '', +     file_content, +     ]) + +  # Finalize the form body +  body.extend(['--' + BOUNDARY + '--', '']) + +  return 'multipart/form-data; boundary=%s' % BOUNDARY, CRLF.join(body) + + +def upload_find_auth(file_path, project_name, summary, labels=None, +                     user_name=None, password=None, tries=3): +  """Find credentials and upload a file to a Google Code project's file server. + +  file_path, project_name, summary, and labels are passed as-is to upload. + +  Args: +    file_path: The local path to the file. +    project_name: The name of your project on Google Code. +    summary: A small description for the file. +    labels: an optional list of label strings with which to tag the file. +    config_dir: Path to Subversion configuration directory, 'none', or None. +    user_name: Your Google account name. +    tries: How many attempts to make. +  """ +  if user_name is None or password is None: +    from netrc import netrc +    authenticators = None +    try: +      authenticators = netrc().authenticators("code.google.com") +    except: +      print "Error accessing netrc authenticator. Trying alternate method" +    if authenticators: +      if user_name is None: +        user_name = authenticators[0] +      if password is None: +        password = authenticators[2] + +  while tries > 0: +    if user_name is None: +      # Read username if not specified or loaded from svn config, or on +      # subsequent tries. +      sys.stdout.write('Please enter your googlecode.com username: ') +      sys.stdout.flush() +      user_name = sys.stdin.readline().rstrip() +    if password is None: +      # Read password if not loaded from svn config, or on subsequent tries. +      print 'Please enter your googlecode.com password.' +      print '** Note that this is NOT your Gmail account password! **' +      print 'It is the password you use to access Subversion repositories,' +      print 'and can be found here: http://code.google.com/hosting/settings' +      password = getpass.getpass() + +    status, reason, url = upload(file_path, project_name, user_name, password, +                                 summary, labels) +    # Returns 403 Forbidden instead of 401 Unauthorized for bad +    # credentials as of 2007-07-17. +    if status in [httplib.FORBIDDEN, httplib.UNAUTHORIZED]: +      # Rest for another try. +      user_name = password = None +      tries = tries - 1 +    else: +      # We're done. +      break + +  return status, reason, url + + +def main(): +  parser = optparse.OptionParser(usage='googlecode-upload.py -s SUMMARY ' +                                 '-p PROJECT [options] FILE') +  parser.add_option('-s', '--summary', dest='summary', +                    help='Short description of the file') +  parser.add_option('-p', '--project', dest='project', +                    help='Google Code project name') +  parser.add_option('-u', '--user', dest='user', +                    help='Your Google Code username') +  parser.add_option('-w', '--password', dest='password', +                    help='Your Google Code password') +  parser.add_option('-l', '--labels', dest='labels', +                    help='An optional list of comma-separated labels to attach ' +                    'to the file') + +  options, args = parser.parse_args() + +  if not options.summary: +    parser.error('File summary is missing.') +  elif not options.project: +    parser.error('Project name is missing.') +  elif len(args) < 1: +    parser.error('File to upload not provided.') +  elif len(args) > 1: +    parser.error('Only one file may be specified.') + +  file_path = args[0] + +  if options.labels: +    labels = options.labels.split(',') +  else: +    labels = None + +  status, reason, url = upload_find_auth(file_path, options.project, +                                         options.summary, labels, +                                         options.user, options.password) +  if url: +    print 'The file was uploaded successfully.' +    print 'URL: %s' % url +    return 0 +  else: +    print 'An error occurred. Your file was not uploaded.' +    print 'Google Code upload server said: %s (%s)' % (reason, status) +    return 1 + + +if __name__ == '__main__': +  sys.exit(main()) diff --git a/scripts/installer.nsi b/scripts/installer.nsi index 87ec18d..1841431 100644 --- a/scripts/installer.nsi +++ b/scripts/installer.nsi @@ -6,6 +6,7 @@ DirText "This will install OpenSCAD on your computer. Choose a directory"  Section "install"  SetOutPath $INSTDIR  File openscad.exe +File openscad.com  File /r /x mingw-cross-env examples  File /r /x mingw-cross-env libraries  ${registerExtension} "$INSTDIR\openscad.exe" ".scad" "OpenSCAD_File" diff --git a/scripts/linux-build-dependencies.sh b/scripts/linux-build-dependencies.sh deleted file mode 100755 index aee423c..0000000 --- a/scripts/linux-build-dependencies.sh +++ /dev/null @@ -1,332 +0,0 @@ -#!/bin/sh -e - -# test_pretty_print copyright 2012 don bright. released under the GPL 2, or -# later, as described in the file named 'COPYING' in OpenSCAD's project root. -# permission to change this license is given to Marius Kintel & Clifford Wolf - -# -# This script builds all library dependencies of OpenSCAD for Linux -# -# This script must be run from the OpenSCAD source root directory -# -# Usage: linux-build-dependencies.sh -# -# Prerequisites: -# - wget or curl -# - Qt4 -# - -printUsage() -{ -  echo "Usage: $0" -  echo -} - -build_git() -{ -  version=$1 -  echo "Building git" $version "..." -  cd $BASEDIR/src -  rm -rf git-$version -  if [ ! -f git-$version.tar.gz ]; then -    curl -O http://git-core.googlecode.com/files/git-$version.tar.gz -  fi -  tar zxf git-$version.tar.gz -  cd git-$version -  ./configure --prefix=$DEPLOYDIR -  make -j$NUMCPU -  make install -} - -build_cmake() -{ -  version=$1 -  echo "Building cmake" $version "..." -  cd $BASEDIR/src -  rm -rf cmake-$version -  if [ ! -f cmake-$version.tar.gz ]; then -    curl -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz -  fi -  tar zxf cmake-$version.tar.gz -  cd cmake-$version -  mkdir build -  cd build -  ../configure --prefix=$DEPLOYDIR -  make -j$NUMCPU -  make install -} - -build_curl() -{ -  version=$1 -  echo "Building curl" $version "..." -  cd $BASEDIR/src -  rm -rf curl-$version -  if [ ! -f curl-$version.tar.bz2 ]; then -    wget http://curl.haxx.se/download/curl-$version.tar.bz2 -  fi -  tar xjf curl-$version.tar.bz2 -  cd curl-$version -  mkdir build -  cd build -  ../configure --prefix=$DEPLOYDIR -  make -j$NUMCPU -  make install -} - -build_gmp() -{ -  version=$1 -  echo "Building gmp" $version "..." -  cd $BASEDIR/src -  rm -rf gmp-$version -  if [ ! -f gmp-$version.tar.bz2 ]; then -    curl -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 -  fi -  tar xjf gmp-$version.tar.bz2 -  cd gmp-$version -  mkdir build -  cd build -  ../configure --prefix=$DEPLOYDIR --enable-cxx -  make install -} - -build_mpfr() -{ -  version=$1 -  echo "Building mpfr" $version "..." -  cd $BASEDIR/src -  rm -rf mpfr-$version -  if [ ! -f mpfr-$version.tar.bz2 ]; then -    curl -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 -  fi -  tar xjf mpfr-$version.tar.bz2 -  cd mpfr-$version -  mkdir build -  cd build -  ../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR -  make install -  cd .. -} - -build_boost() -{ -  version=$1 -  bversion=`echo $version | tr "." "_"` -  echo "Building boost" $version "..." -  cd $BASEDIR/src -  rm -rf boost_$bversion -  if [ ! -f boost_$bversion.tar.bz2 ]; then -    curl -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 -  fi -  tar xjf boost_$bversion.tar.bz2 -  cd boost_$bversion -  # We only need certain portions of boost -  ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex -	if [ $CXX ]; then -		if [ $CXX = "clang" ]; then -		  ./b2 -j$NUMCPU toolset=clang install -		  # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install -		fi -	else -	  ./b2 -j$NUMCPU -	  ./b2 install -	fi -} - -build_cgal() -{ -  version=$1 -  echo "Building CGAL" $version "..." -  cd $BASEDIR/src -  rm -rf CGAL-$version -  if [ ! -f CGAL-$version.tar.gz ]; then -    #4.0.2 -    curl -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 -    # 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz -    # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz -    # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz -    # 3.7 curl -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz -  fi -  tar jxf CGAL-$version.tar.bz2 -  cd CGAL-$version -  if [ $2 = use-sys-libs ]; then -    cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug -  else -    cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug -  fi -  make -j$NUMCPU -  make install -} - -build_glew() -{ -  version=$1 -  echo "Building GLEW" $version "..." -  cd $BASEDIR/src -  rm -rf glew-$version -  if [ ! -f glew-$version.tgz ]; then -    curl -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz -  fi -  tar xzf glew-$version.tgz -  cd glew-$version -  mkdir -p $DEPLOYDIR/lib/pkgconfig - -  # Fedora 64-bit -	if [ -e /usr/lib64 ]; then -	  if [ "`ls /usr/lib64 | grep Xmu`" ]; then -	    echo "modifying glew makefile for 64 bit machine" -	    sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux -	  fi -	fi - -	if [ $CC ]; then -		if [ $CC = "clang" ]; then -			echo "modifying glew makefile for clang" -			sed -i s/\$\(CC\)/clang/ Makefile -		fi -	fi - -	GLEW_DEST=$DEPLOYDIR make -j$NUMCPU -  GLEW_DEST=$DEPLOYDIR make install -} - -build_opencsg() -{ -  version=$1 -  echo "Building OpenCSG" $version "..." -  cd $BASEDIR/src -  rm -rf OpenCSG-$version -  if [ ! -f OpenCSG-$version.tar.gz ]; then -    curl -O http://www.opencsg.org/OpenCSG-$version.tar.gz -  fi -  tar xzf OpenCSG-$version.tar.gz -  cd OpenCSG-$version -  sed -ibak s/example// opencsg.pro # examples might be broken without GLUT - -  # Fedora 64-bit -	if [ -e /usr/lib64 ]; then -	  if [ "`ls /usr/lib64 | grep Xmu`" ]; then -	    echo "modifying opencsg makefile for 64 bit machine" -	    sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ src/Makefile  -	  fi -	fi - -  if [ `uname | grep FreeBSD` ]; then -    sed -ibak s/X11R6/local/g src/Makefile -   fi - -  if [ "`command -v qmake-qt4`" ]; then -    OPENCSG_QMAKE=qmake-qt4 -  else -    OPENCSG_QMAKE=qmake -  fi - -	if [ $CXX ]; then -		if [ $CXX = "clang++" ]; then -		  cd $BASEDIR/src/OpenCSG-$version/src -			$OPENCSG_QMAKE -		  cd $BASEDIR/src/OpenCSG-$version -			$OPENCSG_QMAKE -		fi -	else -		$OPENCSG_QMAKE -	fi - -  make - -  cp -av lib/* $DEPLOYDIR/lib -  cp -av include/* $DEPLOYDIR/include -  cd $OPENSCADDIR -} - -build_eigen() -{ -  version=$1 -  echo "Building eigen" $version "..." -  cd $BASEDIR/src -  rm -rf eigen-$version -  ## Directory name for v2.0.17 -  rm -rf eigen-eigen-b23437e61a07 -  if [ ! -f eigen-$version.tar.bz2 ]; then -    curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 -    mv $version.tar.bz2 eigen-$version.tar.bz2 -  fi -  tar xjf eigen-$version.tar.bz2 -  ## File name for v2.0.17 -  ln -s eigen-eigen-b23437e61a07 eigen-$version -  cd eigen-$version -  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -  make -j$NUMCPU -  make install -} - - -OPENSCADDIR=$PWD -if [ ! -f $OPENSCADDIR/openscad.pro ]; then -  echo "Must be run from the OpenSCAD source root directory" -  exit 0 -fi - -. ./scripts/setenv-linbuild.sh # '.' is equivalent to 'source' -SRCDIR=$BASEDIR/src - -if [ ! $NUMCPU ]; then -	echo "Note: The NUMCPU environment variable can be set for paralell builds" -	NUMCPU=1  -fi - -if [ ! -d $BASEDIR/bin ]; then -  mkdir -p $BASEDIR/bin -fi - -echo "Using basedir:" $BASEDIR -echo "Using deploydir:" $DEPLOYDIR -echo "Using srcdir:" $SRCDIR -echo "Number of CPUs for parallel builds:" $NUMCPU -mkdir -p $SRCDIR $DEPLOYDIR - -if [ ! "`command -v curl`" ]; then -	build_curl 7.26.0 -fi - -# NB! For cmake, also update the actual download URL in the function -if [ ! "`command -v cmake`" ]; then -	build_cmake 2.8.8 -fi -if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then -	build_cmake 2.8.8 -fi - -# build_git 1.7.10.3 - -# Singly build CGAL or OpenCSG -# (Most systems have all libraries available as packages except CGAL/OpenCSG) -# (They can be built singly here by passing a command line arg to the script) -if [ $1 ]; then -  if [ $1 = "cgal-use-sys-libs" ]; then -    build_cgal 4.0.2 use-sys-libs -    exit -  fi -  if [ $1 = "opencsg" ]; then -    build_opencsg 1.3.2 -    exit -  fi -fi - - -# -# Main build of libraries -# edit version numbers here as needed. -# - -build_eigen 2.0.17 -build_gmp 5.0.5 -build_mpfr 3.1.1 -build_boost 1.47.0 -# NB! For CGAL, also update the actual download URL in the function -build_cgal 4.0.2 -build_glew 1.7.0 -build_opencsg 1.3.2 - -echo "OpenSCAD dependencies built and installed to " $BASEDIR diff --git a/scripts/macosx-build-dependencies.sh b/scripts/macosx-build-dependencies.sh index f7b6b18..bfe0ede 100755 --- a/scripts/macosx-build-dependencies.sh +++ b/scripts/macosx-build-dependencies.sh @@ -6,16 +6,16 @@  #   # This script must be run from the OpenSCAD source root directory  # -# Usage: macosx-build-dependencies.sh [-6] +# Usage: macosx-build-dependencies.sh [-6l]  #  -6   Build only 64-bit binaries +#  -l   Force use of LLVM compiler +#  -c   Force use of clang compiler  #  # Prerequisites:  # - MacPorts: curl, cmake -# - Qt4  #  # FIXME:  # o Verbose option -# o Port to other platforms?  #  BASEDIR=$PWD/../libraries @@ -24,13 +24,38 @@ SRCDIR=$BASEDIR/src  DEPLOYDIR=$BASEDIR/install  MAC_OSX_VERSION_MIN=10.5  OPTION_32BIT=true +OPTION_LLVM=false +OPTION_CLANG=false +OPTION_GCC=false +DETECTED_LION=false  export QMAKESPEC=macx-g++  printUsage()  { -  echo "Usage: $0 [-6]" +  echo "Usage: $0 [-6lc]"    echo    echo "  -6   Build only 64-bit binaries" +  echo "  -l   Force use of LLVM compiler" +  echo "  -c   Force use of clang compiler" +} + +# FIXME: Support gcc/llvm/clang flags. Use -platform <whatever> to make this work? kintel 20130117 +build_qt() +{ +  version=$1 +  echo "Building Qt" $version "..." +  cd $BASEDIR/src +  rm -rf qt-everywhere-opensource-src-$version +  if [ ! -f qt-everywhere-opensource-src-$version.tar.gz ]; then +    curl -O http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-$version.tar.gz +  fi +  tar xzf qt-everywhere-opensource-src-$version.tar.gz +  cd qt-everywhere-opensource-src-$version +  if $OPTION_32BIT; then +    QT_32BIT="-arch x86" +  fi +  ./configure -prefix $DEPLOYDIR -release $QT_32BIT -arch x86_64 -opensource -confirm-license -fast -no-qt3support -no-svg -no-phonon -no-audio-backend -no-multimedia -no-javascript-jit -no-script -no-scripttools -no-declarative -no-xmlpatterns -nomake demos -nomake examples -nomake docs -nomake translations -no-webkit +  make -j6 install  }  # Hack warning: gmplib is built separately in 32-bit and 64-bit mode @@ -134,8 +159,8 @@ build_mpfr()    fi    tar xjf mpfr-$version.tar.bz2    cd mpfr-$version -  curl -O http://www.mpfr.org/mpfr-$version/allpatches -  patch -N -Z -p1 < allpatches  +#  curl -O http://www.mpfr.org/mpfr-$version/allpatches +#  patch -N -Z -p1 < allpatches     if $OPTION_32BIT; then      mkdir build-i386      cd build-i386 @@ -177,13 +202,21 @@ build_boost()    tar xjf boost_$bversion.tar.bz2    cd boost_$bversion    # We only need the thread and program_options libraries -  ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex +  ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,chrono,system,regex    if $OPTION_32BIT; then      BOOST_EXTRA_FLAGS="-arch i386"    fi -  ./bjam cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" -  ./bjam install +  if $OPTION_LLVM; then +    BOOST_TOOLSET="toolset=darwin-llvm" +    echo "using darwin : llvm : llvm-g++ ;" >> tools/build/v2/user-config.jam  +  elif $OPTION_CLANG; then +    BOOST_TOOLSET="toolset=clang" +    echo "using clang ;" >> tools/build/v2/user-config.jam  +  fi +  ./b2 -d+2 $BOOST_TOOLSET cflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" linkflags="-mmacosx-version-min=$MAC_OSX_VERSION_MIN -arch x86_64 $BOOST_EXTRA_FLAGS" install    install_name_tool -id $DEPLOYDIR/lib/libboost_thread.dylib $DEPLOYDIR/lib/libboost_thread.dylib  +  install_name_tool -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_thread.dylib  +  install_name_tool -change libboost_chrono.dylib $DEPLOYDIR/lib/libboost_chrono.dylib $DEPLOYDIR/lib/libboost_thread.dylib     install_name_tool -id $DEPLOYDIR/lib/libboost_program_options.dylib $DEPLOYDIR/lib/libboost_program_options.dylib     install_name_tool -id $DEPLOYDIR/lib/libboost_filesystem.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib     install_name_tool -change libboost_system.dylib $DEPLOYDIR/lib/libboost_system.dylib $DEPLOYDIR/lib/libboost_filesystem.dylib  @@ -200,8 +233,10 @@ build_cgal()    cd $BASEDIR/src    rm -rf CGAL-$version    if [ ! -f CGAL-$version.tar.gz ]; then -      # 4.0.2 -      curl -O https://gforge.inria.fr/frs/download.php/31175/CGAL-$version.tar.gz +    # 4.1 +    curl -O https://gforge.inria.fr/frs/download.php/31641/CGAL-$version.tar.gz +    # 4.1-beta1 curl -O https://gforge.inria.fr/frs/download.php/31348/CGAL-$version.tar.gz +    # 4.0.2 curl -O https://gforge.inria.fr/frs/download.php/31175/CGAL-$version.tar.gz      # 4.0 curl -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz      # 3.9 curl -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz      # 3.8 curl -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz @@ -212,7 +247,7 @@ build_cgal()    if $OPTION_32BIT; then      CGAL_EXTRA_FLAGS=";i386"    fi -  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR +  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.dylib -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.dylib -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.dylib -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBUILD_SHARED_LIBS=TRUE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$CGAL_EXTRA_FLAGS" -DBOOST_ROOT=$DEPLOYDIR -DBoost_USE_MULTITHREADED=false    make -j4    make install    install_name_tool -id $DEPLOYDIR/lib/libCGAL.dylib $DEPLOYDIR/lib/libCGAL.dylib @@ -232,12 +267,10 @@ build_glew()    tar xzf glew-$version.tgz    cd glew-$version    mkdir -p $DEPLOYDIR/lib/pkgconfig -  # To avoid running strip on a fat archive as this is not supported by strip -  sed -ibak -e "s/\$(STRIP) -x lib\/\$(LIB.STATIC)//" Makefile     if $OPTION_32BIT; then      GLEW_EXTRA_FLAGS="-arch i386"    fi -  make GLEW_DEST=$DEPLOYDIR CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" install +  make GLEW_DEST=$DEPLOYDIR CC=$CC CFLAGS.EXTRA="-no-cpp-precomp -dynamic -fno-common -mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" LDFLAGS.EXTRA="-mmacosx-version-min=$MAC_OSX_VERSION_MIN $GLEW_EXTRA_FLAGS -arch x86_64" STRIP= install  }  build_opencsg() @@ -265,20 +298,29 @@ build_eigen()    echo "Building eigen" $version "..."    cd $BASEDIR/src    rm -rf eigen-$version -  ## Directory name for v2.0.17 -  rm -rf eigen-eigen-b23437e61a07 + +  EIGENDIR="none" +  if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi +  if [ $version = "3.1.2" ]; then EIGENDIR=eigen-eigen-5097c01bcdc4; fi +  if [ $EIGENDIR = "none" ]; then +    echo Unknown eigen version. Please edit script. +    exit 1 +  fi +  rm -rf ./$EIGENDIR +    if [ ! -f eigen-$version.tar.bz2 ]; then      curl -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2      mv $version.tar.bz2 eigen-$version.tar.bz2    fi    tar xjf eigen-$version.tar.bz2 -  ## File name for v2.0.17 -  ln -s eigen-eigen-b23437e61a07 eigen-$version +  ln -s ./$EIGENDIR eigen-$version    cd eigen-$version +  mkdir build +  cd build    if $OPTION_32BIT; then      EIGEN_EXTRA_FLAGS=";i386"    fi -  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" +  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_BUILD_LIB=ON -DBUILD_SHARED_LIBS=FALSE -DCMAKE_OSX_DEPLOYMENT_TARGET="$MAC_OSX_VERSION_MIN" -DCMAKE_OSX_ARCHITECTURES="x86_64$EIGEN_EXTRA_FLAGS" ..    make -j4    make install  } @@ -288,20 +330,64 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then    exit 0  fi -while getopts '6' c +while getopts '6lc' c  do    case $c in -    6) OPTION_32BIT=false +    6) OPTION_32BIT=false;; +    l) OPTION_LLVM=true;; +    c) OPTION_CLANG=true;;    esac  done +OSVERSION=`sw_vers -productVersion | cut -d. -f2` +if [[ $OSVERSION -ge 7 ]]; then +  echo "Detected Lion or later" +  DETECTED_LION=true +else +  echo "Detected Snow Leopard or earlier" +fi + +USING_LLVM=false +USING_GCC=false +USING_CLANG=false +if $OPTION_LLVM; then +  USING_LLCM=true +elif $OPTION_GCC; then +  USING_GCC=true +elif $OPTION_CLANG; then +  USING_CLANG=true +elif $DETECTED_LION; then +  USING_GCC=true +fi + +if $USING_LLVM; then +  echo "Using gcc LLVM compiler" +  export CC=llvm-gcc +  export CXX=llvm-g++ +  export QMAKESPEC=macx-llvm +elif $USING_GCC; then +  echo "Using gcc compiler" +  export CC=gcc +  export CXX=g++ +  export CPP=cpp +  # Somehow, qmake in Qt-4.8.2 doesn't detect Lion's gcc and falls back into +  # project file mode unless manually given a QMAKESPEC +  export QMAKESPEC=macx-llvm +elif $USING_CLANG; then +  echo "Using clang compiler" +  export CC=clang +  export CXX=clang++ +  export QMAKESPEC=unsupported/macx-clang +fi +  echo "Using basedir:" $BASEDIR  mkdir -p $SRCDIR $DEPLOYDIR -build_eigen 2.0.17 -build_gmp 5.0.5 -build_mpfr 3.1.0 -build_boost 1.47.0 +build_qt 4.8.4 +build_eigen 3.1.2 +build_gmp 5.1.0 +build_mpfr 3.1.1 +build_boost 1.51.0  # NB! For CGAL, also update the actual download URL in the function -build_cgal 4.0.2 -build_glew 1.7.0 +build_cgal 4.1 +build_glew 1.9.0  build_opencsg 1.3.2 diff --git a/scripts/mingw-x-build-dependencies.sh b/scripts/mingw-x-build-dependencies.sh index 76bb7d4..ee51848 100755 --- a/scripts/mingw-x-build-dependencies.sh +++ b/scripts/mingw-x-build-dependencies.sh @@ -41,8 +41,9 @@ if [ ! -e $BASEDIR ]; then  fi  if [ ! -e $MXEDIR ]; then -	echo "Downloading MXE into " $MXEDIR +	mkdir -p $MXEDIR  	cd $MXEDIR/.. +	echo "Downloading MXE into " $PWD  	git clone git://github.com/mxe/mxe.git  fi diff --git a/scripts/opensuse-build-dependencies.sh b/scripts/opensuse-build-dependencies.sh deleted file mode 100755 index 623d7d0..0000000 --- a/scripts/opensuse-build-dependencies.sh +++ /dev/null @@ -1,8 +0,0 @@ -echo "tested on OpenSUSE 12. If this fails try 'old linux' build (see README.md)" - -sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ - libqt4-devel glew-devel cmake git  - -echo "now copy/paste the following to install CGAL and OpenCSG from source:" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh cgal-use-sys-libs" -echo "sudo BASEDIR=/usr/local ./scripts/linux-build-dependencies.sh opencsg" diff --git a/scripts/publish-macosx.sh b/scripts/publish-macosx.sh index a2ded8a..e22e5bd 100755 --- a/scripts/publish-macosx.sh +++ b/scripts/publish-macosx.sh @@ -1,11 +1,12 @@  #!/bin/sh -# Set this if we're doing a release build. Comment it out for development builds -#VERSION=2011.12 +# NB! To build a release build, the VERSION environment variable needs to be set. +# See doc/release-checklist.txt  if test -z "$VERSION"; then    VERSION=`date "+%Y.%m.%d"`    COMMIT=-c +  SNAPSHOT=true  fi  # Turn off ccache, just for safety @@ -14,6 +15,9 @@ PATH=${PATH//\/opt\/local\/libexec\/ccache:}  # This is the same location as DEPLOYDIR in macosx-build-dependencies.sh  export OPENSCAD_LIBRARIES=$PWD/../libraries/install +# Make sure that the correct Qt tools are used +export PATH=$OPENSCAD_LIBRARIES/bin:$PATH +  `dirname $0`/release-common.sh -v $VERSION $COMMIT  if [[ $? != 0 ]]; then    exit 1 @@ -24,10 +28,11 @@ echo "Sanity check of the app bundle..."  if [[ $? != 0 ]]; then    exit 1  fi -cp OpenSCAD-$VERSION.dmg ~/Dropbox/Public -ln -sf OpenSCAD-$VERSION.dmg ~/Dropbox/Public/OpenSCAD-latest.dmg -echo "Upload in progress..." +echo "Uploading..." +LABELS=OpSys-OSX,Type-Executable +if ! $SNAPSHOT; then LABELS=$LABELS,Featured; fi +`dirname $0`/googlecode_upload.py -s 'Mac OS X Snapshot' -p openscad OpenSCAD-$VERSION.dmg -l $LABELS  # Update snapshot filename on wab page  `dirname $0`/update-web.sh OpenSCAD-$VERSION.dmg diff --git a/scripts/publish-mingw-x.sh b/scripts/publish-mingw-x.sh index d6cebcd..5622e9f 100755 --- a/scripts/publish-mingw-x.sh +++ b/scripts/publish-mingw-x.sh @@ -31,7 +31,7 @@ if [ ! -f $OPENSCADDIR/openscad.pro ]; then    exit 1  fi -OSTYPE=mingw-cross-env ./scripts/release-common.sh -v $VERSION $COMMIT +./scripts/release-common.sh -v $VERSION $COMMIT mingw32  if [ $? != 0 ]; then  	echo "release-common.sh returned error code: $?. build stopped." diff --git a/scripts/release-common.sh b/scripts/release-common.sh index 62f8ed8..de14cb1 100755 --- a/scripts/release-common.sh +++ b/scripts/release-common.sh @@ -1,25 +1,29 @@  #!/bin/bash  # -# This script creates a binary release of OpenSCAD. -# This should work under Mac OS X, Windows (msys), and Linux cross-compiling -# for windows using mingw-cross-env (use like: OSTYPE=mingw-cross-env release-common.sh). -# Linux support pending. -# The script will create a file called openscad-<versionstring>.zip -# in the current directory (or in the $DEPLOYDIR of a mingw cross build) +# This script creates a binary release of OpenSCAD. This should work +# under Mac OS X, Linux 32, Linux 64, and Linux->Win32 MXE cross-build. +# Windows under msys has not been tested recently.  # -# Usage: release-common.sh [-v <versionstring>] [-c] -#  -v   Version string (e.g. -v 2010.01) -#  -c   Build with commit info +# The script will create a file called openscad-<versionstring>.<extension> in +# the current directory (or under ./mingw32) +# +# Usage: release-common.sh [-v <versionstring>] [-c] [-x32] +#  -v       Version string (e.g. -v 2010.01) +#  -c       Build with commit info +#  -mingw32 Cross-compile for win32 using MXE  #  # If no version string is given, todays date will be used (YYYY-MM-DD)  # If no make target is given, release will be used on Windows, none one Mac OS X  #  # The commit info will extracted from git and be passed to qmake as OPENSCAD_COMMIT  # to identify a build in the about box. +# +# The mingw32 cross compile depends on the MXE cross-build tools. Please +# see the README.md file on how to install these dependencies.  printUsage()  { -  echo "Usage: $0 -v <versionstring> -c +  echo "Usage: $0 -v <versionstring> -c -mingw32    echo    echo "  Example: $0 -v 2010.01  } @@ -42,11 +46,18 @@ elif [[ $OSTYPE == "linux-gnu" ]]; then      ARCH=32    fi    echo "Detected ARCH: $ARCH" -elif [[ $OSTYPE == "mingw-cross-env" ]]; then +fi + +if [ "`echo $* | grep mingw32`" ]; then    OS=LINXWIN  fi -echo "Detected OS: $OS" +if [ $OS ]; then +  echo "Detected OS: $OS" +else +  echo "Error: Couldn't detect OSTYPE" +  exit +fi  while getopts 'v:c' c  do @@ -147,14 +158,26 @@ case $OS in          ;;  esac +if [ ! $NUMCPU ]; then +  echo "note: you can 'export NUMCPU=x' for multi-core compiles (x=number)"; +  NUMCPU=2 +fi +  case $OS in      LINXWIN) -        # make -jx sometimes has problems with parser_yacc +        # dont use paralell builds, it can error-out on parser_yacc. + +        # make main openscad.exe          cd $DEPLOYDIR && make $TARGET + +        # make console pipe-able openscad.com - see winconsole.pri for info +        i686-pc-mingw32-qmake CONFIG+=winconsole ../openscad.pro +        make +          cd $OPENSCADDIR      ;;      *) -        make -j2 $TARGET +        make -j$NUMCPU $TARGET      ;;  esac @@ -216,6 +239,7 @@ case $OS in          #package          cp win32deps/* openscad-$VERSION          cp $TARGET/openscad.exe openscad-$VERSION +        cp $TARGET/openscad.com openscad-$VERSION          rm -f openscad-$VERSION.zip          "$ZIP" $ZIPARGS openscad-$VERSION.zip openscad-$VERSION          rm -rf openscad-$VERSION @@ -226,6 +250,7 @@ case $OS in          echo "Creating binary package"          cd $DEPLOYDIR          cp $TARGET/openscad.exe openscad-$VERSION +        cp $TARGET/openscad.com openscad-$VERSION          rm -f OpenSCAD-$VERSION.zip          "$ZIP" $ZIPARGS OpenSCAD-$VERSION.zip openscad-$VERSION          cd $OPENSCADDIR diff --git a/scripts/setenv-freebsdbuild.sh b/scripts/setenv-freebsdbuild.sh deleted file mode 100644 index 49f1783..0000000 --- a/scripts/setenv-freebsdbuild.sh +++ /dev/null @@ -1,6 +0,0 @@ -# run with '. ./scripts/setenv-freebsdbuild.sh' - -# use in conjuction with freebsd-build-dependencies.sh - -QMAKESPEC=freebsd-g++ -QTDIR=/usr/local/share/qt4 diff --git a/scripts/setenv-linbuild-clang.sh b/scripts/setenv-linbuild-clang.sh deleted file mode 100644 index 9551235..0000000 --- a/scripts/setenv-linbuild-clang.sh +++ /dev/null @@ -1,12 +0,0 @@ -# build dependencies and/or openscad on linux with the clang compiler - -export CC=clang -export CXX=clang++ -export QMAKESPEC=unsupported/linux-clang - -echo CC has been modified: $CC -echo CXX has been modified: $CXX -echo QMAKESPEC has been modified: $QMAKESPEC - -. ./scripts/setenv-linbuild.sh - diff --git a/scripts/setenv-linbuild.sh b/scripts/setenv-linbuild.sh deleted file mode 100644 index 338cac9..0000000 --- a/scripts/setenv-linbuild.sh +++ /dev/null @@ -1,34 +0,0 @@ -# setup environment variables for building OpenSCAD against custom built -# dependency libraries. called by linux-build-dependencies.sh - -# run this file with 'source setenv-linbuild.sh' every time you re-login -# and want to build or run openscad against custom libraries installed -# into BASEDIR. - -# copy this file to your .bashrc if desired. - -if [ ! $BASEDIR ]; then -  BASEDIR=$HOME/openscad_deps -fi -DEPLOYDIR=$BASEDIR - -export PATH=$BASEDIR/bin:$PATH -export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 -export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 -export OPENSCAD_LIBRARIES=$DEPLOYDIR -export GLEWDIR=$DEPLOYDIR - -echo BASEDIR: $BASEDIR -echo DEPLOYDIR: $DEPLOYDIR -echo PATH modified -echo LD_LIBRARY_PATH modified -echo LD_RUN_PATH modified -echo OPENSCAD_LIBRARIES modified -echo GLEWDIR modified - -if [ "`command -v qmake-qt4`" ]; then -	echo "Please re-run qmake-qt4 and run 'make clean' if necessary" -else -	echo "Please re-run qmake and run 'make clean' if necessary" -fi - diff --git a/scripts/setenv-unibuild.sh b/scripts/setenv-unibuild.sh new file mode 100644 index 0000000..881526e --- /dev/null +++ b/scripts/setenv-unibuild.sh @@ -0,0 +1,134 @@ +# setup environment variables for building OpenSCAD against custom built +# dependency libraries. works on Linux/BSD. +# +# Please see the 'uni-build-dependencies.sh' file for usage information +# + +setenv_common() +{ + if [ ! $BASEDIR ]; then +  if [ -f openscad.pro ]; then +    # if in main openscad dir, put under $HOME +    BASEDIR=$HOME/openscad_deps +  else +    # otherwise, assume its being run 'out of tree'. treat it somewhat like +    # "configure" or "cmake", so you can build dependencies where u wish. +    echo "Warning: Not in OpenSCAD src dir... using current directory as base of build" +    BASEDIR=$PWD/openscad_deps +  fi + fi + DEPLOYDIR=$BASEDIR + + export BASEDIR + export PATH=$BASEDIR/bin:$PATH + export LD_LIBRARY_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 + export LD_RUN_PATH=$DEPLOYDIR/lib:$DEPLOYDIR/lib64 + export OPENSCAD_LIBRARIES=$DEPLOYDIR + export GLEWDIR=$DEPLOYDIR + + echo BASEDIR: $BASEDIR + echo DEPLOYDIR: $DEPLOYDIR + echo PATH modified + echo LD_LIBRARY_PATH modified + echo LD_RUN_PATH modified + echo OPENSCAD_LIBRARIES modified + echo GLEWDIR modified + +} + +setenv_freebsd() +{ + setenv_common + QMAKESPEC=freebsd-g++ + QTDIR=/usr/local/share/qt4 +} + +setenv_netbsd() +{ + setenv_common + QMAKESPEC=netbsd-g++ + QTDIR=/usr/pkg/qt4 + PATH=/usr/pkg/qt4/bin:$PATH + LD_LIBRARY_PATH=/usr/pkg/qt4/lib:/usr/X11R7/lib:$LD_LIBRARY_PATH + + export QMAKESPEC + export QTDIR + export PATH + export LD_LIBRARY_PATH +} + +setenv_linux_clang() +{ + export CC=clang + export CXX=clang++ + export QMAKESPEC=unsupported/linux-clang + + echo CC has been modified: $CC + echo CXX has been modified: $CXX + echo QMAKESPEC has been modified: $QMAKESPEC +} + +clean_note() +{ + if [ $QT5_SETUP ]; then +  QMAKEBIN=qmake + elif [ "`command -v qmake-qt4`" ]; then +  QMAKEBIN=qmake-qt4 + else +  QMAKEBIN=qmake + fi + echo "Please re-run" $QMAKEBIN "and run 'make clean' if necessary" +} + +setenv_qt5() +{ + QT5_SETUP=true + if [ ! $QTDIR ]; then +  QTDIR=/opt/qt5 +  echo Please set QTDIR before running this qt5 script. Assuming $QTDIR + fi + PATH=$QTDIR/bin:$PATH + LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH + LD_RUN_PATH=$QTDIR/lib:$LD_RUN_PATH + if [ "`echo $CC | grep clang`" ]; then +  if [ "`uname | grep -i linux`" ]; then +   QMAKESPEC=linux-clang +   echo QMAKESPEC has been modified: $QMAKESPEC +  fi + fi + + export QTDIR + export PATH + export LD_LIBRARY_PATH + export LD_RUN_PATH + export QMAKESPEC + + echo QTDIR is set to: $QTDIR + echo PATH has been modified with $QTDIR/bin + echo LD_LIBRARY_PATH has been modified with $QTDIR/lib + echo LD_RUN_PATH has been modified with $QTDIR/lib + + export QT5_SETUP +} + +if [ "`uname | grep -i 'linux\|debian'`" ]; then + setenv_common + if [ "`echo $* | grep clang`" ]; then +  setenv_linux_clang + fi +elif [ "`uname | grep -i freebsd`" ]; then + setenv_freebsd +elif [ "`uname | grep -i netbsd`" ]; then + setenv_netbsd +else + # guess + setenv_common + echo unknown system. guessed env variables. see 'setenv-unibuild.sh' +fi + +if [ "`echo $* | grep qt5`" ]; then + setenv_qt5 +fi + +clean_note + diff --git a/scripts/ubuntu-build-dependencies.sh b/scripts/ubuntu-build-dependencies.sh deleted file mode 100755 index 1754e32..0000000 --- a/scripts/ubuntu-build-dependencies.sh +++ /dev/null @@ -1,33 +0,0 @@ - -too_old() -{ -	echo "System version too low. Please try 'old linux' build (see README.md)" -	exit -} - -if [ "`cat /etc/issue | grep 'Debian GNU/Linux 6.0'`" ]; then -	too_old -fi -if [ "`cat /etc/issue | grep 'Debian GNU/Linux 5'`" ]; then -	too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 10'`" ]; then -	too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 9'`" ]; then -	too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 8'`" ]; then -	too_old -fi -if [ "`cat /etc/issue | grep 'Ubunutu 7'`" ]; then -	too_old -fi - -echo "tested on Ubuntu 12. If this fails try 'old linux' build (see README.md)" - -sudo apt-get install build-essential libqt4-dev libqt4-opengl-dev \ - libxmu-dev cmake bison flex libeigen2-dev git-core libboost-all-dev \ - libXi-dev libmpfr-dev libgmp-dev libboost-dev libglew1.6-dev \ - libcgal-dev libopencsg-dev - diff --git a/scripts/uni-build-dependencies.sh b/scripts/uni-build-dependencies.sh new file mode 100755 index 0000000..0c37605 --- /dev/null +++ b/scripts/uni-build-dependencies.sh @@ -0,0 +1,446 @@ + #!/bin/sh -e + +# uni-build-dependencies by don bright 2012. copyright assigned to +# Marius Kintel and Clifford Wolf, 2012. released under the GPL 2, or +# later, as described in the file named 'COPYING' in OpenSCAD's project root. + +# This script builds most dependencies, both libraries and binary tools, +# of OpenSCAD for Linux/BSD. It is based on macosx-build-dependencies.sh +# +# By default it builds under $HOME/openscad_deps. You can alter this by +# setting the BASEDIR environment variable or with the 'out of tree' +# feature +# +# Usage: +#   cd openscad +#   . ./scripts/setenv-unibuild.sh +#   ./scripts/uni-build-dependencies.sh +# +# Out-of-tree usage: +# +#   cd somepath +#   . /path/to/openscad/scripts/setenv-unibuild.sh +#   /path/to/openscad/scripts/uni-build-dependencies.sh +# +# Prerequisites: +# - wget or curl +# - Qt4 +# - gcc +# +# Enable Clang (experimental, only works on linux): +# +#   . ./scripts/setenv-unibuild.sh clang +# +# Enable Qt5 (experimental) +# +#   . ./scripts/setenv-unibuild.sh qt5 +# + +printUsage() +{ +  echo "Usage: $0" +  echo +} + +build_bison() +{ +  version=$1 +  echo "Building bison" $version +  cd $BASEDIR/src +  rm -rf bison-$version +  if [ ! -f bison-$version.tar.gz ]; then +    curl --insecure -O http://ftp.gnu.org/gnu/bison/bison-$version.tar.gz +  fi +  tar zxf bison-$version.tar.gz +  cd bison-$version +  ./configure --prefix=$DEPLOYDIR +  make -j$NUMCPU +  make install +} + +build_git() +{ +  version=$1 +  echo "Building git" $version "..." +  cd $BASEDIR/src +  rm -rf git-$version +  if [ ! -f git-$version.tar.gz ]; then +    curl --insecure -O http://git-core.googlecode.com/files/git-$version.tar.gz +  fi +  tar zxf git-$version.tar.gz +  cd git-$version +  ./configure --prefix=$DEPLOYDIR +  make -j$NUMCPU +  make install +} + +build_cmake() +{ +  version=$1 +  echo "Building cmake" $version "..." +  cd $BASEDIR/src +  rm -rf cmake-$version +  if [ ! -f cmake-$version.tar.gz ]; then +    curl --insecure -O http://www.cmake.org/files/v2.8/cmake-$version.tar.gz +  fi +  tar zxf cmake-$version.tar.gz +  cd cmake-$version +  mkdir build +  cd build +  ../configure --prefix=$DEPLOYDIR +  make -j$NUMCPU +  make install +} + +build_curl() +{ +  version=$1 +  echo "Building curl" $version "..." +  cd $BASEDIR/src +  rm -rf curl-$version +  if [ ! -f curl-$version.tar.bz2 ]; then +    wget http://curl.haxx.se/download/curl-$version.tar.bz2 +  fi +  tar xjf curl-$version.tar.bz2 +  cd curl-$version +  mkdir build +  cd build +  ../configure --prefix=$DEPLOYDIR +  make -j$NUMCPU +  make install +} + +build_gmp() +{ +  version=$1 +  if [ -e $DEPLOYDIR/include/gmp.h ]; then +    echo "gmp already installed. not building" +    return +  fi +  echo "Building gmp" $version "..." +  cd $BASEDIR/src +  rm -rf gmp-$version +  if [ ! -f gmp-$version.tar.bz2 ]; then +    curl --insecure -O ftp://ftp.gmplib.org/pub/gmp-$version/gmp-$version.tar.bz2 +  fi +  tar xjf gmp-$version.tar.bz2 +  cd gmp-$version +  mkdir build +  cd build +  ../configure --prefix=$DEPLOYDIR --enable-cxx +  make install +} + +build_mpfr() +{ +  version=$1 +  if [ -e $DEPLOYDIR/include/mpfr.h ]; then +    echo "mpfr already installed. not building" +    return +  fi +  echo "Building mpfr" $version "..." +  cd $BASEDIR/src +  rm -rf mpfr-$version +  if [ ! -f mpfr-$version.tar.bz2 ]; then +    curl --insecure -O http://www.mpfr.org/mpfr-$version/mpfr-$version.tar.bz2 +  fi +  tar xjf mpfr-$version.tar.bz2 +  cd mpfr-$version +  mkdir build +  cd build +  ../configure --prefix=$DEPLOYDIR --with-gmp=$DEPLOYDIR +  make install +  cd .. +} + +build_boost() +{ +  if [ -e $DEPLOYDIR/include/boost ]; then +    echo "boost already installed. not building" +    return +  fi +  version=$1 +  bversion=`echo $version | tr "." "_"` +  echo "Building boost" $version "..." +  cd $BASEDIR/src +  rm -rf boost_$bversion +  if [ ! -f boost_$bversion.tar.bz2 ]; then +    curl --insecure -LO http://downloads.sourceforge.net/project/boost/boost/$version/boost_$bversion.tar.bz2 +  fi +  tar xjf boost_$bversion.tar.bz2 +  cd boost_$bversion +  if [ "`gcc --version|grep 4.7`" ]; then +    if [ "`echo $version | grep 1.47`" ]; then +      echo gcc 4.7 incompatible with boost 1.47. edit boost version in $0 +      exit +    fi +  fi +  # We only need certain portions of boost +  ./bootstrap.sh --prefix=$DEPLOYDIR --with-libraries=thread,program_options,filesystem,system,regex +  if [ $CXX ]; then +    if [ $CXX = "clang++" ]; then +      ./b2 -j$NUMCPU toolset=clang install +      # ./b2 -j$NUMCPU toolset=clang cxxflags="-stdlib=libc++" linkflags="-stdlib=libc++" install +    fi +  else +    ./b2 -j$NUMCPU +    ./b2 install +  fi +} + +build_cgal() +{ +  if [ -e $DEPLOYDIR/include/CGAL/version.h ]; then +    echo "CGAL already installed. not building" +    return +  fi +  version=$1 +  echo "Building CGAL" $version "..." +  cd $BASEDIR/src +  rm -rf CGAL-$version +  if [ ! -f CGAL-$version.tar.* ]; then +    #4.0.2 +    curl --insecure -O https://gforge.inria.fr/frs/download.php/31174/CGAL-$version.tar.bz2 +    # 4.0 curl --insecure -O https://gforge.inria.fr/frs/download.php/30387/CGAL-$version.tar.gz +    # 3.9 curl --insecure -O https://gforge.inria.fr/frs/download.php/29125/CGAL-$version.tar.gz +    # 3.8 curl --insecure -O https://gforge.inria.fr/frs/download.php/28500/CGAL-$version.tar.gz +    # 3.7 curl --insecure -O https://gforge.inria.fr/frs/download.php/27641/CGAL-$version.tar.gz +  fi +  tar jxf CGAL-$version.tar.bz2 +  cd CGAL-$version +  if [ "`echo $2 | grep use-sys-libs`" ]; then +    cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DCMAKE_BUILD_TYPE=Debug +  else +    cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DGMP_INCLUDE_DIR=$DEPLOYDIR/include -DGMP_LIBRARIES=$DEPLOYDIR/lib/libgmp.so -DGMPXX_LIBRARIES=$DEPLOYDIR/lib/libgmpxx.so -DGMPXX_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_INCLUDE_DIR=$DEPLOYDIR/include -DMPFR_LIBRARIES=$DEPLOYDIR/lib/libmpfr.so -DWITH_CGAL_Qt3=OFF -DWITH_CGAL_Qt4=OFF -DWITH_CGAL_ImageIO=OFF -DBOOST_ROOT=$DEPLOYDIR -DCMAKE_BUILD_TYPE=Debug +  fi +  make -j$NUMCPU +  make install +} + +build_glew() +{ +  if [ -e $DEPLOYDIR/include/GL/glew.h ]; then +    echo "glew already installed. not building" +    return +  fi +  version=$1 +  echo "Building GLEW" $version "..." +  cd $BASEDIR/src +  rm -rf glew-$version +  if [ ! -f glew-$version.tgz ]; then +    curl --insecure -LO http://downloads.sourceforge.net/project/glew/glew/$version/glew-$version.tgz +  fi +  tar xzf glew-$version.tgz +  cd glew-$version +  mkdir -p $DEPLOYDIR/lib/pkgconfig + +  # Glew's makefile is not built for Linux Multiarch. We aren't trying +  # to fix everything here, just the test machines OScad normally runs on + +  # Fedora 64-bit +  if [ "`uname -m | grep 64`" ]; then +    if [ -e /usr/lib64/libXmu.so.6 ]; then +      sed -ibak s/"\-lXmu"/"\-L\/usr\/lib64\/libXmu.so.6"/ config/Makefile.linux +    fi +  fi + +  # debian hurd i386 +  if [ "`uname -m | grep 386`" ]; then +    if [ -e /usr/lib/i386-gnu/libXi.so.6 ]; then +      sed -ibak s/"-lXi"/"\-L\/usr\/lib\/i386-gnu\/libXi.so.6"/ config/Makefile.gnu +    fi +  fi + +  # clang linux +  if [ $CC ]; then +    sed -ibak s/"CC = cc"/"# CC = cc"/ config/Makefile.linux +  fi + +  MAKER=make +  if [ "`uname | grep BSD`" ]; then +    if [ "`command -v gmake`" ]; then +      MAKER=gmake +    else +      echo "building glew on BSD requires gmake (gnu make)" +      exit +    fi +  fi + +  GLEW_DEST=$DEPLOYDIR $MAKER -j$NUMCPU +  GLEW_DEST=$DEPLOYDIR $MAKER install +} + +build_opencsg() +{ +  if [ -e $DEPLOYDIR/include/opencsg.h ]; then +    echo "OpenCSG already installed. not building" +    return +  fi +  version=$1 +  echo "Building OpenCSG" $version "..." +  cd $BASEDIR/src +  rm -rf OpenCSG-$version +  if [ ! -f OpenCSG-$version.tar.gz ]; then +    curl --insecure -O http://www.opencsg.org/OpenCSG-$version.tar.gz +  fi +  tar xzf OpenCSG-$version.tar.gz +  cd OpenCSG-$version + +  # modify the .pro file for qmake, then use qmake to +  # manually rebuild the src/Makefile (some systems don't auto-rebuild it) + +  cp opencsg.pro opencsg.pro.bak +  cat opencsg.pro.bak | sed s/example// > opencsg.pro + +  if [ "`command -v qmake-qt4`" ]; then +    OPENCSG_QMAKE=qmake-qt4 +  elif [ "`command -v qmake4`" ]; then +    OPENCSG_QMAKE=qmake4 +  else +    OPENCSG_QMAKE=qmake +  fi + +  cd $BASEDIR/src/OpenCSG-$version/src +  $OPENCSG_QMAKE + +  cd $BASEDIR/src/OpenCSG-$version +  $OPENCSG_QMAKE + +  make + +  ls lib/* include/* +  if [ -e lib/.libs ]; then ls lib/.libs/*; fi # netbsd +  echo "installing to -->" $DEPLOYDIR +  mkdir -p $DEPLOYDIR/lib +  mkdir -p $DEPLOYDIR/include +  install lib/* $DEPLOYDIR/lib +  install include/* $DEPLOYDIR/include +  if [ -e lib/.libs ]; then install lib/.libs/* $DEPLOYDIR/lib; fi #netbsd + +  cd $BASEDIR +} + +build_eigen() +{ +  version=$1 +  if [ -e $DEPLOYDIR/include/eigen2 ]; then +    if [ `echo $version | grep 2....` ]; then +      echo "Eigen2 already installed. not building" +      return +    fi +  fi +  if [ -e $DEPLOYDIR/include/eigen3 ]; then +    if [ `echo $version | grep 3....` ]; then +      echo "Eigen3 already installed. not building" +      return +    fi +  fi +  echo "Building eigen" $version "..." +  cd $BASEDIR/src +  rm -rf eigen-$version +  EIGENDIR="none" +  if [ $version = "2.0.17" ]; then EIGENDIR=eigen-eigen-b23437e61a07; fi +  if [ $version = "3.1.1" ]; then EIGENDIR=eigen-eigen-43d9075b23ef; fi +  if [ $EIGENDIR = "none" ]; then +    echo Unknown eigen version. Please edit script. +    exit 1 +  fi +  rm -rf ./$EIGENDIR +  if [ ! -f eigen-$version.tar.bz2 ]; then +    curl --insecure -LO http://bitbucket.org/eigen/eigen/get/$version.tar.bz2 +    mv $version.tar.bz2 eigen-$version.tar.bz2 +  fi +  tar xjf eigen-$version.tar.bz2 +  ln -s ./$EIGENDIR eigen-$version +  cd eigen-$version +  mkdir build +  cd build +  cmake -DCMAKE_INSTALL_PREFIX=$DEPLOYDIR -DEIGEN_TEST_NO_OPENGL=1 .. +  make -j$NUMCPU +  make install +} + + +# this section allows 'out of tree' builds, as long as the system has +# the 'dirname' command installed + +if [ "`command -v dirname`" ]; then +  OPENSCAD_SCRIPTDIR=`dirname $0` +else +  if [ ! -f openscad.pro ]; then +    echo "Must be run from the OpenSCAD source root directory (dont have 'dirname')" +    exit 1 +  else +    OPENSCAD_SCRIPTDIR=$PWD +  fi +fi + +. $OPENSCAD_SCRIPTDIR/setenv-unibuild.sh # '.' is equivalent to 'source' +SRCDIR=$BASEDIR/src + +if [ ! $NUMCPU ]; then +  echo "Note: The NUMCPU environment variable can be set for paralell builds" +  NUMCPU=1 +fi + +if [ ! -d $BASEDIR/bin ]; then +  mkdir -p $BASEDIR/bin +fi + +echo "Using basedir:" $BASEDIR +echo "Using deploydir:" $DEPLOYDIR +echo "Using srcdir:" $SRCDIR +echo "Number of CPUs for parallel builds:" $NUMCPU +mkdir -p $SRCDIR $DEPLOYDIR + +# this section builds some basic tools, if they are missing or outdated +# they are installed under $BASEDIR/bin which we have added to our PATH + +if [ ! "`command -v curl`" ]; then +  build_curl 7.26.0 +fi + +if [ ! "`command -v bison`" ]; then +  build_bison 2.6.1 +fi + +# NB! For cmake, also update the actual download URL in the function +if [ ! "`command -v cmake`" ]; then +  build_cmake 2.8.8 +fi +if [ "`cmake --version | grep 'version 2.[1-6][^0-9]'`" ]; then +  build_cmake 2.8.8 +fi + +# build_git 1.7.10.3 + +# Singly build CGAL or OpenCSG +# (Most systems have all libraries available as packages except CGAL/OpenCSG) +# (They can be built singly here by passing a command line arg to the script) +if [ $1 ]; then +  if [ $1 = "cgal" ]; then +    build_cgal 4.0.2 use-sys-libs +    exit +  fi +  if [ $1 = "opencsg" ]; then +    build_opencsg 1.3.2 +    exit +  fi +fi + + +# +# Main build of libraries +# edit version numbers here as needed. +# + +build_eigen 3.1.1 +build_gmp 5.0.5 +build_mpfr 3.1.1 +build_boost 1.49.0 +# NB! For CGAL, also update the actual download URL in the function +build_cgal 4.0.2 +build_glew 1.9.0 +build_opencsg 1.3.2 + +echo "OpenSCAD dependencies built and installed to " $BASEDIR diff --git a/scripts/uni-get-dependencies.sh b/scripts/uni-get-dependencies.sh new file mode 100755 index 0000000..cf9f136 --- /dev/null +++ b/scripts/uni-get-dependencies.sh @@ -0,0 +1,90 @@ +# auto-install dependency packages using the systems package manager. +# after running this, run ./script/check-dependencies.sh. see README.md +# +# this assumes you have sudo installed or are running as root. +# + +get_fedora_deps() +{ + sudo yum install qt-devel bison flex eigen2-devel \ +  boost-devel mpfr-devel gmp-devel glew-devel CGAL-devel gcc pkgconfig git +} + +get_altlinux_deps() +{ + for i in boost-devel boost-filesystem-devel gcc4.5 gcc4.5-c++ boost-program_options-devel \ +  boost-thread-devel boost-system-devel boost-regex-devel eigen2 libmpfr libgmp libgmp_cxx-devel qt4-devel libcgal-devel git-core \ +  libglew-devel flex bison; do sudo apt-get install $i; done +} + +get_freebsd_deps() +{ + pkg_add -r bison boost-libs cmake git bash eigen2 flex gmake gmp mpfr \ +  xorg libGLU libXmu libXi xorg-vfbserver glew \ +  qt4-corelib qt4-gui qt4-moc qt4-opengl qt4-qmake qt4-rcc qt4-uic \ +  opencsg cgal +} + +get_netbsd_deps() +{ + sudo pkgin install bison boost cmake git bash eigen flex gmake gmp mpfr \ +  qt4 glew cgal opencsg modular-xorg +} + +get_opensuse_deps() +{ + sudo zypper install libeigen2-devel mpfr-devel gmp-devel boost-devel \ +  libqt4-devel glew-devel cmake git bison flex cgal-devel opencsg-devel +} + +get_mageia_deps() +{ + sudo urpmi ctags + sudo urpmi task-c-devel task-c++-devel libqt4-devel libgmp-devel \ +  libmpfr-devel libboost-devel eigen3-devel libglew-devel bison flex \ +  cmake imagemagick python curl git +} + +get_debian_deps() +{ + for pkg in build-essential libqt4-dev libqt4-opengl-dev \ +  libxmu-dev cmake bison flex git-core libboost-all-dev \ +  libXi-dev libmpfr-dev libboost-dev libglew-dev libeigen2-dev \ +  libeigen3-dev libcgal-dev libopencsg-dev libgmp3-dev libgmp-dev; do +   sudo apt-get -y install $pkg; + done +} + + +unknown() +{ + echo "Unknown system type. Please install the dependency packages listed" + echo "in README.md using your system's package manager." +} + +if [ -e /etc/issue ]; then + if [ "`grep -i ubuntu /etc/issue`" ]; then +  get_debian_deps + elif [ "`grep -i debian /etc/issue`" ]; then +  get_debian_deps + elif [ "`grep -i suse /etc/issue`" ]; then +  get_opensuse_deps + elif [ "`grep -i fedora /etc/issue`" ]; then +  get_fedora_deps + elif [ "`grep -i red.hat /etc/issue`" ]; then +  get_fedora_deps + elif [ "`grep -i mageia /etc/issue`" ]; then +  get_mageia_deps + elif [ "`command -v rpm`" ]; then +  if [ "`rpm -qa | grep altlinux`" ]; then +   get_altlinux_deps +  fi + fi +elif [ "`uname | grep -i freebsd `" ]; then + get_freebsd_deps +elif [ "`uname | grep -i netbsd`" ]; then + get_netbsd_deps +else + unknown +fi + | 
