From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88AB9C43381 for ; Wed, 20 Mar 2019 13:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61719213F2 for ; Wed, 20 Mar 2019 13:30:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728056AbfCTNaS convert rfc822-to-8bit (ORCPT ); Wed, 20 Mar 2019 09:30:18 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:40928 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727371AbfCTNaR (ORCPT ); Wed, 20 Mar 2019 09:30:17 -0400 Received: by mail-wm1-f68.google.com with SMTP id u10so17711329wmj.5 for ; Wed, 20 Mar 2019 06:30:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-transfer-encoding:user-agent:mime-version; bh=Iq3S0iRl+pVIi5OKd0sAHuLQXZYKN8cqYk2BHNntJPg=; b=AoqEsF0BMup4zsWMuspBxaOoqaRGfmpRhY07Nl4mTklcnCMayEY8gpuscZWS+wDJKU ueceh9jbB0hVRqTdAlwcQ6RhX9LF68yrHthcD93zPp6faXSH4jvxNQvgN2ZPi8vLaooe q4oIPT175wkmeY7lJ0pCnV6lPcv8yr3OXiZtoWyTAb9I8zhZzmdgp8iSziupKGPeyBBG GUckS0+JNgV/U8w+OyuYwyGcKlW9fKN0UOsESt/4fDulkcHG53Q0tYBh1tFC0t0jwJIC qtcwRpXK74Ur1rGACuQhbxG6NB+1Qx32b53HhHf+SSdMh7WsoWLoEXlhLalo/ukthtAa 3AEg== X-Gm-Message-State: APjAAAVVGTNz/1v1QUIbkUOfuH6WpFcOwS1N9XCGEkaOKf05HMdvVM0D Ld+D+/WT9NmVHP+JbywgveHb1yu7lgXHlA== X-Google-Smtp-Source: APXvYqxO8LhdDxsKwLGE47RQbR2Cg/3Pp2LdJ5PvfoSOTEIiKKEnf+T4MLQyK4btAcOoNI3fqGarlA== X-Received: by 2002:a1c:4d12:: with SMTP id o18mr8872931wmh.74.1553088615512; Wed, 20 Mar 2019 06:30:15 -0700 (PDT) Received: from localhost ([2a01:4b00:f419:6f00:b00c:66c8:99df:336]) by smtp.gmail.com with ESMTPSA id y12sm3887324wma.44.2019.03.20.06.30.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 06:30:14 -0700 (PDT) Message-ID: Subject: Re: [PATCH bpf-next v2] tools/bpf: generate pkg-config file for libbpf From: Luca Boccassi To: Stanislav Fomichev Cc: netdev@vger.kernel.org Date: Wed, 20 Mar 2019 13:30:13 +0000 In-Reply-To: References: <20190319210639.6282-1-bluca@debian.org> <20190319230042.32087-1-bluca@debian.org> <20190319231713.GG7431@mini-arch.hsd1.ca.comcast.net> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 2019-03-20 at 13:22 +0000, Luca Boccassi wrote: > On Tue, 2019-03-19 at 16:17 -0700, Stanislav Fomichev wrote: > > On 03/19, Luca Boccassi wrote: > > > Generate a libbpf.pc file at build time so that users can rely > > > on pkg-config to find the library, its CFLAGS and LDFLAGS. > > > > > > Signed-off-by: Luca Boccassi > > > --- > > > v2: use QUIET_GEN instead of QUIET_LINK to generate pc file, > > > save kernel version in its own variable instead of calling > > > make inline > > > > > > tools/lib/bpf/.gitignore | 1 + > > > tools/lib/bpf/Makefile | 19 ++++++++++++++++--- > > > tools/lib/bpf/libbpf.pc.template | 11 +++++++++++ > > > 3 files changed, 28 insertions(+), 3 deletions(-) > > > create mode 100644 tools/lib/bpf/libbpf.pc.template > > > > > > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore > > > index 4db74758c674..7d9e182a1f51 100644 > > > --- a/tools/lib/bpf/.gitignore > > > +++ b/tools/lib/bpf/.gitignore > > > @@ -1,3 +1,4 @@ > > > libbpf_version.h > > > +libbpf.pc > > > FEATURE-DUMP.libbpf > > > test_libbpf > > > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile > > > index a05c43468bd0..1df3ebfb3118 100644 > > > --- a/tools/lib/bpf/Makefile > > > +++ b/tools/lib/bpf/Makefile > > > @@ -80,6 +80,7 @@ libdir_SQ = $(subst ','\'',$(libdir)) > > > libdir_relative_SQ = $(subst ','\'',$(libdir_relative)) > > > > > > LIB_FILE = libbpf.a libbpf.so > > > +PC_FILE = libbpf.pc > > > > > > VERSION = $(BPF_VERSION) > > > PATCHLEVEL = $(BPF_PATCHLEVEL) > > > @@ -89,6 +90,7 @@ OBJ = $@ > > > N = > > > > > > LIBBPF_VERSION = > > > $(BPF_VERSION).$(BPF_PATCHLEVEL).$(BPF_EXTRAVERSION) > > > +KERNEL_VERSION = $(shell make --no-print-directory -sC ../../.. > > > kernelversion) > > Oh, we do already have LIBBPF_VERSION, why not use that? This way > > you don't need to do anything for out-of-tree libbpf from github. > > > > I don't remember what was the strategy regarding libbpf versioning, > > but > > that 0.0.1 should be changed to something sensible (be set to the > > kernel > > version upon release?) > > [re-sending as reply via phone added html and the list daemon said > no- > no] > > That looks like the ABI version though, rather than the source > version? > The source version is more appropriate for the PC file That said, the versioning looks looks like it could use some love and it's not really a factor that should gate a pkg-config file and could be done separately if required, so in v3 I've removed KERNEL_VERSION and used LIBBPF_VERSION as you suggested. Thanks for reviewing! -- Kind regards, Luca Boccassi