Merge pull request #81 from ianrrees/20160126-mac-relocate-script-warnings
Added notes + warnings to mac app bundle tool.
This commit is contained in:
commit
1a06e50f0e
|
@ -4,7 +4,23 @@ from subprocess import Popen, PIPE, check_call, check_output
|
||||||
import pprint
|
import pprint
|
||||||
import re
|
import re
|
||||||
|
|
||||||
SYS_PATHS = ["/System/", "/usr/lib/", "/Library/Frameworks/"]
|
# This script is intended to help copy dynamic libraries used by FreeCAD into
|
||||||
|
# a Mac application bundle and change dyld commands as appropriate. There are
|
||||||
|
# two key items that this currently does differently from other similar tools:
|
||||||
|
#
|
||||||
|
# * @rpath is used rather than @executable_path because the libraries need to
|
||||||
|
# be loadable through a Python interpreter and the FreeCAD binaries.
|
||||||
|
# * We need to be able to add multiple rpaths in some libraries.
|
||||||
|
|
||||||
|
# Assume any libraries in these paths don't need to be bundled
|
||||||
|
systemPaths = [ "/System/", "/usr/lib/",
|
||||||
|
"/Library/Frameworks/3DconnexionClient.framework/" ]
|
||||||
|
|
||||||
|
# If a library is in these paths, but not systemPaths, a warning will be
|
||||||
|
# issued and it will NOT be bundled. Generally, libraries installed by
|
||||||
|
# MacPorts or Homebrew won't end up in /Library/Frameworks, so we assume
|
||||||
|
# that libraries found there aren't meant to be bundled.
|
||||||
|
warnPaths = ["/Library/Frameworks/"]
|
||||||
|
|
||||||
class LibraryNotFound(Exception):
|
class LibraryNotFound(Exception):
|
||||||
pass
|
pass
|
||||||
|
@ -73,9 +89,14 @@ def is_macho(path):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_system_lib(lib):
|
def is_system_lib(lib):
|
||||||
for p in SYS_PATHS:
|
for p in systemPaths:
|
||||||
if lib.startswith(p):
|
if lib.startswith(p):
|
||||||
return True
|
return True
|
||||||
|
for p in warnPaths:
|
||||||
|
if lib.startswith(p):
|
||||||
|
print "WARNING: library %s will not be bundled!" % lib
|
||||||
|
print "See MakeMacRelocatable.py for more information."
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def get_path(name, search_paths):
|
def get_path(name, search_paths):
|
||||||
|
@ -250,19 +271,13 @@ def get_rpaths(library):
|
||||||
|
|
||||||
if "cmd LC_RPATH" in line:
|
if "cmd LC_RPATH" in line:
|
||||||
expectingRpath = True
|
expectingRpath = True
|
||||||
continue
|
elif "Load command" in line:
|
||||||
|
|
||||||
if "Load command" in line:
|
|
||||||
expectingRpath = False
|
|
||||||
continue
|
|
||||||
|
|
||||||
if not expectingRpath:
|
|
||||||
continue
|
|
||||||
|
|
||||||
m = re.match(pathRegex, line)
|
|
||||||
if m:
|
|
||||||
rpaths.append(m.group(1))
|
|
||||||
expectingRpath = False
|
expectingRpath = False
|
||||||
|
elif expectingRpath:
|
||||||
|
m = re.match(pathRegex, line)
|
||||||
|
if m:
|
||||||
|
rpaths.append(m.group(1))
|
||||||
|
expectingRpath = False
|
||||||
|
|
||||||
return rpaths
|
return rpaths
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user