diff -Nurd -x'*~' xrmap-2.33.orig/EXTRADATA xrmap-2.33/EXTRADATA
--- xrmap-2.33.orig/EXTRADATA	2005-11-05 08:31:57.000000000 -0500
+++ xrmap-2.33/EXTRADATA	2005-12-22 16:55:54.000000000 -0500
@@ -3,13 +3,13 @@
 
 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/rmap) :
 
 Required:
-   6750214 CIA_WDB2.jpd.bz2            (CIA vector map data)
+ * 6750214 CIA_WDB2.jpd.bz2            (CIA vector map data)
    4006416 flags-2.5-eps.tar.bz2       (national flags, EPS format)
 or 
-   1198980 flags-2.5-xpm_150.tar.bz2   (national flags, XPM format)
+ * 1198980 flags-2.5-xpm_150.tar.bz2   (national flags, XPM format)
    
 Required only by earthview:
    8399634 earthdata_low_res.tar.bz2   (topography + population data)
@@ -32,4 +32,6 @@
 
 available from ftp://ftp.ac-grenoble.fr/ge/geosciences/xrmap/data
 
+ * CIA_WDB2.jpd and flags_150 are already installed by fink.
+
 ******************************************************************************
diff -Nurd -x'*~' xrmap-2.33.orig/Makefile.noimake xrmap-2.33/Makefile.noimake
--- xrmap-2.33.orig/Makefile.noimake	2005-11-06 16:50:38.000000000 -0500
+++ xrmap-2.33/Makefile.noimake	2005-12-22 16:20:50.000000000 -0500
@@ -1,28 +1,29 @@
 DESTDIR=/usr
-X11DIR=$(DESTDIR)/X11R6
+BINDIR=$(DESTDIR)/bin
 SHAREDIR=$(DESTDIR)/share/rmap
 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)\" \
   -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  -lXpm -lX11 -ljpeg -lz -lpng -lm -L/usr/X11R6/lib $(LDFLAGS)
 ## LDOPTIONS=-O6 -g -Wall libxpm/libXpm.a -lX11 -lz -lm -L/usr/X11R6/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 $(MAKEFLAGS)
+	cd earthview ; make $(MAKEFLAGS)
 	@cat EXTRADATA
 	
 numdefs.h:
@@ -38,7 +39,8 @@
 	gcc $(CCOPTIONS) -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,20 +52,21 @@
 	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 \
 	      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)
-	cp -f xrmap.man $(X11DIR)/man/man1/xrmap.1x
-	if [ -r $(X11DIR)/xrmap.1x.gz ] ; \
-	   then gzip -f $(DESTDIR)$(MANDIR)/xrmap.1x ; fi
-	cd editkit ; make -f Makefile.kit install DESTDIR=$(DESTDIR)
-	cd earthview ; make install DESTDIR=$(DESTDIR)	
+	mkdir -p $(MANDIR)
+	cp -f xrmap.man $(MANDIR)/xrmap.1x
+	if [ -r $(MANDIR)/xrmap.1x.gz ] ; \
+	   then gzip -f $(MANDIR)/xrmap.1x ; fi
+	cd editkit ; make -f Makefile.kit install $(MAKEFLAGS)
+	cd earthview ; make install $(MAKEFLAGS)
 	@cat EXTRADATA
 
 clean:
diff -Nurd -x'*~' xrmap-2.33.orig/earthview/Makefile xrmap-2.33/earthview/Makefile
--- xrmap-2.33.orig/earthview/Makefile	2005-07-14 17:16:30.000000000 -0400
+++ xrmap-2.33/earthview/Makefile	2005-12-28 12:30:38.000000000 -0500
@@ -2,22 +2,27 @@
 DESTDIR=/usr
 #fi
 
-BINDIR=$(DESTDIR)/X11R6/bin
+BINDIR=$(DESTDIR)/bin
 DATADIR=$(DESTDIR)/share/rmap/earthdata
+DOCDIR=$(DESTDIR)/share/rmap/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/usr/X11R6/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 -Nurd -x'*~' xrmap-2.33.orig/editkit/Makefile.kit xrmap-2.33/editkit/Makefile.kit
--- xrmap-2.33.orig/editkit/Makefile.kit	2005-09-28 03:52:13.000000000 -0400
+++ xrmap-2.33/editkit/Makefile.kit	2005-12-22 16:12:24.000000000 -0500
@@ -13,15 +13,16 @@
 # MINIMAL to remove bak files, /usr/share/edmtx and e**rc
 # TLL for Terry Loveall personal settings
 
-SHAREDIR=/usr/share/editkit
+SHAREDIR=$(DESTDIR)/share/editkit
+BINDIR=$(DESTDIR)/bin
 
-CFLAGS = -O2 -fomit-frame-pointer -pipe -Wall -DTHREED -DGREEK -DJUSTIFY -DSHAREDIR="\"$(SHAREDIR)\""
+CFLAGS = -O2 -fomit-frame-pointer -pipe -Wall -DTHREED -DNOEDIT -DGREEK -DJUSTIFY -DSHAREDIR="\"$(SHAREDIR)\"" $(CPPFLAGS)
 
 #CFLAGS = -O2 -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
@@ -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 -Nurd -x'*~' xrmap-2.33.orig/xrmap.c xrmap-2.33/xrmap.c
--- xrmap-2.33.orig/xrmap.c	2005-11-06 16:59:40.000000000 -0500
+++ xrmap-2.33/xrmap.c	2005-12-27 23:02:08.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
