Subject: pkg/36942: net/yale-tftpd fails to build
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Yakovetsky Vladimir <yx@x.ua>
List: pkgsrc-bugs
Date: 09/07/2007 07:50:00
>Number:         36942
>Category:       pkg
>Synopsis:       net/yale-tftpd: fails to build
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 07 07:50:00 +0000 2007
>Originator:     Yakovetsky Vladimir
>Release:        NetBSD 4.0_RC1
>Organization:
>Environment:
System: NetBSD darg.x.ua 4.0_RC1 NetBSD 4.0_RC1 (darg-1.799.2.13-mp-1.8.8.1) #0: Thu Sep 6 15:52:19 EEST 2007 yx@darg.x.ua:/sys/arch/i386/compile/darg.mp i386
Architecture: i386
Machine: i386

>Description:
	net/yale-tftpd fails to build on netbsd/freebsd/linux/solaris

>How-To-Repeat:
	% cd /usr/pkgsrc/net/yale-tftpd && bmake

>Fix:
	Makefile.diff and patches/patch-a[k-r] below.

 [ patch-ak for netbsd/linux]
 [ patch-al for netbsd/freebsd/linux ]
 [ patch-am for freebsd/linux ]
 [ patch-a[no] for linux ]
 [ patch-a[pqr] for solaris ]
 [ Makefile.diff for freebsd/linux/solaris ]
 note:	netbsd-4.0rc1
	freebsd6.2
	linux2.6
	solaris2.10 with gcc



--- net/yale-tftpd/Makefile.~1~
+++ net/yale-tftpd/Makefile
@@ -19,4 +19,9 @@
 
 INSTALLATION_DIRS=	libexec ${PKGMANDIR}/cat8 ${PKGMANDIR}/man8
 
+CFLAGS.FreeBSD+=	-DHAVE_STRERROR
+CFLAGS.Linux+=		-DHAVE_STRERROR
+CFLAGS.SunOS+=		-DHAVE_STRERROR -DBROKEN_TH_STUFF
+LDFLAGS.SunOS+=		-lsocket -lnsl
+
 .include "../../mk/bsd.pkg.mk"
 

:r /usr/pkgsrc/net/yale-tftpd/patches/patch-ak
--- tftpd.c.~1~
+++ tftpd.c
@@ -58,6 +58,9 @@
 
 #include <unistd.h>
 #include <fcntl.h>
+#ifdef __STDC__
+#include <stdlib.h>
+#endif
 
 #define	TIMEOUT		5
 

:r /usr/pkgsrc/net/yale-tftpd/patches/patch-al
--- classes/config.c.~1~
+++ classes/config.c
@@ -4,6 +4,9 @@
 #include <stdlib.h>
 #include <strings.h>
 #include <ctype.h>
+#ifdef HAVE_STRERROR
+#include <string.h>
+#endif
 
 #define DFLT_NFIELDS	10
 #define START_FIELD(S)	\
@@ -127,7 +130,7 @@
 		switch (type) {
 		 case BRK_QUOTE:
 			START_FIELD(to);
-			fr = get_quoted_string (*fr, fr+1, &to);
+			fr = get_quoted_string (*fr, fr+1, (char**)&to);
 			fr++;	/* skip terminating quote */
 			break;
 

:r /usr/pkgsrc/net/yale-tftpd/patches/patch-am
--- classes/dict.c.~1~
+++ classes/dict.c
@@ -16,7 +16,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <strings.h>
+#ifdef HAVE_STRERROR
+#include <string.h>
+#else
 extern char*	strdup();
+#endif
 extern int	strcasecmp();
 
 #define _CLASS_Dict_PRIVATE_
 #include "dict.h"		/* import public declarations */


:r /usr/pkgsrc/net/yale-tftpd/patches/patch-an
--- tftpyale.h.~1~
+++ tftpyale.h
@@ -24,6 +24,10 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#elif HAVE_STRERROR
+#include <stdlib.h>
+#include <string.h>
+#include <errno.h>
 #else				/* not sane unix */
 
 #  ifdef __STDC__


:r /usr/pkgsrc/net/yale-tftpd/patches/patch-ao
--- classes/fuzzdict.c.~1~
+++ classes/fuzzdict.c
@@ -21,7 +21,9 @@
 #define SUPER_remove(S, K)	dict_remove ((Dict)(S), K)
 #define SUPER_keys(S)		dict_keys ((Dict)(S))
 
+#if !defined(HAVE_STRERROR)
 extern int strcmp(), strcasecmp(), strncmp(), strncasecmp();
+#endif
 
 /* Private function declarations */
 #ifdef __STDC__


:r /usr/pkgsrc/net/yale-tftpd/patches/patch-ap
--- tftpd.c.~1~
+++ tftpd.c
@@ -43,6 +43,9 @@
 #include <sys/signal.h>
 #include <sys/time.h>
 #include <sys/param.h>
+#ifdef __sun
+#include <sys/filio.h>
+#endif
 
 #include <netinet/in.h>

 
:r /usr/pkgsrc/net/yale-tftpd/patches/patch-aq
--- tftpsubs.c.~1~
+++ tftpsubs.c
@@ -38,6 +38,9 @@
 #include <netinet/in.h>
 #include <arpa/tftp.h>
 #include <stdio.h>
+#ifdef __sun
+#include <sys/filio.h>
+#endif
 
 #define BUF_PKTSIZE SEGSIZE+4       /* should be moved to tftp.h */

 
:r /usr/pkgsrc/net/yale-tftpd/patches/patch-ar
--- tftpyale.c.~1~
+++ tftpyale.c
@@ -2,8 +2,8 @@
 #include <string.h>
 #include <syslog.h>
 #include <ctype.h>
-#include <arpa/tftp.h>
 #include <sys/types.h>
+#include <arpa/tftp.h>
 #include <sys/stat.h>
 #include <netinet/in.h>
 #include "tftpyale.h"