From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-qg0-f48.google.com ([209.85.192.48]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1XZCBm-0003aG-1n for ptxdist@pengutronix.de; Wed, 01 Oct 2014 07:11:00 +0200 Received: by mail-qg0-f48.google.com with SMTP id i50so61318qgf.35 for ; Tue, 30 Sep 2014 22:10:06 -0700 (PDT) From: jon@ringle.org Date: Wed, 1 Oct 2014 01:09:56 -0400 Message-Id: <1412140197-32021-1-git-send-email-jon@ringle.org> Subject: [ptxdist] [PATCH v3 1/2] install_dir: Allow one to specify an alternate root dir Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de Cc: Jon Ringle From: Jon Ringle This is useful if you install a package to /opt and libs are in /opt/lib: $(call install_lib, foo, 0, 0, 0644, libfoo, /opt) Signed-off-by: Jon Ringle --- rules/post/install.make | 4 +++- scripts/lib/ptxd_make_xpkg_pkg.sh | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/rules/post/install.make b/rules/post/install.make index d57e5dd..2ff9f40 100644 --- a/rules/post/install.make +++ b/rules/post/install.make @@ -231,6 +231,7 @@ install_package = \ # $3: GID # $4: permissions (octal) # $5: library name without suffix. +# $6: optional root dir # install_lib = \ XPKG=$(subst _,-,$(strip $(1))); \ @@ -238,8 +239,9 @@ install_lib = \ GRP="$(strip $(3))"; \ PER="$(strip $(4))"; \ LIB=$(strip $(5)); \ + DST=$(strip $(6)); \ $(call install_check, install_lib); \ - echo "ptxd_install_lib '$$LIB' '$$OWN' '$$GRP' '$$PER'" >> "$(STATEDIR)/$$XPKG.cmds" + echo "ptxd_install_lib '$$LIB' '$$DST' '$$OWN' '$$GRP' '$$PER'" >> "$(STATEDIR)/$$XPKG.cmds" # # install_replace diff --git a/scripts/lib/ptxd_make_xpkg_pkg.sh b/scripts/lib/ptxd_make_xpkg_pkg.sh index 86196a2..5c5ce67 100644 --- a/scripts/lib/ptxd_make_xpkg_pkg.sh +++ b/scripts/lib/ptxd_make_xpkg_pkg.sh @@ -744,9 +744,18 @@ export -f ptxd_install_shared ptxd_install_lib() { local lib_dir=$(ptxd_get_lib_dir) local lib="$1" - shift + local root_dir="${2}" + shift 2 + + if [ -n "${root_dir}" ]; then + root_dir="${root_dir%/}" + + if [[ "${root_dir}" != /* ]]; then + ptxd_install_error "ptxd_lib_install: root_dir '${root_dir}' must be absolute" + fi + fi - local file="$(for dir in "${pkg_pkg_dir}/"{,usr/}${lib_dir}; do + local file="$(for dir in "${pkg_pkg_dir}"${root_dir}{/,/usr/}${lib_dir}; do find "${dir}" -type f -path "${dir}/${lib}.so*"; done 2>/dev/null)" if [ ! -f "${file}" ]; then -- 1.8.5.4 -- ptxdist mailing list ptxdist@pengutronix.de