Subject: Re: Problems creating a new package ...
To: Matthew Grooms <mgrooms@shrew.net>
From: Roland Illig <rillig@NetBSD.org>
List: pkgsrc-users
Date: 09/11/2007 10:31:26
Matthew Grooms wrote:
> Hello all,
> 
> I have a piece of software I'm trying to get to build using package 
> source and am having a few issues trying to get it to work. Let me start 
> by saying that if the correct dependencies are installed, the source 
> compiles and builds without an issue. I have attached the makefile I am 
> using. When I attempt to run make, the software is download and 
> extracted. The cmake configure process also completes without error. But 
> when make is run, I get strange errors during the compile ...
> 
> Scanning dependencies of target ike
> [  1%] Building CXX object source/libike/CMakeFiles/ike.dir/libike.o
> g++: cannot specify -o with -c or -S and multiple compilations
> 
> [wrapper.sh] note: The real command line, after the pkgsrc wrapper, was:
> /usr/pkgsrc/security/ike/work/.gcc/bin/g++ -Dike_EXPORTS -fPIC 
> -I/usr/pkgsrc/security/ike/work/ike/source 
> -I/usr/pkgsrc/security/ike/work/ike/source/iked 
> -I/usr/pkgsrc/security/ike/work/ike/source/libike 
> -I/usr/pkgsrc/security/ike/work/ike/source/libip -D UNIX OPT_NATT 
> QT_THREAD_SUPPORT -DQT_SHARED -DQT_NO_DEBUG -DQT_THREAD_SUPPORT 
> -D_REENTRANT -o source/libike/CMakeFiles/ike.dir/libike.o -c 
> /usr/pkgsrc/security/ike/work/ike/source/libike/libike.cpp 
> -I/usr/pkgsrc/security/ike/work/.buildlink/include 
> -L/usr/pkgsrc/security/ike/work/.buildlink/lib

OPT_NATT isn't prefixed with "-D", but should be. The reason for the 
build failure was that _all_ other packages seemingly don't leave a 
space between the -D and the name to be defined. I've fixed it in 
mk/wrapper/arg-source revision 1.2.

> ------------------------------------------------------------------------
> 
> DISTNAME=		ike-2.0.1-beta-4
> CATEGORIES=		security
> MASTER_SITES=		http://www.shrew.net/vpn/
> EXTRACT_SUFX=		.tbz2
> 
> MAINTAINER=		mgrooms@NetBSD.org
> HOMEPAGE=		http://www.shrew.net/
> COMMENT=		Shrew Soft IKE daemon and client tools
> 
> ONLY_FOR_PLATFORM=	NetBSD-[3-9].1-* Linux-2.[6-9].*-*

Please always add a comment _why_ ONLY_FOR_PLATFORM is needed.

> WRKSRC=			${WRKDIR}/ike
> BUILD_DEPENDS=		cmake>=2.4.*:../../devel/cmake
> BUILD_DEPENDS+=		bison>=2.3:../../devel/bison

I prefer USE_TOOLS+=bison here.

> USE_LANGUAGES=		c c++
> 

The following should go into options.mk.

> PKG_OPTIONS_VAR=	PKG_OPTIONS.ike
> PKG_SUPPORTED_OPTIONS=	qtgui natt ldap debug
> PKG_SUGGESTED_OPTIONS=	qtgui natt
> 
> .include "../../mk/bsd.options.mk"
> 
> CMAKE_ARGS+=		-DETCDIR=${PKG_SYSCONFDIR:Q}
> 
> .if !empty(PKG_OPTIONS:Mqtgui)
> BUILDLINK_API_DEPENDS.qt3-libs?= qt3-libs>=3.3
> CMAKE_ARGS+=		-DQTGUI=YES

What about adding this here:?

.include "../../x11/qt3/application.mk"

> .endif
> 
> .if !empty(PKG_OPTIONS:Mnatt)
> CMAKE_ARGS+=		-DNATT=YES
> .endif
> 
> .if !empty(PKG_OPTIONS:Mldap)
> BUILDLINK_API_DEPENDS.openldap-client?=	openldap-client>=2.0
.include "../../databases/openldap-client/buildlink3.mk"
> CMAKE_ARGS+=		-DLDAP=YES
> .endif
> 
> .if !empty(PKG_OPTIONS:Mdebug)
> CMAKE_ARGS+=		-DDEBUG=YES
> .endif
> 
> do-configure:
> 	cd ${WRKSRC}; \
> 	cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${PREFIX};

Remove the semicolon at the end, replace the semicolon in line 1 with 
&&. Add the necessary environment variables like in the original 
definition of do-configure.

> 
> do-build:
> 	cd ${WRKSRC}; \
> 	${MAKE};
> 
> do-install:
> 	cd ${WRKSRC}; \
> 	${MAKE} install;

Why do you override these targets? They seems to do the same as the 
default ones, only a bit more stub-like.

Roland