From owner-freebsd-ports@FreeBSD.ORG Mon Nov 26 15:22:31 2012 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5A67FF35; Mon, 26 Nov 2012 15:22:31 +0000 (UTC) (envelope-from lifanov@mail.lifanov.com) Received: from mail.lifanov.com (mail.lifanov.com [206.125.175.12]) by mx1.freebsd.org (Postfix) with ESMTP id 3BBE68FC15; Mon, 26 Nov 2012 15:22:31 +0000 (UTC) Received: from [10.1.6.138] (cnet520-windstream.mcclatchyinteractive.com [166.108.16.2]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mail.lifanov.com (Postfix) with ESMTPSA id 10A3819E766; Mon, 26 Nov 2012 15:16:11 +0000 (UTC) Message-ID: <50B387BB.3000502@mail.lifanov.com> Date: Mon, 26 Nov 2012 10:16:11 -0500 From: Nikolai Lifanov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: freebsd-ports@freebsd.org Subject: Re: How to handle WITH_CLANG_IS_CC in ports References: <20121125114918.GA35966@oshi.local> <50B23382.3030600@FreeBSD.org> In-Reply-To: <50B23382.3030600@FreeBSD.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Tobias Rehbein , Dimitry Andric X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2012 15:22:31 -0000 On 11/25/2012 10:04 AM, Dimitry Andric wrote: > On 2012-11-25 12:49, Tobias Rehbein wrote: >> I am the maintainer of ganes/stonesoup. This port builds fine with gcc. >> It also builds with clang, if the MAKE_ARGS are tweaked. >> >> Currently I can check for >> >> ${CC:T:M*clang*} >> >> to know if I have to change the MAKE_ARGS for building with clang or >> not. >> >> In CURRENT cc is clang and the environment variable CC is no longer set. >> This lets the build of games/stonesoup fail. My question is how to >> correctly check if cc is clang or not. My first guess was something >> along the lines of >> >> ${CC:T:M*clang*} || (defined(WITH_CLANG_IS_CC) && ${CC:T:Mcc}) >> >> but I guess there is some kind of official way to handle this (ideally >> warpped in some Mk macro. > > Just check if OSVERSION >= 1000024, maybe? Or add some logic to > bsd.port.mk that handles this, like was done with pkgng. For example, > introducing a PORTS_COMPILER_TYPE macro like in base. This is bad. People with OSVERSION >= 1000024 and WITHOUT_CLANG_IS_CC set will be left out. How about something along the lines of this? bsd.compiler.mk: # # Sets CC variable if unset # .PHONY: setcc setcc: @if [ ! -z "`cc -v 2>&1|grep clang`" ] ; then \ CC?= clang; \ else \ CC?= gcc; \ fi Then, if a port needs this variable to be set, it can call "setcc" in the Makefile.