From patchwork Thu Jul 24 11:22:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: christian.braunersorensen@prevas.dk X-Patchwork-Id: 373372 X-Patchwork-Delegate: esben@haabendal.dk Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hugin.dotsrc.org (hugin.dotsrc.org [IPv6:2001:878:346::102]) by ozlabs.org (Postfix) with ESMTP id 7DC701401F0 for ; Thu, 24 Jul 2014 21:20:31 +1000 (EST) Received: from hugin.dotsrc.org (localhost [127.0.0.1]) by hugin.dotsrc.org (Postfix) with ESMTP id 1884E3FD89 for ; Thu, 24 Jul 2014 13:20:27 +0200 (CEST) X-Original-To: dev@oe-lite.org Delivered-To: dev@oe-lite.org Received: from mail01.prevas.se (mail01.prevas.se [62.95.78.3]) by hugin.dotsrc.org (Postfix) with ESMTPS id 7AC933FA5B for ; Thu, 24 Jul 2014 13:20:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=prevas.dk; i=@prevas.dk; l=1915; q=dns/txt; s=ironport1; t=1406200825; x=1437736825; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HzeaP4DR1B6T+YdhpyZAHKXVTr/Oxy3A7UIm+FrBIVA=; b=XOhRK3SJ4GunRobiQm8nHpILDiVmizCWag1GIwvBEzZMAhSzKviwV96d ieYc/VhlZill7R4RTgycnpzPsLJBeqtLEyaFcLeFAv7EbmdeHjAhkkqrJ qPidlH3XJtY03dupVEF786UHzWXHv74AGVUaRJCHWET7XY4JGjAaEYbVu s=; X-IronPort-AV: E=Sophos;i="5.01,723,1400018400"; d="scan'208";a="4926786" Received: from vmprevas3.prevas.se (HELO smtp.prevas.se) ([172.16.8.103]) by ironport1.prevas.se with ESMTP/TLS/AES128-SHA; 24 Jul 2014 13:20:25 +0200 Received: from cbs-Latitude-E6540.prevas.se (172.16.11.11) by smtp.prevas.se (172.16.8.105) with Microsoft SMTP Server (TLS) id 14.2.347.0; Thu, 24 Jul 2014 13:20:25 +0200 From: To: Subject: [PATCH 1/1] class/pkgconfig-install: Fixup pkgconfig files Date: Thu, 24 Jul 2014 13:22:40 +0200 Message-ID: <4d6bb850c8fa045d88034f3206c8b475510830b3.1406199648.git.christian.braunersorensen@prevas.dk> X-Mailer: git-send-email 2.0.2 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [172.16.11.11] X-BeenThere: dev@oe-lite.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: OE-lite development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces@oe-lite.org Errors-To: dev-bounces@oe-lite.org From: Christian Sørensen Signed-off-by: Christian Sørensen --- classes/pkgconfig-install.oeclass | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 classes/pkgconfig-install.oeclass diff --git a/classes/pkgconfig-install.oeclass b/classes/pkgconfig-install.oeclass new file mode 100644 index 0000000..3097351 --- /dev/null +++ b/classes/pkgconfig-install.oeclass @@ -0,0 +1,37 @@ +## Class for packages having pkgconfig files that needs fixup +## +## Rewrites the paths in the pkgconfig files so that it contains valid dirs. + +require conf/meta.conf + +PKGCONFIG_FILES ?= "${libdir}/pkgconfig/*" +PKGCONFIG_FIXUP_STRIP_DIRS ?= "${HOST_SYSROOT} ${TARGET_SYSROOT} ${D} ${B} ${S}" + +do_install[postfuncs] += "do_install_pkgconfig_fixup" +do_install_pkgconfig_fixup[dirs] = "${D}" + +def do_install_pkgconfig_fixup(d): + installdir = d.get("D") + old_cwd = os.getcwd() + os.chdir(installdir) + pkgconfig_files = [] + for pattern in d.get("PKGCONFIG_FILES").split(): + pkgconfig_files += glob.glob(pattern.lstrip("/")) + strip_dirs = set() + for strip_dir in d.get("PKGCONFIG_FIXUP_STRIP_DIRS").split(): + strip_dirs.add(strip_dir) + strip_dirs.add(os.path.realpath(strip_dir)) + for filename in pkgconfig_files: + print "pkgconfig fixup of /%s"%(filename) + with open(filename, "r") as input_file: + pkgconfig_file = input_file.read() + for strip_dir in strip_dirs: + pkgconfig_file = re.sub(r"-L%s"%(strip_dir), + r"-L", pkgconfig_file) + with open(filename, "w") as output_file: + output_file.write(pkgconfig_file) + os.chdir(old_cwd) + +# Local Variables: +# mode: python +# End: