issue-6957-force-gcc-4.0 force gcc-4.0 if deployment target < 10.5 diff -r 7af510a4795f Mac/BuildScript/build-installer.py --- Mac/BuildScript/build-installer.py Sat Sep 26 01:12:16 2009 -0700 +++ Mac/BuildScript/build-installer.py Sat Sep 26 01:31:37 2009 -0700 @@ -97,6 +97,15 @@ # $MACOSX_DEPLOYMENT_TARGET -> minimum OS X level DEPTARGET = '10.3' +target_cc_map = { + '10.3': 'gcc-4.0', + '10.4': 'gcc-4.0', + '10.5': 'gcc-4.0', + '10.6': 'gcc-4.2', +} + +CC = target_cc_map[DEPTARGET] + USAGE = textwrap.dedent("""\ Usage: build_python [options] @@ -126,7 +135,8 @@ url="http://www.bzip.org/1.0.5/bzip2-1.0.5.tar.gz", checksum='3c15a0c8d1d3ee1c46a1634d00617b1a', configure=None, - install='make install PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + install='make install CC=%s PREFIX=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + CC, shellQuote(os.path.join(WORKDIR, 'libraries')), ' -arch '.join(ARCHLIST), SDKPATH, @@ -137,7 +147,8 @@ url="http://www.gzip.org/zlib/zlib-1.2.3.tar.gz", checksum='debc62758716a169df9f62e6ab2bc634', configure=None, - install='make install prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + install='make install CC=%s prefix=%s/usr/local/ CFLAGS="-arch %s -isysroot %s"'%( + CC, shellQuote(os.path.join(WORKDIR, 'libraries')), ' -arch '.join(ARCHLIST), SDKPATH, @@ -354,7 +365,7 @@ if platform.system() != 'Darwin': fatal("This script should be run on a Mac OS X 10.4 (or later) system") - if int(platform.release().split('.')[0]) <= 8: + if int(platform.release().split('.')[0]) < 8: fatal("This script should be run on a Mac OS X 10.4 (or later) system") if not os.path.exists(SDKPATH): @@ -368,7 +379,7 @@ Parse arguments and update global settings. """ global WORKDIR, DEPSRC, SDKPATH, SRCDIR, DEPTARGET - global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST + global UNIVERSALOPTS, UNIVERSALARCHS, ARCHLIST, CC if args is None: args = sys.argv[1:] @@ -426,6 +437,8 @@ SDKPATH=os.path.abspath(SDKPATH) DEPSRC=os.path.abspath(DEPSRC) + CC=target_cc_map[DEPTARGET] + print "Settings:" print " * Source directory:", SRCDIR print " * Build directory: ", WORKDIR @@ -433,6 +446,7 @@ print " * Third-party source:", DEPSRC print " * Deployment target:", DEPTARGET print " * Universal architectures:", ARCHLIST + print " * C compiler:", CC print "" @@ -652,8 +666,7 @@ os.chdir(curDir) if not os.path.exists(docdir): os.mkdir(docdir) - os.rename(os.path.join(buildDir, 'build', 'html'), - os.path.join(docdir, 'python-docs-html')) + os.rename(os.path.join(buildDir, 'build', 'html'), docdir) def buildPython(): @@ -1039,7 +1052,8 @@ checkEnvironment() os.environ['MACOSX_DEPLOYMENT_TARGET'] = DEPTARGET - + os.environ['CC'] = CC + if os.path.exists(WORKDIR): shutil.rmtree(WORKDIR) os.mkdir(WORKDIR)