pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk add initial support for IBM's XL C/C++ compiler. te...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e7b650f13473
branches:  trunk
changeset: 481522:e7b650f13473
user:      grant <grant%pkgsrc.org@localhost>
date:      Wed Oct 06 09:49:53 2004 +0000

description:
add initial support for IBM's XL C/C++ compiler. tested with version
6.0 on Mac OS X 10.3.5.

to use XL C, set PKGSRC_COMPILER=xlc in mk.conf. XLCBASE defaults to
/opt/ibmcmp/vacpp/6.0 (the default installation location on OS X),
this can be overridden in mk.conf too.

this is a work in progress - some simple packages can be built, but
there are still lots of issues that need to be worked through.

diffstat:

 mk/compiler.mk              |   5 ++-
 mk/compiler/xlc.mk          |  62 +++++++++++++++++++++++++++++++++++++++++++++
 mk/defs.Darwin.mk           |   4 ++-
 mk/wrapper/bsd.wrapper.mk   |  16 ++++++++++-
 mk/wrapper/transform-xlc-cc |  60 +++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 143 insertions(+), 4 deletions(-)

diffs (212 lines):

diff -r 1d7046ab2c35 -r e7b650f13473 mk/compiler.mk
--- a/mk/compiler.mk    Wed Oct 06 09:36:36 2004 +0000
+++ b/mk/compiler.mk    Wed Oct 06 09:49:53 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: compiler.mk,v 1.35 2004/09/21 15:01:39 jlam Exp $
+# $NetBSD: compiler.mk,v 1.36 2004/10/06 09:49:53 grant Exp $
 #
 # This Makefile fragment implements handling for supported C/C++/Fortran
 # compilers.
@@ -17,6 +17,7 @@
 #              mipspro-ucode   Silicon Graphics, Inc. MIPSpro (o32)
 #              sunpro          Sun Microsystems, Inc. WorkShip/Forte/Sun
 #                              ONE Studio
+#              xlc             IBM's XL C/C++ compiler suite
 #
 #      The default is "gcc".  You can use ccache and/or distcc with an
 #      appropriate PKGSRC_COMPILER setting, e.g. "ccache distcc gcc".
@@ -88,7 +89,7 @@
 _USE_PKGSRC_GCC=       yes
 .endif
 
-_COMPILERS=            gcc mipspro mipspro-ucode sunpro
+_COMPILERS=            gcc mipspro mipspro-ucode sunpro xlc
 _PSEUDO_COMPILERS=     ccache distcc
 
 .if defined(NOT_FOR_COMPILER) && !empty(NOT_FOR_COMPILER)
diff -r 1d7046ab2c35 -r e7b650f13473 mk/compiler/xlc.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/compiler/xlc.mk        Wed Oct 06 09:49:53 2004 +0000
@@ -0,0 +1,62 @@
+# $NetBSD: xlc.mk,v 1.1 2004/10/06 09:49:53 grant Exp $
+
+.if !defined(COMPILER_XLC_MK)
+COMPILER_XLC_MK=       defined
+
+.include "../../mk/bsd.prefs.mk"
+
+XLCBASE?=      /opt/ibmcmp/vacpp/6.0
+
+# LANGUAGES.<compiler> is the list of supported languages by the compiler.
+# _LANGUAGES.<compiler> is ${LANGUAGES.<compiler>} restricted to the ones
+# requested by the package in USE_LANGUAGES.
+#
+LANGUAGES.xlc= c c++
+_LANGUAGES.xlc=        # empty
+.for _lang_ in ${USE_LANGUAGES}
+_LANGUAGES.xlc+=       ${LANGUAGES.xlc:M${_lang_}}
+.endfor
+
+_XLC_DIR=      ${WRKDIR}/.xlc
+_XLC_LINKS=    # empty
+.if exists(${XLCBASE}/bin/cc)
+_XLC_CC=       ${_XLC_DIR}/bin/cc
+_XLC_LINKS+=   _XLC_CC
+PKG_CC=                ${_XLC_CC}
+CC=            ${PKG_CC:T}
+.endif
+.if exists(${XLCBASE}/bin/xlc++)
+_XLC_CXX=      ${_XLC_DIR}/bin/xlc++
+_XLC_LINKS+=   _XLC_CXX
+PKG_CXX=       ${_XLC_CXX}
+CXX=           ${PKG_CXX:T}
+.endif
+
+.if exists(${XLCBASE}/bin/cc)
+CC_VERSION_STRING!=    ${XLCBASE}/bin/cc -V 2>&1 | ${GREP} 'IBM XL C.*for' | ${SED} -e 's/^ *//' || ${TRUE}
+CC_VERSION=            ${CC_VERSION_STRING}
+.else
+CC_VERSION_STRING?=    ${CC_VERSION}
+CC_VERSION?=           IBM XL C
+.endif
+
+# Prepend the path to the compiler to the PATH.
+.if !empty(_LANGUAGES.xlc)
+PREPEND_PATH+= ${_XLC_DIR}/bin
+.endif
+
+# Create compiler driver scripts in ${WRKDIR}.
+.for _target_ in ${_XLC_LINKS}
+.  if !target(${${_target_}})
+override-tools: ${${_target_}}        
+${${_target_}}:
+       ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       (${ECHO} '#!${TOOLS_SHELL}';                                    \
+        ${ECHO} 'exec ${XLCBASE}/bin/${${_target_}:T} "$$@"';  \
+       ) > ${.TARGET}
+       ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+.  endif
+.endfor
+
+.endif # COMPILER_XLC_MK
diff -r 1d7046ab2c35 -r e7b650f13473 mk/defs.Darwin.mk
--- a/mk/defs.Darwin.mk Wed Oct 06 09:36:36 2004 +0000
+++ b/mk/defs.Darwin.mk Wed Oct 06 09:49:53 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: defs.Darwin.mk,v 1.81 2004/10/03 00:13:01 tv Exp $
+# $NetBSD: defs.Darwin.mk,v 1.82 2004/10/06 09:49:53 grant Exp $
 #
 # Variable definitions for the Darwin operating system.
 
@@ -84,7 +84,9 @@
 WC?=           /usr/bin/wc
 XARGS?=                /usr/bin/xargs
 
+.if !defined(PKGSRC_COMPILER) || !empty(PKGSRC_COMPILER:Mgcc)
 CPP_PRECOMP_FLAGS?=    -no-cpp-precomp # use the GNU cpp, not the OS X cpp
+.endif
 DEF_UMASK?=            0022
 DEFAULT_SERIAL_DEVICE?=        /dev/null
 EXPORT_SYMBOLS_LDFLAGS?=       # Don't add symbols to the dynamic symbol table
diff -r 1d7046ab2c35 -r e7b650f13473 mk/wrapper/bsd.wrapper.mk
--- a/mk/wrapper/bsd.wrapper.mk Wed Oct 06 09:36:36 2004 +0000
+++ b/mk/wrapper/bsd.wrapper.mk Wed Oct 06 09:49:53 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.wrapper.mk,v 1.6 2004/10/04 20:28:30 jlam Exp $
+# $NetBSD: bsd.wrapper.mk,v 1.7 2004/10/06 09:49:53 grant Exp $
 #
 # Copyright (c) 2004 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -240,6 +240,13 @@
 _WRAP_TRANSFORM.CXX=   ${_WRAP_TRANSFORM.CC}
 .endif
 
+.if !empty(PKGSRC_COMPILER:Mxlc)
+_WRAP_CACHE_BODY.CC=   ${WRAPPER_TMPDIR}/cache-body-xlc-cc
+_WRAP_TRANSFORM.CC=    ${WRAPPER_TMPDIR}/transform-xlc-cc
+_WRAP_CACHE_BODY.CXX=  ${_WRAP_CACHE_BODY.CC}
+_WRAP_TRANSFORM.CXX=   ${_WRAP_TRANSFORM.CC}
+.endif
+
 _WRAP_CMD_SINK.LD=             ${WRAPPER_TMPDIR}/cmd-sink-ld
 _WRAP_TRANSFORM_SED.IMAKE=     # empty
 
@@ -423,6 +430,13 @@
        ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC}                    \
                | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
 
+${WRAPPER_TMPDIR}/transform-xlc-cc:                                    \
+               ${WRAPPER_SRCDIR}/transform-xlc-cc
+       ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+       ${_PKG_SILENT}${_PKG_DEBUG}${CAT} ${.ALLSRC}                    \
+               | ${_WRAP_SH_CRUNCH_FILTER} > ${.TARGET}
+
+
 .if !target(${_WRAP_GEN_REORDER})
 ${_WRAP_GEN_REORDER}:                                                  \
                ${_WRAP_SHELL_LIB}                                      \
diff -r 1d7046ab2c35 -r e7b650f13473 mk/wrapper/transform-xlc-cc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/wrapper/transform-xlc-cc       Wed Oct 06 09:49:53 2004 +0000
@@ -0,0 +1,60 @@
+# $NetBSD: transform-xlc-cc,v 1.1 2004/10/06 09:49:53 grant Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#        This product includes software developed by the NetBSD
+#        Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+#    contributors may be used to endorse or promote products derived
+#    from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+case $arg in
+######################################################################
+# Leave -Wl,-R unchanged.
+######################################################################
+-Wl,-R*)
+       ;;
+######################################################################
+# XL C doens't understand many -W* arguments, so just silently ignore
+# them all.
+######################################################################
+-W*)
+       arg=
+       msg_log $wrapperlog "   (transform-xlc-cc) to: $arg"
+       addtocache=yes
+       ;;
+######################################################################
+# Ignore some flags that are unnecessary for XL C.
+######################################################################
+-pipe|-ansi|-fno-common|-fno-gnu-keywords|-fstrict-prototypes|-no-cpp-precomp|-pedantic)
+       arg=
+       msg_log $wrapperlog "   (transform-xlc-cc) to: $arg"
+       addtocache=yes
+       ;;
+esac



Home | Main Index | Thread Index | Old Index