Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8193017: Import freetype sources into OpenJDK source tree #318

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

gdams
Copy link
Member

@gdams gdams commented May 24, 2023

Imports the Freetype source to be consistent with JDK11+

As discussed in ibmruntimes/openj9-openjdk-jdk8#631 CC @gnu-andrew


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8193017 needs maintainer approval

Issue

  • JDK-8193017: Import freetype sources into OpenJDK source tree (Bug - P3)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk8u-dev.git pull/318/head:pull/318
$ git checkout pull/318

Update a local copy of the PR:
$ git checkout pull/318
$ git pull https://git.openjdk.org/jdk8u-dev.git pull/318/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 318

View PR using the GUI difftool:
$ git pr show -t 318

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk8u-dev/pull/318.diff

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 24, 2023

👋 Welcome back gdams! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot changed the title Backport 58ff4ee8c4ec399528338b59eadea996110366a0 8193017: Import freetype sources into OpenJDK source tree May 24, 2023
@openjdk
Copy link

openjdk bot commented May 24, 2023

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk bot added backport rfr Pull request is ready for review labels May 24, 2023
@mlbridge
Copy link

mlbridge bot commented May 24, 2023

@gnu-andrew
Copy link
Member

Good to see this being proposed. I was wondering what had happened to it.

How close is this to JDK-8193017? Were other changes necessary on top?

I'll do a comparison of the two patches when I get a chance.

@mlbridge
Copy link

mlbridge bot commented Jun 2, 2023

Mailing list message from Andrew Hughes on jdk8u-dev:

On 20:03 Wed 31 May , Thorsten Glaser wrote:

On Wed, 31 May 2023, Andrew John Hughes wrote:

Good to see this being proposed. I was wondering what had happened to it.

As long as there is a flag to still use the system library,
and I can figure out how and where to add it in the build
process?

bye,
//mirabilos
--
Infrastrukturexperte ? tarent solutions GmbH
Am Dickobskreuz 10, D-53121 Bonn ? http://www.tarent.de/
Telephon +49 228 54881-393 ? Fax: +49 228 54881-235
HRB AG Bonn 5168 ? USt-ID (VAT): DE122264941
Gesch?ftsf?hrer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

                    \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

/?\ The UTF-8 Ribbon
??? Campaign against Mit dem tarent-Newsletter nichts mehr verpassen:
??? HTML eMail! Also, https://www.tarent.de/newsletter
??? header encryption!
****************************************************

Given 8u is a stable release, I don't intend for any defaults to
change, so you shouldn't have to add any new options.

This is primarily aimed at Windows, where FreeType is not readily
available on the system and FreeType sources have to be supplied
manually to the JDK build.

Thanks,
--
Andrew :)
Pronouns: he / him or they / them
Principal Free Java Software Engineer
OpenJDK Package Owner
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222

Please contact via e-mail, not proprietary chat networks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://mail.openjdk.org/pipermail/jdk8u-dev/attachments/20230601/18c9724d/signature-0001.asc>

@gdams
Copy link
Member Author

gdams commented Jun 6, 2023

Good to see this being proposed. I was wondering what had happened to it.

How close is this to JDK-8193017? Were other changes necessary on top?

I'll do a comparison of the two patches when I get a chance.

it's reasonably close, the main difference is that the freetype source is located in jdk/src/share/native/sun/awt/libfreetype/ rather than jdk/src/share/native/libfreetype to be consistent with other JDK8u sources. I also removed freetype task from the GitHub actions workflow.

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 4, 2023

@gdams This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@gdams
Copy link
Member Author

gdams commented Jul 4, 2023

Please keep this open

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 1, 2023

@gdams This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 30, 2023

@gdams This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Aug 30, 2023
@mrserb
Copy link
Member

mrserb commented Aug 30, 2023

probably we should keep it open?

@gdams
Copy link
Member Author

gdams commented Jul 12, 2024

/open

@openjdk openjdk bot reopened this Jul 12, 2024
@openjdk
Copy link

openjdk bot commented Jul 12, 2024

@gdams This pull request is now open

@openjdk
Copy link

openjdk bot commented Jul 12, 2024

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Jul 12, 2024

@gdams this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout freetype
git fetch https://git.openjdk.org/jdk8u-dev.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Jul 12, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Aug 9, 2024

@gdams This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@mrserb
Copy link
Member

mrserb commented Aug 12, 2024

@gdams do you have a chance to look at the merge-conflict?

@gdams
Copy link
Member Author

gdams commented Aug 12, 2024

Yup @mrserb I'll try and get to it this week. I must stress that it would be good to make a decision on this as it's very painful to keep such a large changeset up to date

@gdams
Copy link
Member Author

gdams commented Aug 13, 2024

@mrserb I've resolved the merge conflicts. I'm slightly worried about the changes to common/autoconf/generated-configure.sh though. I've got autoconf@2.69 on my mac (installed using brew) but there might be a more specific version required?

@mrserb
Copy link
Member

mrserb commented Aug 13, 2024

@mrserb I've resolved the merge conflicts. I'm slightly worried about the changes to common/autoconf/generated-configure.sh though. I've got autoconf@2.69 on my mac (installed using brew) but there might be a more specific version required?

I had a similar issue some time ago #413 (comment), at that time I also run 2.69 on macos. Solved that by running autoconf on some linux hosts.

@gdams
Copy link
Member Author

gdams commented Aug 13, 2024

@mrserb I've resolved the merge conflicts. I'm slightly worried about the changes to common/autoconf/generated-configure.sh though. I've got autoconf@2.69 on my mac (installed using brew) but there might be a more specific version required?

I had a similar issue some time ago #413 (comment), at that time I also run 2.69 on macos. Solved that by running autoconf on some linux hosts.

that looks better, I've compiled it locally with the patch applied and the generated configure looks correct now

make/lib/Awt2dLibraries.gmk Outdated Show resolved Hide resolved
@mrserb
Copy link
Member

mrserb commented Aug 15, 2024

I did a quick test on macOS. If the "libfreetype.dylib" is deleted from some old jdk8 build(or jdk-21) the next exception is occurred for the font demo:

./jdk-8/bin/java -jar ./build/macosx-x86_64-normal-server-release/images/j2sdk-image/demo/jfc/Font2DTest/Font2DTest.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: /Users/openjdk/jdk8u-dev/jdk-8/jre/lib/libfontmanager.dylib: dlopen(/Users/openjdk/jdk8u-dev/jdk-8/jre/lib/libfontmanager.dylib, 0x0001): Library not loaded: @rpath/libfreetype.dylib.6
Referenced from: /Users/openjdk/jdk8u-dev/jdk-8/jre/lib/libfontmanager.dylib
Reason: tried: '/Users/openjdk/jdk8u-dev/jdk-8/jre/lib/./libfreetype.dylib.6' (no such file), '/Users/openjdk/jdk8u-dev/jdk-8/jre/lib/./libfreetype.dylib.6' (no such file), '/Users/openjdk/jdk8u-dev/jdk-8/jre/lib/server/./libfreetype.dylib.6' (no such file), '/Users/openjdk/jdk8u-dev/jdk-8/jre/lib/server/../libfreetype.dylib.6' (no such file), '/Users/openjdk/jdk8u-dev/jdk-8/bin/./libfreetype.dylib.6' (no such file), '/usr/lib/libfreetype.dylib.6' (no such file, not in dyld cache)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at sun.lwawt.macosx.LWCToolkit$1.run(LWCToolkit.java:93)
at sun.lwawt.macosx.LWCToolkit$1.run(LWCToolkit.java:80)
at java.security.AccessController.doPrivileged(Native Method)
at sun.lwawt.macosx.LWCToolkit.(LWCToolkit.java:79)
....
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
....
at Font2DTest.main(Font2DTest.java:1031)

But If I delete the "libfreetype.dylib" from the build after this patch the demo works fine.

@mrserb
Copy link
Member

mrserb commented Aug 15, 2024

But If I delete the "libfreetype.dylib" from the build after this patch the demo works fine.

Using "DYLD_PRINT_LIBRARIES=YES" traced that the "Homebrew" version of freetype is loaded. it is unclear why this version is not loaded in case of jdk-21. @rpath looks the same.

@mrserb
Copy link
Member

mrserb commented Aug 15, 2024

Using "DYLD_PRINT_LIBRARIES=YES" traced that the "Homebrew" version of freetype is loaded. it is unclear why this version is not loaded in case of jdk-21. @rpath looks the same.

nevermind seems that in case of "macos+Homebrew" the jdk-21 is affected as well but only if I build jdk locally.
tested on windows and works fine.

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Aug 15, 2024
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Aug 15, 2024
@@ -0,0 +1,537 @@
## The FreeType Project: Freetype v2.9
Copy link
Member

Choose a reason for hiding this comment

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

The "legal" folder is used in jdk9+, for jdk8 licenses should be placed in THIRD_PARTY_README file. We have several of them in jdk8, but after #557 integration there will be only one.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've copied the entire contents of this file to the THIRD_PARTY_README file. Hopefully that's the correct way to do it.

# (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
# 'v110' or 'v120' for VS 2010, 2012 or VS2013
eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"

Copy link
Member

Choose a reason for hiding this comment

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

this change probably correct, but it is not part of the jdk11 commit, and this code still exists in the openjdk/jdk

Copy link
Member Author

Choose a reason for hiding this comment

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

good spot, I've pushed a commit to revert this and will see if a build still passes

@@ -405,9 +405,6 @@ happens, read more below in [the `configure` options](#configureoptions).

Some examples:

> **Windows 32bit build with freetype specified:** \
Copy link
Member

Choose a reason for hiding this comment

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

doc/building.html should be updated as well.

Copy link
Member

Choose a reason for hiding this comment

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

note that the documentation for freetype in jdk8 is outdated, in jdk9 it was reworked by this commit. We should update at least the freetype related part as a follow-up patch.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that commit probably needs to be backported as a starting point and then further changes made, including the other FreeType changes in the original version of this commit and replacing Mercurial with git.

I think this patch should at least update doc/building.html to match the building.md changes being made.

# First check if the files exists.
if test -s "$POTENTIAL_FREETYPE_INCLUDE_PATH/ft2build.h"; then
# We found an arbitrary include file. That's a good sign.
# Assume we've found freetype to begin
Copy link
Member

Choose a reason for hiding this comment

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

from where this comment is come from? the jdk11 and openjdk/jdk use "# Let's start with an optimistic view of the world :-)" added by the "openjdk/jdk@6b1eac7"

Copy link
Member Author

Choose a reason for hiding this comment

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

good spot, I've updated the comment but this is only a partial backport of those changes

FREETYPE_TO_USE=bundled
if test "x$OPENJDK_TARGET_OS" != "xwindows" && \
test "x$OPENJDK_TARGET_OS" != "xmacosx" && \
test "x$OPENJDK_TARGET_OS" != "xaix"; then
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure about "aix" do we want to use the bundled version on it?

@mrserb
Copy link
Member

mrserb commented Aug 15, 2024

it will be good to test it on solartis and aix.

@theRealAph
Copy link
Contributor

This one is outside the usual rules for 8u, which is closed for enhancements. For that reason, it must be accompanied by a very strong justification, and evidence that it carries no risk.
By now, I'd have thought that everyone building JDK 8 on Windows etc. had workflows in place. We are at the (long) tail of the JDK 8 life cycle.

@gnu-andrew
Copy link
Member

This one is outside the usual rules for 8u, which is closed for enhancements. For that reason, it must be accompanied by a very strong justification, and evidence that it carries no risk. By now, I'd have thought that everyone building JDK 8 on Windows etc. had workflows in place. We are at the (long) tail of the JDK 8 life cycle.

I'm not sure I'd call this an enhancement. The lack of in-tree sources for FreeType means that there is no reference version of FreeType to build and test against, as there is with other libraries used by the AWT classes (libjpeg, libpng, giflib, LCMS).

Historically, this is because Oracle did not use FreeType and its maintenance was largely left to others. There is evidence of this in this patch with the only JDK code changes being to allow FreeType to be used on non-OpenJDK builds (largely irrelevant to use I would expect)

Yes, those on Windows & Mac likely have some way of building against FreeType in place, but it is an ongoing burden to maintain that version of FreeType, and it means every person building OpenJDK potentially uses some different version of FreeType.

It's also an issue on the GNU/Linux side as there is no option not to use a system FreeType, which potentially reduces the portability of such builds. A build of OpenJDK may take place against one system installation of FreeType and then be used against a completely different one.

The reason these issues have not been a bigger problem up to now is FreeType is a pretty stable library. I think the risk of introducing this now is still very low (as I say, there are very few code changes at all) and it improves the maintainability of 8u for everyone.

Copy link
Member

@gnu-andrew gnu-andrew left a comment

Choose a reason for hiding this comment

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

Patch looks good for comparison with the 11u version. My only real issue is with the doc updates. I thought at first we should update the other FreeType documentation here, but, after reading other comments, it seems better to follow up this work by trying to sync closer to later JDK versions first, then apply the changes from this changeset. This patch should at least update building.html to match building.md though by regenerating the HTML.

I'll try bundled and system builds with this patch while you work on that.

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 27, 2024

@gdams This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@gnu-andrew
Copy link
Member

Keep open. Would be good to get this in.

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 4, 2024

@gdams This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants