diff -ruN xrmap-2.33-orig/EXTRADATA xrmap-2.33/EXTRADATA
--- xrmap-2.33-orig/EXTRADATA	2005-11-05 07:31:57.000000000 -0600
+++ xrmap-2.33/EXTRADATA	2018-09-28 21:34:53.000000000 -0500
@@ -3,33 +3,35 @@
 
 In addition to compiling and installing source files, xrmap requires 
 DATA FILES. You should download them SEPARATELY, and uncompress them 
-in SHAREDIR (/usr/share/rmap by default) :
+in SHAREDIR (/usr/share/xrmap by default) :
 
 Required:
-   6750214 CIA_WDB2.jpd.bz2            (CIA vector map data)
-   4006416 flags-2.5-eps.tar.bz2       (national flags, EPS format)
+ * 6750214 CIA_WDB2.jpd.bz2            (CIA vector map data)
+   4910461 flags-2.7-eps.tar.bz2       (323 national flags, EPS format)
 or 
-   1198980 flags-2.5-xpm_150.tar.bz2   (national flags, XPM format)
+ * 1198980 flags-2.7-xpm_150.tar.bz2   (323 national flags, XPM format)
    
 Required only by earthview:
    8399634 earthdata_low_res.tar.bz2   (topography + population data)
 
 Recommended:
-     95748 anthems-1.1.tar.bz2         (national anthems)
-    612060 hymns-1.2.tar.bz2           (national hymns in MIDI format)
-    699410 factbook_text_2005.tar.bz2  (CIA factbook, ASCII format)
+    204506 anthems-1.3.tar.bz2         (270 national anthems)
+    841330 hymns-1.4.tar.bz2           (270 national hymns in MIDI format)
+    859837 factbook_text_2008.tar.bz2  (CIA factbook, ASCII format)
   50589431 earthdata_med_res.tar.bz2   (required only by earthview)
 
 Optional:
-  27193880 factbook_html_2005.tar.bz2  (CIA factbook, HTML format + maps)
-  46412445 pdfmaps-1.2.tar.bz2         (PDF maps from United Nations)
+  42761187 factbook_html_2008.tar.bz2  (CIA factbook, HTML format + maps)
+  48457671 pdfmaps-1.3.tar.bz2         (PDF maps from United Nations)
   29194589 eawpats12.tar.bz2           (GUS samples for the MIDI player)
-   4062495 flags-2.5-svg.tar.bz2       (national flags, SVG format)
+   5271488 flags-2.9-svg.tar.bz2       (324 national flags, SVG format)
  488145582 earthdata_high_res.tar.bz2  (required only by earthview)
 
 Source files (not needed to run xrmap) :
-   7084612 flags-2.5-src.tar.bz2       (national flags, SVG full collection)
+   8869285 flags-2.9-src.tar.bz2       (550 flags, SVG full collection)
 
 available from ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/data
 
+ * CIA_WDB2.jpd and flags_150 are already installed by fink.
+
 ******************************************************************************
diff -ruN xrmap-2.33-orig/Makefile.noimake xrmap-2.33/Makefile.noimake
--- xrmap-2.33-orig/Makefile.noimake	2005-11-06 15:50:38.000000000 -0600
+++ xrmap-2.33/Makefile.noimake	2018-09-28 21:34:53.000000000 -0500
@@ -1,28 +1,29 @@
 DESTDIR=/usr
-X11DIR=$(DESTDIR)/X11R6
-SHAREDIR=$(DESTDIR)/share/rmap
+BINDIR=$(DESTDIR)/bin
+SHAREDIR=$(DESTDIR)/share/xrmap
 PS_VIEWER="gv -noantialias"
 IM_VIEWER="display -background gray84"
 HTML_VIEWER="dillo"
 PRINT_CMD="lpr -Plocal"
 EDITOR="emx"
-MIDIPLAYER="timidity -ig"
+MIDIPLAYER="qtplay"
 SVG_VIEWER="inkscape"
 SVG_CONVERT="inkscape %s --export-height=%d --export-png=%s"
+MANDIR=$(DESTDIR)/share/man/man1
 
-CCOPTIONS=-O6 -g -Wall -DZLIB -DXPMBUG -DSHAREDIR=\"$(SHAREDIR)\" \
+CCOPTIONS=-Os -g -Wall -DZLIB -DXPMBUG -DSHAREDIR=\"$(SHAREDIR)\" \
   -DPS_VIEWER=\"$(PS_VIEWER)\" -DIM_VIEWER=\"$(IM_VIEWER)\" \
   -DSVG_VIEWER=\"$(SVG_VIEWER)\" -DSVG_CONVERT=\"$(SVG_CONVERT)\" \
   -DHTML_VIEWER=\"$(HTML_VIEWER)\" -DPRINT_CMD=\"$(PRINT_CMD)\" \
-  -DEDITOR=\"$(EDITOR)\" -DMIDIPLAYER=\"$(MIDIPLAYER)\"
+  -DEDITOR=\"$(EDITOR)\" -DMIDIPLAYER=\"$(MIDIPLAYER)\" $(CPPFLAGS)
   
-LDOPTIONS=-O6 -g -Wall  -lXpm -lX11 -ljpeg -lz -lpng -lm -L/usr/X11R6/lib
-## LDOPTIONS=-O6 -g -Wall libxpm/libXpm.a -lX11 -lz -lm -L/usr/X11R6/lib
+LDOPTIONS=-Os -g -Wall  -lXpm -lX11 -ljpeg -lz -lpng -lm -L$(DESTDIR)/lib -L@X11_BASE_DIR@/lib $(LDFLAGS)
+## LDOPTIONS=-Os -g -Wall libxpm/libXpm.a -lX11 -lz -lm -L@X11_BASE_DIR@/lib
 
 all: explorer.o image.o xrmap.o
 	gcc $(LDOPTIONS) -o xrmap explorer.o image.o xrmap.o
-	cd editkit ; make -f Makefile.kit DESTDIR=$(DESTDIR)
-	cd earthview ; make DESTDIR=$(DESTDIR)	
+	cd editkit ; make -f Makefile.kit edx emx $(MAKEFLAGS)
+	cd earthview ; make $(MAKEFLAGS)
 	@cat EXTRADATA
 	
 numdefs.h:
@@ -35,10 +36,11 @@
 	gcc $(CCOPTIONS) -c image.c
 	
 xrmap.o: xrmap.h version.h bitmaps.h numdefs.h menudefs.h xrmap.c
-	gcc $(CCOPTIONS) -c xrmap.c
+	gcc $(CCOPTIONS) -trigraphs -c xrmap.c
 
 install:
-	install -c -s xrmap $(X11DIR)/bin
+	mkdir -p $(BINDIR)
+	install -c -s xrmap $(BINDIR)
 	mkdir -p $(SHAREDIR)
 	cp -f Xrmaprc Locations $(SHAREDIR)
 	cd postscript ; rm -f *~
@@ -50,15 +52,16 @@
 	if [ -d i18n ] ; then cd i18n ; rm -f *~ ; fi
 	if [ -d i18n ] ; then cp -fR i18n $(SHAREDIR) ; fi
 	if [ -d flags ] ; then cd flags ; rm -f *~ ; fi	
-	if [ -d flags ] ; then cp -fR flags $(DESTDIR)$(SHAREDIR) ; fi	
+	if [ -d flags ] ; then cp -fR flags $(SHAREDIR) ; fi	
 	if [ -d picons ] ; then cp -fR picons $(SHAREDIR) ; fi
 	mkdir -p $(SHAREDIR)/doc
-	cp -f CHANGES INSTALL LICENSE MAPEDIT README TODO VECTORMAP EXTRADATA \
+	cp -f CHANGES INSTALL.txt LICENSE MAPEDIT README TODO VECTORMAP EXTRADATA \
 	      rc/00_example.rc midi_cfg/README.midi $(SHAREDIR)/doc
 	cp -f README $(SHAREDIR)/doc/README.xrmap
-	cp -f earthview/README $(DESTDIR)$(SHAREDIR)/doc/README.earthview
+	cp -f earthview/README $(SHAREDIR)/doc/README.earthview
 	cd rc ; rm -f *~
 	cp -fR rc $(SHAREDIR)
+	mkdir -p $(X11DIR)/man/man1
 	cp -f xrmap.man $(X11DIR)/man/man1/xrmap.1x
 	if [ -r $(X11DIR)/xrmap.1x.gz ] ; \
 	   then gzip -f $(DESTDIR)$(MANDIR)/xrmap.1x ; fi
Binary files xrmap-2.33-orig/earthview/.earthview.c.un~ and xrmap-2.33/earthview/.earthview.c.un~ differ
diff -ruN xrmap-2.33-orig/earthview/Makefile xrmap-2.33/earthview/Makefile
--- xrmap-2.33-orig/earthview/Makefile	2005-07-14 16:16:30.000000000 -0500
+++ xrmap-2.33/earthview/Makefile	2018-09-28 21:34:53.000000000 -0500
@@ -2,22 +2,27 @@
 DESTDIR=/usr
 #fi
 
-BINDIR=$(DESTDIR)/X11R6/bin
-DATADIR=$(DESTDIR)/share/rmap/earthdata
+BINDIR=$(DESTDIR)/bin
+DATADIR=$(DESTDIR)/share/xrmap/earthdata
+DOCDIR=$(DESTDIR)/share/xrmap/doc
 
 all: earthview
 
-earthview: earthview.c
-	gcc -Wall -DDATADIR=\"$(DATADIR)\" earthview.c -o earthview -L/usr/X11R6/lib -lX11 -lm -lz -lbz2
+CPPFLAGS+= -DDATADIR=\"$(DATADIR)\"
+earthview: earthview.o
+	gcc -Wall earthview.o -o earthview -L@X11_BASE_DIR@/lib -lX11 -lm -lz -lbz2
+
 
 install:
+	mkdir -p $(BINDIR)
 	install -c -s earthview $(BINDIR)
 	mkdir -p $(DATADIR)
 	mkdir -p $(DATADIR)/topography
 	cp -f data/topography.cps $(DATADIR)/topography
 	mkdir -p $(DATADIR)/population
 	cp -f data/population.cps $(DATADIR)/population
-	cp -f README $(DESTDIR)/share/rmap/doc/README.earthview
+	mkdir -p $(DOCDIR)
+	cp -f README $(DOCDIR)/README.earthview
 
 help: earthview
 	./earthview -help
diff -ruN xrmap-2.33-orig/earthview/earthview.c xrmap-2.33/earthview/earthview.c
--- xrmap-2.33-orig/earthview/earthview.c	2005-07-12 08:56:41.000000000 -0500
+++ xrmap-2.33/earthview/earthview.c	2018-09-28 21:35:21.000000000 -0500
@@ -96,7 +96,7 @@
 char *data_file = NULL;
 char *cps_file, *cps_dir;
 FILE *fd = NULL;
-gzFile *gzd = NULL;
+gzFile gzd = NULL;
 
 /* Predefined color schemes */
 /* You can of course add as many as you like... */
@@ -212,7 +212,7 @@
     return n;
 }
 
-int ngzread(gzFile *gzd)
+int ngzread(gzFile gzd)
 {
 unsigned char c;
 int n;
diff -ruN xrmap-2.33-orig/editkit/Makefile.kit xrmap-2.33/editkit/Makefile.kit
--- xrmap-2.33-orig/editkit/Makefile.kit	2005-09-28 02:52:13.000000000 -0500
+++ xrmap-2.33/editkit/Makefile.kit	2018-09-28 21:34:53.000000000 -0500
@@ -13,19 +13,20 @@
 # MINIMAL to remove bak files, /usr/share/edmtx and e**rc
 # TLL for Terry Loveall personal settings
 
-SHAREDIR=/usr/share/editkit
+SHAREDIR=$(DESTDIR)/share/xrmap/editkit
+BINDIR=$(DESTDIR)/bin
 
-CFLAGS = -O2 -fomit-frame-pointer -pipe -Wall -DTHREED -DGREEK -DJUSTIFY -DSHAREDIR="\"$(SHAREDIR)\""
+CFLAGS = -Os -fomit-frame-pointer -pipe -Wall -DTHREED -DNOEDIT -DGREEK -DJUSTIFY -DSHAREDIR="\"$(SHAREDIR)\"" $(CPPFLAGS)
 
-#CFLAGS = -O2 -fomit-frame-pointer -pipe -Wall -DMINIMAL -DTWOBUTN -DVERTCURS -DTLL
+#CFLAGS = -Os -fomit-frame-pointer -pipe -Wall -DMINIMAL -DTWOBUTN -DVERTCURS -DTLL
 
 #CFLAGS = -g -pipe
 
-TLIBS = -L/usr/lib -ltermcap
+TLIBS = -lncurses $(LDFLAGS)
 XLIBS = -L/usr/X11R6/lib -lX11
 
 # Use this for solaris
-#CFLAGS = -O2 -pipe -Wall
+#CFLAGS = -Os -pipe -Wall
 #LIBS = -L/usr/openwin/lib -lsocket -lnsl -lresolv -lXext -lX11
 
 
@@ -47,23 +48,23 @@
 	gcc $(CFLAGS) -o emx emx.o $(XLIBS)
 	@ls -al $@;strip $@;ls -al $@
 
-edt.o: Makefile version.h messages.def termcap.c edit.h edit.c term_bind_ws.c
+edt.o: Makefile.kit version.h messages.def termcap.c edit.h edit.c term_bind_ws.c
 	gcc $(CFLAGS) -DWORDSTAR -o edt.o -c termcap.c
 
-emt.o: Makefile version.h messages.def termcap.c edit.h edit.c term_bind_em.c
+emt.o: Makefile.kit version.h messages.def termcap.c edit.h edit.c term_bind_em.c
 	gcc $(CFLAGS) -DEMACS -o emt.o -c termcap.c
 
-edx.o: Makefile version.h messages.def x11.c edit.h edit.c x11_bind_ws.c
+edx.o: Makefile.kit version.h messages.def x11.c edit.h edit.c x11_bind_ws.c
 	gcc $(CFLAGS) -DWORDSTAR -o edx.o -c x11.c
 
-emx.o: Makefile version.h messages.def x11.c edit.h edit.c x11_bind_em.c
+emx.o: Makefile.kit version.h messages.def x11.c edit.h edit.c x11_bind_em.c
 	gcc $(CFLAGS) -DEMACS -o emx.o -c x11.c
 
 install:
-	if [ -x edt ]; then cp -f edt /usr/bin; fi
-	if [ -x emt ]; then cp -f emt /usr/bin; fi
-	if [ -x edx ]; then cp -f edx /usr/X11R6/bin; fi
-	if [ -x emx ]; then cp -f emx /usr/X11R6/bin; fi
+	if [ -x edt ]; then cp -f edt $(BINDIR); fi
+	if [ -x emt ]; then cp -f emt $(BINDIR); fi
+	if [ -x edx ]; then cp -f edx $(BINDIR); fi
+	if [ -x emx ]; then cp -f emx $(BINDIR); fi
 	mkdir -p $(SHAREDIR)
 	cp -f rc.example $(SHAREDIR)/rc.common
 	cp -f README $(SHAREDIR)
diff -ruN xrmap-2.33-orig/image.c xrmap-2.33/image.c
--- xrmap-2.33-orig/image.c	2005-11-06 11:36:13.000000000 -0600
+++ xrmap-2.33/image.c	2018-09-28 21:34:53.000000000 -0500
@@ -18,6 +18,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <zlib.h>
 #include <png.h>
 #include <jpeglib.h>
 
diff -ruN xrmap-2.33-orig/xrmap.c xrmap-2.33/xrmap.c
--- xrmap-2.33-orig/xrmap.c	2005-11-06 15:59:40.000000000 -0600
+++ xrmap-2.33/xrmap.c	2018-09-28 21:34:53.000000000 -0500
@@ -5742,21 +5742,21 @@
     return 1;
 }
 
-void arcinfo_lines(ImageLayout *scene) {
-    void *fd;
-    char buf[512];
-    char sep;
-    char *ptr;
-    char **seg;
-    double a, b, c, d;
-    int i, j, k, u, n, p, i0;
-    int new_arc=0, ind, indpr, num_mod = -1, nstrokes, xi, yi;
-    SpherePt sp;
-    ScreenPt pt1, pt2;
-    Pixel pix;
-    double cotan_lat0, conv_lat0;
+/* fink patches here to un-nest next_segment from arcinfo_lines */
+    static void *fd;
+    static char buf[512];
+    static char sep;
+    static char *ptr;
+    static char **seg;
+    static double a, b, c, d;
+    static int i, j, k, u, n, p, i0;
+    static int new_arc=0, ind, indpr, num_mod = -1, nstrokes, xi, yi;
+    static SpherePt sp;
+    static ScreenPt pt1, pt2;
+    static Pixel pix;
+    static double cotan_lat0, conv_lat0;
 
-void next_segment(double x, double y)
+void next_segment(double x, double y, ImageLayout *scene)
 {
     double u, v, w, t;
     int i, j, dx, dy, dxp, dyp, epsx, epsy;
@@ -5849,6 +5849,10 @@
     }
 }
 
+void arcinfo_lines(ImageLayout *scene)
+{
+  new_arc=0;
+
     if (!arc_file) return; 
 
     i0 = -1;
@@ -5972,14 +5976,14 @@
           ptr[28] = '\0';
           n = sscanf(ptr, "%lg %lg", &a, &b);
 	  if (n<2) continue;
-          next_segment(a, b);
+          next_segment(a, b, &scene);
           ptr[28] = sep;
           p = sscanf(ptr+28, "%lg %lg", &c, &d);
-          if (p>=2) next_segment(c, d);
+          if (p>=2) next_segment(c, d, &scene);
        } else {
           n = sscanf(ptr, "%lg %lg", &a, &b);
 	  if (n<2) continue;
-	  next_segment(a, b);
+	  next_segment(a, b, &scene);
        }
     }
 #ifdef ZLIB
