# FIXME: /etc/rpc comes from here, or where? (glibc?)
Package-Name: portmap
Homepage: ftp://ftp.porcupine.org/pub/security/index.html
Source: ftp://ftp.porcupine.org/pub/security/portmap_(\d+).tar.gz $1
Zap-Before-Install: 1
Repack:
	tar xzvfp "$(SOURCE)"
	mv portmap_"$(VERSION)" portmap-"$(VERSION)"
Compile:
	mv -f BLURB CHANGES README "$(PREFIX)/"
	$(MAKE) FACILITY=LOG_DAEMON HOSTS_ACCESS= AUX=daemon.o
	umask 022 ; mkdir -p "$(PREFIX)"/sbin
	mv -f pmap_dump pmap_set "$(PREFIX)"/sbin/
	mv -f portmap "$(PREFIX)"/sbin/rpc.portmap
Install:
	$(MAKE) instsbin SBIN="pmap_dump pmap_set rpc.portmap"
Patch: <<EOT
######## begin glibc 2.3 fix
--- portmap.c.old	1996-05-31 22:52:59 +0900
+++ portmap.c	2003-11-26 17:21:32 +0900
@@ -124,7 +124,7 @@
 static void callit();
 struct pmaplist *pmaplist;
 int debugging = 0;
-extern int errno;
+#include <errno.h>
 
 #include "pmap_check.h"
 
######## end glibc 2.3 fix
--- Makefile.old	1996-05-31 22:50:40 +0900
+++ Makefile	2002-11-24 21:24:50 +0900
@@ -74,8 +74,8 @@
 
 all:	portmap pmap_dump pmap_set
 
-portmap: $(OBJECTS) $(WRAP_DIR)/libwrap.a
-	$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(WRAP_DIR)/libwrap.a $(LIBS)
+portmap: $(OBJECTS)
+	$(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LIBS)
 
 pmap_dump: pmap_dump.c
 	$(CC) $(CFLAGS) -o $@ $? $(LIBS)
--- from_local.c.old	1996-05-31 22:52:58 +0900
+++ from_local.c	2002-11-24 21:28:40 +0900
@@ -52,6 +52,9 @@
 #include <sys/ioctl.h>
 #include <syslog.h>
 
+#undef perror
+#define perror perror_
+
 #ifndef TRUE
 #define	TRUE	1
 #define FALSE	0
--- portmap.c.old	1996-05-31 22:52:59 +0900
+++ portmap.c	2002-11-24 21:23:56 +0900
@@ -233,6 +233,8 @@
 
 #ifndef lint
 /* need to override perror calls in rpc library */
+#undef perror
+#define perror perror_
 void
 perror(what)
 	const char *what;
EOT

/pkg/portmap/
/usr/sbin/pmap_dump
/usr/sbin/pmap_set
/usr/sbin/rpc.portmap
