Browse Source

makepanda: remove ability to target Mac OS X 10.6 "Snow Leopard"

This effectively ends support for 32-bit Intel Macs.  It switches the standard library to libc++, allowing us to use features from C++11.

There are some known bugs with older versions of libc++ (such as the istream::eof() bug); we may end up raising the minimum further (eg. to 10.9) soon if the situation becomes untenable.

Fixes #300
rdb 7 years ago
parent
commit
b1018d52ee
2 changed files with 29 additions and 72 deletions
  1. 2 3
      README.md
  2. 27 69
      makepanda/makepanda.py

+ 2 - 3
README.md

@@ -135,9 +135,8 @@ you may build Panda3D using a command like the following:
 python makepanda/makepanda.py --everything --installer
 python makepanda/makepanda.py --everything --installer
 ```
 ```
 
 
-In order to make a universal build, pass the --universal flag.  You may also
-target a specific minimum macOS version using the --osxtarget flag followed
-by the release number, eg. 10.6 or 10.7.
+You may target a specific minimum macOS version using the --osxtarget flag
+followed by the release number, eg. 10.7 or 10.9.
 
 
 If the build was successful, makepanda will have generated a .dmg file in
 If the build was successful, makepanda will have generated a .dmg file in
 the source directory containing the installer.  Simply open it and run the
 the source directory containing the installer.  Simply open it and run the

+ 27 - 69
makepanda/makepanda.py

@@ -63,7 +63,6 @@ MAJOR_VERSION=None
 COREAPI_VERSION=None
 COREAPI_VERSION=None
 PLUGIN_VERSION=None
 PLUGIN_VERSION=None
 OSXTARGET=None
 OSXTARGET=None
-OSX_ARCHS=[]
 HOST_URL=None
 HOST_URL=None
 global STRDXSDKVERSION, BOOUSEINTELCOMPILER
 global STRDXSDKVERSION, BOOUSEINTELCOMPILER
 STRDXSDKVERSION = 'default'
 STRDXSDKVERSION = 'default'
@@ -142,7 +141,6 @@ def usage(problem):
     print("  --host URL        (set the host url (runtime build only))")
     print("  --host URL        (set the host url (runtime build only))")
     print("  --threads N       (use the multithreaded build system. see manual)")
     print("  --threads N       (use the multithreaded build system. see manual)")
     print("  --osxtarget N     (the OS X version number to build for (OS X only))")
     print("  --osxtarget N     (the OS X version number to build for (OS X only))")
-    print("  --universal       (build universal binaries (OS X only))")
     print("  --override \"O=V\"  (override dtool_config/prc option value)")
     print("  --override \"O=V\"  (override dtool_config/prc option value)")
     print("  --static          (builds libraries for static linking)")
     print("  --static          (builds libraries for static linking)")
     print("  --target X        (experimental cross-compilation (android only))")
     print("  --target X        (experimental cross-compilation (android only))")
@@ -170,7 +168,7 @@ def usage(problem):
 
 
 def parseopts(args):
 def parseopts(args):
     global INSTALLER,WHEEL,RUNTESTS,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION
     global INSTALLER,WHEEL,RUNTESTS,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION
-    global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL
+    global COMPRESSOR,THREADCOUNT,OSXTARGET,HOST_URL
     global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
     global DEBVERSION,WHLVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX,RTDIST_VERSION
     global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
     global STRDXSDKVERSION, WINDOWS_SDK, MSVC_VERSION, BOOUSEINTELCOMPILER
     global COPY_PYTHON
     global COPY_PYTHON
@@ -178,7 +176,7 @@ def parseopts(args):
     # Options for which to display a deprecation warning.
     # Options for which to display a deprecation warning.
     removedopts = [
     removedopts = [
         "use-touchinput", "no-touchinput", "no-awesomium", "no-directscripts",
         "use-touchinput", "no-touchinput", "no-awesomium", "no-directscripts",
-        "no-carbon",
+        "no-carbon", "universal",
         ]
         ]
 
 
     # All recognized options.
     # All recognized options.
@@ -188,14 +186,13 @@ def parseopts(args):
         "version=","lzma","no-python","threads=","outputdir=","override=",
         "version=","lzma","no-python","threads=","outputdir=","override=",
         "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
         "static","host=","debversion=","rpmrelease=","p3dsuffix=","rtdist-version=",
         "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
         "directx-sdk=", "windows-sdk=", "msvc-version=", "clean", "use-icl",
-        "universal", "target=", "arch=", "git-commit=", "no-copy-python",
+        "target=", "arch=", "git-commit=", "no-copy-python",
         ] + removedopts
         ] + removedopts
 
 
     anything = 0
     anything = 0
     optimize = ""
     optimize = ""
     target = None
     target = None
     target_arch = None
     target_arch = None
-    universal = False
     clean_build = False
     clean_build = False
     for pkg in PkgListGet():
     for pkg in PkgListGet():
         longopts.append("use-" + pkg.lower())
         longopts.append("use-" + pkg.lower())
@@ -221,7 +218,6 @@ def parseopts(args):
             elif (option=="--threads"): THREADCOUNT=int(value)
             elif (option=="--threads"): THREADCOUNT=int(value)
             elif (option=="--outputdir"): SetOutputDir(value.strip())
             elif (option=="--outputdir"): SetOutputDir(value.strip())
             elif (option=="--osxtarget"): OSXTARGET=value.strip()
             elif (option=="--osxtarget"): OSXTARGET=value.strip()
-            elif (option=="--universal"): universal = True
             elif (option=="--target"): target = value.strip()
             elif (option=="--target"): target = value.strip()
             elif (option=="--arch"): target_arch = value.strip()
             elif (option=="--arch"): target_arch = value.strip()
             elif (option=="--nocolor"): DisableColors()
             elif (option=="--nocolor"): DisableColors()
@@ -303,25 +299,6 @@ def parseopts(args):
     if target is not None or target_arch is not None:
     if target is not None or target_arch is not None:
         SetTarget(target, target_arch)
         SetTarget(target, target_arch)
 
 
-    if universal:
-        if target_arch:
-            exit("--universal is incompatible with --arch")
-
-        OSX_ARCHS.append("i386")
-        if OSXTARGET:
-            osxver = OSXTARGET
-        else:
-            maj, min = platform.mac_ver()[0].split('.')[:2]
-            osxver = int(maj), int(min)
-
-        if osxver[1] < 6:
-            OSX_ARCHS.append("ppc")
-        else:
-            OSX_ARCHS.append("x86_64")
-
-    elif HasTargetArch():
-        OSX_ARCHS.append(GetTargetArch())
-
     try:
     try:
         SetOptimize(int(optimize))
         SetOptimize(int(optimize))
         assert GetOptimize() in [1, 2, 3, 4]
         assert GetOptimize() in [1, 2, 3, 4]
@@ -433,22 +410,7 @@ elif target == 'darwin':
         maj, min = platform.mac_ver()[0].split('.')[:2]
         maj, min = platform.mac_ver()[0].split('.')[:2]
         osxver = int(maj), int(min)
         osxver = int(maj), int(min)
 
 
-    arch_tag = None
-    if not OSX_ARCHS:
-        arch_tag = GetTargetArch()
-    elif len(OSX_ARCHS) == 1:
-        arch_tag = OSX_ARCHS[0]
-    elif frozenset(OSX_ARCHS) == frozenset(('i386', 'ppc')):
-        arch_tag = 'fat'
-    elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'i386')):
-        arch_tag = 'intel'
-    elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'ppc64')):
-        arch_tag = 'fat64'
-    elif frozenset(OSX_ARCHS) == frozenset(('x86_64', 'i386', 'ppc')):
-        arch_tag = 'fat32'
-    else:
-        raise RuntimeError('No arch tag for arch combination %s' % OSX_ARCHS)
-
+    arch_tag = GetTargetArch()
     PLATFORM = 'macosx-{0}.{1}-{2}'.format(osxver[0], osxver[1], arch_tag)
     PLATFORM = 'macosx-{0}.{1}-{2}'.format(osxver[0], osxver[1], arch_tag)
 
 
 elif target == 'linux' and (os.path.isfile("/lib/libc-2.5.so") or os.path.isfile("/lib64/libc-2.5.so")) and os.path.isdir("/opt/python"):
 elif target == 'linux' and (os.path.isfile("/lib/libc-2.5.so") or os.path.isfile("/lib64/libc-2.5.so")) and os.path.isdir("/opt/python"):
@@ -934,7 +896,6 @@ if (COMPILER=="GCC"):
 
 
         if not PkgSkip("FFMPEG"):
         if not PkgSkip("FFMPEG"):
             if GetTarget() == "darwin":
             if GetTarget() == "darwin":
-                LibName("FFMPEG", "-Wl,-read_only_relocs,suppress")
                 LibName("FFMPEG", "-framework VideoDecodeAcceleration")
                 LibName("FFMPEG", "-framework VideoDecodeAcceleration")
             elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
             elif os.path.isfile(GetThirdpartyDir() + "ffmpeg/lib/libavcodec.a"):
                 # Needed when linking ffmpeg statically on Linux.
                 # Needed when linking ffmpeg statically on Linux.
@@ -1347,9 +1308,11 @@ def CompileCxx(obj,src,opts):
                 cmd += " -isysroot " + SDK["MACOSX"]
                 cmd += " -isysroot " + SDK["MACOSX"]
                 cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
                 cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
 
 
-            for arch in OSX_ARCHS:
-                if 'NOARCH:' + arch.upper() not in opts:
-                    cmd += " -arch %s" % arch
+            # Use libc++ to enable C++11 features.
+            cmd += " -stdlib=libc++"
+
+            arch = GetTargetArch()
+            cmd += " -arch %s" % arch
 
 
         if "SYSROOT" in SDK:
         if "SYSROOT" in SDK:
             if GetTarget() != "android":
             if GetTarget() != "android":
@@ -1867,9 +1830,11 @@ def CompileLink(dll, obj, opts):
                 cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"]
                 cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"]
                 cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
                 cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET)
 
 
-            for arch in OSX_ARCHS:
-                if 'NOARCH:' + arch.upper() not in opts:
-                    cmd += " -arch %s" % arch
+            # Use libc++ to enable C++11 features.
+            cmd += " -stdlib=libc++"
+
+            arch = GetTargetArch()
+            cmd += " -arch %s" % arch
 
 
         elif GetTarget() == 'android':
         elif GetTarget() == 'android':
             arch = GetTargetArch()
             arch = GetTargetArch()
@@ -2120,10 +2085,10 @@ def Package(target, inputs, opts):
         if SDK.get("MACOSX"):
         if SDK.get("MACOSX"):
             command += " -R \"%s\"" % SDK["MACOSX"]
             command += " -R \"%s\"" % SDK["MACOSX"]
 
 
-        for arch in OSX_ARCHS:
-            if arch == "x86_64":
-                arch = "amd64"
-            command += " -P osx_%s" % arch
+        arch = GetTargetArch()
+        if arch == "x86_64":
+            arch = "amd64"
+        command += " -P osx_%s" % arch
 
 
     command += " -i \"" + GetOutputDir() + "/stage\""
     command += " -i \"" + GetOutputDir() + "/stage\""
     if (P3DSUFFIX):
     if (P3DSUFFIX):
@@ -5009,10 +4974,10 @@ if (PkgSkip("BULLET")==0 and not RUNTIME):
 #
 #
 
 
 if (PkgSkip("PHYSX")==0):
 if (PkgSkip("PHYSX")==0):
-  OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC']
+  OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX']
   TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx')
   TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx')
 
 
-  OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOARCH:PPC']
+  OPTS=['DIR:panda/src/physx', 'PHYSX']
   IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"])
   IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"])
   TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES)
   TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES)
   TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx'])
   TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx'])
@@ -5022,15 +4987,15 @@ if (PkgSkip("PHYSX")==0):
 #
 #
 
 
 if (PkgSkip("PHYSX")==0):
 if (PkgSkip("PHYSX")==0):
-  OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC', 'PYTHON']
+  OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'PYTHON']
   TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx')
   TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx')
 
 
   TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj')
   TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj')
   TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj')
   TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj')
   TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS)
   TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS)
-  TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC', 'PYTHON'])
+  TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'PYTHON'])
 
 
-  OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC']
+  OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX']
   PyTargetAdd('physx_module.obj', input='libpandaphysx.in')
   PyTargetAdd('physx_module.obj', input='libpandaphysx.in')
   PyTargetAdd('physx_module.obj', opts=OPTS)
   PyTargetAdd('physx_module.obj', opts=OPTS)
   PyTargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core'])
   PyTargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx', 'IMPORT:panda3d.core'])
@@ -5040,7 +5005,7 @@ if (PkgSkip("PHYSX")==0):
   PyTargetAdd('physx.pyd', input='libpandaphysx.dll')
   PyTargetAdd('physx.pyd', input='libpandaphysx.dll')
   PyTargetAdd('physx.pyd', input='libp3interrogatedb.dll')
   PyTargetAdd('physx.pyd', input='libp3interrogatedb.dll')
   PyTargetAdd('physx.pyd', input=COMMON_PANDA_LIBS)
   PyTargetAdd('physx.pyd', input=COMMON_PANDA_LIBS)
-  PyTargetAdd('physx.pyd', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC'])
+  PyTargetAdd('physx.pyd', opts=['WINUSER', 'PHYSX'])
 
 
 #
 #
 # DIRECTORY: panda/src/physics/
 # DIRECTORY: panda/src/physics/
@@ -6452,16 +6417,9 @@ if not PkgSkip("PANDATOOL"):
 for VER in MAYAVERSIONS:
 for VER in MAYAVERSIONS:
   VNUM = VER[4:]
   VNUM = VER[4:]
   if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
   if not PkgSkip(VER) and not PkgSkip("PANDATOOL") and not PkgSkip("EGG"):
-    if GetTarget() == 'darwin' and int(VNUM) >= 2012:
-      ARCH_OPTS = ['NOARCH:PPC', 'NOARCH:I386']
-      if len(OSX_ARCHS) != 0 and 'x86_64' not in OSX_ARCHS:
-        continue
-    elif GetTarget() == 'darwin' and int(VNUM) >= 2009:
-      ARCH_OPTS = ['NOARCH:PPC']
-    elif GetTarget() == 'darwin':
-      ARCH_OPTS = ['NOARCH:X86_64']
-    else:
-      ARCH_OPTS = []
+    if GetTarget() == 'darwin' and int(VNUM) < 2009:
+      # No x86_64 support.
+      continue
 
 
     OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC', VER] + ARCH_OPTS
     OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC', VER] + ARCH_OPTS
     TargetAdd('mayaeggimport'+VNUM+'_mayaeggimport.obj', opts=OPTS, input='mayaEggImport.cxx')
     TargetAdd('mayaeggimport'+VNUM+'_mayaeggimport.obj', opts=OPTS, input='mayaEggImport.cxx')