很久以前就知道dillo這個embedded web browser.
也曾經試著cross compile過,但並不成功.
這兩天因緣際會之下又把它拿出來玩玩看.
過程如下
Requirement
jpeg-6b
libpng-1.2.24
libiconv-1.13
microwindows-0.91
nxlib-0.45
以上Libraries的cross compile就不再贅述.
fltk-2.0.x-r6483
dillo-2.0
1.Cross compile fltk-2.0.x-r6483
CFLAGS="-G 0 -I$PWD/.." CXXFLAGS="-G 0 -I$PWD/.." LDFLAGS="-s -L$PWD/../nxlib-0.45 -L$PWD/../microwindows-0.91/src/lib" CXX=mipsel-linux-uclibc-g++ CC=mipsel-linux-uclibc-gcc AR=mipsel-linux-uclibc-ar ./configure --host=mipsel-linux --target=mipsel-linux --prefix=/usr/local/MIPSEL_UCLIBC --enable-shared --with-x --disable-gl --disable-cygwin --x-includes=../ --x-libraries=$PWD/../nxlib-0.45 --cache-file=/dev/null
修改fltk2-xonfig & makeinclude
將所有 -lXi -lXext拿掉,換成-lX11 -lnano-X
之後過程中有一樣錯誤的也比照辦理修改Makefile
make
sudo PATH=$PATH:/usr/local/MIPSEL_UCLIBC make install
2.Cross compile dillo-2.0
修改configure
將fltk2_config 換成 $FLTK2_CONFIG
{ echo "$as_me:$LINENO: checking FLTK2" >&5
echo $ECHO_N "checking FLTK2... $ECHO_C" >&6; }
if sh -c "$FLTK2_CONFIG --version" >/dev/null 2>&1
then { echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6; }
LIBFLTK_CXXFLAGS=`$FLTK2_CONFIG --cxxflags`
LIBFLTK_CFLAGS=`$FLTK2_CONFIG --cflags`
LIBFLTK_LIBS=`$FLTK2_CONFIG --use-images --ldflags`
else { echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6; }
{ { echo "$as_me:$LINENO: error: FLTK2 must be installed!" >&5
echo "$as_me: error: FLTK2 must be installed!" >&2;}
{ (exit 1); exit 1; }; }
fi
FLTK2_CONFIG=../fltk-2.0.x-r6483/fltk2-config PNG_CONFIG=../libpng-1.2.24/libpng-config CC=mipsel-linux-uclibc-gcc CXX=mipsel-linux-uclibc-g++ AR=mipsel-linux-uclibc-ar ./configure --host=mipsel-linux --target=mipsel-linux --cache-file=/dev/null
patch code
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2008-November/005427.html
--- dillo2/src/html.cc 2008-10-30 21:15:50.000000000 +0000
+++ dillo2-sup/src/html.cc 2008-11-11 20:53:21.000000000 +0000
@@ -3722,6 +3722,39 @@ static void Html_callback(int Op, CacheC
}
/*
+ * Determine length of word in string s
+ */
+static int Html_word_len(char *s, char *end)
+{
+ int len = 0;
+
+ while (1) {
+ if (strchr(" <\n\r\t\f\v", *s))
+ break;
+ if (!(*s & 0x80)) {
+ /* ascii */
+ len++;
+ s++;
+ } else {
+ int l;
+ unsigned unicode = utf8decode(s, end, &l);
+ len += l;
+ s += l;
+ if ((unicode >= 0xf900 && unicode <= 0xfaff) ||
+ (unicode >= 0xfe30 && unicode <= 0xfe4f) ||
+ ((unicode >= 0x2E80 && unicode <= 0xa4cf) &&
+ !(unicode >= 0x3130 && unicode <= 0x318f))) {
+ /* Treat Chinese/Japanese characters as words so that text
+ * without whitespace will wrap.
+ */
+ break;
+ }
+ }
+ }
+ return len;
+}
+
+/*
* Here's where we parse the html and put it into the Textblock structure.
* Return value: number of bytes parsed
*/
@@ -3833,7 +3866,7 @@ static int Html_write_raw(DilloHtml *htm
} else {
/* A Word: search for whitespace or tag open */
while (++buf_index < bufsize) {
- buf_index += strcspn(buf + buf_index, " <\n\r\t\f\v");
+ buf_index += Html_word_len(buf + buf_index, buf + bufsize);
if (buf[buf_index] == '<' && (ch = buf[buf_index + 1]) &&
!isalpha(ch) && !strchr("/!?", ch))
continue;
修改src/prefs.c
將 DILLORC_SYS 置換成 "/etc/dillorc"
make
遇到 -lXi -lXext的錯誤時作法如前
接著將所需要的Library都copy 至 target上
libX11.so.6
libfltk2.so
libiconv.so.2
libnano-X.so
libpng12.so
libstdc++.so.6
複製src/dillo 到target上
設定檔是/etc/dillorc
以下是dillorc內容紅字部份是依照偶的需求而修改的
PS : FireFly 的font name 是 "Sung"
# dillorc
# Sample dillo initialization file.
#
# Lines that start with a '#' are comments.
# "#option=..." shows the built-in default.
# "# option=..." is an additional example.
# "option=..." overrides the built-in value.
#-------------------------------------------------------------------------
# FIRST SECTION :)
#-------------------------------------------------------------------------
# Set the desired initial browser size
# geometry=650x545+0+20
geometry=480x272
# Change this if you want to have text-only browsing from the start.
# (there's a toggle button near the bug meter to change this on-the-fly)
#load_images=YES
# Change the buffering scheme for drawing
# 0 no double buffering - useful for debugging
# 1 light buffering using a single back buffer for all windows
# 2 full fltk-based double buffering for all windows
#buffered_drawing=1
# Set your default directory for download/save operations
save_dir=/tmp
#-------------------------------------------------------------------------
# RENDERING SECTION
#-------------------------------------------------------------------------
# Fontname for variable width rendering (most of the text).
# - some fonts may slow down rendering.
# - try to tune a fontname/font_factor combination.
# Ex. {helvetica, lucida, times, "new century schoolbook", utopia, ...}
# vw_fontname="new century schoolbook"
# vw_fontname="helvetica"
# vw_fontname="times"
# vw_fontname="Bitstream vera Serif"
# vw_fontname="arial"
#vw_fontname="DejaVu Sans"
vw_fontname="sung"
# Fontname for fixed width rendering (mainly text quoted with
)
# fw_fontname=courier
# fw_fontname="Bitstream Vera Sans Mono"
# fw_fontname="Andale Mono"
#fw_fontname="DejaVu Sans Mono"
# All fontsizes are scaled by this value
# font_factor=1.5
#font_factor=1.0
# Show tooltip popup for images?
# Note: We use the "title" attribute and not "alt".
# More info at: http://bugzilla.mozilla.org/show_bug.cgi?id=25537
# *** NOT HOOKED UP YET ***
#
#show_tooltip=YES
# Set this to YES if you want to limit the word wrap width to the viewport
# width (may be useful for iPAQ)
# *** NOT HOOKED UP YET ***
#
#limit_text_width=NO
#-------------------------------------------------------------------------
# PARSING SECTION
#-------------------------------------------------------------------------
# If you prefer more accurate HTML bug diagnosis over better rendering
# (page authors and webmasters) set the following to "NO".
#
#w3c_plus_heuristics=YES
#-------------------------------------------------------------------------
# NETWORK SECTION
#-------------------------------------------------------------------------
# Set the start page.
# start_page="about:blank"
# start_page="http://www.dillo.org"
# start_page="file:/home/jcid/custom_page.html"
start_page="http://www.google.com.tw"
# Set the home location
# home="file:/home/jcid/HomePage/Home.html"
home="http://www.google.com.tw"
# Set the URL used by the web search dialog.
# "%s" is replaced with the search keywords separated by '+'.
# search_url="http://search.lycos.com/?query=%s"
# search_url="http://www.alltheweb.com/search?cat=web&query=%s"
#search_url="http://www.google.com/search?q=%s"
# Set the proxy information for http.
# WARNING: dillo uses wget for ftp and https. To use a proxy for those
# protocols, you will need to configure wget.
# http_proxy="http://localhost:8080/"
#(by default, no proxy is used)
# If you need to provide a user/password pair for the proxy,
# set the proxy user name here and Dillo will ask for the password later.
# http_proxyuser="joe"
#(by default, no proxy is used)
# Set the domains to access without proxy
# no_proxy = ".hola.com .mynet.cl .hi.de"
#(by default, no proxy is used)
# Set the HTTP Referer (sic) header.
# Note that there is no option to reveal the page that you came from because it
# would endanger your privacy. 'host' and 'path' allow you to pretend that the
# link you followed was on the same site that you're going to.
# none : Don't send any Referer header at all.
# host : Send the requested URI's hostname.
# path : Send the requested URI's host and path.
#http_referer=host
#-------------------------------------------------------------------------
# COLORS SECTION
#-------------------------------------------------------------------------
# Here we can use the HTML color names or C syntax.
# Set the background color
# bg_color=gray
# bg_color=0xd6d6c0
#bg_color=0xdcd1ba
# Set the text color
#text_color=black
# Set the link color
#link_color=blue
# If your eyes suffer with white backgrounds, change this.
#allow_white_bg=YES
# Use the same colors with all documents?
#force_my_colors=NO
# When set to YES, the page author's visited link color may be overridden
# to allow better contrast with text/links/background
#contrast_visited_color=YES
# Colors for widgets inside forms.
# YES = toolkit's default colors, NO = use page's text and background color.
# ("NO" looks less traditional but more stylish).
#standard_widget_colors=NO
#-------------------------------------------------------------------------
# USER INTERFACE SECTION
#-------------------------------------------------------------------------
# Size of dillo panel (used to enlarge the browsing area)
# tiny : recommended for iPAQ (with small_icons)
# small : very nice! (it's "medium" without icon titles)
# medium : nice!
# large : Traditional
panel_size=tiny
# panel_size=small
# panel_size=medium
#panel_size=large
#small_icons=NO
# Here you can choose to hide some widgets of the dillo panel...
#show_back=YES
#show_forw=YES
#show_home=YES
#show_reload=YES
#show_save=YES
#show_stop=YES
#show_bookmarks=YES
#show_filemenu=YES
#show_clear_url=YES
#show_url=YES
#show_search=YES
#show_progress_box=YES
# Start dillo with the panels hidden?
#fullwindow_start=NO
# When filling out forms, our default behaviour is to submit on enterpress,
# but only when there's a single text entry (to avoid incomplete submits).
# OTOH, if you have to fill out the same form repeatedly, you may find it
# useful to keep away from the mouse by forcing enter to submit.
#enterpress_forces_submit=NO
# Some forms lack a submit button, and dillo can generate a custom one
# internally. Unfortunately there's no guarantee for it to work. :(
# (my experience is that forms that lack a submit rely on Javascript)
#generate_submit=NO
# A mouse's middle click over a link opens a new Tab.
# If you prefer to open a new Window instead, set it to NO.
#middle_click_opens_new_tab=YES
# Focus follows new Tabs.
# You can hold SHIFT to temporarily revert this behaviour.
#focus_new_tab=YES
#-------------------------------------------------------------------------
# DEBUG MESSAGES SECTION
#-------------------------------------------------------------------------
# Soon we should add the "show_debug_messages=NO" option...
# Generic messages (mainly for debugging specific parts)
# Change this to disable them.
#show_msg=YES
#-------------------------------------------------------------------------
# HTML BUG MESSAGES SECTION
#-------------------------------------------------------------------------
# Accepted by the W3C validator but "strongly discouraged" by the SPEC.
# (Such as "TAB character inside").
#show_extra_warnings=NO
# -----------------------------------------------------------------------
# dillorc ends here.
3.Running
./nano-X -p &
./dillo
prefs: Can't open dillorc file: //.dillo/dillorc
prefs: Using /etc/dillorc
XSetErrorHandler called
nx11: display bpp = 16, bits_per_rgb 6
XInternAtom WM_DELETE_WINDOW 0
XInternAtom WM_PROTOCOLS 0
XInternAtom _MOTIF_WM_HINTS 0
XInternAtom FLTKChangeScheme 0
XInternAtom TARGETS 0
XInternAtom CLIPBOARD 0
XInternAtom XdndAware 0
XInternAtom XdndSelection 0
XInternAtom XdndEnter 0
XInternAtom XdndTypeList 0
XInternAtom XdndPosition 0
XInternAtom XdndLeave 0
XInternAtom XdndDrop 0
XInternAtom XdndStatus 0
XInternAtom XdndActionCopy 0
XInternAtom XdndFinished 0
XInternAtom text/plain;charset=UTF-8 0
XInternAtom text/plain 0
XInternAtom TEXT 0
XInternAtom text/uri-list 0
XInternAtom _NET_WM_NAME 0
XInternAtom _NET_WM_ICON_NAME 0
XInternAtom _NET_WORKAREA 0
XInternAtom _NET_CURRENT_DESKTOP 0
XInternAtom UTF8_STRING 0
XSetLocaleModifiers called
XOpenIM called
XOpenIM() failed
Pattern : -*-helvetica-medium-r-normal--*
Match : -firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1
Match : -b&h-lucidabright-medium-i-normal--34-240-100-100-p-194-iso8859-1
Match : -adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1
_addFontToList : -adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1
_nxfontcount = 2
Read : 3
checking '-adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1' '-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1'
checking '-adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1' '-b&h-lucidabright-medium-i-normal--34-240-100-100-p-194-iso8859-1'
checking '-adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1' '-adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1'
XLoadFont('-adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1') = '/phone/lib/X11/fonts/misc/helvR24.pcf' [1060]
Pattern : -*
Match : -firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1
_addFontToList : -firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1
Match : -b&h-lucidabright-medium-i-normal--34-240-100-100-p-194-iso8859-1
_addFontToList : -b&h-lucidabright-medium-i-normal--34-240-100-100-p-194-iso8859-1
Match : -adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1
_addFontToList : -adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1
Pattern : -*-sung-medium-*-*--*
Match : -firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1
_addFontToList : -firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1
Match : -b&h-lucidabright-medium-i-normal--34-240-100-100-p-194-iso8859-1
Match : -adobe-helvetica-medium-r-normal--24-240-75-75-p-130-iso10646-1
_nxfontcount = 2
Read : 3
checking '-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1' '-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1'
XLoadFont('-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1') = '/phone/lib/X11/fonts/misc/fireflyR16.pcf' [1061]
nxTranslateEventMask no handler for event mask (0022c07f): 14
XChangeProperty _NET_WM_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_ICON_NAME
XChangeProperty (null)
XChangeProperty WM_PROTOCOLS
XChangeProperty _MOTIF_WM_HINTS
XChangeProperty (null)
XChangeProperty XdndAware
translateNXEvent: unhandled update event subtype 6
XChangeProperty _MOTIF_WM_HINTS
_nxfontcount = 2
Read : 3
checking '-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1' '-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1'
XLoadFont('-firefly-sung-medium-r-normal--16-150-75-75-p-159-iso10646-1') = '/phone/lib/X11/fonts/misc/fireflyR16.pcf' [1062]
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XParseColor: bad parse on None
XParseColor: bad parse on gray70
XCreatePixmap 22,22 depth 16
XSetClipMask 828
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XParseColor: bad parse on None
XParseColor: bad parse on gray70
XCreatePixmap 22,22 depth 16
XSetClipMask 831
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XSetClipMask 833
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XSetClipMask 835
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XSetClipMask 837
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XSetClipMask 839
XParseColor: bad parse on None
XCreatePixmap 22,22 depth 16
XSetClipMask 841
XParseColor: bad parse on None
XCreatePixmap 11,11 depth 16
XSetClipMask 843
XParseColor: bad parse on None
XCreatePixmap 14,16 depth 16
XSetClipMask 845
XParseColor: bad parse on None
XCreatePixmap 15,15 depth 16
XParseColor: bad parse on None
XCreatePixmap 15,15 depth 16
XSetClipMask 848
XParseColor: bad parse on none
XCreatePixmap 15,15 depth 16
XSetClipMask 850
XChangeProperty _NET_WM_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_ICON_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_ICON_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_NAME
XChangeProperty (null)
XChangeProperty _NET_WM_ICON_NAME
XChangeProperty (null)
XSetClipMask 828
XSetClipMask 831
XSetClipMask 833
XSetClipMask 835
XSetClipMask 837
XSetClipMask 839
XSetClipMask 841
XSetClipMask 843
XSetClipMask 845
XSetClipMask 848
XParseColor: bad parse on None
XCreatePixmap 16,16 depth 16
XSetClipMask 852
XSetClipMask 828
XSetClipMask 831
XSetClipMask 833
XSetClipMask 835
XSetClipMask 837
XSetClipMask 839
XSetClipMask 841
XSetClipMask 843
XSetClipMask 845
XCreatePixmap 480,10 depth 16
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XSetArcMode called
XCreatePixmap 465,224 depth 16
XSetClipMask 828
XSetClipMask 831
XSetClipMask 833
XSetClipMask 835
XSetClipMask 837
XSetClipMask 839
XSetClipMask 841
XSetClipMask 843
XSetClipMask 845
XSetClipMask 828
XSetClipMask 831
XSetClipMask 839
XSetClipMask 828
XSetClipMask 831
XParseColor: bad parse on None
XParseColor: bad parse on gray70
XCreatePixmap 22,22 depth 16
XSetClipMask 856
系統resource狀況
1038 root 3072 S ./nano-X -p
1048 root SWN [jffs2_gcd_mtd0]
1520 root 2900 S ./dillo
1521 root 2900 S ./dillo
1528 root 380 R ps
# ./rfree
total used free slab buffers cached
Mem: 29680 27456 2224 3844 44 17436
-/+ buffers/cache: 6132 19704 3844
Swap: 0 0 0
# top
Mem: 27472K used, 2208K free, 0K shrd, 44K buff, 17436K cached
Load average: 1.00 1.01 1.00 (Status: S=sleeping R=running, W=waiting)
PID USER STATUS RSS PPID %CPU %MEM COMMAND
1534 root R 392 1007 4.7 1.3 top
1038 root S 3072 1 0.0 10.3 nano-X
1520 root S 2900 942 0.0 9.7 dillo
1521 root S 2900 1520 0.0 9.7 dillo
靠,開個google首頁只用了不到 3M memory,讚啦.
不過很多網頁的排版看起來都怪怪的...應該跟偶設定的screen size有關
Hello Steve,
回覆刪除nice blog. i'm just trying to follow your work and got some understanding problems.
you are writing:
將所有 -lXi -lXext拿掉,換成-lX11 -lnano-X
i thought you are linking with -lnx11.
if i link it with -lnx11 i get:
: undefined reference to `XineramaQueryExtension'
../lib/libfltk2.a(run.o)(.text+0x18bc): In function `fltk::Monitor::list(fltk::Monitor const**)':
: undefined reference to `XineramaQueryScreens'
../lib/libfltk2.a(run.o)(.text+0x1d44): In function `open_stylus_device(_XDeviceInfo*, int, int)':
: undefined reference to `XSelectExtensionEvent'
../lib/libfltk2.a(run.o)(.text+0x1da8): In function `open_stylus_device(_XDeviceInfo*, int, int)':
: undefined reference to `XOpenDevice'
../lib/libfltk2.a(run.o)(.text+0x2044): In function `fltk::enable_tablet_events()':
: undefined reference to `XGetExtensionVersion'
../lib/libfltk2.a(run.o)(.text+0x20b4): In function `fltk::enable_tablet_events()':
: undefined reference to `XListInputDevices'
../lib/libfltk2.a(run.o)(.text+0x2198): In function `fltk::enable_tablet_events()':
: undefined reference to `XFreeDeviceList'
../lib/libfltk2.a(run.o)(.text+0x30b4): In function `fltk::Window::flush()':
: undefined reference to `XdbeAllocateBackBufferName'
../lib/libfltk2.a(run.o)(.text+0x3414): In function `fltk::Window::flush()':
: undefined reference to `XdbeSwapBuffers'
../lib/libfltk2.a(run.o)(.text+0x3468): In function `fltk::Window::flush()':
: undefined reference to `XdbeQueryExtension'
../lib/libfltk2.a(run.o)(.text+0x350c): In function `fltk::Window::flush()':
: undefined reference to `XdbeGetVisualInfo'
../lib/libfltk2.a(run.o)(.text+0x357c): In function `fltk::Window::flush()':
: undefined reference to `XdbeFreeVisualInfo'
../lib/libfltk2.a(run.o)(.text+0x6418): In function `fltk::handle()':
: undefined reference to `Xutf8LookupString'
../lib/libfltk2.a(setvisual.o)(.text+0x160): In function `test_visual(XVisualInfo&, int)':
: undefined reference to `XdbeQueryExtension'
../lib/libfltk2.a(setvisual.o)(.text+0x1a0): In function `test_visual(XVisualInfo&, int)':
: undefined reference to `XdbeGetVisualInfo'
Any help is welcome.
Thanks for you work!
[版主回覆06/18/2009 19:51:22]Due to nxlib is a fake X11 interface, there are many X feature not really implement.
Just add missing functions to nxlib-0.45/stub.c
int XOpenDevice() { printf("XOpenDevice called\n"); return 0; }
int XSelectExtensionEvent() { printf("XSelectExtensionEvent called\n"); return 0; }
int XListInputDevices() { printf("XListInputDevices called\n"); return 0; }
int XFreeDeviceList() { printf("XFreeDeviceList called\n"); return 0; }
int Xutf8LookupString() { printf("Xutf8LookupString called\n"); return 0; }
int XGetExtensionVersion() { printf("XGetExtensionVersion called\n"); return 0; }
Also configure FLTK2 with --disable-xdbe ...
你好....我按照這篇文章修改一下後,dillo已經可以顯示網頁了,可是網頁上的中文卻無法顯示,可以請教你一下,dillo的中文支援是透過microwin還是fltk 還是dillo本身自己有把字型檔編入呢?謝謝
回覆刪除[版主回覆10/03/2009 01:25:50]字型是microwindow處理的,請參考
http://tw.myblog.yahoo.com/stevegigijoe/article?mid=67&prev=68&next=66&l=a&fid=1