From 9b9d68a6385015e94e88384317e28c005b04eb67 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Sat, 16 Dec 2017 13:58:42 +0900 Subject: [PATCH] Prepare Python scripts for building for Mac OSX. This refs #4. --- macbuild/ReadMe.txt | 25 +++ macbuild/build4mac.py | 390 ++++++++++++++++++++++++++++++++++++++ macbuild/build4mac_env.py | 143 ++++++++++++++ 3 files changed, 558 insertions(+) create mode 100644 macbuild/ReadMe.txt create mode 100755 macbuild/build4mac.py create mode 100755 macbuild/build4mac_env.py diff --git a/macbuild/ReadMe.txt b/macbuild/ReadMe.txt new file mode 100644 index 000000000..4c3d8d693 --- /dev/null +++ b/macbuild/ReadMe.txt @@ -0,0 +1,25 @@ +<< Draft >> + +This directory "macbuild" contains different files required to build KLayout +version 0.25 or later for different Max OSX including: + * Yosemite (10.10) + * El Capitan (10.11) + * Sierra (10.12) + * High Sierra (10.13) + +By default, Qt framework is the from Mac Ports (https://www.macports.org/) which +is usually located under: + /opt/local/libexec/qt5/ + +Also by default, supported script languages, i.e,, Ruby and Python, are those +standard ones bundled with the OS. +However, you are able to choose other options like Python from Anaconda. + +etc. etc. + + +Make a symbolic link from the parent directory like: + build4mac.py -> macbuild/build4mac.py +then execute the Python script to build with appropriate options if required. + +[End of File] diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py new file mode 100755 index 000000000..0e61bd5e1 --- /dev/null +++ b/macbuild/build4mac.py @@ -0,0 +1,390 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +#=============================================================================== +# File: "macbuild/build4mac.py" +# +# The main script for building KLayout (http://www.klayout.de/index.php) +# version 0.25 or later on different Apple Mac OSX platforms. +#=============================================================================== +from __future__ import print_function # to use print() of Python 3 in Python >= 2.7 +import sys +import os +import platform +import optparse +import subprocess + +#------------------------------------------------------------------------------- +## To import global dictionaries of different modules +#------------------------------------------------------------------------------- +mydir = os.path.dirname(os.path.abspath(__file__)) +sys.path.append( mydir + "/macbuild" ) +from build4mac_env import * + +#------------------------------------------------------------------------------- +## To set global variables including present directory and platform info. +#------------------------------------------------------------------------------- +def SetGlobals(): + global PresentDir # present directory + global Usage # string on usage + global BuildBash # the main build Bash script + global Platform # platform + global ModuleQt # Qt module to be used + global ModuleRuby # Ruby module to be used + global ModulePython # Python module to be used + global NoQtBindings # True if not creating Qt bindings for Ruby scripts + global MakeOptions # options passed to `make` + global DebugMode # True if debug mode build + global CheckComOnly # True if check the command line only + # auxiliary variables on platform + global System # 6-tuple from platform.uname() + global Node # - do - + global Release # - do - + global Version # - do - + global Machine # - do - + global Processor # - do - + global Bit # machine bit-size + + Usage = "\n" + Usage += "---------------------------------------------------------------------------------------------\n" + Usage += "<< Usage of 'build4mac.py' >>\n" + Usage += " for building KLayout 0.25 or later on different Apple Mac OSX platforms.\n" + Usage += "\n" + Usage += "$ [python] build4mac.py \n" + Usage += " option & argument : comment on option if any | default value\n" + Usage += " -----------------------------------------------------------------------+---------------\n" + Usage += " : * key type names below are case insensitive * | \n" + Usage += " : 'nil' = not to support the script language | \n" + Usage += " : 'Sys' = using the OS standard script language | \n" + Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts'] | qt5macports \n" + Usage += " [-r|--ruby ] : type=['nil', 'Sys', 'RubySource'] | sys \n" + Usage += " [-p|--python ] : type=['nil', 'Sys', 'Anaconda27', 'Anaconda36'] | sys \n" + Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" + Usage += " [-m|--make