diff --git a/www-client/netsurf/patches/netsurf-2.HEAD.patch b/www-client/netsurf/patches/netsurf-2.HEAD.patch new file mode 100644 index 000000000..dc64e2274 --- /dev/null +++ b/www-client/netsurf/patches/netsurf-2.HEAD.patch @@ -0,0 +1,295 @@ +diff --git a/beos/Makefile.target b/beos/Makefile.target +index b1d1eaa..461ecbc 100644 +--- a/beos/Makefile.target ++++ b/beos/Makefile.target +@@ -9,8 +9,10 @@ + # for Haiku + LDFLAGS += -L/boot/common/lib + # some people do *not* have libm... +- LDFLAGS += -lxml2 -lcurl -liconv +- LDFLAGS += -lssl -lcrypto -lcss -ldom -lparserutils -lhubbub -lwapcaplet ++ LDFLAGS += -lssl -lcrypto -lcss ++ $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny))) ++ LDFLAGS += -ldom -lparserutils -lhubbub -lwapcaplet ++ LDFLAGS += -lexpat -lxml2 -lcurl -liconv + + CFLAGS += -I. -O $(WARNFLAGS) -Dnsbeos \ + -D_BSD_SOURCE -D_POSIX_C_SOURCE \ +@@ -61,9 +63,8 @@ + # cross: Haiku ? + NETLDFLAGS := -lnetwork + endif +- LDFLAGS += -lbe -ltranslation $(NETLDFLAGS) ++ LDFLAGS += -lbe -ltranslation $(NETLDFLAGS) -lstdc++ -lsupc++ + +- $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny))) + ifeq ($(HOST),beos) + CFLAGS += -I$(PREFIX)/include + LDFLAGS += -L$(PREFIX)/lib +@@ -100,7 +101,7 @@ RDEF_IMP_BEOS := $(addprefix $(OBJROOT)/,$(subst /,_,$(RDEF_IMP_BEOS))) + + RDEP_BEOS := \ + adblock.css beosdefault.css default.css internal.css quirks.css \ +- netsurf.png ca-bundle.txt messages ++ netsurf.png ca-bundle.txt + RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \ + $(wildcard beos/res/Icons/*.png) \ + $(wildcard beos/res/throbber/throbber*.png) +@@ -128,7 +129,7 @@ install-beos: + @cp -vRL beos/res/beosdefault.css $(DESTDIR)$(NETSURF_BEOS_RESOURCES) + @cp -vRL gtk/res/license $(DESTDIR)$(NETSURF_BEOS_RESOURCES) + # @cp -vRL beos/res/throbber/*.png $(DESTDIR)$(NETSURF_BEOS_RESOURCES)throbber +- gzip -9v < beos/res/messages > $(DESTDIR)$(NETSURF_BEOS_RESOURCES)messages ++ $(call split_install_messages, beos, $(DESTDIR)$(NETSURF_BEOS_RESOURCES)) + + # ---------------------------------------------------------------------------- + # Package target +diff --git a/beos/gui.cpp b/beos/gui.cpp +index b275616..3f7e943 100644 +--- a/beos/gui.cpp ++++ b/beos/gui.cpp +@@ -450,7 +450,6 @@ static void gui_init2(int argc, char** argv) + /** Normal entry point from OS */ + int main(int argc, char** argv) + { +- char buf[PATH_MAX]; + setbuf(stderr, NULL); + + BPath options; +@@ -458,12 +457,10 @@ int main(int argc, char** argv) + options.Append("x-vnd.NetSurf"); + } + +- find_resource(buf, "messages", "./beos/res/messages"); +- LOG(("Using '%s' as Messages file", buf)); +- //messages_load(buf); ++ char* messages = "/boot/apps/netsurf/res/en/Messages"; + + /* initialise netsurf */ +- netsurf_init(&argc, &argv, options.Path(), buf); ++ netsurf_init(&argc, &argv, options.Path(), messages); + + gui_init(argc, argv); + gui_init2(argc, argv); +@@ -553,37 +550,38 @@ void gui_init(int argc, char** argv) + /* check what the font settings are, setting them to a default font + * if they're not set - stops Pango whinging + */ ++#define SETFONTDEFAULT(OPTION,y) if (nsoption_charp(OPTION) == NULL) nsoption_set_charp(OPTION, strdup((y))) + + //XXX: use be_plain_font & friends, when we can check if font is serif or not. + /* + font_family family; + font_style style; + be_plain_font->GetFamilyAndStyle(&family, &style); +- nsoption_setnull_charp(font_sans, family); +- nsoption_setnull_charp(font_serif, family); +- nsoption_setnull_charp(font_mono, family); +- nsoption_setnull_charp(font_cursive, family); +- nsoption_setnull_charp(font_fantasy, family); ++ SETFONTDEFAULT(font_sans, family); ++ SETFONTDEFAULT(font_serif, family); ++ SETFONTDEFAULT(font_mono, family); ++ SETFONTDEFAULT(font_cursive, family); ++ SETFONTDEFAULT(font_fantasy, family); + */ + #ifdef __HAIKU__ +- nsoption_setnull_charp(font_sans, "DejaVu Sans"); +- nsoption_setnull_charp(font_serif, "DejaVu Serif"); +- nsoption_setnull_charp(font_mono, "DejaVu Mono"); +- nsoption_setnull_charp(font_cursive, "DejaVu Sans"); +- nsoption_setnull_charp(font_fantasy, "DejaVu Sans"); ++ SETFONTDEFAULT(font_sans, "DejaVu Sans"); ++ SETFONTDEFAULT(font_serif, "DejaVu Serif"); ++ SETFONTDEFAULT(font_mono, "DejaVu Mono"); ++ SETFONTDEFAULT(font_cursive, "DejaVu Sans"); ++ SETFONTDEFAULT(font_fantasy, "DejaVu Sans"); + #else +- nsoption_setnull_charp(font_sans, "Bitstream Vera Sans"); +- nsoption_setnull_charp(font_serif, "Bitstream Vera Serif"); +- nsoption_setnull_charp(font_mono, "Bitstream Vera Sans Mono"); +- nsoption_setnull_charp(font_cursive, "Bitstream Vera Serif"); +- nsoption_setnull_charp(font_fantasy, "Bitstream Vera Serif"); ++ SETFONTDEFAULT(font_sans, "Bitstream Vera Sans"); ++ SETFONTDEFAULT(font_serif, "Bitstream Vera Serif"); ++ SETFONTDEFAULT(font_mono, "Bitstream Vera Sans Mono"); ++ SETFONTDEFAULT(font_cursive, "Bitstream Vera Serif"); ++ SETFONTDEFAULT(font_fantasy, "Bitstream Vera Serif"); + #if 0 +- nsoption_setnull_charp(font_sans, "Swis721 BT"); +- nsoption_setnull_charp(font_serif, "Dutch801 Rm BT"); +- //nsoption_setnull_charp(font_mono, "Monospac821 BT"); +- nsoption_setnull_charp(font_mono, "Courier10 BT"); +- nsoption_setnull_charp(font_cursive, "Swis721 BT"); +- nsoption_setnull_charp(font_fantasy, "Swis721 BT"); ++ SETFONTDEFAULT(font_sans, "Swis721 BT"); ++ SETFONTDEFAULT(font_serif, "Dutch801 Rm BT"); ++ //SETFONTDEFAULT(font_mono, "Monospac821 BT"); ++ SETFONTDEFAULT(font_mono, "Courier10 BT"); ++ SETFONTDEFAULT(font_cursive, "Swis721 BT"); ++ SETFONTDEFAULT(font_fantasy, "Swis721 BT"); + #endif + #endif + +diff --git a/beos/login.cpp b/beos/login.cpp +index 32860de..90cadde 100644 +--- a/beos/login.cpp ++++ b/beos/login.cpp +@@ -45,7 +45,7 @@ class LoginAlert : public BAlert { + public: + LoginAlert(nserror (*callback)(bool proceed, void *pw), + void *callbaclpw, +- const char *url, ++ nsurl *url, + const char *host, + const char *realm, + const char *text); +@@ -53,7 +53,7 @@ public: + void MessageReceived(BMessage *message); + + private: +- BString fUrl; /**< URL being fetched */ ++ nsurl* fUrl; /**< URL being fetched */ + BString fHost; /**< Host for user display */ + BString fRealm; /**< Authentication realm */ + nserror (*fCallback)(bool proceed, void *pw); +@@ -63,8 +63,8 @@ private: + BTextControl *fPassControl; + }; + +-static void create_login_window(const char *host, +- const char *realm, const char *fetchurl, ++static void create_login_window(nsurl *host, ++ lwc_string *realm, const char *fetchurl, + nserror (*cb)(bool proceed, void *pw), void *cbpw); + + +@@ -73,7 +73,7 @@ static void create_login_window(const char *host, + + LoginAlert::LoginAlert(nserror (*callback)(bool proceed, void *pw), + void *callbackpw, +- const char *url, ++ nsurl *url, + const char *host, + const char *realm, + const char *text) +@@ -140,7 +140,7 @@ LoginAlert::MessageReceived(BMessage *message) + break; + BMessage *m = new BMessage(*message); + m->what = 'nsLO'; +- m->AddString("URL", fUrl.String()); ++ m->AddPointer("URL", fUrl); + m->AddString("Host", fHost.String()); + m->AddString("Realm", fRealm.String()); + m->AddPointer("callback", (void *)fCallback); +@@ -163,14 +163,13 @@ LoginAlert::MessageReceived(BMessage *message) + } + + +-void gui_401login_open(const char *url, const char *realm, ++extern "C" void gui_401login_open(nsurl *url, const char *realm, + nserror (*cb)(bool proceed, void *pw), void *cbpw) + { +- char *host; ++ lwc_string *host; + url_func_result res; + +- res = url_host(url, &host); +- assert(res == URL_FUNC_OK); ++ host = nsurl_get_component(url, NSURL_HOST); + + create_login_window(url, host, realm, cb, cbpw); + +@@ -179,7 +178,7 @@ void gui_401login_open(const char *url, const char *realm, + + //void create_login_window(struct browser_window *bw, const char *host, + // const char *realm, const char *fetchurl) +-static void create_login_window(const char *url, const char *host, ++static void create_login_window(nsurl *url, lwc_string *host, + const char *realm, nserror (*cb)(bool proceed, void *pw), + void *cbpw) + { +@@ -191,8 +190,8 @@ static void create_login_window(const char *url, const char *host, + text << "Host: " << host << "\n"; + //text << "\n"; + +- LoginAlert *a = new LoginAlert(cb, cbpw, url, host, r.String(), +- text.String()); ++ LoginAlert *a = new LoginAlert(cb, cbpw, url, lwc_string_data(host), ++ r.String(), text.String()); + // asynchronously + a->Go(NULL); + +diff --git a/beos/window.cpp b/beos/window.cpp +index 253b5d1..b9e6491 100644 +--- a/beos/window.cpp ++++ b/beos/window.cpp +@@ -131,7 +131,7 @@ static GdkCursor *nsbeos_create_menu_cursor(void); + + NSBrowserFrameView::NSBrowserFrameView(BRect frame, struct gui_window *gui) + : BView(frame, "NSBrowserFrameView", B_FOLLOW_ALL_SIDES, +- B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS /*| B_SUBPIXEL_PRECISE*/), ++ B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS ), + fGuiWindow(gui) + { + } +@@ -756,18 +756,25 @@ void nsbeos_dispatch_event(BMessage *message) + break; + case 'nsLO': // login + { +- BString url; ++ nsurl* url; + BString realm; + BString auth; +- if (message->FindString("URL", &url) < B_OK) ++ void* cbpw; ++ nserror (*cb)(bool proceed, void* pw); ++ ++ if (message->FindPointer("URL", (void**)&url) < B_OK) + break; + if (message->FindString("Realm", &realm) < B_OK) + break; + if (message->FindString("Auth", &auth) < B_OK) + break; ++ if (message->FindPointer("callback", (void**)&cb) < B_OK) ++ break; ++ if (message->FindPointer("callback_pw", (void**)&cbpw) < B_OK) ++ break; + //printf("login to '%s' with '%s'\n", url.String(), auth.String()); +- urldb_set_auth_details(url.String(), realm.String(), auth.String()); +- browser_window_go(gui->bw, url.String(), 0, true); ++ urldb_set_auth_details(url, realm.String(), auth.String()); ++ cb(true, cbpw); + break; + } + default: +@@ -1674,7 +1681,7 @@ bool gui_add_to_clipboard(const char *text, size_t length, bool space, + BFont font; + text_run *run = new text_run; + +- nsbeos_style_to_font(font, &fstyle); ++ nsbeos_style_to_font(font, fstyle); + run->offset = current_selection.Length(); + run->font = font; + run->color = nsbeos_rgb_colour(fstyle->foreground); +diff --git a/utils/config.h b/utils/config.h +index bd2e303..1c1eef6 100644 +--- a/utils/config.h ++++ b/utils/config.h +@@ -24,14 +24,14 @@ + + /* Try to detect which features the target OS supports */ + +-#if (defined(_GNU_SOURCE) && !defined(__APPLE__)) ++#if (defined(_GNU_SOURCE) && !defined(__APPLE__) || defined(__HAIKU__)) + #define HAVE_STRNDUP + #else + #undef HAVE_STRNDUP + char *strndup(const char *s, size_t n); + #endif + +-#if (defined(_GNU_SOURCE) || defined(__APPLE__)) ++#if (defined(_GNU_SOURCE) || defined(__APPLE__) || defined(__HAIKU__)) + #define HAVE_STRCASESTR + #else + #undef HAVE_STRCASESTR