Subject: devel/nbitools needs to set compiler flags
To: None <tech-pkg@netbsd.org>
From: Idar Tollefsen <idart@performancedesign.no>
List: tech-pkg
Date: 07/25/2005 13:39:25
This is a multi-part message in MIME format.
--------------080604020002090604070005
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

devel/nbitools needs to set compiler flags from mk.conf. It needs to do so in 
order to facilitate building a 64-bit version on such architectures as SPARC and 
AMD. Especially important since other packages built with nbitools uses the same 
compiler flags (inputmethod/canna-lib for one).

I've attached a suggested patch against nbitools' Makefile, incorporating and 
expanding the patch suggested in pkg/30341. Note that the SunPro major version 
is hard coded, witch is of course not acceptable. I just wasn't sure what the 
right way to retrieve it would be. I also don't know for sure if the variables 
used to set the compiler flags are the correct once, or the only once. This is 
therefore more of a hint as to where and how these flags might be set.

--------------080604020002090604070005
Content-Type: text/plain;
 name="Makefile.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Makefile.diff"

--- ../nbitools.orig/Makefile	Sun May 22 22:07:53 2005
+++ Makefile	Mon Jul 25 13:34:19 2005
@@ -19,6 +19,8 @@
 
 .include "../../mk/bsd.prefs.mk"
 
+MAKE_ENV+=	BOOTSTRAPCFLAGS="${CFLAGS} ${LDFLAGS}"
+
 .if ${OPSYS} == "Linux"
 USE_TOOLS+=	gmake
 .endif
@@ -27,5 +29,23 @@
 	@${MV} ${WRKSRC}/config/cf/site.def ${WRKSRC}/config/cf/site.def.orig
 	@${SED} -e 's|^\(\#define[ \t]*ProjectRoot\).*|\1 ${PREFIX}|' \
 		${WRKSRC}/config/cf/site.def.orig > ${WRKSRC}/config/cf/site.def
+post-configure:
+	@${ECHO} "#define CcCmd ${CC}"  >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define CplusplusCmd ${CXX}" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define CplusplusIncludes" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define LdCmd ${LD}"  >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define DefaultCCOptions ${CFLAGS} ${LDFLAGS}"  >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define DefaultCplusplusOptions ${CXXFLAGS} ${LDFLAGS}"  >> ${WRKSRC}/config/cf/host.def
+.if ${OPSYS} == "SunOS"
+.  if ${PKGSRC_COMPILER} == "gcc"
+	@${ECHO} "#define HasSunC NO" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define HasGcc2 YES" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define HasSunCplusplus NO" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define HasGcc2ForCplusplus YES" >> ${WRKSRC}/config/cf/host.def
+.  elif ${PKGSRC_COMPILER} == "sunpro"
+	@${ECHO} "#define CCompilerMajorVersion 5" >> ${WRKSRC}/config/cf/host.def
+	@${ECHO} "#define CplusplusCompilerMajorVersion 5" >> ${WRKSRC}/config/cf/host.def
+.  endif
+.endif
 
 .include "../../mk/bsd.pkg.mk"

--------------080604020002090604070005--