2
0
Эх сурвалжийг харах

[Mac] Fix the install id of the python library so that binaries that link to it will set the correct relative path to find the library. Other fixes to be able to build python.

Signed-off-by: amzn-sj <[email protected]>
amzn-sj 3 жил өмнө
parent
commit
84b8477806

+ 1 - 1
package-system/python/darwin_x64/PackageInfo.json

@@ -1,5 +1,5 @@
 {
-    "PackageName" : "python-3.7.12-rev2-darwin",
+    "PackageName" : "python-3.7.12-rev3-darwin",
     "License"     : "PSF-2.0",
     "URL"         : "https://python.org",
     "LicenseFile" : "LICENSE"

+ 6 - 9
package-system/python/darwin_x64/make-python.sh

@@ -179,19 +179,16 @@ echo ""
 echo "---------------- Final RPATH update ----------------"
 echo ""
 # The filename of the main python dylib is 'Python'.
-# It is located at ./package/Python.framework/Versions/3.7
-# This, despite just being called 'Python' with no extension is actually the main python 
-# dylib that is required to load if you link your application to the import library for 
-# Python.  The below change of its 'id' (which is what programs link to it will import it as)
-# allows programs linked ot it to work as long the dylib is deployed to the executable,
-# and as long as the executable adds the executable's path to its list of @rpath to search.
-# (Instead of its original which is "@rpath/Versions/3.7/Python" which would require us to
-# copy it to such a subfolder)
+# It is located at ./package/Python.framework/Versions/3.7(symlinked to Current)
+# The original rpath "@rpath/Versions/3.7/Python" is incorrect. When the Python.framework
+# is embedded in an app bundle, any executable/shared library linking to it will need to
+# find it in "@rpath/Python.framework/Versions/Current/Python". The executable will have
+# its rpath set to "<bundle_name>.app/Contents/Frameworks".
 # Because all the python framework libraries already have 2 rpaths, the @loader_path
 # as well as the root of the framework (ie, @loader_path/../../../.. etc), this makes
 # the whole thing work regardless of whether Python is in the same folder as the binary or 
 # whether a python native plugin is being located from the framework in some subfolder.
-install_name_tool -id @rpath/Python $FRAMEWORK_OUTPUT_FOLDER/Python.framework/Versions/3.7/Python
+install_name_tool -id @rpath/Python.framework/Versions/Current/Python $FRAMEWORK_OUTPUT_FOLDER/Python.framework/Versions/3.7/Python
 
 echo ""
 echo "---------------- rsync package layout into $SCRIPT_DIR/package ----------------"

+ 12 - 3
package-system/python/darwin_x64/open3d_python.patch

@@ -99,9 +99,9 @@ index 4fab488..2f1bd81 100755
 -                  ' -arch '.join(ARCHLIST),
 -              ),
 -          ),
-+              name="ZLib 1.2.11",
-+              url="https://zlib.net/zlib-1.2.11.tar.gz",
-+              checksum='1c9f62f0778697a09d36121ead88e08e',
++              name="ZLib 1.2.12",
++              url="https://zlib.net/zlib-1.2.12.tar.gz",
++              checksum='5fc414a9726be31427b440b434d05f78',
 +              suppressCFlags=True,
 +              configure='./configure',
 +              configure_full=[
@@ -179,6 +179,15 @@ index 4fab488..2f1bd81 100755
 
          if 'configure_post' in recipe:
              configure_args = configure_args + list(recipe['configure_post'])
+@@ -1090,6 +1092,8 @@ def buildPythonDocs():
+     if not os.path.exists(htmlDir):
+         # Create virtual environment for docs builds with blurb and sphinx
+         runCommand('make venv')
++        runCommand('venv/bin/python3 -m pip install -U markupsafe==2.0.1')
++        runCommand('venv/bin/python3 -m pip install -U jinja2==2.11.3')
+         runCommand('venv/bin/python3 -m pip install -U Sphinx==2.3.1')
+         runCommand('make html PYTHON=venv/bin/python')
+     os.rename(htmlDir, docdir)
 @@ -1522,6 +1524,11 @@ def buildInstaller():
      pkgroot = os.path.join(outdir, 'Python.mpkg', 'Contents')
      pkgcontents = os.path.join(pkgroot, 'Packages')

+ 2 - 2
package_build_list_host_darwin.json

@@ -37,7 +37,7 @@
         "astc-encoder-3.2-rev5-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/astc-encoder --platform-name Mac --package-root ../../package-system --clean",
         "DirectXShaderCompilerDxc-1.6.2112-o3de-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/DirectXShaderCompiler --platform-name Mac --package-root ../../package-system --clean",
         "azslc-1.7.35-rev1-mac": "Scripts/extras/pull_and_build_from_git.py ../../package-system/azslc --platform-name Mac --package-root ../../package-system --clean",
-        "python-3.7.12-rev2-darwin": "package-system/python/build_package_image.py",
+        "python-3.7.12-rev3-darwin": "package-system/python/build_package_image.py",
         "mcpp-2.7.2_az.2-rev1-mac": "package-system/mcpp/get_and_build_mcpp.py mcpp-2.7.2_az.2-rev1",
         "mikkelsen-1.0.0.4-mac": "package-system/mikkelsen/build_package_image.py --platform mac",
         "mikkelsen-1.0.0.4-ios": "package-system/mikkelsen/build_package_image.py --platform ios",
@@ -75,7 +75,7 @@
         "OpenEXR-3.1.3-rev2-mac": "package-system/OpenEXR-mac",
         "tiff-4.2.0.15-rev3-mac": "package-system/tiff-mac",
         "tiff-4.2.0.15-rev3-ios": "package-system/tiff-ios",
-        "python-3.7.12-rev2-darwin": "package-system/python/darwin_x64/package",
+        "python-3.7.12-rev3-darwin": "package-system/python/darwin_x64/package",
         "asn1-0.9.27-rev2-ios": "package-system/asn1-ios",
         "PhysX-4.1.2.29882248-rev5-mac": "package-system/PhysX-mac",
         "PhysX-4.1.2.29882248-rev5-ios": "package-system/PhysX-ios",