|
| 1 | +import mkcwproject |
| 2 | +import sys |
| 3 | +import os |
| 4 | + |
| 5 | +PROJECTDIR = os.path.join(sys.prefix, ":Mac:Build") |
| 6 | +MODULEDIRS = [ # Relative to projectdirs |
| 7 | + "::Modules:%s", |
| 8 | + "::Modules", |
| 9 | + ":::Modules", |
| 10 | +] |
| 11 | + |
| 12 | +def genpluginproject(module, |
| 13 | + project=None, projectdir=None, |
| 14 | + sources=[], sourcedirs=[], |
| 15 | + libraries=[], extradirs=[], |
| 16 | + extraexportsymbols=[]): |
| 17 | + if not project: |
| 18 | + project = module + '.mcp' |
| 19 | + if not projectdir: |
| 20 | + projectdir = PROJECTDIR |
| 21 | + if not sources: |
| 22 | + sources = [module + 'module.c'] |
| 23 | + if not sourcedirs: |
| 24 | + for moduledir in MODULEDIRS: |
| 25 | + if '%' in moduledir: |
| 26 | + moduledir = moduledir % module |
| 27 | + fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) |
| 28 | + if os.path.exists(fn): |
| 29 | + moduledir, sourcefile = os.path.split(fn) |
| 30 | + sourcedirs = [moduledir] |
| 31 | + sources[0] = sourcefile |
| 32 | + break |
| 33 | + else: |
| 34 | + print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) |
| 35 | + sourcedirs = [] |
| 36 | + dict = { |
| 37 | + "sysprefix" : sys.prefix, |
| 38 | + "sources" : sources, |
| 39 | + "extrasearchdirs" : sourcedirs + extradirs, |
| 40 | + "libraries": libraries, |
| 41 | + "mac_outputdir" : os.path.join(sys.prefix, ":Mac:Plugins"), |
| 42 | + "extraexportsymbols" : extraexportsymbols, |
| 43 | + } |
| 44 | + mkcwproject.mkproject(os.path.join(projectdir, project), module, dict) |
| 45 | + |
| 46 | +def genallprojects(): |
| 47 | + # Standard Python modules |
| 48 | + genpluginproject("ucnhash", sources=["ucnhash.c"]) |
| 49 | + genpluginproject("pyexpat", |
| 50 | + sources=["pyexpat.c"], |
| 51 | + libraries=["libexpat.ppc.lib"], |
| 52 | + extradirs=["::::expat:mac"]) |
| 53 | + genpluginproject("zlib", |
| 54 | + libraries=["zlib.ppc.Lib"], |
| 55 | + extradirs=["::::imglibs:zlib:mac", "::::imglibs:zlib"]) |
| 56 | + genpluginproject("gdbm", |
| 57 | + libraries=["gdbm.ppc.gusi.lib"], |
| 58 | + extradirs=["::::gdbm:mac", "::::gdbm"]) |
| 59 | + |
| 60 | + # bgen-generated Toolbox modules |
| 61 | + genpluginproject("App", libraries=["AppearanceLib"]) |
| 62 | + genpluginproject("Cm", |
| 63 | + libraries=["QuickTimeLib"], |
| 64 | + extraexportsymbols=[ |
| 65 | + "CmpObj_New", |
| 66 | + "CmpObj_Convert", |
| 67 | + "CmpInstObj_New", |
| 68 | + "CmpInstObj_Convert", |
| 69 | + ]) |
| 70 | + genpluginproject("Drag", libraries=["DragLib"]) |
| 71 | + genpluginproject("Fm") |
| 72 | + genpluginproject("Help") |
| 73 | + genpluginproject("Icn", libraries=["IconServicesLib"]) |
| 74 | + genpluginproject("List") |
| 75 | + genpluginproject("Qt", libraries=["QuickTimeLib", "Cm.ppc.slb"], extradirs=["::Plugins"]) |
| 76 | + genpluginproject("Qdoffs") |
| 77 | + genpluginproject("Scrap") |
| 78 | + genpluginproject("Snd", libraries=["SoundLib"]) |
| 79 | + genpluginproject("Sndihooks", sources=[":snd:Sndihooks.c"]) |
| 80 | + genpluginproject("TE", libraries=["DragLib"]) |
| 81 | + |
| 82 | + # Other Mac modules |
| 83 | + genpluginproject("calldll", sources=["calldll.c"]) |
| 84 | + genpluginproject("ColorPicker") |
| 85 | + genpluginproject("Printing") |
| 86 | + genpluginproject("waste", |
| 87 | + sources=[ |
| 88 | + "wastemodule.c", |
| 89 | + 'WEAccessors.c', 'WEBirthDeath.c', 'WEDebug.c', |
| 90 | + 'WEDrawing.c', 'WEFontTables.c', 'WEHighLevelEditing.c', |
| 91 | + 'WEICGlue.c', 'WEInlineInput.c', 'WELineLayout.c', 'WELongCoords.c', |
| 92 | + 'WELowLevelEditing.c', 'WEMouse.c', 'WEObjects.c', 'WEScraps.c', |
| 93 | + 'WESelecting.c', 'WESelectors.c', 'WEUserSelectors.c', 'WEUtilities.c', |
| 94 | + 'WEObjectHandlers.c', |
| 95 | + 'WETabs.c', |
| 96 | + 'WETabHooks.c'], |
| 97 | + libraries=['DragLib'], |
| 98 | + extradirs=['::::Waste 1.3 Distribution:*'] |
| 99 | + ) |
| 100 | + genpluginproject("ctb") |
| 101 | + genpluginproject("icglue", sources=["icgluemodule.c"], |
| 102 | + libraries=["ICGlueCFM-PPC.lib"], |
| 103 | + extradirs=["::::ICProgKit1.4:APIs"]) |
| 104 | + genpluginproject("macspeech", libraries=["SpeechLib"]) |
| 105 | + |
| 106 | +if __name__ == '__main__': |
| 107 | + genallprojects() |
| 108 | + |
0 commit comments