Subject: Re: pkg/33494: net/vsftpd doesn't build on Solaris
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Stefan Pfetzing <dreamind@dreamind.de>
List: pkgsrc-bugs
Date: 05/16/2006 18:45:02
The following reply was made to PR pkg/33494; it has been noted by GNATS.

From: Stefan Pfetzing <dreamind@dreamind.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/33494: net/vsftpd doesn't build on Solaris
Date: Tue, 16 May 2006 20:40:38 +0200

 --Apple-Mail-2--153569620
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=US-ASCII;
 	delsp=yes;
 	format=flowed
 
 Hi Joerg,
 
 Am 16.05.2006 um 18:55 schrieb joerg@britannica.bec.de:
 
 >  ARGH. OK, I see. Does the attached patch work? I've also made PAM
 >  optional.
 
 Works fine so far, but I had to add -lrt and -lsendfile.
 
 >>>> diff -uraN ../net/vsftpd/patches/patch-ag vsftpd/patches/patch-ag
 >>>
 >>>  I can't comment on the patch itself. Does a variable like  
 >>> timezone or
 >>>  localtime exist perhaps?
 >>
 >>  Dunno, but this way does work fine - the only problem is, the tm
 >>  struct doesn't contain tm_gmtoff.
 >
 >  This looks just too complicated. According to what I found on the  
 > net,
 >  Solaris should have declare "extern time_t timezone", which is the
 >  difference between UTC and localtime. Can you try to use that  
 > instead?
 >  It is much simpler after all :-)
 
 Yup, tried that, works fine ;)
 
 I've attached the complete patch used by me.
 
 
 --Apple-Mail-2--153569620
 Content-Transfer-Encoding: 7bit
 Content-Type: application/octet-stream;
 	x-unix-mode=0644;
 	name="vsftpd-fix-for-solaris.patch"
 Content-Disposition: attachment;
 	filename=vsftpd-fix-for-solaris.patch
 
 diff -uraN ../net/vsftpd/distinfo vsftpd/distinfo
 --- ../net/vsftpd/distinfo	2006-01-28 03:42:02.887916689 +0100
 +++ vsftpd/distinfo	2006-05-16 20:29:42.741522449 +0200
 @@ -3,9 +3,10 @@
  SHA1 (vsftpd-2.0.4.tar.gz) = 6ffbcc08a91300664d527b3ac7c515421d5cd764
  RMD160 (vsftpd-2.0.4.tar.gz) = e8f07c125c0c3a8f0d457b47fd0062d6431c480b
  Size (vsftpd-2.0.4.tar.gz) = 154857 bytes
 -SHA1 (patch-aa) = 7e42db098d0d2261d5f02b36f7cba4ec6d91c6a0
 +SHA1 (patch-aa) = 0d9dd04f5ea3b24aea230cbcde0b6af0c812a167
  SHA1 (patch-ab) = 18431ae27f53270ad4c19b0530e55348397fe143
  SHA1 (patch-ac) = 49269d863fd232d1e78cda039ae1a67368acfe1e
  SHA1 (patch-ad) = dd22f355216685fe0089addc5b1acf3b11490b06
  SHA1 (patch-ae) = 373edb952206871b0b5c3e06fd5b90e25000f284
  SHA1 (patch-af) = 895496296cfa867653f05c6f475fd5d69f21811b
 +SHA1 (patch-ag) = 04afb0d4e4a7636b6987ea4cf98f72f0f592b220
 diff -uraN ../net/vsftpd/Makefile vsftpd/Makefile
 --- ../net/vsftpd/Makefile	2006-04-23 20:11:49.809006262 +0200
 +++ vsftpd/Makefile	2006-05-16 20:18:09.889152124 +0200
 @@ -1,5 +1,6 @@
  # $NetBSD: Makefile,v 1.22 2006/04/23 00:12:41 jlam Exp $
  #
 +#
  
  DISTNAME=	vsftpd-2.0.4
  PKGREVISION=	1
 @@ -36,6 +37,12 @@
  SUBST_SED.paths+=	-e 's,@PKG_SYSCONFDIR@,${PKG_SYSCONFDIR},g'
  SUBST_STAGE.paths=	post-patch
  
 +MAKE_ENV+=		LIBS=${LIBS:M*:Q}
 +
 +.include "../../mk/bsd.prefs.mk"
 +
 +LIBS.SunOS=	-lsocket -lnsl -lrt -lsendfile
 +
  .include "options.mk"
  
  do-install:
 diff -uraN ../net/vsftpd/options.mk vsftpd/options.mk
 --- ../net/vsftpd/options.mk	2006-04-22 13:37:39.194538940 +0200
 +++ vsftpd/options.mk	2006-05-16 19:54:44.289157104 +0200
 @@ -1,8 +1,8 @@
  # $NetBSD: options.mk,v 1.2 2006/01/30 18:07:06 wiz Exp $
  
  PKG_OPTIONS_VAR=	PKG_OPTIONS.vsftpd
 -PKG_SUPPORTED_OPTIONS=	inet6 ssl tcpwrappers
 -PKG_SUGGESTED_OPTIONS=	inet6 tcpwrappers
 +PKG_SUPPORTED_OPTIONS=	inet6 pam ssl tcpwrappers
 +PKG_SUGGESTED_OPTIONS=	inet6 pam tcpwrappers
  
  .include "../../mk/bsd.options.mk"
  
 @@ -12,6 +12,18 @@
  BROKEN=		Needs ipv6 option enabled.
  .endif
  
 +.if !empty(PKG_OPTIONS:Mpam)
 +.include "../../mk/pam.buildlink3.mk"
 +LIBS+=		-L${PAMBASE}
 +LIBS+=		${COMPILER_RPATH_FLAG}${PAMBASE}
 +LIBS+=		-lpam
 +.else
 +SUBST_CLASSES+=		pam
 +SUBST_FILES.pam=	builddefs.h
 +SUBST_SED.pam+=		-e 's,define VSF_BUILD_PAM,undef VSF_BUILD_PAM,g'
 +SUBST_STAGE.pam=	pre-configure
 +.endif
 +
  .if !empty(PKG_OPTIONS:Mssl)
  .include "../../security/openssl/buildlink3.mk"
  SUBST_CLASSES+=		ssl
 @@ -19,6 +31,10 @@
  SUBST_SED.ssl+=		-e 's,undef VSF_BUILD_SSL,define VSF_BUILD_SSL,g'
  SUBST_SED.ssl+=		-e 's,/usr/share/ssl/certs/vsftpd.pem,${SSLCERTS}/vsftpd.pem,g'
  SUBST_STAGE.ssl=	pre-configure
 +
 +LIBS+=		-L${BUILDLINK_PREFIX.openssl}
 +LIBS+=		${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.openssl}
 +LIBS+=		-lssl -lcrypto
  .endif
  
  .if !empty(PKG_OPTIONS:Mtcpwrappers)
 @@ -27,4 +43,8 @@
  SUBST_FILES.tcpwrappers=	builddefs.h
  SUBST_SED.tcpwrappers+=		-e 's,undef VSF_BUILD_TCPWRAPPERS,define VSF_BUILD_TCPWRAPPERS,g'
  SUBST_STAGE.tcpwrappers=	pre-configure
 +
 +LIBS+=		-L${BUILDLINK_PREFIX.tcp_wrappers}
 +LIBS+=		${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.tcp_wrappers}
 +LIBS+=		-lwrap
  .endif
 diff -uraN ../net/vsftpd/patches/patch-aa vsftpd/patches/patch-aa
 --- ../net/vsftpd/patches/patch-aa	2003-05-10 01:31:40.000000000 +0200
 +++ vsftpd/patches/patch-aa	2006-05-16 20:11:55.608018003 +0200
 @@ -1,16 +1,17 @@
 -$NetBSD: patch-aa,v 1.3 2003/05/09 23:31:40 salo Exp $
 +$NetBSD$
  
 ---- Makefile.orig	2002-10-22 01:15:16.000000000 +0200
 -+++ Makefile	2003-05-09 23:46:09.000000000 +0200
 -@@ -1,9 +1,9 @@
 +--- Makefile.orig	2005-06-29 00:24:03.000000000 +0200
 ++++ Makefile
 +@@ -1,12 +1,6 @@
   # Makefile for systems with GNU tools
  -CC 	=	gcc
 -+#CC 	=	gcc
   INSTALL	=	install
   IFLAGS  = -idirafter dummyinc
 - #CFLAGS = -g
 +-#CFLAGS = -g
  -CFLAGS	=	-O2 -Wall -W -Wshadow #-pedantic -Werror -Wconversion
 -+CFLAGS	+=	-O2 -Wall -W -Wshadow #-pedantic -Werror -Wconversion
 - 
 - LIBS	=	`./vsf_findlibs.sh`
 - LINK	=	-Wl,-s
 +-
 +-LIBS	=	`./vsf_findlibs.sh`
 +-LINK	=	-Wl,-s
 +
 + OBJS	=	main.o utility.o prelogin.o ftpcmdio.o postlogin.o privsock.o \
 +		tunables.o ftpdataio.o secbuf.o ls.o \
 diff -uraN ../net/vsftpd/patches/patch-ag vsftpd/patches/patch-ag
 --- ../net/vsftpd/patches/patch-ag	1970-01-01 01:00:00.000000000 +0100
 +++ vsftpd/patches/patch-ag	2006-05-16 20:29:25.486352344 +0200
 @@ -0,0 +1,20 @@
 +--- sysutil.c.orig	2006-05-16 14:50:01.756061293 +0200
 ++++ sysutil.c	2006-05-16 15:29:33.564923203 +0200
 +@@ -2475,10 +2475,17 @@
 + {
 +   time_t the_time = 0;
 +   struct tm* p_tm;
 ++#if defined (__SVR4) && defined (__sun) 
 ++  extern time_t timezone;
 ++#endif
 +   tzset();
 +   the_time = time(NULL);
 +   p_tm = localtime(&the_time);
 ++#if defined (__SVR4) && defined (__sun) 
 ++  s_timezone = timezone;
 ++#else
 +   s_timezone = -p_tm->tm_gmtoff;
 ++#endif
 + }
 + 
 + const char*
 
 --Apple-Mail-2--153569620
 Content-Transfer-Encoding: 7bit
 Content-Type: text/plain;
 	charset=US-ASCII;
 	format=flowed
 
 
 thanks.
 
 bye
 
 Stefan
 
 -- 
          http://www.dreamind.de/
 Oroborus and Debian GNU/Linux Developer.
 
 
 
 
 --Apple-Mail-2--153569620--