.endif
_gcc41_cross= gnu/usr.bin/cc41
_gcc41_tools= gnu/usr.bin/cc41/cc_prep gnu/usr.bin/cc41/cc_tools
+_custom_cross= libexec/customcc
_binutils= gnu/usr.bin/binutils217
.if exists(${.CURDIR}/kerberos5) && exists(${.CURDIR}/crypto) && \
cross-tools:
.for _tool in ${_btxld} ${_binutils} \
usr.bin/objformat usr.bin/crunch/crunchide \
- ${_gcc34_cross} ${_gcc41_cross}
+ ${_gcc34_cross} ${_gcc41_cross} ${_custom_cross}
${ECHODIR} "===> ${_tool} (cross-tools)"; \
cd ${.CURDIR}/${_tool}; \
${MAKE} DIRPRFX=${_tool}/ obj; \
#
BIN2= pccard_ether rc.firewall rc.suspend rc.resume
-DEFAULTS= rc.conf make.conf periodic.conf uuids
+DEFAULTS= compilers.conf make.conf periodic.conf rc.conf uuids
MTREE= BSD.include.dist BSD.local.dist BSD.root.dist BSD.usr.dist \
BSD.var.dist
--- /dev/null
+# clang from SVN trunk
+clang_CC=/usr/local/bin/clang
+clang_CFLAGS="-fno-color-diagnostics -std=gnu89"
+clang_VERSION=4.1.2
+
+# gcc44 from pkgsrc
+gcc44_CC=/usr/pkg/gcc44/bin/cc
+gcc44_CXX=/usr/pkg/gcc44/bin/c++
+gcc44_CPP=/usr/pkg/gcc44/bin/cpp
elf
..
..
+ custom
+ ..
gcc34
..
gcc41
SUBDIR= atrun \
bootpd \
comsat \
+ customcc \
dma \
fingerd \
ftpd \
--- /dev/null
+SCRIPTS= cc
+SCRIPTSDIR= /usr/libexec/custom
+SYMLINKS= cc ${SCRIPTSDIR}/cpp \
+ cc ${SCRIPTSDIR}/c++ \
+ cc ${SCRIPTSDIR}/gcc \
+ cc ${SCRIPTSDIR}/g++
+CLEANFILES= cc
+NOMAN=
+
+beforeinstall:
+ sed "s#@@PREFIX2@@#${USRDATA_PREFIX}/usr#g" ${.CURDIR}/cc.sh >cc
+
+.include <bsd.prog.mk>
--- /dev/null
+#!/bin/sh
+
+CDIR=$(dirname $0)
+CNAME=$(basename $0)
+
+# XXX clang needs some special handling
+#
+# it is called only for "cc" and "gcc" and even then it could have been
+# run on c++ files
+#
+if [ "${CCVER}" = "clang" ]; then
+ if [ "${CNAME}" = "cpp" ]; then
+ exec ${CDIR}/../gcc41/cpp "$@"
+ elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
+ exec ${CDIR}/../gcc41/c++ "$@"
+ elif [ -z $beenhere ]; then
+ export beenhere=1
+ oldargs="$@"
+ export oldargs
+ INCOPT="-isystem @@PREFIX2@@/include \
+ -isystem @@PREFIX2@@/libdata/gcc41"
+ elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
+ exec ${CDIR}/../gcc41/cc $oldargs
+ fi
+fi
+
+. /etc/defaults/compilers.conf
+[ -f /etc/compilers.conf ] && . /etc/compilers.conf
+
+CUSTOM_CC=`eval echo \$\{${CCVER}_CC\}`
+CUSTOM_CFLAGS=`eval echo \$\{${CCVER}_CFLAGS\}`
+CUSTOM_CXX=`eval echo \$\{${CCVER}_CXX\}`
+CUSTOM_CXXFLAGS=`eval echo \$\{${CCVER}_CXXFLAGS\}`
+CUSTOM_CPP=`eval echo \$\{${CCVER}_CPP\}`
+CUSTOM_CPPFLAGS=`eval echo \$\{${CCVER}_CPPFLAGS\}`
+CUSTOM_VERSION=`eval echo \$\{${CCVER}_VERSION\}`
+
+if [ "${CUSTOM_VERSION}" != "" -a "$1" = "-dumpversion" ]; then
+ echo ${CUSTOM_VERSION}
+elif [ "${CNAME}" = "cc" -o "${CNAME}" = "gcc" ]; then
+ exec ${CUSTOM_CC} ${INCOPT} ${CUSTOM_CFLAGS} "$@"
+elif [ "${CNAME}" = "c++" -o "${CNAME}" = "g++" ]; then
+ exec ${CUSTOM_CXX} ${INCOPT} ${CUSTOM_CXXFLAGS} "$@"
+elif [ "${CNAME}" = "cpp" ]; then
+ exec ${CUSTOM_CPP} ${INCOPT} ${CUSTOM_CPPFLAGS} "$@"
+else
+ echo "unknown compiler ${CNAME}"
+ exit 1
+fi
amd.map - configuration file for amd(8)
apmd.conf - configuration file for apmd(8)
auth.conf - authentication capability database
+compilers.conf - configuration for non-base compilers
crontab - system scheduled command table
csh.cshrc - system-wide .cshrc for csh(1)
csh.login - system-wide .login for csh(1)
#MISSING: dump.5 plot.5
MAN= acct.5 \
a.out.5 \
+ compilers.conf.5 \
core.5 \
devices.conf.5 \
dir.5 \
--- /dev/null
+.\"
+.\" Copyright (c) 2009
+.\" The DragonFly Project. All rights reserved.
+.\"
+.\" 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. Neither the name of The DragonFly Project 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 COPYRIGHT HOLDERS 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
+.\" COPYRIGHT HOLDERS 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.
+.\"
+.Dd July 3, 2009
+.Os
+.Dt COMPILERS.CONF 5
+.Sh NAME
+.Nm compilers.conf
+.Nd configuration file for external compilers
+.Sh SYNOPSIS
+.Pa /etc/compilers.conf
+.Sh DESCRIPTION
+The
+.Nm
+file allows to configure
+.Dq external
+compilers for usage with the
+.Dx
+.Xr build 7
+system.
+.Pp
+The
+.Pa /etc/defaults/compilers.conf
+file specifies the default settings for all variables, the
+.Pa /etc/compilers.conf
+file specifies override settings.
+.Pp
+The following variables are available:
+.Bl -tag -width ".Va <version>_CPPFLAGS"
+.It Va <version>_CC
+The pathname of the
+.Nm cc
+program of the compiler.
+.It Va <version>_CFLAGS
+Any additional flags to pass to
+.Va <version>_CC .
+.It Va <version>_CPP
+The pathname of the
+.Nm cpp
+program of the compiler.
+.It Va <version>_CPPFLAGS
+Any additional flags to pass to
+.Va <version>_CPP .
+.It Va <version>_CXX
+The pathname of the
+.Nm c++
+program of the compiler.
+.It Va <version>_CXXFLAGS
+Any additional flags to pass to
+.Va <version>_CXX .
+.It Va <version>_VERSION
+What to output when the
+.Fl dumpversion
+option is used.
+This helps
+.Nm clang
+with
+.Xr pkgsrc 7 .
+.El
+.Pp
+Once configured the compiler can then be used like this:
+.Bd -literal -offset indent
+cd /usr/pkgsrc/wip/gcc44
+[build and install gcc44]
+cd /usr/src
+env WORLD_CCVER=gcc44 make buildworld
+.Ed
+.Pp
+Defaults are provided for
+.Nm clang
+(installed from SVN trunk)
+and
+.Nm gcc44
+(installed from
+.Pa pkgsrc/wip ) .
+.Sh FILES
+.Bl -tag -width ".Pa /etc/compilers.conf" -compact
+.It Pa /etc/compilers.conf
+external compiler configuration file
+.El
+.Sh SEE ALSO
+.Xr objformat 1 ,
+.Xr build 7
+.Sh HISTORY
+The
+.Nm
+file first appeared in
+.Dx 2.3 .
# @(#)Makefile 8.1 (Berkeley) 6/8/93
FILES= bsd.README
-FILES+= bsd.cpu.mk bsd.cpu.gcc34.mk bsd.cpu.gcc41.mk
+FILES+= bsd.cpu.mk bsd.cpu.gcc34.mk bsd.cpu.gcc41.mk bsd.cpu.custom.mk
FILES+= bsd.dep.mk bsd.doc.mk bsd.files.mk bsd.patch.mk
FILES+= bsd.incs.mk bsd.info.mk bsd.init.mk
FILES+= bsd.kmod.mk bsd.hostlib.mk
--- /dev/null
+# Set default CPU compile flags for custom compilers. Not much to see here.
+
+. if ${MACHINE_ARCH} == "i386"
+MACHINE_CPU = i486
+. elif ${MACHINE_ARCH} == "amd64"
+MACHINE_CPU = amd64 sse2 sse
+. endif
CCVER ?= gcc41
_CCVER := ${CCVER}
+.if ${_CCVER} == "gcc34" || ${_CCVER} == "gcc41"
.if exists(/usr/libexec/${_CCVER}/cc)
HOST_CCVER?= ${_CCVER}
.else
HOST_CCVER?= gcc34
.endif
+.else
+.if exists(/usr/libexec/custom/cc)
+HOST_CCVER?= ${CCVER}
+.else
+HOST_CCVER?= gcc34
+.endif
+.endif
.if ${CCVER} == "gcc34"
. include <bsd.cpu.gcc34.mk>
. include "${CCVER_BSD_CPU_MK}"
. endif
.else
-.error "Either set CCVER to a known compiler or specify CCVER_BSD_CPU_MK"
+. include <bsd.cpu.custom.mk>
.endif
# /usr/bin/cc depend on the CCVER environment variable, make sure CCVER is
asprintf(&newcmd, "%s%s/%s/%s/%s",
chunk, base_path, env_value, objformat, cmd);
} else {
- asprintf(&newcmd, "%s%s/%s/%s",
- chunk, base_path, env_value, cmd);
+ if (strncmp(env_value, "gcc34", 5) != 0 &&
+ strncmp(env_value, "gcc41", 5) != 0) {
+ asprintf(&newcmd, "%s%s/custom/%s",
+ chunk, base_path, cmd);
+ } else {
+ asprintf(&newcmd, "%s%s/%s/%s",
+ chunk, base_path, env_value, cmd);
+ }
}
if (newcmd == NULL)
err(1, "cannot allocate memory");