]>
git.saurik.com Git - wxWidgets.git/blob - distrib/scripts/mac/lipo-dir.py
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 linkto
= os
.readlink(fullpath
)
29 if linkto
.startswith(ppc_basedir
):
30 linkto
= linkto
.replace(ppc_basedir
, outputdir
)
31 elif linkto
.startswith(intel_basedir
):
32 linkto
= linkto
.replace(intel_basedir
, outputdir
)
34 os
.symlink(linkto
, outputfile
)
36 elif not os
.path
.isdir(fullpath
):
37 shutil
.copy(fullpath
, outputfile
)
40 if __name__
== "__main__":
42 print "Usage: %s <ppcdir> <inteldir> <outputdir>"
44 print "Takes a directory containing a Mac ppc application, and a directory"
45 print "containing a Mac intel application, and merges them into a universal"
49 ppc_basedir
= sys
.argv
[1]
50 intel_basedir
= sys
.argv
[2]
51 outputdir
= sys
.argv
[3]
53 os
.path
.walk(ppc_basedir
, lipo_walker
, None)