Re: a patch to fix building OpenJDK with jhalfs

"Xi Ruoyao" ([email protected] via alfs-discuss Mailing List) <[email protected]> Sat, 01 Feb 2025 21:04:09 +0800
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
On Sat, 2025-02-01 at 13:48 +0100, Pierre Labastie wrote:
> Le samedi 01 février 2025 à 19:23 +0800, Xi Ruoyao a écrit :
> > On Sat, 2025-02-01 at 12:20 +0100, Pierre Labastie wrote:
> > > Le lundi 27 janvier 2025 à 07:35 +0800, Zhang Wen a écrit :
> > > > The OpenJDK package requires JOBS=N instead of -jN as makeflags
> > > > to
> > > > build 
> > > > parallel, so it can't be built with jhalfs now. Attached is the
> > > > patch
> > > > I'm using and it works well for me, hope someone can review this
> > > > patch.
> > > > 
> > > > diff --git a/BLFS/xsl/scripts.xsl b/BLFS/xsl/scripts.xsl
> > > > index b5a6fa5..104da13 100644
> > > > --- a/BLFS/xsl/scripts.xsl
> > > > +++ b/BLFS/xsl/scripts.xsl
> > > > @@ -193,7 +193,15 @@ export JH_KEEP_FILES="</xsl:text>
> > > >        parallel jobs. This supposes that ninja has been build
> > > > with
> > > >        support for NINJAJOBS in lfs. We'll have to change that
> > > > code
> > > >        if lfs changes its policy for ninja. -->
> > > > -      <xsl:text>export MAKEFLAGS="-j</xsl:text>
> > > > +      <xsl:text>export MAKEFLAGS="</xsl:text>
> > > > +      <xsl:choose>
> > > > +        <xsl:when test="@id='openjdk'">
> > > > +          <xsl:text>JOBS=</xsl:text>
> > > > +        </xsl:when>
> > > > +        <xsl:otherwise>
> > > > +                <xsl:text>-j</xsl:text>
> > > > +        </xsl:otherwise>
> > > > +      </xsl:choose>
> > > >         <xsl:choose>
> > > >           <xsl:when test="$jobs = 0">
> > > >             <xsl:text>$(nproc)"
> > > 
> > > This should work, but actually it is better to change the blfs book
> > > itself by adding "unset MAKEFLAGS" and passing --jobs=$(nproc) to
> > > configure. Note that jhalfs has recently learned how to treat
> > > $(nproc)
> > > (in a <replaceable> tag), that is replace it with the number of
> > > jobs
> > > set by the user (or $(nproc) if the user sets $jobs to 0.)
> > 
> > Do we really need to unset MAKEFLAGS?  I.e. is a MAKEFLAGS=-j4
> > breaking
> > the build, or it's just ineffective?
> > 
> 
> It makes configure exit with an error

Oh, I see the book already has unset MAKEFLAGS.  And the book also has
an <option> in explanation:

--with-jobs=$(nproc): The -j passed to make does not work with make as
invoked here. By default, the build system will use the number of CPUs -
1.

So if it works, we should use it instead of "JOBS=" (and turn it from
<option> to <parameter>).

-- 
Xi Ruoyao <[email protected]>
School of Aerospace Science and Technology, Xidian University

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page