about summary refs log tree commit diff stats
path: root/netbsd
diff options
context:
space:
mode:
authorDavid Hill <dhill@conformal.com>2013-06-14 11:41:26 -0400
committerDavid Hill <dhill@conformal.com>2013-06-16 18:21:53 -0400
commitd45b6ceced65e0bc4ba688925903152203348bd9 (patch)
treed5cd410a946cb37642479162db5fb38b7c019d11 /netbsd
parenta8e2264b6a8aefc5f4b06ff30274143b2e85b2bc (diff)
downloadxombrero-d45b6ceced65e0bc4ba688925903152203348bd9.tar.gz
fix build on NetBSD. From Arnaud Degroote
Diffstat (limited to 'netbsd')
-rw-r--r--netbsd/Makefile163
-rw-r--r--netbsd/netbsd.c10
-rw-r--r--netbsd/util.h3
3 files changed, 37 insertions, 139 deletions
diff --git a/netbsd/Makefile b/netbsd/Makefile
index 88590a3..b31aa7a 100644
--- a/netbsd/Makefile
+++ b/netbsd/Makefile
@@ -1,95 +1,3 @@
-GTK_VERSION?= gtk3
-.if ${GTK_VERSION} == "gtk2"
-LIBS= gtk+-2.0 webkit-1.0
-.else
-LIBS= gtk+-3.0 webkitgtk-3.0
-.endif
-LIBS+= libsoup-2.4 gnutls
-
-LDADD= -lutil -lX11
-GTK_CFLAGS!= pkg-config --cflags $(LIBS)
-GTK_LDFLAGS!= pkg-config --libs $(LIBS)
-CFLAGS+= $(GTK_CFLAGS) -O2 -Wall -I. -I..
-LDFLAGS+= $(GTK_LDFLAGS)
-
-PREFIX?= /usr/local
-BINDIR?= $(PREFIX)/bin
-LIBDIR?= $(PREFIX)/lib
-MANDIR?= $(PREFIX)/man
-RESDIR?= $(PREFIX)/share/xombrero
-
-CC= cc
-
-all: ../javascript.h ../tooltip.h xombrero
-
-../javascript.h: ../js-merge-helper.pl ../hinting.js ../autoscroll.js
-	perl ../js-merge-helper.pl ../hinting.js ../input-focus.js \
-	../autoscroll.js > ../javascript.h
-
-../tooltip.h: ../ascii2txt.pl ../txt2tooltip.pl ../xombrero.1
-	nroff -c -Tascii -mandoc ../xombrero.1 | \
-	perl ../ascii2txt.pl | \
-	perl ../txt2tooltip.pl > ../tooltip.h
-
-xombrero.o: ../xombrero.o
-
-unix.o: ../unix.o
-
-marco.o: ../marco.o
-
-whitelist.o: ../whitelist.o
-
-settings.o: ../settings.o
-
-about.o: ../about.o
-
-inspector.o: ../inspector.o
-
-cookie.o: ../cookie.o
-
-inputfocus.o: ../inputfocus.o
-
-history.o: ../history.o
-
-completion.o: ../completion.o
-
-externaleditor.o: ../externaleditor.o
-
-tldlist.o: ../tldlist.o
-
-../xombrero.o: ../javascript.h ../tooltip.h
-
-xombrero: xombrero.o netbsd.o marco.o about.o inspector.o whitelist.o settings.o \
-	cookie.o history.o completion.o inputfocus.o tldlist.o externaleditor.o \
-	unix.o
-	$(CC) $(LDFLAGS) -o $@ *.o $+ $(LDADD)
-
-install: all
-	install -m 755 -d $(DESTDIR)$(BINDIR)
-	install -m 755 -d $(DESTDIR)$(LIBDIR)
-	install -m 755 -d $(DESTDIR)$(MANDIR)/man1
-	install -m 755 -d $(DESTDIR)$(RESDIR)
-	install -m 755 xombrero $(DESTDIR)$(BINDIR)
-	install -m 644 ../xombrero.1 $(DESTDIR)$(MANDIR)/man1/xombrero.1
-	install -m 644 ../xombrero.css $(DESTDIR)$(RESDIR)
-	install -m 644 ../xombrero.desktop $(DESTDIR)$(PREFIX)/share/applications
-	install -m 644 ../xombreroicon16.png $(DESTDIR)$(RESDIR)
-	install -m 644 ../xombreroicon32.png $(DESTDIR)$(RESDIR)
-	install -m 644 ../xombreroicon48.png $(DESTDIR)$(RESDIR)
-	install -m 644 ../xombreroicon64.png $(DESTDIR)$(RESDIR)
-	install -m 644 ../xombreroicon128.png $(DESTDIR)$(RESDIR)
-	install -m 644 ../tld-rules $(DESTDIR)$(RESDIR)
-	install -m 644 ../style.css $(DESTDIR)$(RESDIR)
-	install -m 644 ../hsts-preload $(DESTDIR)$(RESDIR)
-	install -m 644 ../torenabled.ico $(DESTDIR)$(RESDIR)
-	install -m 644 ../tordisabled.ico $(DESTDIR)$(RESDIR)
-
-clean:
-	rm -f xombrero *.o
-	rm -f javascript.h
-	rm -f tooltip.h
-
-.PHONY: all install clean
 PREFIX?=/usr/local
 BINDIR=${PREFIX}/bin
 
@@ -100,10 +8,14 @@ DEBUG= -g
 
 SRCS= cookie.c inspector.c marco.c about.c whitelist.c settings.c inputfocus.c
 SRCS+= history.c completion.c tldlist.c externaleditor.c unix.c xombrero.c
+SRCS+= netbsd.c
+.PATH: ${.CURDIR}/..
+
 CFLAGS+= -O2 -Wall -Wno-format-extra-args -Wunused
 CFLAGS+= -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wno-sign-compare ${DEBUG}
 CFLAGS+= -DGTK_DISABLE_SINGLE_INCLUDES -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE
-CFLAGS+= -I. -I${.CURDIR}
+CFLAGS+= -DGDK_DISABLE_DEPRECATION_WARNINGS -DGLIB_DISABLE_DEPRECATION_WARNINGS
+CFLAGS+= -I. -I..
 LDADD= -lutil -lgcrypt
 GTK_VERSION ?= gtk3
 .if ${GTK_VERSION} == "gtk2"
@@ -119,64 +31,47 @@ GTK_CFLAGS!= pkg-config --cflags $(LIBS)
 GTK_LDFLAGS!= pkg-config --libs $(LIBS)
 CFLAGS+= $(GTK_CFLAGS)
 LDFLAGS+= $(GTK_LDFLAGS)
-BUILDVERSION != sh "${.CURDIR}/buildver.sh"
+BUILDVERSION != sh "${.CURDIR}/../buildver.sh"
 .if !${BUILDVERSION} == ""
 CPPFLAGS+= -DXOMBRERO_BUILDSTR=\"$(BUILDVERSION)\"
 .endif
 
-MANDIR= ${PREFIX}/man/man
+MANDIR= ${PREFIX}/man/
 
-CLEANFILES += ${.CURDIR}/javascript.h javascript.h tooltip.h xombrero.cat1 xombrero.core
+CLEANFILES += ${.CURDIR}/javascript.h javascript.h tooltip.h xombrero.cat1 xombrero.core xombrero.html1
 
-JSFILES += hinting.js
-JSFILES += input-focus.js
-JSFILES += autoscroll.js
+JSFILES += ../hinting.js
+JSFILES += ../input-focus.js
+JSFILES += ../autoscroll.js
 
 .for _js in ${JSFILES}
 JSCURDIR += ${.CURDIR}/${_js}
 .endfor
 
-javascript.h: ${JSFILES} js-merge-helper.pl
-	perl ${.CURDIR}/js-merge-helper.pl \
+.NOPATH: javascript.h tooltip.h
+javascript.h: ${JSFILES} ../js-merge-helper.pl
+	perl ${.CURDIR}/../js-merge-helper.pl \
 		${JSCURDIR} > javascript.h
 
-tooltip.h: ${MAN} ascii2txt.pl txt2tooltip.pl
-	mandoc -Tascii ${.CURDIR}/${MAN} | \
-		perl ${.CURDIR}/ascii2txt.pl | \
-		perl ${.CURDIR}/txt2tooltip.pl > tooltip.h
+tooltip.h: ${MAN} ../ascii2txt.pl ../txt2tooltip.pl
+	mandoc -Tascii ${.CURDIR}/../${MAN} | \
+		perl ${.CURDIR}/../ascii2txt.pl | \
+		perl ${.CURDIR}/../txt2tooltip.pl > tooltip.h
 
 beforeinstall:
 	install -m 755 -d ${PREFIX}/bin
 	install -m 755 -d ${PREFIX}/man/man1/
+	install -m 755 -d ${PREFIX}/man/html1/
 	install -m 755 -d ${PREFIX}/share/xombrero
-	install -m 644 $(.CURDIR)/xombrero.css ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon16.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon32.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon48.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon64.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/xombreroicon128.png ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/tld-rules ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/style.css ${PREFIX}/share/xombrero
-	install -m 644 ${.CURDIR}/hsts-preload ${PREFIX}/share/xombrero
-
-${PROG} ${OBJS} beforedepend: javascript.h tooltip.h
-
-# clang targets
-.if ${.TARGETS:M*analyze*}
-CFLAGS+= -Wdeclaration-after-statement -Wshadow
-CC=clang
-CXX=clang++
-CPP=clang -E
-CFLAGS+=--analyze
-.elif ${.TARGETS:M*clang*}
-CFLAGS+= -Wdeclaration-after-statement -Wshadow
-CC=clang
-CXX=clang++
-CPP=clang -E
-.endif
-
-analyze: all
-clang: all
+	install -m 644 $(.CURDIR)/../xombrero.css ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon16.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon32.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon48.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon64.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../xombreroicon128.png ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../tld-rules ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../style.css ${PREFIX}/share/xombrero
+	install -m 644 ${.CURDIR}/../hsts-preload ${PREFIX}/share/xombrero
 
 .include <bsd.prog.mk>
diff --git a/netbsd/netbsd.c b/netbsd/netbsd.c
index 93c41e0..387d886 100644
--- a/netbsd/netbsd.c
+++ b/netbsd/netbsd.c
@@ -77,7 +77,8 @@ scan_scaled(char *scaled, long long *result)
 	long long scale_fact = 1, whole = 0, fpart = 0;
 
 	/* Skip leading whitespace */
-	while (isascii(*p) && isspace(*p))
+	while (isascii((unsigned char)*p) &&
+		  isspace((unsigned char)*p))
 		++p;
 
 	/* Then at most one leading + or - */
@@ -104,7 +105,8 @@ scan_scaled(char *scaled, long long *result)
 	 * (but note that E for Exa might look like e to some!).
 	 * Advance 'p' to end, to get scale factor.
 	 */
-	for (; isascii(*p) && (isdigit(*p) || *p=='.'); ++p) {
+	for (; isascii((unsigned char)*p) &&
+		    (isdigit((unsigned char)*p) || *p=='.'); ++p) {
 		if (*p == '.') {
 			if (fract_digits > 0) {	/* oops, more than one '.' */
 				errno = EINVAL;
@@ -148,10 +150,10 @@ scan_scaled(char *scaled, long long *result)
 
 		/* Are we there yet? */
 		if (*p == scale_chars[i] ||
-			*p == tolower(scale_chars[i])) {
+			*p == tolower((unsigned char)scale_chars[i])) {
 
 			/* If it ends with alphanumerics after the scale char, bad. */
-			if (isalnum(*(p+1))) {
+			if (isalnum((unsigned char)*(p+1))) {
 				errno = EINVAL;
 				return -1;
 			}
diff --git a/netbsd/util.h b/netbsd/util.h
index d08783f..56b0422 100644
--- a/netbsd/util.h
+++ b/netbsd/util.h
@@ -32,4 +32,5 @@
 #endif
 
 #define FMT_SCALED_STRSIZE      7       /* minus sign, 4 digits, suffix, null byte */
-int     fmt_scaled(long long number, char *result);
+int     	fmt_scaled(long long number, char *result);
+long long	strtonum(const char *, long long, long long, const char **);