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=-2.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 332E5C07E95 for ; Tue, 20 Jul 2021 12:21:52 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9E0876113C for ; Tue, 20 Jul 2021 12:21:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E0876113C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:48722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5okw-0001IS-Pn for qemu-devel@archiver.kernel.org; Tue, 20 Jul 2021 08:21:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44180) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5ojf-0000VI-08 for qemu-devel@nongnu.org; Tue, 20 Jul 2021 08:20:31 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:33374) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5ojc-00033c-MV for qemu-devel@nongnu.org; Tue, 20 Jul 2021 08:20:30 -0400 Received: by mail-ed1-x52d.google.com with SMTP id dj21so28296634edb.0 for ; Tue, 20 Jul 2021 05:20:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BJm6V/aucfl5uK5HsKViO2HGzjABBk3kTTqaZAhR1Fw=; b=tgltD24rFs0yzt686+dHl/vOB2b6dHN+gXJ+vYuAp05ODNn1yBwLcWAcdfLp5yDZnT OUx7kgEjinGeUJxPwOlvh5SQkI0T6ZtzMl/7tyHA1u+FpdOUJdJvf/4KgmWaxZvTSkcp nXOXGCLtWdJzuQHycO4WVwcz/TfWkId9S7EBZeshc3Bqb0DqLt97rBsLlo8SAJdWb6pL 3UuS07HRqk7ysi0TW+gIDTDR6W8CNmW5qmNCPayeg5ZlyPu7cIRabmKjpvRRuXEg6gL6 D4GLG4TFbDDSss6jjiMjVpFZicdzKe2dSl7zoRAmv3NYG5h9kJvFm+TBJg+GHL+wWq8b 3jiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BJm6V/aucfl5uK5HsKViO2HGzjABBk3kTTqaZAhR1Fw=; b=VrBjDxK4rU9jtsP4f7tOAvtKb55DSRx5YPKlUNXnywsjeDwEON9J9kcqY+zf0c0HGb eiGsRpJLhrQQMSDRrT2ulwqn6nSI2b30fjeDD/FeOxxzbF3e9+5Ra8QmaS6Yhz4Dg8kf ypCfzFQYEiDGjci2bCnvhDm2zNpwuCccB+P44TthpW7+t828YZ9AHTMOmsdcrGdPHR11 vbnpsawlKmHP5evmGk3H1GifK/oeG/lebB4YV8RL0/oH0Cq34wvsbdixx9SEWxkm7W39 xIK9NgoulgqV7bLna637G5UcYLUgpu53rbCeWUR6nFq1wyUtwCFKuQbFojWMBUjys9EU xo9g== X-Gm-Message-State: AOAM530GrFIQG6TKDPZEF+x7DEBW901TDBZM1OLjD9EwTD2yQdBoFQEP DhqwvKaIyMEMlww3laSxlO9m55CezXLMIkhtH0k= X-Google-Smtp-Source: ABdhPJy0Oo251Cral5IudABrP09b3eICq6nS3RJp1zD/G8lvB+yrXYxUT+Xf1BhUoh4KfHIlIwcS+kpY3iiy1ZY9hXU= X-Received: by 2002:a50:fe95:: with SMTP id d21mr40434778edt.257.1626783625612; Tue, 20 Jul 2021 05:20:25 -0700 (PDT) MIME-Version: 1.0 References: <5002d6a67cb6c429b2e3d21e106b468176e82a1f.1626722742.git.jag.raman@oracle.com> <20210719202409.GB1443636@movementarian.org> <0268673C-D5FD-4288-B7E6-B4B6D3CCCD23@oracle.com> In-Reply-To: <0268673C-D5FD-4288-B7E6-B4B6D3CCCD23@oracle.com> From: =?UTF-8?B?TWFyYy1BbmRyw6kgTHVyZWF1?= Date: Tue, 20 Jul 2021 16:20:13 +0400 Message-ID: Subject: Re: [PATCH RFC server 01/11] vfio-user: build library To: Jag Raman Content-Type: multipart/alternative; boundary="00000000000021903305c78d149d" Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=marcandre.lureau@gmail.com; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Elena Ufimtseva , John Johnson , =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , Swapnil Ingle , John Levon , "richard.henderson@linaro.org" , "qemu-devel@nongnu.org" , "f4bug@amsat.org" , "alex.williamson@redhat.com" , "stefanha@redhat.com" , Thanos Makatos , Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --00000000000021903305c78d149d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi On Tue, Jul 20, 2021 at 4:12 PM Jag Raman wrote: > > > > On Jul 19, 2021, at 4:24 PM, John Levon wrote: > > > > On Mon, Jul 19, 2021 at 04:00:03PM -0400, Jagannathan Raman wrote: > > > >> add the libvfio-user library as a submodule. build it as part of QEMU > >> > >> diff --git a/meson.build b/meson.build > >> index 6e4d2d8..f2f9f86 100644 > >> --- a/meson.build > >> +++ b/meson.build > >> @@ -1894,6 +1894,41 @@ if get_option('cfi') and slirp_opt =3D=3D 'syst= em' > >> + ' Please configure with --enable-slirp=3Dgit') > >> endif > >> > >> +vfiouser =3D not_found > >> +if have_system and multiprocess_allowed > >> + have_internal =3D fs.exists(meson.current_source_dir() / > 'libvfio-user/Makefile') > >> + > >> + if not have_internal > >> + error('libvfio-user source not found - please pull git submodule'= ) > >> + endif > >> + > >> + vfiouser_files =3D [ > >> + 'libvfio-user/lib/dma.c', > >> + 'libvfio-user/lib/irq.c', > >> + 'libvfio-user/lib/libvfio-user.c', > >> + 'libvfio-user/lib/migration.c', > >> + 'libvfio-user/lib/pci.c', > >> + 'libvfio-user/lib/pci_caps.c', > >> + 'libvfio-user/lib/tran_sock.c', > >> + ] > >> + > >> + vfiouser_inc =3D include_directories('libvfio-user/include', > 'libvfio-user/lib') > >> + > >> + json_c =3D dependency('json-c', required: false) > >> + if not json_c.found() > >> + json_c =3D dependency('libjson-c') > >> + endif > >> + > >> + libvfiouser =3D static_library('vfiouser', > >> + build_by_default: false, > >> + sources: vfiouser_files, > >> + dependencies: json_c, > >> + include_directories: vfiouser_inc) > >> + > >> + vfiouser =3D declare_dependency(link_with: libvfiouser, > >> + include_directories: vfiouser_inc) > >> +endif > > > > Why this way, rather than recursing into the submodule? Seems a bit > fragile to > > encode details of the library here. > > +maintainers of meson.build. I apologize for not adding them when I sent > the > patches out initially. I copied the email list from Elena, but Elena did > not make > any changes to meson.build - stupid me. > > John, > > This way appears to be present convention with QEMU - I=E2=80=99m als= o not > very clear > on the reason for it. > > For example submodules such as slirp (libslirp), capstone (libcapstone), > dtc (libfdt) are built this way. > For slirp and dtc, we are eventually going to use meson subproject(). No idea about capstone. > > I=E2=80=99m guessing it=E2=80=99s because QEMU doesn=E2=80=99t build all = parts of a submodule. For > example, QEMU only builds libfdt in the doc submodule. Similarly, > libvfio-user only builds the core library without building the tests and > samples. > > You can give subproject options to build limited parts. Fwiw, since libvfio-user uses cmake, we may be able to use meson cmake.subproject() (https://mesonbuild.com/CMake-module.html). --=20 Marc-Andr=C3=A9 Lureau --00000000000021903305c78d149d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Tue, Jul 20, 2021 at 4:12 PM Jag= Raman <jag.raman@oracle.com= > wrote:


> On Jul 19, 2021, at 4:24 PM, John Levon <john.levon@nutanix.com> wrote:
>
> On Mon, Jul 19, 2021 at 04:00:03PM -0400, Jagannathan Raman wrote:
>
>> add the libvfio-user library as a submodule. build it as part of Q= EMU
>>
>> diff --git a/meson.build b/meson.build
>> index 6e4d2d8..f2f9f86 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -1894,6 +1894,41 @@ if get_option('cfi') and slirp_opt = =3D=3D 'system'
>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 + ' Please configure with --= enable-slirp=3Dgit')
>> endif
>>
>> +vfiouser =3D not_found
>> +if have_system and multiprocess_allowed
>> +=C2=A0 have_internal =3D fs.exists(meson.current_source_dir() / &= #39;libvfio-user/Makefile')
>> +
>> +=C2=A0 if not have_internal
>> +=C2=A0 =C2=A0 error('libvfio-user source not found - please p= ull git submodule')
>> +=C2=A0 endif
>> +
>> +=C2=A0 vfiouser_files =3D [
>> +=C2=A0 =C2=A0 'libvfio-user/lib/dma.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/irq.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/libvfio-user.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/migration.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/pci.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/pci_caps.c',
>> +=C2=A0 =C2=A0 'libvfio-user/lib/tran_sock.c',
>> +=C2=A0 ]
>> +
>> +=C2=A0 vfiouser_inc =3D include_directories('libvfio-user/inc= lude', 'libvfio-user/lib')
>> +
>> +=C2=A0 json_c =3D dependency('json-c', required: false) >> +=C2=A0 if not json_c.found()
>> +=C2=A0 =C2=A0 json_c =3D dependency('libjson-c')
>> +=C2=A0 endif
>> +
>> +=C2=A0 libvfiouser =3D static_library('vfiouser',
>> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0build_by_default: false, >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0sources: vfiouser_files, >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dependencies: json_c,
>> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0include_directories: vfious= er_inc)
>> +
>> +=C2=A0 vfiouser =3D declare_dependency(link_with: libvfiouser, >> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 include_directories: vfiou= ser_inc)
>> +endif
>
> Why this way, rather than recursing into the submodule? Seems a bit fr= agile to
> encode details of the library here.

+maintainers of meson.build. I apologize for not adding them when I sent th= e
patches out initially. I copied the email list from Elena, but Elena did no= t make
any changes to meson.build - stupid me.

John,

=C2=A0 =C2=A0 This way appears to be present convention with QEMU - I=E2=80= =99m also not very clear
on the reason for it.

For example submodules such as slirp (libslirp), capstone (libcapstone), dtc (libfdt) are built this way.

For sl= irp and dtc, we are eventually going to use meson subproject(). No idea abo= ut capstone.

I=E2=80=99m guessing it=E2=80=99s because QEMU doesn=E2=80=99t build all pa= rts of a submodule. For
example, QEMU only builds libfdt in the doc submodule. Similarly,
libvfio-user only builds the core library without building the tests and sa= mples.

=C2=A0
You can give subproject options to b= uild limited parts.
=C2=A0
Fwiw, since libvfio-user= uses cmake, we may be able to use meson cmake.subproject() (https://mesonbuild.com/CMake-module.= html).

--
Marc-Andr=C3=A9 Lureau
--00000000000021903305c78d149d--