From owner-freebsd-ports@FreeBSD.ORG Wed Mar 11 18:03:18 2015 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16516F1C; Wed, 11 Mar 2015 18:03:18 +0000 (UTC) Received: from gw.catspoiler.org (cl-1657.chi-02.us.sixxs.net [IPv6:2001:4978:f:678::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98AE13E4; Wed, 11 Mar 2015 18:03:17 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id t2BI37Q0092119; Wed, 11 Mar 2015 10:03:11 -0800 (PST) (envelope-from truckman@FreeBSD.org) Message-Id: <201503111803.t2BI37Q0092119@gw.catspoiler.org> Date: Wed, 11 Mar 2015 11:03:07 -0700 (PDT) From: Don Lewis Subject: Re: possible to adjust OPTIONS_DEFAULT based on COMPILER_TYPE? To: mat@FreeBSD.org In-Reply-To: MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii Cc: ports@FreeBSD.org X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Mar 2015 18:03:18 -0000 On 11 Mar, Mathieu Arnold wrote: > +--On 10 mars 2015 16:30:35 -0700 Don Lewis wrote: > | I've run into a situation where I'd like to change OPTIONS_DEFAULT based > | on the value of the value of COMPILER_TYPE. I'm setting USE_GCC=yes. If > | the base compiler is gcc, then I can enable a particular option to make > | the port more featureful. If the base compiler is clang, then some of > | the other ports the option depends on are C++ code that gets compiled > | with clang and the port breaks because of the libstdc++ vs. libc++ > | conflict. In that case, I'd like to disable the option to at least have > | working binary packages available, even though they aren't as > | featureful. > | > | This doesn't look possible, though. OPTIONS_DEFAULT needs to be set > | before the .include , and COMPILER_TYPE isn't set > | until after that, or possibly even after bsd.port.pre.mk. > > Mmmm, yes, you're kinda stuck, I've already had a look, and it's not > possible to have options working including port.options and also be able to > change stuff after it. > > Though, USE_GCC=yes will never use the old base gcc, but always lang/gcc > (well, the one defined in bsd.default-versions, which if left alone is > lang/gcc), USE_GCC=any will use gcc from base though, but I'm not sure you > can have a good reason to use it. At present, I always need to compile with gcc from ports, which is why I use USE_GCC=yes. On systems where clang is the base compiler, many ports with C++ code will use clang as their compiler and I need to avoid bringing in any of those because they will drag in libc++, which conflicts with libstdc++ that we use when compiling with gcc. One of the options for this port (that I want to enable by default) brings in one of those libraries, so I want to disable that option by default. I've come up with a workaround. Basically I'm duplicating the code from /usr/ports/Mk/Uses/compiler.mk that sets COMPILER_TYPE and adding it to Makefile before the OPTIONS stuff. Portlint -a whines about the !=, but I can live with that since this is hopefully a short term fix until I can get the port converted to build with clang.