From patchwork Wed Mar 18 00:10:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kaaira Gupta X-Patchwork-Id: 3150 Return-Path: Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DF45F60422 for ; Wed, 18 Mar 2020 01:10:45 +0100 (CET) Received: by mail-pg1-x541.google.com with SMTP id 37so12619434pgm.11 for ; Tue, 17 Mar 2020 17:10:45 -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=AZN6TEGOKuDqe3KiH69oLtXcUjXsNId/klKpnB4hwS6AwKMWDEesqtrgJI9w0YoCpy 7TzrP6JloMp07brEoVLvz/+FT+OxDf/IpcqWz5uXZR4zZk4enU++24qcflgy+sCm/4Pz vvlVH+OzsbaERgYslhdNUhuwrn+Nx/M+u1zrs86SAiAtU/9ndq5gFQTWOxnxQMF+B7ou VcoaEc0bYxA6U2W+BhUULawNlCKWpM/4NKduEKkzKwKJNhI2rLtRXGEBl2mVU61BdaDz s5n5CEokgGoLPp3ZXxbN6zENvkpbuwOQ5PbRjgS7Yhn8Sp3Hp2bPXztExOJMpG5Xre3E bTfw== 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=qE8DW7P/98ZaMZo3ulraAYysUu+G0eVR7rQ4RuhQbH4O8spZeA8zxQ97v7hx5pgI/H VFIGz2+Kh0/jgtIWQDzCGkZSm5+4edOL778OuTXu0OVn27U0ofPxmq9NQ32DpS//D8jy 4ed/S8kjy7NMc1wXFhhvrfNzLFkTtlDL69tHc0SAsLBCRiIcg2c7Rj0NJBhozSjZRJTq mPBdBbt+ehIzbz35dBlFxfge+OTX4euw19gkhEJAWbU/2/DBJh2HoM2vuC5XTHlmhsGu wAeN6NFl37YJdF9DFF+X/94InKomtkxt1lGrJoKZnbCdk2x9NFauRDVvlnEuJszuPvBV DUMA== X-Gm-Message-State: ANhLgQ15MLPnfMtAc7PTTpCkTBv0WzWpgKcqJdQONwnXtZ2Q2FUR+6Ld MYBxjW02vP3rQtvRk+46Rjp4iw== X-Google-Smtp-Source: ADFU+vvZ7KGjTM3tbG5lzs031TnpxX8XZWvxj1e64i8FxtbLNyEIPGxSjKG92EZ3PtdBWPoS3AyZwA== X-Received: by 2002:aa7:9838:: with SMTP id q24mr1413578pfl.135.1584490244487; Tue, 17 Mar 2020 17:10:44 -0700 (PDT) Received: from kaaira-HP-Pavilion-Notebook ([103.113.213.153]) by smtp.gmail.com with ESMTPSA id f127sm4178266pfa.112.2020.03.17.17.10.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2020 17:10:44 -0700 (PDT) From: Kaaira Gupta To: kieran.bingham@ideasonboard.com, libcamera-devel@lists.libcamera.org, Helen Koike , Vaishali Thakkar Cc: Kaaira Gupta Date: Wed, 18 Mar 2020 05:40:07 +0530 Message-Id: <20200318001009.32512-5-kgupta@es.iitr.ac.in> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200318001009.32512-1-kgupta@es.iitr.ac.in> References: <20200318001009.32512-1-kgupta@es.iitr.ac.in> Subject: [libcamera-devel] [PATCH LIBCAMERA v2 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 00:10:46 -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(); }