]>
git.saurik.com Git - wxWidgets.git/blob - distrib/scripts/mac/lipo-dir.py
aaee9d0735f7ca1fdb370b4ec91e9a28379f3097
7 def lipo_walker(data
, dirname
, names
):
13 fullpath
= os
.path
.join(dirname
, name
)
14 intel_fullpath
= fullpath
.replace(ppc_basedir
, intel_basedir
)
15 outputfile
= fullpath
.replace(ppc_basedir
, outputdir
)
16 outdir
= os
.path
.dirname(outputfile
)
17 if not os
.path
.exists(outdir
):
20 # this call will only succeed if the file is a binary that can
22 if not os
.path
.islink(fullpath
) and os
.system("lipo -info %s" % fullpath
) == 0:
23 if os
.system("lipo -output %s -create %s %s" % (outputfile
, fullpath
, intel_fullpath
)) == 0:
24 print "Successfully created %s" % outputfile
26 if os
.path
.islink(fullpath
):
27 if os
.path
.exists(outputfile
):
29 linkto
= os
.readlink(fullpath
)
31 if linkto
.startswith(ppc_basedir
):
32 linkto
= linkto
.replace(ppc_basedir
, outputdir
)
33 elif linkto
.startswith(intel_basedir
):
34 linkto
= linkto
.replace(intel_basedir
, outputdir
)
36 os
.symlink(linkto
, outputfile
)
38 elif not os
.path
.isdir(fullpath
):
39 shutil
.copy(fullpath
, outputfile
)
42 if __name__
== "__main__":
44 print "Usage: %s <ppcdir> <inteldir> <outputdir>"
46 print "Takes a directory containing a Mac ppc application, and a directory"
47 print "containing a Mac intel application, and merges them into a universal"
51 ppc_basedir
= sys
.argv
[1]
52 intel_basedir
= sys
.argv
[2]
53 outputdir
= sys
.argv
[3]
55 os
.path
.walk(ppc_basedir
, lipo_walker
, None)