• make it possible to compile bouncycastle with jdk21

    From Ronald Klop@ronald-lists@klop.ws to muc.lists.freebsd.ports on Thu Dec 4 17:22:03 2025
    From Newsgroup: muc.lists.freebsd.ports

    ------=_Part_9383_115034253.1764865323234
    Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit

    Hi,

    I made a patch to make it possible to compile java/bouncycastle with jdk21. diff --git a/java/bouncycastle/Makefile b/java/bouncycastle/Makefile
    index cc8a0c788ad5..f8dc316f9f90 100644
    --- a/java/bouncycastle/Makefile
    +++ b/java/bouncycastle/Makefile
    @@ -1,6 +1,6 @@
    PORTNAME= bouncycastle
    DISTVERSION= 1.71
    -PORTREVISION= 1
    +PORTREVISION= 2
    CATEGORIES= java security
    MASTER_SITES= http://www.bouncycastle.org/download/ \
    http://polydistortion.net/bc/download/
    @@ -41,9 +41,10 @@ ZIPSRC_ALL_TARGET= zip-src

    ARTIFACTSDIR= ${WRKSRC}/build/artifacts/jdk${JDKMVERSION}
    DVERSION= ${PORTVERSION:S/.//}
    -JDKMVERSION= 1.5
    -JDKNVERSION= 15
    -JARSUFFIX= -jdk${JDKNVERSION}to18-${DVERSION}.jar
    +JDKMVERSION= 1.8
    +JDKNVERSION= 18
    +# matches target.prefix property in WRKSRC/ant/jdk18+.xml
    +JARSUFFIX= -jdk${JDKNVERSION}on-${DVERSION}.jar

    .include <bsd.port.options.mk>
    -----

    Any suggestions or objections for me to commit this in the next few days.

    I tested this with poudriere on aarch64.

    NB: port does not have a maintainer. I have a commit bit so can handle this.

    Regards,
    Ronald.

    ------=_Part_9383_115034253.1764865323234
    Content-Type: text/html; charset=us-ascii
    Content-Transfer-Encoding: 7bit

    <html><head></head><body>Hi,<br>

    I made a patch to make it possible to compile java/bouncycastle with jdk21. <pre>diff --git a/java/bouncycastle/Makefile b/java/bouncycastle/Makefile
    index cc8a0c788ad5..f8dc316f9f90 100644
    --- a/java/bouncycastle/Makefile
    +++ b/java/bouncycastle/Makefile
    @@ -1,6 +1,6 @@
    PORTNAME= bouncycastle
    DISTVERSION= 1.71
    -PORTREVISION= 1
    +PORTREVISION= 2
    CATEGORIES= java security
    MASTER_SITES= http://www.bouncycastle.org/download/ \
    http://polydistortion.net/bc/download/
    @@ -41,9 +41,10 @@ ZIPSRC_ALL_TARGET= zip-src

    ARTIFACTSDIR= ${WRKSRC}/build/artifacts/jdk${JDKMVERSION}
    DVERSION= ${PORTVERSION:S/.//}
    -JDKMVERSION= 1.5
    -JDKNVERSION= 15
    -JARSUFFIX= -jdk${JDKNVERSION}to18-${DVERSION}.jar
    +JDKMVERSION= 1.8
    +JDKNVERSION= 18
    +# matches target.prefix property in WRKSRC/ant/jdk18+.xml
    +JARSUFFIX= -jdk${JDKNVERSION}on-${DVERSION}.jar

    .include &lt;bsd.port.options.mk&gt;</pre>
    -----<br>

    Any suggestions or objections for me to commit this in the next few days.<br>

    I tested this with poudriere on aarch64.<br>

    NB: port does not have a maintainer. I have a commit bit so can handle this.<br>

    Regards,<br>
    Ronald.<br>
    &nbsp;</body></html>
    ------=_Part_9383_115034253.1764865323234--


    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Olivier Certner@olce@freebsd.org to muc.lists.freebsd.ports on Thu Dec 4 19:00:06 2025
    From Newsgroup: muc.lists.freebsd.ports

    --nextPart3136992.hHqAuc6tWs
    Content-Transfer-Encoding: 7Bit
    Content-Type: text/plain; charset="utf-8"; protected-headers="v1"
    From: Olivier Certner <olce@freebsd.org>
    To: java@freebsd.org, Ronald Klop <ronald-lists@klop.ws>
    Cc: ports@freebsd.org
    Subject: Re: make it possible to compile bouncycastle with jdk21
    Date: Thu, 04 Dec 2025 19:00:06 +0100
    Message-ID: <3084524.slGk94SIus@ravel>
    In-Reply-To: <991224173.9384.1764865323241@localhost>
    References: <991224173.9384.1764865323241@localhost>
    MIME-Version: 1.0

    Hi,

    I have the same changes as yours plus an old patch that I did a while ago to enable building with openjdk11. I guess it is not needed for jdk21, but it shouldn't hurt:

    diff --git a/java/bouncycastle/files/patch-ant_bc+-build.xml b/java/bouncycastle/files/patch-ant_bc+-build.xml
    new file mode 100644
    index 000000000000..d8c18203edf1
    --- /dev/null
    +++ b/java/bouncycastle/files/patch-ant_bc+-build.xml
    @@ -0,0 +1,26 @@
    +--- ant/bc+-build.xml.orig 2022-01-31 06:50:53 UTC
    ++++ ant/bc+-build.xml
    +@@ -118,6 +118,7 @@
    + <mkdir dir="${artifacts.dir}/@{target}" />
    +
    + <javac source="${bc.javac.source}" target="${bc.javac.target}"
    ++ encoding="UTF-8"
    + srcdir="${artifacts.dir}/@{target}/src"
    + destdir="${build.dir}/@{target}/classes"
    + memoryMaximumSize="512m"
    +@@ -155,6 +156,7 @@
    + <mkdir dir="${artifacts.dir}/@{target}" />
    +
    + <javac source="${bc.javac.source}" target="${bc.javac.target}"
    ++ encoding="UTF-8"
    + srcdir="${artifacts.dir}/@{target}/src"
    + destdir="${build.dir}/@{target}/classes"
    + memoryMaximumSize="512m"
    +@@ -302,6 +304,7 @@
    + </copy>
    +
    + <javac source="${bc.javac.source}" target="${bc.javac.target}"
    ++ encoding="UTF-8"
    + srcdir="${lcrypto.target.src.dir}"
    + destdir="${lcrypto.target.classes.dir}"
    + memoryMaximumSize="512m"

    Without it, I get errors like:

    /wrkdirs/usr/ports/java/bouncycastle/work/crypto-171/build/artifacts/jdk1.8/bcprov-jdk18on-171/src/org/bouncycastle/crypto/generators/Argon2BytesGenerator.java:489: error: unmappable character (0xCF) for encoding US-ASCII
    * H0 = H64(p, ??, m, t, v, y, |P|, P, |S|, S, |L|, K, |X|, X)

    Could you test building with this patch? I'm not versed in Java building, so maybe there is some better way than that. Perhaps it's openjdk11 itself that should be compiled differently to default to UTF-8?

    Thanks and regards.
    --
    Olivier Certner
    --nextPart3136992.hHqAuc6tWs
    Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit

    -----BEGIN PGP SIGNATURE-----

    iQIzBAABCQAdFiEEmNCxHjkosai0LYIujKEwQJceJicFAmkxzCYACgkQjKEwQJce JieVNA//XJXxTzy5xCSxft4/LozZsDGGjxYjQKs6cGJI4WAWjT/zYQ/qhKHR8G6u d6MCX2yQ6cyNY5RF1Le3ruxyiLAEtdtSA6NeyCuRDxezmbeckK+drnNgiyXEPYbW RUCq/qHS3aq7ZPDbLNwUWOASU+eHDHVqiI5/s5Es4l7nIqrtPcobBzv7gJY83zh1 REH19HLatUb1l/sHu5rUTv5q7sIlf+UUlvkYKWXNj+l0dnH+XbLJbOsnU72Y6EHD 55jnSXXzkUD308IYwK/CAGT0URmOUvi0NdzEaZ4MXjjXq2j/+y74Kssah20fGTZ7 MFLA8+zAfoU7pfGz1SYKvM6geV5kuOlAjufK4ZqKa6BNYPwSYZs1Mvau+q0IkFQa 88ecu4E+ivHmXXpLKsJ6DHTDaQIBwFl2O7iwtnikLAjmid6Tar0mZEUaUn8zHlAP Rg+QgxjJE3BKsVrWPBjuzg5lXx+LLUiu3QO1XdA/A/zi725/OMdiLyxTNBv04Ncg hSQWvTtCbjIugZ/+JxH55Ub0mPTCAYodaYkkgPgAxWO00+xRQBzFDp+fOc8OghQF mxQh70opn3bH1NCK0hSfK9c49zmYG3my9zPBwa/dFPQnR+hXUUOOSo1TG1UDr7WQ MvT2V6Q7yTf4yhTvXmPUZWgUJwaMWSBKkmvBDtSzdFP6p9E/Eh0=
    =1dV9
    -----END PGP SIGNATURE-----

    --nextPart3136992.hHqAuc6tWs--





    --
    Posted automagically by a mail2news gateway at muc.de e.V.
    Please direct questions, flames, donations, etc. to news-admin@muc.de
    --- Synchronet 3.21a-Linux NewsLink 1.2