[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAK7LNARk52-MvsPSjgQV3vDXpv2RXpeg0vkzMJAsLR1yQwr7Qw@mail.gmail.com>
Date: Mon, 21 Aug 2023 06:05:30 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Bastian Germann <bage@...utronix.de>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Nicolas Schier <nicolas@...sle.eu>
Subject: Re: [PATCH] kbuild: deb-pkg: support DEB_BUILD_OPTIONS=parallel=N in debian/rules
On Mon, Aug 21, 2023 at 1:20 AM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> 'make srcdeb-pkg' generates a source package, which you can build
> later by using dpkg-buildpackage.
>
> In older dpkg versions, 'dpkg-buildpackage -j N' sets not only
> DEB_BUILD_OPTIONS but also MAKEFLAGS. Hence, passing -j (--jobs)
> to dpkg-buildpackage was enough to run parallel building.
>
> The behavior was changed by commit 1d0ea9b2ba3f ("dpkg-buildpackage:
> Change -j, --jobs semantics to non-force mode") of dpkg project. [1]
>
> Since then, 'dpkg-buildpackage -j N' sets only DEB_BUILD_OPTIONS,
> which is not parsed by the current debian/rules. You cannot build it
> in parallel unless you pass --jobs-force instead or set the MAKEFLAGS
> environment variable.
>
> Debian policy [2] suggests the following code snippet for debian/rules.
>
> ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
> NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
> MAKEFLAGS += -j$(NUMJOBS)
> endif
>
> I added slightly different code to debian/rules so 'make -j N deb-pkg'
> works as before. In this case, the '-j N' should not be specified in
> debian/rules again. 'make deb-pkg' without the -j option must explicitly
> pass -j1 to dpkb-buildpackage because otherwise DEB_BUILD_OPTIONS
> contains parallel=<nproc> by default.
>
> This should work with almost all Make versions Kbuild supports.
>
> Only the corner case I found not working is 'make-3.82 -j deb-pkg',
> which results in single thread building. It is not a big deal because
> -j without an argument, which does not limit the number of jobs, is
> rarely used.
>
> As far as I tested, the MAKEFLAGS format varies by Make versions.
>
> command line option $(MAKEFLAGS) in recipe
> Make 3.82 -j j
> -j1 <none>
> -j2 -j
> Make 4.0/4.1 -j -j
> -j1 <none>
> -j2 -j
> Make 4.2+ -j -j
> -j1 -j1
> -j2 -j2
On second thought, this is not a good idea.
I will send v2 with a different solution.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists