From patchwork Wed Mar 18 11:58:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3166 Return-Path: Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 89DDA60419 for ; Wed, 18 Mar 2020 12:59:29 +0100 (CET) Received: by mail-pg1-x544.google.com with SMTP id m5so13571828pgg.0 for ; Wed, 18 Mar 2020 04:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=es-iitr-ac-in.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=S9PynKcuJpQuOHFN0kYzs6do1Q7f5BCY5H/KXRXtOSw=; b=0fH4m7JPOKML1jbO5sadrOwmzYctIEJNi0shwkBi1nJWytq0MsPF99JWvozUZapOK+ 4ceanhci/SwPr8GWIC9QlZMddwPZa4qoCaVSIeQWHP163X7vfuzfF6VZrGTSRLC6+LW7 cb93j+CIgqws15DtWm/spu0TR2+qz6rDiFk7Onn+XIFEQ3b+1X6vqTlkfM6M/qTxIWCF 42obaQNvVB747wV1XXukyUfRxB2C2OXOj2kyot1HPkNH3tAcRhQ6kWBlc+6ZumbkQhlV WEk1z7aeGU4SwZI+L8V0CKU3ZB5OKL2GXtERtZG7sQpVpVMh/ilL3n8mhOYaK0v3okPi Aryw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=S9PynKcuJpQuOHFN0kYzs6do1Q7f5BCY5H/KXRXtOSw=; b=TUA5PUYjr30Y1Kwc9eO4AJwXRqAcf9ZGj6+Bkbn/jvMMG+PuVQUPjl4FISudmo1P8V BV0HgolpOw7qpXiDcQu+LzblmKs08y79WXrwaKVKTa9H7ktHnZOc4nguPalOOXniSIwa EsnU/uOtvTGWn1jwJS626lnP/a6lrjrEtjV+rcRwEkJNYn9+76BZ06yPqbmtpMZKWf/Z yAXdv2SYIhQGMmp4u+8WpZ6ltXXzER9q/p+7kaWWR7dwr6jMXHwefYEu3ugAwSbgsyRU FwKmOFzlNmzvn92FN+x6Bp2e6t/cQxNBPom0w/LgIBRSNYc8G9xnEF4r0FnnCeIHmQ6j T7GA== X-Gm-Message-State: ANhLgQ0kvkTBS5btJ+6sPNUwUuF5Hfub61Gn3hrEWrsvt9F5rSHvxrIh vSr7dwlBrj8cpdz7Icck+M83aJiobiU= X-Google-Smtp-Source: ADFU+vvouxoXglSf1HSkQuIcmGFk+yvofKmvOvPRdpjXMeMX5Odc0iQv3sIvAstb3Q2I7XPmCwZaow== X-Received: by 2002:a63:8b42:: with SMTP id j63mr4038255pge.27.1584532768129; Wed, 18 Mar 2020 04:59:28 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id g6sm2288456pjv.13.2020.03.18.04.59.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2020 04:59:27 -0700 (PDT) From: Kaaira Gupta To: Helen Koike , Vaishali Thakkar , kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 17:28:44 +0530 Message-Id: <20200318115846.7975-5-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318115846.7975-1-kgupta@es.iitr.ac.in> References: <20200318115846.7975-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v3 4/6] libcamera: ipa_proxy: search for proxy in build tree 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, 18 Mar 2020 11:59:29 -0000 When libcamera is built and tested before installing, it will be unable to locate the path to proxy files, or previously installed files in the system path may be incorrect to load. Hence, when libcamera is not installed and running from a build tree, identify the location of that tree by using libcameraPath(), and from that point add relative path to the proxy file. Signed-off-by: Kaaira Gupta --- src/libcamera/ipa_proxy.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libcamera/ipa_proxy.cpp b/src/libcamera/ipa_proxy.cpp index b409e1d..1014e79 100644 --- a/src/libcamera/ipa_proxy.cpp +++ b/src/libcamera/ipa_proxy.cpp @@ -91,10 +91,23 @@ std::string IPAProxy::resolvePath(const std::string &file) const } } - /* Try finding the exec target from the install directory. */ - std::string proxyPath = std::string(IPA_PROXY_DIR) + proxyFile; - if (!access(proxyPath.c_str(), X_OK)) - return proxyPath; + /* + * When libcamera is used before it is installed, load proxies from the + * same build directory as the libcamera directory itself. This requires + * identifying the path of the libcamera.so, and referencing a relative + * path for the proxies from that point. + */ + if (!utils::isLibcameraInstalled()) { + std::string ipaProxyDir = utils::dirname(utils::libcameraPath()) + "/../../proxy"; + + LOG(IPAProxy, Info) + << "libcamera is not installed. Adding '" + << ipaProxyDir << "' to the Proxy search path"; + + std::string proxyPath = ipaProxyDir + proxyFile; + if (!access(proxyPath.c_str(), X_OK)) + return proxyPath; + } return std::string(); }