This tutorial is not intended for beginners at compiling.
First I patch webkit since it segfaults like crazy otherwise.
Code: Select all
diff -urB webkit-1.3.12/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp webkit-1.3.12-new/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp
--- webkit-1.3.12/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp 2011-01-12 09:40:52.000000000 -0500
+++ webkit-1.3.12-new/Source/WebCore/platform/text/gtk/TextBreakIteratorGtk.cpp2011-03-10 08:12:00.000000000 -0500
@@ -210,8 +210,7 @@
int charLength = iterator->m_charIterator.getLength();
iterator->m_type = type;
- if (createdIterator)
- g_free(iterator->m_logAttrs);
+ //if (createdIterator) g_free(iterator->m_logAttrs);
iterator->m_logAttrs = g_new0(PangoLogAttr, charLength + 1);
pango_get_log_attrs(iterator->m_charIterator.getText(), iterator->m_charIterator.getSize(),
-1, 0, iterator->m_logAttrs, charLength + 1);
Then I set up my environment variables to optimize for size.
Code: Select all
export CFLAGS=" -pipe -combine -Os -ffunction-sections -fdata-sections -momit-leaf-frame-pointer -fomit-frame-pointer -fmerge-all-constants -march=i486 -mtune=i686 -momit-leaf-frame-pointer -fomit-frame-pointer -mpreferred-stack-boundary=2 -fmerge-all-constants"
export CXXFLAGS=" -pipe -combine -Os -ffunction-sections -fdata-sections -momit-leaf-frame-pointer -fomit-frame-pointer -fmerge-all-constants -march=i486 -mtune=i686 -momit-leaf-frame-pointer -fomit-frame-pointer -mpreferred-stack-boundary=2 -fmerge-all-constants"
export LDFLAGS=" -Wl,-relax,-Os,-s "
Code: Select all
./configure --enable-3d-transforms --enable-fast-mobile-scrolling --with-unicode-backend=glib --enable-static --disable-shared --prefix=/usr
Make clean does not work right. If you need to start over, delete and re-extract the whole source tree.
Now edit GNUMakefile. The configure script probably added an -O2 to the end of the CFLAGS and CXXFLAGS variables. You need to remove that or you won't get a small build.
Now run make and make install. This takes forever even on a fast machine.
Edit the file /usr/lib/pkgconfig/webkit-1.0.pc to look like this:
Code: Select all
prefix=/usr
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: WebKit
Description: Web content engine for GTK+
Version: 1.3.12
Requires: glib-2.0 gtk+-2.0 libsoup-2.4
Libs: -L${libdir}
Cflags: -I${includedir}/webkit-1.0
Now you're ready to configure Midori.
Code: Select all
./configure --prefix=/usr
Run make a few more times until you reach this step:
Code: Select all
[ 60/116] cc_link: _build_/default/midori/main_2.o -> _build_/default/midori/midori
Create /usr/lib/midori if it doesn't exist. If it does exist, delete any plugins that are inside.
Copy the new plugins to /usr/lib/midori.
Code: Select all
cp default/extensions/*.so /usr/lib/midori/
Now we are going to link the plugins in as shared libraries. This will allow us to have only one copy of webkit and we won't need to export the symbols, which saves even more size. Of course now Midori won't be able to start if its plugins are not there.
There might be a better way to accomplish this - but this is the best I could figure out
Code: Select all
/usr/bin/gcc default/midori/main_2.o /usr/lib/midori/libhistory-list.so /usr/lib/midori/libcookie-manager.so /usr/lib/midori/libformhistory.so /usr/lib/midori/libweb-cache.so /usr/lib/midori/libfeed-panel.so /usr/lib/midori/libadblock.so /usr/lib/midori/libaddons.so /usr/lib/midori/libshortcuts.so /usr/lib/midori/libcolorful-tabs.so /usr/lib/midori/libmouse-gestures.so /usr/lib/midori/libstatus-clock.so /usr/lib/midori/libtabs-minimized.so /usr/lib/midori/libcopy-tabs.so /usr/lib/midori/libpage-holder.so /usr/lib/midori/libstatusbar-features.so /usr/lib/midori/libtab-panel.so /usr/lib/midori/libtoolbar-editor.so -o default/midori/midori -Wl,-O,-Os,--gc-sections,-s -pthread -o default/midori/midori -Ldefault/midori -L/usr/X11R7/lib -L/usr/X11R6/lib -lmidori-core -lm -lunique-1.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lgdk_pixbuf-2.0 -lpangocairo-1.0 -lcairo -lpango-1.0 -lfreetype -lz -lfontconfig -lgobject-2.0 -lgmodule-2.0 -lrt -lglib-2.0 -lsoup-2.4 -lgnutls -lgthread-2.0 -lsqlite3 -lnotify -ldbus-glib-1 -ldbus-1 -lwebkitgtk-1.0 -lpcre -lenchant -lgailutil -ljpeg -lxslt -lxml2 -lXt -lX11 -lstdc++ -lgstbase-0.10 -lgstpbutils-0.10 -lgstapp-0.10 -lgstvideo-0.10 -lgstinterfaces-0.10 -lgstreamer-0.10 -lXss -lsoup-2.4
Now you should be able to run make install. Check the size of the Midori binary - I get around 8.6MB. You can then upx it to get it under 3MB.