Typo
[linux_from_scratch_hints.git] / OLD / mozcompile.txt
blob91477d3cd8fe7ededff3024c56febfc7c811b227
1 TITLE:          Compiling Mozilla and Installing Plugins
3 LFS VERSION:    All(?)
5 AUTHOR:         Tushar Teredesai <Tush@Yahoo.Com>
7 SYNOPSIS:
8         How to compile moz from scratch and install Plugins.
9         The compiler I used was gcc-3.0.4. There are some additional tips to
10         allow commercial plugins to be used with gcc3 compiled moz.
12 HINT:
14 Hint Version: 1.1
15 ChangeLog:
16         * Typo in running regxpcom.
17         * Env variable to speed up mozilla.
19 Pre-requesites:
20         * X (See X Hint)
21         * GLib & GTK >= 1.2 (See GNOME Hint)
22         * libIDL >= 0.6.3 & <= 0.6.8 (See GNOME Hint)
23         * JPEG, PNG, MNG Libraries (See BLFS Book or KDE Hint)
25 Packages to download:
26         * Info Zip >= 2.3 <http://www.info-zip.org/Zip.html>
27         * iCal <http://www.softwarestudio.org/libical> [Optional]
28         * Mozilla:) <http://www.mozilla.org/download-mozilla.html>
30 Installing Zip:
31         There are additional options, check out the unix/Makefile.
32                 make -f unix/Makefile prefix=/usr generic_gcc &&
33                 make -f unix/Makefile prefix=/usr install
35 Installing libical:
36         libical is only required if you want to play around with calendar.
37         I had problems building mozilla calendar, YMMV.
38                 ./configure --prefix=/usr --disable-static &&
39                 make &&
40                 make install
42 Installing Mozilla:
43         One option is to pass the options to configure. Alternatively, these
44         options can be placed in a file .mozconfig that is read by moz's
45         configure script. I used the latter method.
47         I built the package in /usr/src/mozilla.
49         First we will set the flags so that we can build a distribution rather
50         than having to run mozilla from the directory we compiled.
51                 export MOZILLA_OFFICIAL=1
52                 export BUILD_OFFICIAL=1
53                 export MOZ_INTERNAL_LIBART_LGPL=1
54                 export MOZ_CALENDAR=1
55         The third export specifies that you accept the LGPL License for libart.
56         This is required for SVG support and is recommended.
57         The fourth export is required only if you want to build the calendar
58         interface (experimental).
59         Also set CFLAGS and CXXFLAGS based on your needs.
61         Now we create the .mozconfig file containing the options we want.
62         This is how I configure, skip the options you don't like; for more
63         options try ./configure --help.
64                 cd /usr/src/mozilla/
65                 echo ac_add_options --with-system-jpeg >> .mozconfig
66                 echo ac_add_options --with-system-zlib >> .mozconfig
67                 echo ac_add_options --with-system-png >> .mozconfig
68                 echo ac_add_options --with-system-mng >> .mozconfig
69                 echo ac_add_options --enable-crypto >> .mozconfig
70                 echo ac_add_options --disable-jsd >> .mozconfig
71                 echo ac_add_options --disable-accessibility >> .mozconfig
72                 echo ac_add_options --enable-mathml >> .mozconfig
73                 echo ac_add_options --enable-svg >> .mozconfig
74                 echo mk_add_options MOZ_INTERNAL_LIBART_LGPL=1 >> .mozconfig
75                 echo ac_add_options --disable-tests >> .mozconfig
76                 echo ac_add_options --disable-debug >> .mozconfig
77                 echo ac_add_options --disable-dtd-debug >> .mozconfig
78                 echo ac_add_options --enable-reorder >> .mozconfig
79                 echo ac_add_options --enable-strip >> .mozconfig
80                 echo ac_add_options --enable-optimize=-O3 >> .mozconfig
81                 echo ac_add_options --enable-elf-dynstr-gc >> .mozconfig
82                 echo ac_add_options --enable-cpp-rtti >> .mozconfig
83                 echo mk_add_options MOZCALENDAR=1
84                 echo ac_add_options --enable-calendar >> .mozconfig
85         Remove the last two commands to skip building the calendar.
87         Now configure and compile the package as usual. If there are problems
88         run configure again by removing the option that caused the problem.
89                 ./configure &&
90                 make
92         Now to making the distribution:
93                 cd xpinstall/packager &&
94                 make
95         This will run for some time and create a package in the dist directory.
96                 cd ../../dist &&
97                 ls *.tar.gz
98         Verify that the distribution has been built.
100         I install moz into /opt/mozilla.
101                 cd /opt &&
102                 tar -xzf /usr/src/mozilla/dist/mozilla-i686-pc-linux-gnu.tar.gz
104         Add mozilla to your PATH.
105                 export PATH=$PATH:/opt/mozilla
107         To make your mozilla build go faster, set XPCOM_CHECK_THREADSAFE=0 in
108         .bash_profile or in run-mozilla.sh. This apparently only affects
109         debug builds, but no harm in setting it for optimized builds.
111         To allow all users to run mozilla, the following needs to be done.
112                 /opt/mozilla/regxpcom
113                 /opt/mozilla/regchrome
114                 touch `find /opt/mozilla -name *.rdf`
116         Enzoy:)
118 GCC 3 Tips:
119         If you compile Mozilla using gcc3, closed source plugins such as flash
120         will crash moz since these plugins are compiled using gcc2. A work-
121         around till the plugins are fixed is to pre-load a library that will
122         make some required functions available to these plugins.
124         Create a file libc++mem.c.
125                 cat > libc++mem.c << "EOF"
126                 // From http://bugzilla.mozilla.org/show_bug.cgi?id=124006
127                 void *__builtin_new(int size) {
128                         return (void*)malloc(size);
129                 }
130                 void *__builtin_vec_new(int size) {
131                         return __builtin_new(size);
132                 }
133                 void *__builtin_delete(void *ptr) {
134                         free(ptr);
135                 }
136                 void *__builtin_vec_delete(void *ptr) {
137                         __builtin_delete(ptr);
138                 }
139                 EOF
141                 gcc -shared -fPIC -o libc++mem.so libc++mem.c &&
142                 mv libc++mem.so /opt/mozilla
144                 Open /opt/mozilla/run-mozilla.sh and just below line 351 enter
145                         export LD_PRELOAD=/opt/mozilla/libc++mem.so
147 Installing Adobe Acrobat Plugin:
148         Download the Acronat Reader from Adobe's website.
149         http://www.adobe.com/products/acrobat/readstep2.html
150         Install Acrobat in /opt/acrobat
151                 cd /opt/mozilla/plugins &&
152                 ln -s /opt/acrobat/Browsers/intellinux/nppdf.so
154 Installing Java Plugin from IBM:
155         Download IBM JRE 1.3 from IBM's website. I had problems with Sun's JDK.
156         http://www.alphaworks.ibm.com/
157         Install IBM JDK in /opt/IBMJava2-13
158                 cd /opt/mozilla/plugins &&
159                 ln -s /opt/IBMJava2-13/jre/bin/libjavaplugin_oji.so
161 Installing Macromedia Flash Player:
162         Download the Flash Player from Macromedia's website.
163         http://sdc.shockwave.com/shockwave/download/alternates/#linux
164         Untar the files and copy libflashplayer.so and ShockwaveFlash.class
165         to /opt/mozilla/plugins
167 Installing RealPlayer:
168         Download the plugin from Real Networks.
169         http://forms.real.com/real/player/unix/unix.html
170         I am still working on making Real Player work. I will update this
171         section when I have more information.
173 CodeWeaver's CrossOver Plugin:
174         If you are interested in using Windows plugins (Why??!!), this
175         commercial product will allow you to do it. Check out
176         http://www.codeweavers.com/products/crossover/ for more info.
178 Have fun mozzing around.
180 BTW, seems like the countdown for Mozilla 1.0 (YaY) has started. Will update
181 the hint on release if needed.
183 Don't forget to send me bug reports so that I can keep the hint updated.
185 --Tushar.