Skip to content

Include libffi license notice in binary distributions - #1739

Open
atgreen wants to merge 1 commit into
java-native-access:masterfrom
atgreen:include-libffi-license
Open

atgreen wants to merge 1 commit into
java-native-access:masterfrom
atgreen:include-libffi-license

Conversation

@atgreen

@atgreen atgreen commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

JNA bundles libffi in its native libraries, but the distributed license files currently contain only JNA’s LGPL/Apache licensing information. Add the bundled libffi copyright and permission notice verbatim to the top-level LICENSE, so recipients of newly built JARs and AARs receive it.

Clarify that JNA’s dual-license choice applies to its own code. Include META-INF/LICENSE in the native, cross-build-package, and Web Start JAR targets, and invalidate the main JAR when its license files or build definition change.

Existing checked-in lib/native/*.jar archives still need repackaging: the dist target copies those archives, so changing the packaging rules does not retrofit them. This PR deliberately contains only the source/build changes, with no rebuilt binaries.

Validation:

  • Built the main, minimal, and JPMS JARs, Android archive, native cross-build package, and Linux x86-64 native JAR.
  • Verified the main/minimal/JPMS JARs, AAR’s classes.jar, and rebuilt Linux native JAR contain the updated LICENSE, including the exact bundled libffi notice.
  • Independent review found no actionable issues; git diff --check passed.
  • ant checkstyle dist passed.
  • ant test test-platform passed: 635 core tests and 44 platform tests, with no failures or errors (Linux x86-64, OpenJDK 26).
  • Existing compiler/Javadoc warnings remain; no runtime code was changed. Web Start execution was not tested.

@matthiasblaesing matthiasblaesing left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking care of this. I had a quick look at this and generally this makes sense to.

I can repackage the binaries, but that will not be a rebuild, just a modification of the existing jar files. Rebuilding the binaries is work ranging in days, which makes no sense as the source code did not change. The dist folder should not be touched for this, just binaries below lib/native. I would then also remove them from the dist folder. From my perspective there is little reason to have them there.

Comment thread LICENSE
Comment on lines +28 to +52

The native libraries bundled with JNA incorporate libffi, which is
distributed under the following license:

libffi - Copyright (c) 1996-2022 Anthony Green, Red Hat, Inc and others.
See source files for details.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
``Software''), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first thought was, that the license file might not be the best file for this. The ALv2 license has an explicit location for required notices. I'm referring to the NOTICE file (section 4d): https://www.apache.org/licenses/LICENSE-2.0#redistribution.

Comment thread build.xml
cd ..
</echo>
<jar jarfile="${build}/${os.prefix}.jar" createUnicodeExtraFields="never" encoding="UTF-8">
<zipfileset dir="." includes="LICENSE" prefix="META-INF"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also include the AL2.0 and LGPL2.1 files. The LICENSE file explicitly references these. My first thought was that it alone might be enough, but jnidispatch is more than just libffi, it also contains parts only in JNA.

This applies to the two location below too.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants