From patchwork Wed Feb 5 13:04:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 2774 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D264760912 for ; Wed, 5 Feb 2020 14:04:26 +0100 (CET) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7B3664F8; Wed, 5 Feb 2020 14:04:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1580907866; bh=F62auJcz8x0tN8NLTtSNSGfS7N/7zl7eW81saD4rxN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MYfkVZYwxjs7O7GIdPKmOrHvTPQLsUHca6+7TxvXLYA+Ha4gGb2rRWTIYsAlgTkze /uJoz+3Nyk1p4vi1a6RCtLIWh0imS64KFxj6TtJzChKIRjoDVK6ivPeZdgi7JoQQ6N MwEKCmCHB3VvTloN2kzQ24+YR+YBQ45+NQZrzeWE= From: Kieran Bingham To: LibCamera Devel Date: Wed, 5 Feb 2020 13:04:19 +0000 Message-Id: <20200205130420.8736-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200205130420.8736-1-kieran.bingham@ideasonboard.com> References: <20200205130420.8736-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 4/5] libcamera: ipa_manager: Search the runpath for IPA libraries X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Feb 2020 13:04:27 -0000 Expose the IPA build path through the libcamera library runpath entry in the elf string table. Utilise this path to search for compiled IPA libraries when loading the IPAManager. The build time path is removed during the library install phase. Signed-off-by: Kieran Bingham --- src/libcamera/ipa_manager.cpp | 9 +++++++++ src/libcamera/meson.build | 1 + src/meson.build | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/src/libcamera/ipa_manager.cpp b/src/libcamera/ipa_manager.cpp index 24fe709108fe..3dfe84fcf95e 100644 --- a/src/libcamera/ipa_manager.cpp +++ b/src/libcamera/ipa_manager.cpp @@ -102,6 +102,15 @@ IPAManager::IPAManager() if (ret > 0) ipaCount += ret; + /* + * Utilise the Elf runpath to supply the IPA build directory, allowing + * us to load IPA's before they are installed for testing and + * development. + */ + const char *runpath = utils::get_runpath(); + if (runpath) + ipaCount += addPath(runpath, true); + const char *modulePaths = utils::secure_getenv("LIBCAMERA_IPA_MODULE_PATH"); if (!modulePaths) { if (!ipaCount) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 68d89559b290..87c5bbbb17a4 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -107,6 +107,7 @@ libcamera = shared_library('camera', install : true, link_with : libcamera_link_with, include_directories : includes, + build_rpath : ipa_build_path, dependencies : libcamera_deps) libcamera_dep = declare_dependency(sources : [libcamera_api, libcamera_ipa_api, libcamera_h], diff --git a/src/meson.build b/src/meson.build index 5adcd61fd913..42e1eb984ccd 100644 --- a/src/meson.build +++ b/src/meson.build @@ -2,6 +2,13 @@ if get_option('android') subdir('android') endif +# Provide libcamera with a reference to the current build for IPA +# loading. This allows IPAs to be successfully loaded when tests and +# applications are run from the build tree, but is stripped during the +# install phase, ensuring we maintain reproducible builds. + +ipa_build_path = join_paths(meson.current_build_dir(), 'ipa') + subdir('libcamera') subdir('ipa') subdir('cam')