Subject: pkg/22896: Solaris fixes and cleanups for news/newsfetch
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <jonathan@perkin.org.uk>
List: netbsd-bugs
Date: 09/22/2003 18:46:30
>Number:         22896
>Category:       pkg
>Synopsis:       Solaris fixes and cleanups for news/newsfetch
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 22 18:47:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Perkin
>Release:        N/A
>Organization:
British Broadcasting Corporation
>Environment:
SunOS build1 5.9 Generic_112233-01 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
>Description:
1) Fix build on Solaris with missing network libraries
2) Prefer $(CC) to `gcc', remove gcc-specific -O2
3) Use correct install macros
4) Don't force strip(1), install macros may purposefully be changed to
   remove -s.

Note that we don't -DSUN as per Makefile.sun, as that only provides a
local copy of herror(), which we can fetch from -lresolv anyway.
>How-To-Repeat:
===> Building for newsfetch-1.3
gcc -c -O2 newsfetch.c
gcc -c -O2 nntp.c
gcc -c -O2 net.c
gcc -c -O2 opt.c
gcc -c -O2 util.c
gcc -c -O2 getopt.c
gcc -o newsfetch newsfetch.o nntp.o net.o opt.o util.o getopt.o
Undefined                       first referenced
 symbol                             in file
socket                              net.o
gethostbyname                       net.o
setsockopt                          net.o
gethostbyaddr                       net.o
inet_addr                           net.o
herror                              net.o
connect                             net.o
ld: fatal: Symbol referencing errors. No output written to newsfetch
collect2: ld returned 1 exit status
*** Error code 1
>Fix:
http://www.perkin.org.uk/projects/netbsd/newsfetch.diff

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/news/newsfetch/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile	2003/03/29 12:42:08	1.4
+++ Makefile	2003/09/22 18:40:30
@@ -12,4 +12,10 @@
 
 USE_CONFIGURE=	yes
 
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "SunOS"
+LDFLAGS+=	-lsocket -lnsl -lresolv
+.endif
+
 .include "../../mk/bsd.pkg.mk"
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/news/newsfetch/distinfo,v
retrieving revision 1.2
diff -u -r1.2 distinfo
--- distinfo	2001/04/19 13:37:54	1.2
+++ distinfo	2003/09/22 18:40:30
@@ -2,4 +2,4 @@
 
 SHA1 (newsfetch-1.3.tar.gz) = e497eecffa15d62b1cde6921734dd6e1cb9d933c
 Size (newsfetch-1.3.tar.gz) = 12159 bytes
-SHA1 (patch-aa) = 6ab267de378355c0e738e6b9da4c8bb9dfd031a0
+SHA1 (patch-aa) = 1311f2d0b7a8cdb4e07ba8b6dba491d9878e20df
Index: patches/patch-aa
===================================================================
RCS file: /cvsroot/pkgsrc/news/newsfetch/patches/patch-aa,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 patch-aa
--- patches/patch-aa	2000/12/27 23:15:51	1.1.1.1
+++ patches/patch-aa	2003/09/22 18:40:30
@@ -1,18 +1,32 @@
 $NetBSD: patch-aa,v 1.1.1.1 2000/12/27 23:15:51 hubertf Exp $
 
---- Makefile.orig	Wed Dec 27 23:23:40 2000
-+++ Makefile
-@@ -1,7 +1,7 @@
+--- Makefile.orig	Mon Nov 13 02:01:49 2000
++++ Makefile	Mon Sep 22 19:38:52 2003
+@@ -1,9 +1,9 @@
  # Makefile for newsfetch program
- CC = gcc
+-CC = gcc
 -BINDIR = /usr/local/bin
 -MANDIR = /usr/local/man/man1
++#CC = gcc
 +BINDIR = ${PREFIX}/bin
 +MANDIR = ${PREFIX}/man/man1
  
- CFLAGS= -O2 # inline opt
+-CFLAGS= -O2 # inline opt
++#CFLAGS= -O2 # inline opt
  
-@@ -25,10 +25,8 @@
+ # uncomment this for strict checking
+ #CFLAGS = -O2 -Wall -pedantic -Wstrict-prototypes -fno-strength-reduce
+@@ -15,8 +15,7 @@
+ objs = newsfetch.o nntp.o net.o opt.o util.o getopt.o
+  
+ newsfetch: $(objs)
+-	$(CC) -o newsfetch $(objs)
+-	strip newsfetch
++	$(CC) -o newsfetch $(objs) $(LDFLAGS)
+ 
+ .c.o:
+ 	$(CC) -c $(CFLAGS) $< 
+@@ -25,10 +24,8 @@
  	rm -f *.o newsfetch
  
  install:
@@ -20,8 +34,8 @@
 -#	cp newsfetch.1 $(MANDIR)/newsfetch.1
 -	cp newsfetch /usr/local/bin
 -	cp newsfetch.1 /usr/local/man/man1
-+	cp newsfetch $(BINDIR)/newsfetch
-+	cp newsfetch.1 $(MANDIR)/newsfetch.1
++	${BSD_INSTALL_PROGRAM} newsfetch $(BINDIR)/newsfetch
++	${BSD_INSTALL_MAN} newsfetch.1 $(MANDIR)/newsfetch.1
  
  uninstall:
  	rm -f $(BINDIR)/newsfetch
>Release-Note:
>Audit-Trail:
>Unformatted: