From owner-svn-src-all@FreeBSD.ORG Mon Dec 28 00:51:00 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8871D1065696; Mon, 28 Dec 2009 00:51:00 +0000 (UTC) (envelope-from luigi@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 676808FC21; Mon, 28 Dec 2009 00:51:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nBS0p0ZW073214; Mon, 28 Dec 2009 00:51:00 GMT (envelope-from luigi@svn.freebsd.org) Received: (from luigi@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nBS0p0aq073212; Mon, 28 Dec 2009 00:51:00 GMT (envelope-from luigi@svn.freebsd.org) Message-Id: <200912280051.nBS0p0aq073212@svn.freebsd.org> From: Luigi Rizzo Date: Mon, 28 Dec 2009 00:51:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201072 - head/release/picobsd/build X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Dec 2009 00:51:00 -0000 Author: luigi Date: Mon Dec 28 00:51:00 2009 New Revision: 201072 URL: http://svn.freebsd.org/changeset/base/201072 Log: more support to import files and libraries from the host. Modified: head/release/picobsd/build/picobsd Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Mon Dec 28 00:42:42 2009 (r201071) +++ head/release/picobsd/build/picobsd Mon Dec 28 00:51:00 2009 (r201072) @@ -568,10 +568,17 @@ do_links() { # rootdir varname # find_progs is a helper function to locate the named programs # or libraries in ${o_objdir} or ${_SHLIBDIRPREFIX}, # and return the full pathnames. -# Sets ${u_progs} to the list of programs, and ${u_libs} +# Called as "find_progs [-L libpath] [-P binpath] prog1 prog2 ... " +# On return it sets ${u_progs} to the list of programs, and ${u_libs} # to the list of shared libraries used. +# +# '-L path' can be used to specify a search path for libraries +# (which searches in $path/lib:$path/usr/lib:$path/usr/local/lib +# '-P binpath' can be used to specify a search path for programs +# (which searches in a lot of places in the subtree) +# -L must be the first, followed by -P # -# You can use it e.g. in a local configuration file by writing +# You can use it e.g. in a local confign file by writing # # do_copyfiles_user() { # local dst=$1 @@ -580,41 +587,60 @@ do_links() { # rootdir varname # cp -p ${u_libs} ${dst}/lib # mkdir -p ${dst}/libexec # find_progs ld-elf.so.1 -# cp -p ${u_progs} ${dst}/libexec +# cp -p ${u_progs} ${dst}/libexec # ignore errors # } find_progs() { # programs local i + local oo=${o_objdir:-${_SHLIBDIRPREFIX}} # default objdir + local lp=$oo/lib # default lib.prefix + local o="" # additional objdir + if [ x"$1" = "x-L" -a -d "$2" ] ; then # set lib search path + o=$2; shift; shift + lp="$lp:$o/lib:$o/usr/lib:$o/usr/local/lib" + o="-P $o" + fi u_progs="`find_progs_helper $*`" - local o=${o_objdir:-${_SHLIBDIRPREFIX}} - log "looking for libs for $u_progs in $_SHLIBDIRPREFIX" + log "looking for libs for <$u_progs> in $lp" [ -z "${u_progs}" ] && return 1 # not found, error - i="`LD_LIBRARY_PATH=$o/lib ldd ${u_progs} | grep -v '^/' | awk '{print $1}' | sort | uniq`" - u_libs="`find_progs_helper $i`" + i="`( LD_LIBRARY_PATH=$lp ldd ${u_progs} ) | \ + grep -v '^/' | awk '{print $1}' | sort | uniq`" + u_libs="`find_progs_helper $o $i`" return 0 } find_progs_helper() { # programs + local dir=${o_objdir:-${_SHLIBDIRPREFIX}/..} + local ldir="" + if [ x"$1" = "x-P" -a -d "$2" ] ; then # set path + ldir=$2; shift; shift + fi local progs="$*" - local i o places names - local subdirs="bin sbin usr.bin usr.sbin libexec lib \ + local subdirs=". local/bin local/sbin local/lib local/libexec \ + bin sbin usr.bin usr.sbin libexec lib \ gnu/usr.bin gnu/lib \ secure/usr.bin secure/usr.sbin secure/libexec secure/lib" - names="" # files to search - o="" + local names="" # files to search + local o="" + local i for i in $progs ; do - # plain programs come out verbatim + # full pathnames are just listed [ -f "$i" ] && echo $i && continue names="${names} ${o} -name $i" o="-o" done [ -z "${names}" ] && return 0 - places="" # places to search - o=${o_objdir:-${_SHLIBDIRPREFIX}/..} + local places="" # places to search for i in $subdirs ; do - [ -d "${o}/${i}" ] && places="${places} ${o}/${i}" + [ -d "${dir}/${i}" ] && places="${places} ${dir}/${i}" done - find ${places} -type f \( ${names} \) + if [ -n "${ldir}" ] ; then + for i in $subdirs ; do + [ -d "${ldir}/${i}" ] && places="${places} ${ldir}/${i}" + done + fi + # use maxdepth 3 because some libs are way down + find ${places} -maxdepth 3 -type f \( ${names} \) } # Populate the memory filesystem with binaries and non-variable