Integrated changes by Kazunari for MacOS build.

This commit is contained in:
Matthias Koefferlein 2017-11-26 22:12:55 +01:00
parent 8378e59b41
commit 19df2e06d9
2 changed files with 41 additions and 17 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# KLayout Layout Viewer # KLayout Layout Viewer
# Copyright (C) 2006-2017 Matthias Koefferlein # Copyright (C) 2006-2017 Matthias Koefferlein
# #
@ -17,10 +17,11 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# #
CURR_DIR=`pwd` CURR_DIR=`pwd`
RUN_MAKE=1 RUN_MAKE=1
IS_MAC="no"
HAVE_QTBINDINGS=1 HAVE_QTBINDINGS=1
HAVE_64BIT_COORD=0 HAVE_64BIT_COORD=0
@ -46,6 +47,16 @@ MAKE_OPT=""
CONFIG="release" CONFIG="release"
BUILD_EXPERT=0 BUILD_EXPERT=0
# Check if building on Mac OSX Darwin family
case `uname` in
Darwin*)
IS_MAC="yes"
;;
*)
IS_MAC="no"
;;
esac
# Check, whether build.sh is run from the top level folder # Check, whether build.sh is run from the top level folder
if ! [ -e src ] || ! [ -e src/klayout.pro ]; then if ! [ -e src ] || ! [ -e src/klayout.pro ]; then
echo "*** ERROR: run build.sh from the top level folder" echo "*** ERROR: run build.sh from the top level folder"
@ -200,7 +211,7 @@ done
echo "Scanning installation .." echo "Scanning installation .."
echo "" echo ""
# Import version info # Import version info
. ./version.sh . ./version.sh
echo "Version Info:" echo "Version Info:"
@ -212,8 +223,8 @@ echo ""
# if not given, try to detect the qmake binary # if not given, try to detect the qmake binary
if [ "$QMAKE" = "" ]; then if [ "$QMAKE" = "" ]; then
for qmake in "qmake5" "qmake-qt5" "qmake4" "qmake-qt4" "qmake"; do for qmake in "qmake5" "qmake-qt5" "qmake4" "qmake-qt4" "qmake"; do
if [ "$QMAKE" = "" ] && [ "`$qmake -v 2>/dev/null`" != "" ]; then if [ "$QMAKE" = "" ] && [ "`$qmake -v 2>/dev/null`" != "" ]; then
QMAKE="$qmake" QMAKE="$qmake"
fi fi
done done
fi fi
@ -246,8 +257,8 @@ echo ""
# if not given, locate ruby interpreter (prefer 1.9, then default, finally 1.8 as fallback) # if not given, locate ruby interpreter (prefer 1.9, then default, finally 1.8 as fallback)
if [ "$RUBY" = "" ]; then if [ "$RUBY" = "" ]; then
for ruby in "ruby2.4" "ruby2.3" "ruby2.2" "ruby2.1" "ruby2" "ruby1.9" "ruby" "ruby1.8"; do for ruby in "ruby2.4" "ruby2.3" "ruby2.2" "ruby2.1" "ruby2" "ruby1.9" "ruby" "ruby1.8"; do
if [ "$RUBY" = "" ] && [ "`$ruby -e 'puts 1' 2>/dev/null`" = "1" ]; then if [ "$RUBY" = "" ] && [ "`$ruby -e 'puts 1' 2>/dev/null`" = "1" ]; then
RUBY="$ruby" RUBY="$ruby"
fi fi
done done
fi fi
@ -314,7 +325,7 @@ if [ "$RUBY" != "" ] && [ "$RUBY" != "-" ]; then
RUBYINCLUDE2=`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['rubyarchhdrdir'] || '')"` RUBYINCLUDE2=`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['rubyarchhdrdir'] || '')"`
fi fi
if [ "$RUBYINCLUDE2" = "" ]; then if [ "$RUBYINCLUDE2" = "" ]; then
RUBYINCLUDE2="$RUBYHDRDIR"/`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['arch'] || '')"` RUBYINCLUDE2="$RUBYHDRDIR"/`$RUBY -rrbconfig -e "puts (RbConfig::CONFIG['arch'] || '')"`
fi fi
echo " Ruby headers found: $RUBYINCLUDE and $RUBYINCLUDE2" echo " Ruby headers found: $RUBYINCLUDE and $RUBYINCLUDE2"
fi fi
@ -329,11 +340,11 @@ if [ "$RUBY" != "" ] && [ "$RUBY" != "-" ]; then
fi fi
# if not given, locate Python interpreter # if not given, locate Python interpreter
if [ "$PYTHON" = "" ]; then if [ "$PYTHON" = "" ]; then
for python in "python3.5" "python3.4" "python3.3" "python3.2" "python3.1" "python3" "python2.8" "python2.7" "python2" "python"; do for python in "python3.5" "python3.4" "python3.3" "python3.2" "python3.1" "python3" "python2.8" "python2.7" "python2" "python"; do
if [ "$PYTHON" = "" ] && [ "`$python -c 'print(1)' 2>/dev/null`" = "1" ]; then if [ "$PYTHON" = "" ] && [ "`$python -c 'print(1)' 2>/dev/null`" = "1" ]; then
PYTHON="$python" PYTHON="$python"
fi fi
done done
fi fi
@ -468,11 +479,21 @@ mkdir -p $BUILD
. $(dirname $(which $0))/version.sh . $(dirname $(which $0))/version.sh
# qmake needs absolute paths, so we get them now: # qmake needs absolute paths, so we get them now:
BUILD=`readlink -f $BUILD` # OSX does not have `readlink -f` command. Use equivalent Perl script.
BIN=`readlink -f $BIN` if [ "$IS_MAC" = "no" ]; then
BUILD=`readlink -f $BUILD`
BIN=`readlink -f $BIN`
else
BUILD=`perl -MCwd -le 'print Cwd::abs_path(shift)' $BUILD`
BIN=`perl -MCwd -le 'print Cwd::abs_path(shift)' $BIN`
fi
if ( gmake -v >/dev/null 2>/dev/null ); then if [ "$IS_MAC" = "no" ]; then
MAKE_PRG=gmake if ( gmake -v >/dev/null 2>/dev/null ); then
MAKE_PRG=gmake
else
MAKE_PRG=make
fi
else else
MAKE_PRG=make MAKE_PRG=make
fi fi

View File

@ -5,8 +5,11 @@
KLAYOUT_VERSION="0.25" KLAYOUT_VERSION="0.25"
# The build date # The build date
KLAYOUT_VERSION_DATE=$(date --iso-8601) KLAYOUT_VERSION_DATE=$(date "+%Y-%m-%d")
# The short SHA hash of the commit # The short SHA hash of the commit
KLAYOUT_VERSION_REV=$(git rev-parse --short HEAD) KLAYOUT_VERSION_REV=$(git rev-parse --short HEAD 2>/dev/null)
if [ "$KLAYOUT_VERSION_REV" = "" ]; then
KLAYOUT_VERSION_REV="LatestSourcePackage"
fi