You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.



Adding XPIDL interface files to the build process

We've a few rules to the build process to make it easy to create headers and xpt typelib files from XPIDL interface files.
  • Windows and Unixes:
    Define XPIDLSRCS in your Makefile.in or makefile.win, listing all the .idl files that you want to compile. rules.mk and rules.mak will use this variable to
    • create .h files for each .idl file and export them to the include directory.
    • create .xpt files for each .idl file
    • link the .xpt files together into $(MODULE).xpt
    • export the resulting .xpt file to the components directory.
    If you have several directories with the same MODULE that you want to compile .idl files in, you may want to define XPIDL_MODULE as well with a new name to avoid conflicts. The build system will use XPIDL_MODULE instead.

  • Macintosh:
    John McMullen contributed the following instructions:
    1. Start with an existing idl project, eg mozilla/xpfe/components/history/macbuild/historyIDL.mcp.
    2. Copy this project file to the desired location (by convention, in mozilla/foo/macbuild), and rename it "fooIDL.mcp".
    3. Open the project file.
    4. Switch to the "targets" tab.
    5. Double-click on the "headers" target, to bring up the settings window.
    6. On the "Target"/"Target settings" panel, change the output directory to your liking.
    7. On the "Target"/"Access paths" panel, make sure that the only access path is to ::::dist:idl: (your number of leading colons will vary). Other needed access paths may get added automatically when you add your idl files.
    8. On the "Language Settings"/"xpidl Settings" panel change the linker output to "foo.headers".
    9. Close the settings window, and save the changes.
    10. Double-click the "history.xpt" target, to bring up the settings window.
    11. On the "Target"/"Target settings" panel, change the target name to "foo.xpt".
    12. On the "Target"/"Access paths" panel, make sure that the only access path is to ::::dist:idl: (your number of leading colons will vary). Other needed access paths may get added automatically when you add your idl files.
    13. On the "Language Settings"/"xpidl Settings" panel change the linker output to "foo.xpt"
    14. Close the settings window, and save the changes.
    15. Switch to the "Files" tab.
    16. Select all the files in the list, and remove them from the project (eg, using cmd-delete).
    17. Add your foo idl files to the project. (or proceed to the next step, and add the files later).
    18. Open MacCVS Pro, and find your new file fooIDL.mcp. Select it and choose "Orphan Files" to remove the previous MacCVS information. At this point, you can check the new file in, if you want.
    19. If you want your IDL files to be exported, a file MANIFEST_IDL must be added to the same directory as the .idl file. Add the name of your .idl file to MANIFEST_IDL, leaf name only, one file per line.
    20. Finally, modify the build script that drives the build, namely mozilla/build/mac/NGLayoutBuildList.pm. Find the function BuildClientDist(). Add lines such as these:

      InstallFromManifest(":mozilla:foo:public:MANIFEST_IDL", "$distdirectory:idl:");
      BuildIDLProject(":mozilla:foo:macbuild:fooIDL.mcp", "foo");

      The first line exports your idl headers to dist (assuming you want this, and have created the manifest file in a previous step). The second line causes the .h and the .xpt files to be generated. Be sure that, if your idl files include other idl files, that your new lines follow the lines that export the headers on which they depend.
    21. You're done!
mike+mozilla@meer.net

Last modified: Fri Jun 4 11:02:49 PDT 1999