From owner-freebsd-ports@FreeBSD.ORG Tue Nov 9 21:13:27 2010 Return-Path: Delivered-To: ports@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A0C90106564A; Tue, 9 Nov 2010 21:13:27 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [92.53.116.15]) by mx1.freebsd.org (Postfix) with ESMTP id 5BE148FC08; Tue, 9 Nov 2010 21:13:27 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.71) (envelope-from ) id 1PFuxT-0002uW-AX; Tue, 09 Nov 2010 23:38:23 +0300 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id ABA2BB84D; Tue, 9 Nov 2010 23:38:22 +0300 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id A09B5B844; Tue, 9 Nov 2010 23:38:22 +0300 (MSK) Date: Tue, 9 Nov 2010 23:38:22 +0300 From: Dmitry Marakasov To: Lev Serebryakov Message-ID: <20101109203822.GA67706@hades.panopticon> References: <241091055.20101109182834@serebryakov.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <241091055.20101109182834@serebryakov.spb.ru> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: ports@FreeBSD.org Subject: Re: Proper way to detect kernel / userland sources? X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Nov 2010 21:13:27 -0000 * Lev Serebryakov (lev@FreeBSD.org) wrote: > I'm preparing port which depends both on kernel source (it contains > kernel module) and userland sources (it needs GEOM sources). > > I see, that ports with kernel modules check for hardcoded > "/usr/src/sys/Makefile". But it doesn't look good: sources could be > perfectly valid, but placed in other directory! > > Is here any standerd variable which should be used instead of > hardcoded "/usr/src"? Oh, that reminded me. For now, there's no other way than to hardcode /usr/src (however some ports make that overridable). I've though of that too and made a patch that has been lying here for some time without purpose. As this topic is risen, I'd like to discuss it, possibly improve and push into Mk. http://people.freebsd.org/~amdmi3/USE_SRC.patch - Introduces SRC_BASE which defaults to /usr/src and may be used in ports to access system sources - Introduces USE_SRC (to be set in ports that require kernel source) that checks whether system sources are installed and whether their version corresponds to system version (overridable) - Corrects a typo While here, I'm worried about the fact that /usr/src is used as a possible source for OSVERSION. Currently, in presence of freebsd-update, it's really likely that system sources are out-of sync with installed system, so getting OSVERSION from /usr/src should likely be removed. osreldate is enough fallback if /usr/include/sys/param.h is absent for some reason. -- Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D amdmi3@amdmi3.ru ..: jabber: amdmi3@jabber.ru http://www.amdmi3.ru