View | Details | Raw Unified | Return to bug 254702
Collapse All | Expand All

(-)Makefile (-21 / +20 lines)
Lines 8-14 Link Here
8
MASTER_SITES=	http://download.netsurf-browser.org/netsurf/releases/source/
8
MASTER_SITES=	http://download.netsurf-browser.org/netsurf/releases/source/
9
DISTNAME=	${PORTNAME}-${PORTVERSION}-src
9
DISTNAME=	${PORTNAME}-${PORTVERSION}-src
10
10
11
MAINTAINER=	nc@FreeBSD.org
11
MAINTAINER=	ports@FreeBSD.org
12
COMMENT=	Lightweight web browser
12
COMMENT=	Lightweight web browser
13
13
14
LICENSE=	GPLv2 MIT
14
LICENSE=	GPLv2 MIT
Lines 30-43 Link Here
30
		libwapcaplet.so:textproc/libwapcaplet \
30
		libwapcaplet.so:textproc/libwapcaplet \
31
		libhubbub.so:www/libhubbub \
31
		libhubbub.so:www/libhubbub \
32
		libexpat.so:textproc/expat2 \
32
		libexpat.so:textproc/expat2 \
33
		libnspsl.so:dns/libnspsl
33
		libnspsl.so:dns/libnspsl \
34
		libwebp.so:graphics/webp
34
RUN_DEPENDS=	duk:lang/duktape \
35
RUN_DEPENDS=	duk:lang/duktape \
35
		${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
36
		${LOCALBASE}/share/certs/ca-root-nss.crt:security/ca_root_nss
36
37
37
USES=		bison desktop-file-utils gettext-runtime gmake gnome iconv jpeg \
38
USES=		bison desktop-file-utils gmake gnome jpeg \
38
		localbase pkgconfig shebangfix ssl
39
		localbase pkgconfig shebangfix ssl iconv:translit
39
ALL_TARGET=	#empty
40
ALL_TARGET=	#empty
40
LDFLAGS+=	-L${OPENSSLLIB} -lssl -lcrypto ${ICONV_LIB}
41
LDFLAGS+=	-L${OPENSSLLIB} -lssl -lcrypto
41
CFLAGS+=	-I${OPENSSLINC}
42
CFLAGS+=	-I${OPENSSLINC}
42
MAKE_ARGS=	HOST_CC="${CC}" CC="${CC}" CCOPT="" HOST="${OPSYS}" \
43
MAKE_ARGS=	HOST_CC="${CC}" CC="${CC}" CCOPT="" HOST="${OPSYS}" \
43
		TARGET="gtk3" \
44
		TARGET="gtk3" \
Lines 48-78 Link Here
48
WRKSRC=		${WRKDIR}/${DISTNAME:S/-src//}
49
WRKSRC=		${WRKDIR}/${DISTNAME:S/-src//}
49
50
50
SHEBANG_FILES=	utils/split-messages.pl
51
SHEBANG_FILES=	utils/split-messages.pl
51
perl_CMD=	${SETENV} perl
52
perl_CMD=	${PERL}
52
53
53
OPTIONS_DEFINE=		GSTREAMER
54
NLS_USES=		gettext
54
OPTIONS_EXCLUDE=	GSTREAMER
55
NLS_CONFIGURE_ENABLE=	nls
55
GSTREAMER_USE=		GSTREAMER=yes, good
56
56
57
post-patch:
57
post-patch:
58
	@${REINPLACE_CMD} '/CFLAGS/d' \
58
	@${REINPLACE_CMD} '/CFLAGS/d' \
59
		${WRKSRC}//Makefile.defaults
59
		${WRKSRC}//Makefile.defaults
60
	@${REINPLACE_CMD} 's| -O2||' \
60
	@${CP} ${FILESDIR}/buildui.pl ${WRKSRC}/utils/
61
		${WRKSRC}/frontends/gtk/Makefile.defaults
62
	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|' \
63
		${WRKSRC}/frontends/gtk/gui.c
64
61
65
do-configure:
62
do-configure:
66
	@${CP} ${FILESDIR}/Makefile.config  ${WRKSRC}
63
	@${CP} ${FILESDIR}/Makefile.config  ${WRKSRC}
67
.if empty(ICONV_LIB)
68
	@${REINPLACE_CMD} '/NETSURF_USE_LIBICONV_PLUG/ s|NO|YES|' \
69
		${WRKSRC}/Makefile.config
70
.endif
71
64
72
do-configure-GSTREAMER-on:
73
	@${REINPLACE_CMD} '/NETSURF_USE_VIDEO/ s|NO|YES|' \
74
		${WRKSRC}/Makefile.config
75
76
post-install:
65
post-install:
77
	cd ${STAGEDIR}${PREFIX}/bin && ${LN} -sf netsurf-gtk3 \
66
	cd ${STAGEDIR}${PREFIX}/bin && ${LN} -sf netsurf-gtk3 \
78
		netsurf-gtk
67
		netsurf-gtk
Lines 79-84 Link Here
79
.for d in applications pixmaps
68
.for d in applications pixmaps
80
	${MKDIR} ${STAGEDIR}${PREFIX}/share/${d}
69
	${MKDIR} ${STAGEDIR}${PREFIX}/share/${d}
81
.endfor
70
.endfor
71
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/deoptions.gtk3.ui \
72
		${STAGEDIR}${PREFIX}/share/netsurf
73
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/enoptions.gtk3.ui \
74
		${STAGEDIR}${PREFIX}/share/netsurf
75
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/froptions.gtk3.ui \
76
		${STAGEDIR}${PREFIX}/share/netsurf
77
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/itoptions.gtk3.ui \
78
		${STAGEDIR}${PREFIX}/share/netsurf
79
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/nloptions.gtk3.ui \
80
		${STAGEDIR}${PREFIX}/share/netsurf
82
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/netsurf-gtk.desktop \
81
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/netsurf-gtk.desktop \
83
		${STAGEDIR}${PREFIX}/share/applications
82
		${STAGEDIR}${PREFIX}/share/applications
84
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/netsurf.xpm \
83
	${INSTALL_DATA} ${WRKSRC}/frontends/gtk/res/netsurf.xpm \
(-)files/Makefile.config (-1 / +1 lines)
Lines 1-4 Link Here
1
NETSURF_USE_LIBICONV_PLUG=NO
1
NETSURF_USE_LIBICONV_PLUG=YES
2
NETSURF_USE_NSSVG=NO
2
NETSURF_USE_NSSVG=NO
3
NETSURF_USE_RSVG=YES
3
NETSURF_USE_RSVG=YES
4
NETSURF_USE_VIDEO=NO
4
NETSURF_USE_VIDEO=NO
(-)files/buildui.pl (+82 lines)
Line 0 Link Here
1
#!
2
#
3
# Create ui files for each language listed in FatMessages
4
5
my $inputfn = $ARGV[0]; 		# path to FatMessages
6
my $templatefn = $ARGV[1];	# path to UI Template
7
my $output = $ARGV[2];		# output path
8
my $stub = $ARGV[3];		# filename stub. like options.gtk3.ui will become enoptions.gtk3.ui
9
10
if (length($stub)<3) {
11
	print "invalid stub.\n";
12
	exit;
13
}
14
15
my $template;
16
my %langs = {'en'=>1};
17
my %trans;
18
$trans{'en'}{'foo'}='bar';
19
20
open(my $fh, '<', $templatefn) or die "cannot open template file $templatefn";
21
{
22
	local $/;
23
	$template = <$fh>;
24
}
25
close($fh);
26
27
$template =~ s/translatable="yes"/translatable="no"/g;
28
29
open(my $input, '<', $inputfn) or die "cannot open FatMessages file $inputfn";
30
31
while (<$input>)
32
{
33
	# skip comment and empty lines
34
	/^#/    && next;
35
	/^\s*$/ && next;
36
37
	# only parsing things that look like message lines:
38
	if( /^([a-z]{2}).([^.]+).([^:]+):(.*)/ )
39
	{
40
		my( $lang, $plat, $key, $val ) = ( $1, $2, $3, $4 );
41
		if ($plat == 'gtk')
42
		{
43
			$val =~ s|<.+?>||g; #remove HTML
44
			$langs{$lang}=1;
45
			$trans{$lang}{$key}=$val;
46
		}
47
	}
48
49
}
50
51
# load up langs hash with copy of the template for each lang
52
53
foreach $key (keys %langs)
54
{
55
	if (length($key)==2)
56
	{
57
		$langs{$key} = $template
58
	}
59
}
60
61
# iterate through each and key replace with translated text
62
63
foreach my $tran (keys %trans)
64
{
65
	foreach my $key (keys %{$trans{$tran}})
66
	{
67
		$langs{$tran} =~ s/\>$key\</\>$trans{$tran}{$key}\</g;
68
	}
69
}
70
71
# save the ui file for each language
72
73
foreach $key (keys %langs)
74
{
75
	if (length($key)==2)
76
	{
77
		open (OFN, '>', $output.'/'.$key.$stub) or die "cannot open output file ".$output.'/'.$key.$stub;
78
		print OFN $langs{$key};
79
		close (OFN);
80
	}
81
}
82
(-)files/patch-Makefile (-1 / +49 lines)
Lines 1-6 Link Here
1
--- Makefile.orig	2020-05-24 20:55:29 UTC
1
--- Makefile.orig	2020-05-24 20:55:29 UTC
2
+++ Makefile
2
+++ Makefile
3
@@ -547,7 +547,6 @@ ifeq ($(HOST),mint)
3
@@ -484,16 +484,6 @@ ifneq ($(CC_MAJOR),2)
4
   COMMON_WARNFLAGS += -Wno-unused-parameter
5
 endif
6
 
7
-# deal with lots of unwanted warnings from javascript
8
-ifeq ($(call cc_ver_ge,4,6),1)
9
-  COMMON_WARNFLAGS += -Wno-unused-but-set-variable
10
-endif
11
-
12
-# Implicit fallthrough warnings suppressed by comment
13
-ifeq ($(call cc_ver_ge,7,1),1)
14
-  COMMON_WARNFLAGS += -Wimplicit-fallthrough=3
15
-endif
16
-
17
 # deal with chaging warning flags for different platforms
18
 ifeq ($(HOST),OpenBSD)
19
   # OpenBSD headers are not compatible with redundant declaration warning
20
@@ -547,7 +537,6 @@ ifeq ($(HOST),mint)
4
 else
21
 else
5
     $(eval $(call pkg_config_find_and_add_enabled,CURL,libcurl,Curl))
22
     $(eval $(call pkg_config_find_and_add_enabled,CURL,libcurl,Curl))
6
 endif
23
 endif
Lines 8-10 Link Here
8
 
25
 
9
 $(eval $(call pkg_config_find_and_add_enabled,UTF8PROC,libutf8proc,utf8))
26
 $(eval $(call pkg_config_find_and_add_enabled,UTF8PROC,libutf8proc,utf8))
10
 $(eval $(call pkg_config_find_and_add_enabled,WEBP,libwebp,WEBP))
27
 $(eval $(call pkg_config_find_and_add_enabled,WEBP,libwebp,WEBP))
28
@@ -680,14 +669,21 @@ $$(MESSAGES_TARGET)/$(1)/Messages: resources/FatMessag
29
 	$$(Q)$$(SPLIT_MESSAGES) -l $(1) -p $$(MESSAGES_FILTER) -f messages -o $$@ -z $$<
30
 
31
 CLEAN_MESSAGES += $$(MESSAGES_TARGET)/$(1)/Messages
32
+CLEAN_MESSAGES += $$(MESSAGES_TARGET)/$(1)options.gtk3.ui
33
 MESSAGES += $$(MESSAGES_TARGET)/$(1)/Messages
34
 
35
 endef
36
 
37
+buildui: 
38
+	@echo "BUILDUI: options ui for each language in resources/FatMessages"
39
+	@$(PERL) utils/buildui.pl resources/FatMessages frontends/gtk/res/options.gtk3.ui $(MESSAGES_TARGET) options.gtk3.ui
40
+
41
 # generate the message file rules
42
 $(eval $(foreach LANG,$(MESSAGES_LANGUAGES), \
43
 	$(call split_messages,$(LANG))))
44
 
45
+MESSAGES += buildui
46
+
47
 clean-messages:
48
 	$(VQ)echo "   CLEAN: $(CLEAN_MESSAGES)"
49
 	$(Q)$(RM) $(CLEAN_MESSAGES)
50
@@ -710,7 +706,7 @@ OBJECTS := $(sort $(addprefix $(OBJROOT)/,$(subst /,_,
51
 # Include directory flags
52
 IFLAGS = $(addprefix -I,$(INCLUDE_DIRS))
53
 
54
-$(EXETARGET): $(OBJECTS) $(RESOURCES) $(MESSAGES)
55
+$(EXETARGET): $(OBJECTS) $(RESOURCES) $(MESSAGES) 
56
 	$(VQ)echo "    LINK: $(EXETARGET)"
57
 ifneq ($(TARGET)$(SUBTARGET),riscos-elf)
58
 	$(Q)$(CC) -o $(EXETARGET) $(OBJECTS) $(LDFLAGS)
(-)files/patch-frontends_gtk_Makefile.defaults (-1 / +7 lines)
Lines 1-4 Link Here
1
--- frontends/gtk/Makefile.defaults.orig	2016-11-19 13:37:41 UTC
1
--- frontends/gtk/Makefile.defaults.orig	2020-05-24 20:55:29 UTC
2
+++ frontends/gtk/Makefile.defaults
2
+++ frontends/gtk/Makefile.defaults
3
@@ -4,7 +4,7 @@
3
@@ -4,7 +4,7 @@
4
 
4
 
Lines 9-11 Link Here
9
 
9
 
10
 # Where to install the netsurf binary
10
 # Where to install the netsurf binary
11
 NETSURF_GTK_BIN := $(PREFIX)/bin/
11
 NETSURF_GTK_BIN := $(PREFIX)/bin/
12
@@ -39,4 +39,4 @@ NETSURF_FS_BACKING_STORE := YES
13
 NETSURF_GTK_MAJOR ?= 2
14
 
15
 # Optimisation levels
16
-CFLAGS += -O2
17
+CFLAGS +=
(-)files/patch-frontends_gtk_preferences.c (+33 lines)
Line 0 Link Here
1
--- frontends/gtk/preferences.c.orig	2021-04-01 17:51:28 UTC
2
+++ frontends/gtk/preferences.c
3
@@ -962,11 +962,26 @@ GtkWidget* nsgtk_preferences(struct browser_window *bw
4
 		return GTK_WIDGET(priv->dialog);
5
 	}
6
 
7
-	res = nsgtk_builder_new_from_resname("options", &preferences_builder);
8
-	if (res != NSERROR_OK) {
9
-		NSLOG(netsurf, INFO, "Preferences UI builder init failed");
10
-		return NULL;
11
+	const char *client_lang;
12
+	char ui_lang[10] = "en";
13
+        client_lang = getenv("LANG");
14
+	
15
+	if (strlen(client_lang)>1)
16
+	{
17
+		strncpy(ui_lang,client_lang,2);
18
 	}
19
+
20
+	strcat(ui_lang,"options");
21
+	
22
+	res = nsgtk_builder_new_from_resname(ui_lang, &preferences_builder);
23
+        if (res != NSERROR_OK) {
24
+                //LANG not found, so fall back to english i guess
25
+                res = nsgtk_builder_new_from_resname("enoption", &preferences_builder);
26
+        }
27
+        if (res != NSERROR_OK) {
28
+                NSLOG(netsurf, INFO, "Preferences UI builder init failed");
29
+                return NULL;
30
+        }
31
 
32
 	priv->dialog = gtk_builder_get_object(preferences_builder,
33
 					       "dialogPreferences");
(-)files/patch-frontends_gtk_resources.c (+22 lines)
Line 0 Link Here
1
--- frontends/gtk/resources.c.orig	2021-04-01 19:00:43 UTC
2
+++ frontends/gtk/resources.c
3
@@ -82,6 +82,11 @@ static struct nsgtk_resource_s ui_resource[] = {
4
 	RES_ENTRY("globalhistory"),
5
 	RES_ENTRY("localhistory"),
6
 	RES_ENTRY("options"),
7
+	RES_ENTRY("deoptions"),
8
+	RES_ENTRY("enoptions"),
9
+	RES_ENTRY("froptions"),
10
+	RES_ENTRY("itoptions"),
11
+	RES_ENTRY("nloptions"),
12
 	RES_ENTRY("hotlist"),
13
 	RES_ENTRY("cookies"),
14
 	RES_ENTRY("viewdata"),
15
@@ -552,6 +557,7 @@ nsgtk_builder_new_from_resname(const char *resname, Gt
16
 			      error->message);
17
 			g_error_free(error);
18
 			g_object_unref(G_OBJECT(new_builder));
19
+			
20
 			return NSERROR_INIT_FAILED;
21
 		}
22
 	} else {
(-)pkg-plist (+5 lines)
Lines 47-52 Link Here
47
%%DATADIR%%/nl/licence.html
47
%%DATADIR%%/nl/licence.html
48
%%DATADIR%%/nl/welcome.html
48
%%DATADIR%%/nl/welcome.html
49
%%DATADIR%%/options.gtk3.ui
49
%%DATADIR%%/options.gtk3.ui
50
%%DATADIR%%/deoptions.gtk3.ui
51
%%DATADIR%%/enoptions.gtk3.ui
52
%%DATADIR%%/froptions.gtk3.ui
53
%%DATADIR%%/itoptions.gtk3.ui
54
%%DATADIR%%/nloptions.gtk3.ui
50
%%DATADIR%%/pageinfo.gtk3.ui
55
%%DATADIR%%/pageinfo.gtk3.ui
51
%%DATADIR%%/password.gtk3.ui
56
%%DATADIR%%/password.gtk3.ui
52
%%DATADIR%%/quirks.css
57
%%DATADIR%%/quirks.css

Return to bug 254702