root/trunk/llmozlib2/README-mac.txt

Revision 8, 6.1 kB (checked in by rob.linden, 2 years ago)

Latest internal snapshot
Last Changed Rev: 80909
Last Changed Date: 2008-02-27 15:08:55 -0800 (Wed, 27 Feb 2008)

  • Property svn:eol-style set to native
Line 
1 The projects and scripts in this directory create the llmozlib library and package it with the mozilla runtime.
2
3 If you just need to rebuild the llmozlib library, you can skip ahead to building the xcode project.
4
5 Building mozilla from scratch
6 -----------------------------
7
8 If you want to start from scratch, or are updating to a new mozilla release tag, you should first build the mozilla project.  The script ../mozilla-mac-universal-build/checkout_patch_build.sh will check out the mozilla sources from the mozilla cvs server, apply our local patches, and build the whole thing.  Embedded in this script is the CVS tag to check out, which should correspond to one of the official mozilla releases.  If you update to a later version, please commit the change to checkout_patch_build.sh so that others will be able to tell which version is current.
9
10 Once you have the mozilla library built, run the copy_products_mac.sh script in this directory to pull the necessary bits across.  This will repopulate the architecture-specific portions of the libraries directory here, so you may want to do a preemptive 'svn remove' and commit first.  It will also create mozilla-universal-darwin-original.tgz which contains the necessary runtime bits that need to go into the application bundle.
11
12 At this point, you can 'svn add' any new files in ./libraries, commit them and mozilla-universal-darwin-original.tgz, and someone else will be able to check out this directory and rebuild llmozlib without having to do a full mozilla build.  This is the reason for splitting the build process at this point. 
13
14 Rebuilding llmozlib (Xcode)
15 ---------------------------
16
17 *** WARNING ***
18
19 Build will fail the first time!  This is expected!  There's some voodoo going on with include directory names.  Open the project in Xcode (or use the command line equivalent listed at the end of this section).  Build it.  Now close the Xcode project and reopen it and build it again (or just run the command line equivalent again).
20
21 Once you've got the mozilla libraries in place, open llmozlib.xcodeproj and build the "Release" build style.  If the build fails with a bunch of missing include files, close the project and reopen it, then try again.  (A script phase in the project creates a symlink, but xcode only reevaluates the wildcard header path search when the project is opened.  You should only have to do this once per checkout.)
22
23 If the llmozlib build still fails due to missing header files after doing the steps above, you'll want to figure out where in the mozilla build they live and modify copy_products_mac.sh to copy them, run it (so they get pulled into ./libraries), 'svn add' the new files, and commit.
24
25 If there's any chance the public interface (i.e. member functions) of the LLMozLib class has changed, you need to regenerate the exports file and (re)build the "Release" target.  See the NOTE about llmozlib2.exp below.
26
27 If you did a full mozilla build and you're certain you have all the header files you need copied into ./libraries, it's now safe to delete the files that the mozilla build generated:
28
29         build_mozilla/cvsco.log
30         build_mozilla/mozilla
31         build_mozilla/objdir-mozilla-universal
32
33 After the xcode build completes, run repackage_runtime.sh to do the final packaging step (including creating mozilla-universal-darwin.tgz from mozilla-universal-darwin-original.tgz and the llmozlib build products) and copy the necessary pieces into your sandbox.  The script takes a single argument, which is the location of the sandbox directory.  (Note that this should be the directory containing the 'libraries' and 'indra' directories.)  The script should be run from the llmozlib directory, and the sandbox path can either be relative or absolute (i.e. './repackage_runtime.sh ../../BRANCH' will work fine).
34
35 NOTE:  Command line build command:
36
37 xcodebuild -project llmozlib2.xcodeproj -target llmozlib2 -configuration Release build
38
39 (You can use "clean" instead of "build")
40
41 -----------
42 NOTE: about llmozlib2.exp
43
44 In order to hide internal symbols in the mozilla library, we have to use an explicit export list when building llmozlib.
45
46 The list of symbols to export is in llmozlib.exp.  The symbols are in "name mangled" form, making them a bit of a pain to read.
47
48 If changes are made to any of the class definitions in llmozlib.h, this list may need to be regenerated.  The script update-mac-symbols.sh in this directory now takes care of doing this step.  The following directions are what I used to do manually, preserved for posterity (or in case the script breaks in the future).  If you run the script and it works, you don't need to read any further.
49
50
51 To regenerate the list of symbols:
52
53 - Open up the xcode project
54 - Build the "All Symbols" configuration
55 - Execute the following commands:
56
57 otool -vT 'build/All Symbols/libllmozlib2.dylib' >symbols.txt
58 sed -n -e '/.*\.eh/d' -e 's/^single module    \(.*\)/\1/p' <symbols.txt >symbols2.txt
59
60 - symbols2.txt should now contain the list of global symbols that the library would export with no controls in place.
61
62 Now comes the hard part.  The list must be manually pruned.  At the moment, deleting all symbols that don't begin with __ZN8LLMozLib seems to be correct.  Look at the existing llmozlib.exp for guidance.
63
64 Once you've got the new list, paste it into llmozlib.exp and change the "Exported Symbols File" setting back to "llmozlib.exp".
65
66 NOTE:  Command line build command:
67
68 xcodebuild -project llmozlib2.xcodeproj -target llmozlib2 -configuration Release build
69
70 (You can use "clean" instead of "build")
71
72 -----------
73 NOTE: about llmozlib_stub.c
74
75 Due to the way the Mac linker works, it was necessary to create a 'stub' library.  This is a shared library containing nothing but the export symbols that is used to make the linker happy when building the application.  The real shared library then gets referenced during runtime.
76
77 There's a shell script phase in the project that runs a 'sed' script which creates llmozlib_stub.c from llmozlib.exp.  It's about as stupid as possible. 
78
79 Make sure the stub library gets copied into libraries/universal-darwin/lib_{debug|release} and that the real library gets put into the application bundle.  Getting either one into the other's place will cause problems.
Note: See TracBrowser for help on using the browser.