This is a security update and complete overhaul of the www/w3m port.
It uses the Debian version as upstream, which fixes 23 (!) CVEs,
and follows the Debian package in some other respects.

People who use w3m need to test this!


Details:

The w3m upstream has been long dead again.  New maintenance is happing
in the Debian git: https://anonscm.debian.org/cgit/collab-maint/w3m.git
The results are "released" as patch files for the Debian package,
so switch to using this as the new upstream.

Switch the image flavor to use imlib2 instead of gtk2.  This is a
much lighter dependency and appears to be good enough.

Drop the japanese flavor.  Japanese localization via gettext is
available.  There are some translation gaps, but it seems to be
good enough for the Japanese maintainer of the Debian package.  The
Japanese documentation is now always installed.  We'll need to add
quirks for ja-w3m-* -> w3m-*.

All the Japanese docs are converted from a mix of EUC-JP and
ISO-2022-JP to UTF-8.  (This is something that should be done for
other ports with non-UTF-8 docs, too.)

w3m links against boehm-gc with links against pthread.  But we no
longer need to transitively link w3m against pthread, do we?  w3m
itself does not use pthreads at all.


Index: Makefile
===================================================================
RCS file: /cvs/ports/www/w3m/Makefile,v
retrieving revision 1.87
diff -u -p -r1.87 Makefile
--- Makefile    19 Nov 2016 12:06:06 -0000      1.87
+++ Makefile    17 Dec 2016 22:41:52 -0000
@@ -3,22 +3,26 @@
 COMMENT=       pager/text-based web browser
 
 DISTNAME=      w3m-0.5.3
-REVISION=      4
+REVISION=      5
 CATEGORIES=    www
 HOMEPAGE=      http://w3m.sourceforge.net/
 
 # BSD-like
 PERMIT_PACKAGE_CDROM=  Yes
 
-WANTLIB=       c crypto curses gc iconv intl m pthread ssl z
+WANTLIB=       c crypto curses gc iconv intl m ssl z
 
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=w3m/}
+MASTER_SITES0= ${MASTER_SITE_DEBIAN:=main/w/w3m/}
+
+DISTFILES=     ${DISTNAME}.tar.gz \
+               w3m_0.5.3-33.debian.tar.xz:0
 
 BUILD_DEPENDS= devel/gettext-tools
 
 LIB_DEPENDS=   devel/boehm-gc devel/gettext
 
-FLAVORS=       image japanese
+FLAVORS=       image
 FLAVOR?=
 
 CONFIGURE_STYLE=gnu
@@ -29,30 +33,43 @@ CONFIGURE_ARGS=     --disable-xface \
 NO_TEST=       Yes
 
 .if ${FLAVOR:Mimage}
-LIB_DEPENDS+=  x11/gtk+2
-CONFIGURE_ARGS+=--with-imagelib=gtk2
-WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
-WANTLIB += Xrandr Xrender atk-1.0 cairo fontconfig freetype
-WANTLIB += gdk-x11-2.0 gdk_pixbuf-2.0 gdk_pixbuf_xlib-2.0 gio-2.0
-WANTLIB += glib-2.0 gmodule-2.0 gobject-2.0 gtk-x11-2.0
-WANTLIB += pango-1.0 pangocairo-1.0 pangoft2-1.0
+LIB_DEPENDS+=  graphics/imlib2
+CONFIGURE_ARGS+=--with-imagelib=imlib2
+WANTLIB+=      Imlib2 X11 Xext freetype
 .else
 CONFIGURE_ARGS+=--enable-image=no
 .endif
 
-.if ${FLAVOR:Mjapanese}
-FULLPKGNAME=   ja-${PKGNAME}${FLAVOR_EXT:S/-japanese//}
-CATEGORIES+=   japanese
-CONFIGURE_ARGS+=--enable-japanese=U
-DOCSRC=                ${WRKSRC}/doc-jp
-.else
-DOCSRC=                ${WRKSRC}/doc
-.endif
+PATCH_DIST_STRIP= -p1
+
+do-distpatch:
+       @for p in ${WRKDIR}/debian/patches/*.patch; do \
+           ${PATCH} ${PATCH_DIST_ARGS} < $$p; \
+       done
+
+post-build:
+       cd ${WRKSRC}/doc-jp; \
+           for f in ${EUC_JP}; do \
+               iconv -f euc-jp -t utf-8 $$f >$$f.tmp; \
+               mv $$f.tmp $$f; \
+           done; \
+           for f in ${ISO_2022_JP}; do \
+               iconv -f iso-2022-jp -t utf-8 $$f >$$f.tmp; \
+               mv $$f.tmp $$f; \
+           done
 
 post-install:
-       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/w3m
-       cd ${DOCSRC}; \
-       find . -type f \! \( -name w3m.1 -or -path "*/CVS/*" \) -print0 | \
-       xargs -0r -J % ${INSTALL_DATA} % ${PREFIX}/share/doc/w3m
+.for src dst in doc "" doc-jp ja doc-de de
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/w3m/${dst}
+       cd ${WRKSRC}/${src}; \
+           ${INSTALL_DATA} !(w3m.1|CVS|*${DISTORIG}|README.cygwin) \
+               ${PREFIX}/share/doc/w3m/${dst}
+.endfor
+
+EUC_JP=                FAQ.html HISTORY MANUAL.html README README.SSL 
README.cookie \
+               README.dict README.func README.img README.keymap README.m17n \
+               README.mailcap README.menu README.migemo README.mouse \
+               README.siteconf STORY.html menu.default menu.submenu w3m.1
+ISO_2022_JP=   README.passwd README.pre_form README.tab
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/www/w3m/distinfo,v
retrieving revision 1.20
diff -u -p -r1.20 distinfo
--- distinfo    18 Jan 2015 03:15:50 -0000      1.20
+++ distinfo    17 Dec 2016 22:41:52 -0000
@@ -1,2 +1,4 @@
 SHA256 (w3m-0.5.3.tar.gz) = 6ZTSY/L9LCL+v75FEDUm4AFFp2dKD9p5yCK5fCdwqeM=
+SHA256 (w3m_0.5.3-33.debian.tar.xz) = 
UDxHYVQuRlBUWYa1NH7Grx93yPwunYyaHvUW9MyqGUg=
 SIZE (w3m-0.5.3.tar.gz) = 2202328
+SIZE (w3m_0.5.3-33.debian.tar.xz) = 183952
Index: patches/patch-Makefile_in
===================================================================
RCS file: patches/patch-Makefile_in
diff -N patches/patch-Makefile_in
--- patches/patch-Makefile_in   12 Mar 2011 23:20:17 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-Makefile_in,v 1.3 2011/03/12 23:20:17 sthen Exp $
---- Makefile.in.orig   Tue Jan  4 09:22:18 2011
-+++ Makefile.in        Sat Mar 12 21:00:14 2011
-@@ -219,11 +219,11 @@ install-core: $(TARGETS)
-       -$(MKDIR) $(DESTDIR)$(CGIBIN_DIR)
-       -$(MKDIR) $(DESTDIR)$(HELP_DIR)
-       -$(MKDIR) $(DESTDIR)$(mandir)/man1
--      -$(MKDIR) $(DESTDIR)$(mandir)/ja/man1
-+      -$(MKDIR) $(DESTDIR)$(mandir)/ja_JP.EUC/man1
-       $(INSTALL_PROGRAM) $(TARGET) $(DESTDIR)$(bindir)/$(TARGET)
-       $(INSTALL_DATA) $(HELP_FILE) $(DESTDIR)$(HELP_DIR)/$(HELP_TARGET)
-       $(INSTALL_DATA) $(MAN1) $(DESTDIR)$(mandir)/man1/$(MAN1_TARGET)
--      $(INSTALL_DATA) $(MAN1_JA) $(DESTDIR)$(mandir)/ja/man1/$(MAN1_TARGET)
-+      $(INSTALL_DATA) $(MAN1_JA) 
$(DESTDIR)$(mandir)/ja_JP.EUC/man1/$(MAN1_TARGET)
-       targets="$(AUXBIN_TARGETS)"; for file in $$targets; \
-       do \
-               case $$file in \
Index: patches/patch-config_h_in
===================================================================
RCS file: patches/patch-config_h_in
diff -N patches/patch-config_h_in
--- patches/patch-config_h_in   19 Apr 2014 15:41:09 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-config_h_in,v 1.1 2014/04/19 15:41:09 sthen Exp $
---- config.h.in.orig   Sat Apr 19 16:38:20 2014
-+++ config.h.in        Sat Apr 19 16:38:44 2014
-@@ -84,7 +84,7 @@
- #undef INET6
- #undef HAVE_SOCKLEN_T
- #undef HAVE_OLD_SS_FAMILY
--#define USE_EGD
-+#undef USE_EGD
- #define ENABLE_REMOVE_TRAILINGSPACES
- #undef MENU_THIN_FRAME
- #undef USE_RAW_SCROLL
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/www/w3m/patches/patch-configure,v
retrieving revision 1.16
diff -u -p -r1.16 patch-configure
--- patches/patch-configure     12 Mar 2011 23:20:17 -0000      1.16
+++ patches/patch-configure     17 Dec 2016 22:41:52 -0000
@@ -1,39 +1,12 @@
-$OpenBSD: patch-configure,v 1.16 2011/03/12 23:20:17 sthen Exp $
---- configure.orig     Sat Mar 12 21:00:56 2011
-+++ configure  Sat Mar 12 21:08:16 2011
-@@ -8209,7 +8209,7 @@ if test "${ac_cv_lib_gc_GC_init+set}" = set; then :
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lgc  $LIBS"
-+LIBS="-lgc -pthread $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
+$OpenBSD$
+--- configure.orig     Mon Nov 21 21:39:38 2016
++++ configure  Mon Nov 21 21:40:16 2016
+@@ -6955,7 +6955,7 @@ $as_echo "$as_me: WARNING: Imlib2 is not installed.  I
+      IMGTARGETS="x11"
+      $as_echo "#define USE_IMLIB2 1" >>confdefs.h
  
-@@ -8240,7 +8240,7 @@ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gc_GC_init" >&5
- $as_echo "$ac_cv_lib_gc_GC_init" >&6; }
- if test "x$ac_cv_lib_gc_GC_init" = x""yes; then :
--  LIBGC="-lgc"
-+  LIBGC="-lgc -pthread"
- fi
- 
-  if test x"$ac_cv_lib_gc_GC_init" = xno; then
-@@ -8261,7 +8261,7 @@ if test "${ac_cv_lib_gc_GC_init+set}" = set; then :
-   $as_echo_n "(cached) " >&6
- else
-   ac_check_lib_save_LIBS=$LIBS
--LIBS="-lgc  $LIBS"
-+LIBS="-lgc -pthread $LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
- /* end confdefs.h.  */
- 
-@@ -8292,7 +8292,7 @@ fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gc_GC_init" >&5
- $as_echo "$ac_cv_lib_gc_GC_init" >&6; }
- if test "x$ac_cv_lib_gc_GC_init" = x""yes; then :
--  gclibdir="$dir/lib"; LIBGC="-L$dir/lib -lgc"; break
-+  gclibdir="$dir/lib"; LIBGC="-L$dir/lib -lgc -pthread"; break
- fi
- 
-       LDFLAGS="$ldflags"
+-     IMGX11CFLAGS="`${IMLIB2_CONFIG} --cflags`"
++     IMGX11CFLAGS="`${PKG_CONFIG} --cflags imlib2`"
+      IMGX11LDFLAGS="-lX11 `${PKG_CONFIG} --libs imlib2`"
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unable to build 
w3mimgdisplay with X11 support" >&5
Index: patches/patch-main_c
===================================================================
RCS file: patches/patch-main_c
diff -N patches/patch-main_c
--- patches/patch-main_c        1 Jun 2013 21:06:20 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-$OpenBSD: patch-main_c,v 1.1 2013/06/01 21:06:20 kurt Exp $
---- main.c.orig        Thu May 30 12:31:09 2013
-+++ main.c     Thu May 30 12:32:02 2013
-@@ -833,7 +833,9 @@ main(int argc, char **argv, char **envp)
-     mySignal(SIGPIPE, SigPipe);
- #endif
- 
--    orig_GC_warn_proc = GC_set_warn_proc(wrap_GC_warn_proc);
-+    orig_GC_warn_proc = GC_get_warn_proc();
-+    GC_set_warn_proc(wrap_GC_warn_proc);
-+
-     err_msg = Strnew();
-     if (load_argc == 0) {
-       /* no URL specified */
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/www/w3m/pkg/DESCR,v
retrieving revision 1.14
diff -u -p -r1.14 DESCR
--- pkg/DESCR   26 Jun 2004 04:57:36 -0000      1.14
+++ pkg/DESCR   17 Dec 2016 22:41:52 -0000
@@ -9,5 +9,3 @@ it has several features Lynx doesn't hav
 Available flavors:
   image     - Support displaying inline images when run from an X11
               terminal emulator.
-  japanese  - Provide Japanese menus and documentation, and properly
-              display Japanese characters in kterm.
Index: pkg/PFRAG.image
===================================================================
RCS file: /cvs/ports/www/w3m/pkg/PFRAG.image,v
retrieving revision 1.5
diff -u -p -r1.5 PFRAG.image
--- pkg/PFRAG.image     12 Mar 2011 23:20:17 -0000      1.5
+++ pkg/PFRAG.image     17 Dec 2016 22:41:52 -0000
@@ -1,3 +1,4 @@
 @comment $OpenBSD: PFRAG.image,v 1.5 2011/03/12 23:20:17 sthen Exp $
+@pkgpath www/w3m,image,japanese
 @bin libexec/w3m/w3mimgdisplay
 share/doc/w3m/README.img
Index: pkg/PFRAG.japanese
===================================================================
RCS file: pkg/PFRAG.japanese
diff -N pkg/PFRAG.japanese
--- pkg/PFRAG.japanese  12 Mar 2011 23:20:17 -0000      1.5
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-@comment $OpenBSD: PFRAG.japanese,v 1.5 2011/03/12 23:20:17 sthen Exp $
-@conflict w3m-*
-@man man/ja_JP.EUC/man1/w3m.1
-share/doc/w3m/README.SSL
-share/doc/w3m/README.keymap
-share/doc/w3m/README.mailcap
-share/doc/w3m/README.menu
-share/doc/w3m/README.migemo
Index: pkg/PFRAG.no-image
===================================================================
RCS file: pkg/PFRAG.no-image
diff -N pkg/PFRAG.no-image
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ pkg/PFRAG.no-image  17 Dec 2016 22:41:52 -0000
@@ -0,0 +1,2 @@
+@comment $OpenBSD$
+@pkgpath www/w3m,japanese
Index: pkg/PFRAG.no-japanese
===================================================================
RCS file: pkg/PFRAG.no-japanese
diff -N pkg/PFRAG.no-japanese
--- pkg/PFRAG.no-japanese       18 Sep 2004 13:15:27 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,2 +0,0 @@
-@comment $OpenBSD: PFRAG.no-japanese,v 1.2 2004/09/18 13:15:27 espie Exp $
-@conflict ja-w3m-*
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/www/w3m/pkg/PLIST,v
retrieving revision 1.20
diff -u -p -r1.20 PLIST
--- pkg/PLIST   12 Mar 2011 23:20:17 -0000      1.20
+++ pkg/PLIST   17 Dec 2016 22:41:52 -0000
@@ -1,4 +1,6 @@
 @comment $OpenBSD: PLIST,v 1.20 2011/03/12 23:20:17 sthen Exp $
+@conflict ja-w3m-*
+%%image%%
 @bin bin/w3m
 bin/w3mman
 libexec/w3m/
@@ -6,12 +8,20 @@ libexec/w3m/cgi-bin/
 libexec/w3m/cgi-bin/dirlist.cgi
 libexec/w3m/cgi-bin/multipart.cgi
 @bin libexec/w3m/cgi-bin/w3mbookmark
+libexec/w3m/cgi-bin/w3mdict.cgi
 libexec/w3m/cgi-bin/w3mhelp.cgi
 @bin libexec/w3m/cgi-bin/w3mhelperpanel
 libexec/w3m/cgi-bin/w3mmail.cgi
 libexec/w3m/cgi-bin/w3mman2html.cgi
 @bin libexec/w3m/inflate
 @comment libexec/w3m/xface2xpm
+man/de/
+man/de/man1/
+@man man/de/man1/w3m.1
+@man man/de/man1/w3mman.1
+man/ja/
+man/ja/man1/
+@man man/ja/man1/w3m.1
 @man man/man1/w3m.1
 @man man/man1/w3mman.1
 share/doc/w3m/
@@ -20,25 +30,56 @@ share/doc/w3m/HISTORY
 share/doc/w3m/MANUAL.html
 share/doc/w3m/README
 share/doc/w3m/README.cookie
-@comment share/doc/w3m/README.cygwin
 share/doc/w3m/README.dict
 share/doc/w3m/README.func
 share/doc/w3m/README.m17n
 share/doc/w3m/README.mouse
 share/doc/w3m/README.passwd
 share/doc/w3m/README.pre_form
+share/doc/w3m/README.siteconf
+share/doc/w3m/README.sixel
 share/doc/w3m/README.tab
 share/doc/w3m/STORY.html
+share/doc/w3m/de/
+share/doc/w3m/de/FAQ.html
+share/doc/w3m/de/MANUAL.html
+share/doc/w3m/de/README.func
+share/doc/w3m/ja/
+share/doc/w3m/ja/FAQ.html
+share/doc/w3m/ja/HISTORY
+share/doc/w3m/ja/MANUAL.html
+share/doc/w3m/ja/README
+share/doc/w3m/ja/README.SSL
+share/doc/w3m/ja/README.cookie
+share/doc/w3m/ja/README.dict
+share/doc/w3m/ja/README.func
+share/doc/w3m/ja/README.img
+share/doc/w3m/ja/README.keymap
+share/doc/w3m/ja/README.m17n
+share/doc/w3m/ja/README.mailcap
+share/doc/w3m/ja/README.menu
+share/doc/w3m/ja/README.migemo
+share/doc/w3m/ja/README.mouse
+share/doc/w3m/ja/README.passwd
+share/doc/w3m/ja/README.pre_form
+share/doc/w3m/ja/README.siteconf
+share/doc/w3m/ja/README.tab
+share/doc/w3m/ja/STORY.html
+share/doc/w3m/ja/keymap.default
+share/doc/w3m/ja/keymap.lynx
+share/doc/w3m/ja/menu.default
+share/doc/w3m/ja/menu.submenu
 share/doc/w3m/keymap.default
 share/doc/w3m/keymap.lynx
 share/doc/w3m/menu.default
 share/doc/w3m/menu.submenu
+share/locale/de/LC_MESSAGES/w3m.mo
 share/locale/ja/LC_MESSAGES/w3m.mo
+share/locale/zh_CN/LC_MESSAGES/w3m.mo
+share/locale/zh_TW/LC_MESSAGES/w3m.mo
 share/w3m/
+share/w3m/w3mhelp-funcdesc.de.pl
 share/w3m/w3mhelp-funcdesc.en.pl
 share/w3m/w3mhelp-funcdesc.ja.pl
 share/w3m/w3mhelp-funcname.pl
 share/w3m/w3mhelp.html
-%%japanese%%
-!%%japanese%%
-%%image%%
-- 
Christian "naddy" Weisgerber                          na...@mips.inka.de

Reply via email to