From owner-freebsd-hackers@freebsd.org Wed Mar 28 14:39:19 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63F32F64372 for ; Wed, 28 Mar 2018 14:39:19 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1b.ore.mailhop.org (outbound1b.ore.mailhop.org [54.200.247.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E940D6E7A4 for ; Wed, 28 Mar 2018 14:39:18 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: afd605aa-3295-11e8-bb8e-b35b57339d60 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound1.ore.mailhop.org (Halon) with ESMTPSA id afd605aa-3295-11e8-bb8e-b35b57339d60; Wed, 28 Mar 2018 14:38:32 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w2SEd9O9063978; Wed, 28 Mar 2018 08:39:10 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1522247949.49673.54.camel@freebsd.org> Subject: Re: how to add local changes to buildworld? From: Ian Lepore To: Daniel Braniss Cc: freebsd-hackers@freebsd.org Date: Wed, 28 Mar 2018 08:39:09 -0600 In-Reply-To: <539E3F8D-8275-4904-8D19-8FB31C05787C@cs.huji.ac.il> References: <1522169225.49673.36.camel@freebsd.org> <539E3F8D-8275-4904-8D19-8FB31C05787C@cs.huji.ac.il> Content-Type: multipart/mixed; boundary="=-HE4N3m0OyjMXI39S+Zrl" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Mar 2018 14:39:19 -0000 --=-HE4N3m0OyjMXI39S+Zrl Content-Type: text/plain; charset="iso-8859-7" Content-Transfer-Encoding: 8bit On Wed, 2018-03-28 at 08:50 +0300, Daniel Braniss wrote: > > > > > On 27 Mar 2018, at 19:47, Ian Lepore wrote: > > > > On Tue, 2018-03-27 at 19:20 +0300, Daniel Braniss wrote: > > > > > > Hi, > > > I have some local additions which int the past, after making changes > > > to some Makefiles, etc, I got them compiled > > > but somehow, things stopped working after 11, so I¢m now trying to do > > > a fresh set of patches, > > > and was wondering if there is some docs around on how to to this > > > cleanly? trying to figure out the *.mk is becoming a bit complicated. > > > thanks, > > > danny > > > > > If you're asking what I think (you want to add code of your own into > > the buildworld), just add LOCAL_DIRS="path/to/dir1 path/to/dir2" to the > > buildworld command line and it will visit your directories and run the > > same targets there as for standard freebsd dirs (so your makefiles have > > to have those targets, mostly easily accomplished by including the > > usual bsd..mk where foo=prog|lib|subdir|whatever. > > > > The local dir paths in LOCAL_DIRS must be relative to the top-level > > freebsd source dir, you can't use absolute paths (but you can use > > relative paths that take you outside the freebsd path, I think, like > > ../mysources/project1). > > > > -- Ian > > > I guess in my haste I was not clear enough :-) > my problem is the dependency, > in particular, it¢s a pam module, that needs a local library. in the past the library was compiled first, and then the module, > now it still happens, but the module does not find the library, which has been compiled! there is a new piece of mail that > i¢m missing :-(  > i¢ll try again with LOCAL_DIRS. > thanks > danny Oh yeah, libraries... there is also a LOCAL_LIB_DIRS you can set to list libraries.  But looking at Makefile.inc1 it builds the local lib dirs after the other local dirs, which seems completely wrong and useless.  I think the LOCAL_LIB_DIRS should be built along with the base system dirs; the attached patch would do that. -- Ian --=-HE4N3m0OyjMXI39S+Zrl Content-Disposition: inline; filename="Makefile.inc1.locallibs_first.diff" Content-Type: text/x-patch; name="Makefile.inc1.locallibs_first.diff"; charset="ASCII" Content-Transfer-Encoding: 7bit Index: Makefile.inc1 =================================================================== --- Makefile.inc1 (revision 331499) +++ Makefile.inc1 (working copy) @@ -241,6 +241,17 @@ X${BINUTIL}?= ${${BINUTIL}} SUBDIR= ${SUBDIR_OVERRIDE} .else SUBDIR= lib libexec +# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR +# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and +# LOCAL_LIB_DIRS=foo/lib to behave as expected. +.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} +_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} +.endfor +.for _DIR in ${LOCAL_LIB_DIRS} +.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) +SUBDIR+= ${_DIR} +.endif +.endfor .if !defined(NO_ROOT) && (make(installworld) || make(install)) # Ensure libraries are installed before progressing. SUBDIR+=.WAIT @@ -282,17 +293,6 @@ SUBDIR+=contrib/ofed SUBDIR+= ${_DIR} .endif .endfor -# Add LOCAL_LIB_DIRS, but only if they will not be picked up as a SUBDIR -# of a LOCAL_DIRS directory. This allows LOCAL_DIRS=foo and -# LOCAL_LIB_DIRS=foo/lib to behave as expected. -.for _DIR in ${LOCAL_DIRS:M*/} ${LOCAL_DIRS:N*/:S|$|/|} -_REDUNDANT_LIB_DIRS+= ${LOCAL_LIB_DIRS:M${_DIR}*} -.endfor -.for _DIR in ${LOCAL_LIB_DIRS} -.if ${_DIR} == ".WAIT" || (empty(_REDUNDANT_LIB_DIRS:M${_DIR}) && exists(${.CURDIR}/${_DIR}/Makefile)) -SUBDIR+= ${_DIR} -.endif -.endfor # We must do etc/ last as it hooks into building the man whatis file # by calling 'makedb' in share/man. This is only relevant for --=-HE4N3m0OyjMXI39S+Zrl--