From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <luca.boccassi@gmail.com>
Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68])
 by dpdk.org (Postfix) with ESMTP id ED2687CB6
 for <dev@dpdk.org>; Fri,  1 Sep 2017 15:32:56 +0200 (CEST)
Received: by mail-wm0-f68.google.com with SMTP id e204so226722wma.2
 for <dev@dpdk.org>; Fri, 01 Sep 2017 06:32:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=message-id:subject:from:to:date:in-reply-to:references
 :content-transfer-encoding:mime-version;
 bh=WS3DPiA0P8Lf1HWLJ8J3Ybg7v8g2OdO/+S5/BJJ7GAc=;
 b=UhvYcygekrAIvhk2/L0uldG1HgqLUxPjSk3vO+wwIoGCqHuxQ+iDdCsTl1s4XavN0T
 WAnTkYgy/QbkJU6tnQUkZsErWPUmHjPySZENYl94uGMuJJRm6OpJARYQBZadi8xi9yXy
 BhPOR2Ue1pXkYHRcqguXAhK5obbZwn77nk/Xm8lBL/chtMFmbx4SBnwOrxm6ml7xVgT1
 mmB02eLXhJXeDvLpNj9XC07N1MgQgB/QclmCt0yTwxWu45Y+mR6l0MsgaZioq/pSed8D
 AsxPOfi2sAdbRi1VSVc5xOO9ZBX9EhDDhSjAqYP7Hr+mvpk2Na8V7zZ+an9iQR+6CfJA
 qmww==
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:date:in-reply-to
 :references:content-transfer-encoding:mime-version;
 bh=WS3DPiA0P8Lf1HWLJ8J3Ybg7v8g2OdO/+S5/BJJ7GAc=;
 b=HzmFn6VFSsi5s7wA2TuuaOposub3kudNMzQFeiVxfeXdibOtVm4vq3IxxQvc7If0D5
 63g2AuzhBwrdySW6f3/G7ABmvxPCmGJZa/DqmUzaHYH9v3vriaDZP/85EisLZcAXX0Gw
 zfp6w9qaZQ/26JbGt2vSADfRbFBZVcMtitJP+zD1eX2TkM/x4uabPYFcT/f3QbS5ZSk6
 0f6dfwLFLvTMBsvhPn5THSNht8qZO5fdLum7WkZjT9LSKQYrKtMMbW6o5GgBGps/iVj9
 SdDim9eoIYt/U/ijjw9g3sYrtjH1VFaPftjiN5M256XUjZ5IIv3OJQdOwBTGUnUoxN9G
 BkVw==
X-Gm-Message-State: AHPjjUgUlxEb6qD2MjmuJrXnZk9iOMsV1Q1MG2wzVYcfaV81rWu5IfNP
 bEJ8MpmxlVZ8vw==
X-Google-Smtp-Source: ADKCNb5Z6/oZt1Kd8g9EfGYO++hTNhlaNgH2ini6jXHjIBxq6bfe5kpMYPNfwjanUV9Y7JZ7IjBPaA==
X-Received: by 10.28.13.81 with SMTP id 78mr532057wmn.7.1504272776439;
 Fri, 01 Sep 2017 06:32:56 -0700 (PDT)
Received: from localhost ([2a00:23c5:bef3:400:4a51:b7ff:fe0b:4749])
 by smtp.gmail.com with ESMTPSA id 53sm191916wry.35.2017.09.01.06.32.53
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Fri, 01 Sep 2017 06:32:54 -0700 (PDT)
Message-ID: <1504272772.31011.2.camel@gmail.com>
From: Luca Boccassi <luca.boccassi@gmail.com>
To: Bruce Richardson <bruce.richardson@intel.com>, dev@dpdk.org
Date: Fri, 01 Sep 2017 14:32:52 +0100
In-Reply-To: <20170901100416.80264-4-bruce.richardson@intel.com>
References: <20170901100416.80264-1-bruce.richardson@intel.com>
 <20170901100416.80264-4-bruce.richardson@intel.com>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailer: Evolution 3.22.6-1 
Mime-Version: 1.0
Subject: Re: [dpdk-dev] [PATCH 03/17] igb_uio: add igb_uio kmod to meson
 build
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 01 Sep 2017 13:32:57 -0000

On Fri, 2017-09-01 at 11:04 +0100, Bruce Richardson wrote:
> Support building igb_uio using meson and ninja. For this, we still
> use the
> kernel's kbuild system, by calling out to make, since it's safer and
> easier
> than trying to reproduce that in meson. A list of suitable file
> dependencies is given so that we have a reasonable chance of a
> rebuild when
> necessary.
>=20
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
> =C2=A0lib/librte_eal/linuxapp/igb_uio/Kbuild=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0|=C2=A0=C2=A01 +
> =C2=A0lib/librte_eal/linuxapp/igb_uio/meson.build | 47
> +++++++++++++++++++++++++++++
> =C2=A0lib/librte_eal/linuxapp/meson.build=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0| 10 ++++++
> =C2=A0meson_options.txt=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=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=A02 ++
> =C2=A04 files changed, 60 insertions(+)
> =C2=A0create mode 100644 lib/librte_eal/linuxapp/igb_uio/Kbuild
> =C2=A0create mode 100644 lib/librte_eal/linuxapp/igb_uio/meson.build
>=20
> diff --git a/lib/librte_eal/linuxapp/igb_uio/Kbuild
> b/lib/librte_eal/linuxapp/igb_uio/Kbuild
> new file mode 100644
> index 000000000..98c98fe52
> --- /dev/null
> +++ b/lib/librte_eal/linuxapp/igb_uio/Kbuild
> @@ -0,0 +1 @@
> +obj-m :=3D igb_uio.o
> diff --git a/lib/librte_eal/linuxapp/igb_uio/meson.build
> b/lib/librte_eal/linuxapp/igb_uio/meson.build
> new file mode 100644
> index 000000000..c046e1d66
> --- /dev/null
> +++ b/lib/librte_eal/linuxapp/igb_uio/meson.build
> @@ -0,0 +1,47 @@
> +#=C2=A0=C2=A0=C2=A0BSD LICENSE
> +#
> +#=C2=A0=C2=A0=C2=A0Copyright(c) 2017 Intel Corporation. All rights reser=
ved.
> +#=C2=A0=C2=A0=C2=A0All rights reserved.
> +#
> +#=C2=A0=C2=A0=C2=A0Redistribution and use in source and binary forms, wi=
th or
> without
> +#=C2=A0=C2=A0=C2=A0modification, are permitted provided that the followi=
ng
> conditions
> +#=C2=A0=C2=A0=C2=A0are met:
> +#
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Redistributions of source code must ret=
ain the above
> copyright
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0notice, this list of conditio=
ns and the following
> disclaimer.
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Redistributions in binary form must rep=
roduce the above
> copyright
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0notice, this list of conditio=
ns and the following disclaimer
> in
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0the documentation and/or othe=
r materials provided with the
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0distribution.
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0* Neither the name of Intel Corporation n=
or the names of its
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0contributors may be used to e=
ndorse or promote products
> derived
> +#=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0from this software without sp=
ecific prior written
> permission.
> +#
> +#=C2=A0=C2=A0=C2=A0THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AN=
D
> CONTRIBUTORS
> +#=C2=A0=C2=A0=C2=A0"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUD=
ING, BUT
> NOT
> +#=C2=A0=C2=A0=C2=A0LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY=
 AND
> FITNESS FOR
> +#=C2=A0=C2=A0=C2=A0A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHAL=
L THE
> COPYRIGHT
> +#=C2=A0=C2=A0=C2=A0OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIR=
ECT,
> INCIDENTAL,
> +#=C2=A0=C2=A0=C2=A0SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDI=
NG, BUT NOT
> +#=C2=A0=C2=A0=C2=A0LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVIC=
ES; LOSS OF
> USE,
> +#=C2=A0=C2=A0=C2=A0DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER C=
AUSED AND
> ON ANY
> +#=C2=A0=C2=A0=C2=A0THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIAB=
ILITY, OR
> TORT
> +#=C2=A0=C2=A0=C2=A0(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WA=
Y OUT OF
> THE USE
> +#=C2=A0=C2=A0=C2=A0OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY =
OF SUCH
> DAMAGE.
> +
> +mkfile =3D custom_target('igb_uio_makefile',
> +	output: 'Makefile',
> +	command: ['touch', '@OUTPUT@'])
> +
> +custom_target('igb_uio',
> +	input: ['igb_uio.c', 'Kbuild'],
> +	output: 'igb_uio.ko',
> +	command: ['make', '-C', kernel_dir,
> +		'M=3D' + meson.current_build_dir(),
> +		'src=3D' + meson.current_source_dir(),
> +		'EXTRA_CFLAGS=3D-I' + meson.current_source_dir() +
> +			'/../../common/include',
> +		'modules'],
> +	depends: mkfile,
> +	depend_files: [join_paths(kernel_dir, 'Kconfig')],

Can this be made optional somehow?

There's no build/Kconfig on Debian:

$ ls /lib/modules/4.9.0-3-amd64/build
arch=C2=A0=C2=A0include=C2=A0=C2=A0Makefile=C2=A0=C2=A0Module.symvers=C2=A0=
=C2=A0scripts

But the build works fine without that depend_files line.

> +	build_by_default: true)
> diff --git a/lib/librte_eal/linuxapp/meson.build
> b/lib/librte_eal/linuxapp/meson.build
> index bc9f22175..2383bd368 100644
> --- a/lib/librte_eal/linuxapp/meson.build
> +++ b/lib/librte_eal/linuxapp/meson.build
> @@ -30,3 +30,13 @@
> =C2=A0#=C2=A0=C2=A0=C2=A0OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBI=
LITY OF SUCH
> DAMAGE.
> =C2=A0
> =C2=A0subdir('eal')
> +
> +if get_option('enable_kmods')
> +	kernel_dir =3D get_option('kernel_dir')
> +	if kernel_dir =3D=3D ''
> +		kernel_version =3D run_command('uname', '-
> r').stdout().strip()
> +		kernel_dir =3D '/lib/modules/' + kernel_version +
> '/build'
> +	endif
> +
> +	subdir('igb_uio')
> +endif
> diff --git a/meson_options.txt b/meson_options.txt
> index c03b79fbd..9c45b8159 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -4,3 +4,5 @@ option('max_numa_nodes', type: 'string', value: '4',
> description: 'maximum numbe
> =C2=A0option('use_hpet', type: 'boolean', value: false, description: 'use
> HPET timer in EAL')
> =C2=A0option('allow_invalid_socket_id', type: 'boolean', value: false,
> =C2=A0	description: 'allow out-of-range NUMA socket id\'s for
> platforms that don\'t report the value correctly')
> +option('enable_kmods', type: 'boolean', value: true, description:
> 'build kernel modules')
> +option('kernel_dir', type: 'string', value: '', description: 'path
> to the kernel for building kernel modules')

--=20
Kind regards,
Luca Boccassi