From owner-freebsd-ports@freebsd.org Wed Jun 29 00:43:45 2016 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE51EB8134B for ; Wed, 29 Jun 2016 00:43:45 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id DDD95205B for ; Wed, 29 Jun 2016 00:43:45 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id DCF69B81349; Wed, 29 Jun 2016 00:43:45 +0000 (UTC) Delivered-To: ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC974B81348 for ; Wed, 29 Jun 2016 00:43:45 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id D04A7205A; Wed, 29 Jun 2016 00:43:45 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from AlfredMacbookAir.local (unknown [IPv6:2601:645:8003:a4d6:d0d1:6b95:f41e:a128]) by elvis.mu.org (Postfix) with ESMTPSA id 75014346DE8D; Tue, 28 Jun 2016 17:43:44 -0700 (PDT) Subject: Re: best way to tune ports to add a CLFAGS entry To: Julian Elischer , "ports@FreeBSD.org" References: <7d454696-f910-7533-5757-74eb624f9315@freebsd.org> From: Alfred Perlstein Organization: FreeBSD Message-ID: <577319BF.5040403@freebsd.org> Date: Tue, 28 Jun 2016 17:43:43 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <7d454696-f910-7533-5757-74eb624f9315@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jun 2016 00:43:46 -0000 On 6/28/16 9:52 AM, Julian Elischer wrote: > At work I am doing various cross compiles in order to make a product > under freebsd that actually will run under a modified FreeBSD that > runs on an appliance. We want to get away from hand rolling everything > to leverage all teh work in getting ports working well on FreeBSD. > > We have some extra syscalls and some structures have different sizes, > so we need to compile/link agains an alternate set of > includes/libraries and not those in /usr/include or /usr/lib. > > Ideally I want to use the "--sysroot" and "-isystem" options to the > compiler/linker or failing that, add a -I or -L entries to make it > look at the correct includes and libraries, not those in the base system. > > > In many ports CFLAGS etc. are sent in via the arguments to ./configure > or environment vars, but there are many other ports that have other > ways to specify these. > > Does the ports framework have any standard way to do this? > LDEXTRA_ARGS or EXTRA_CFLAGS or similar? > > I've looked around and can't really see anything. Best would be a > single file to which I could add these things but adding them to the > environment would also work. > > yours in ports ignorance.. Sounds like a decent idea to override includedirs, but I wouldn't trust it. :) Why not do what NANOBSD/FreeNAS do and compile inside a chroot (or even VM) with the proper includes and such installed? It sounds like a big sledgehammer to use a chroot or a VM, but in reality it's MUCH safer than some port accidentally pulling something from the wrong /usr/include and then you spending hours, days, etc tracking it down. Trust me, I've seen the fallout and it's NOT FUN!!! For FreeNAS we made it so that you could run the FreeNAS OS (trueos) as the actual build server and that saved us a huge number of headaches. If you're very, very against the idea of VM or chroot then you could just make /usr/include actually contain YOUR includes as you probably shouldn't need them otherwise on a build server. -Alfred -Alfred