Bug 205042

Summary: [CMake] Add HarfBuzz targets
Product: WebKit Reporter: Don Olmstead <don.olmstead>
Component: CMakeAssignee: Don Olmstead <don.olmstead>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, clopez, commit-queue, ews-watchlist, gyuyoung.kim, ryuan.choi, sergio
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
WIP Patch
none
WIP Patch
none
WIP Patch
none
Patch
none
Patch none

Description Don Olmstead 2019-12-09 18:15:51 PST
Add HarfBuzz:: targets within the FindHarfBuzz module.
Comment 1 Don Olmstead 2019-12-09 18:29:23 PST Comment hidden (obsolete)
Comment 2 Don Olmstead 2019-12-09 18:30:52 PST Comment hidden (obsolete)
Comment 3 Don Olmstead 2019-12-09 18:35:02 PST Comment hidden (obsolete)
Comment 4 Don Olmstead 2019-12-10 13:46:47 PST
Created attachment 385303 [details]
Patch
Comment 5 Don Olmstead 2019-12-10 14:17:41 PST
Comment on attachment 385303 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385303&action=review

> Source/cmake/OptionsGTK.cmake:27
> +find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)

Igalia folks is this ok? Latest release is 2.6.4 and 0.9.18 is from May of 2013. WPE sets it as the minimum.

If not then I have to add back in the version check to see if the ICU library is split off from the main harfbuzz library.
Comment 6 Konstantin Tokarev 2019-12-10 14:47:06 PST
Comment on attachment 385303 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385303&action=review

Actually, modern versions of HarfBuzz provide cmake config files with harfbuzz::harfbuzz and harfbuzz::icu target, though I didn't research in which version they were added

> Source/cmake/FindHarfBuzz.cmake:60
> +``HarfBuzz_INCLUDE_DIRS``

While code below defines HarfBuzz_INCLUDE_DIR, not DIRS.

FWIW, modern cmake use "*DIRS" naming.

> Source/cmake/FindHarfBuzz.cmake:94
> +    message(FATAL_ERROR "Required version (" ${Harfbuzz_FIND_VERSION} ") is higher than found version (" ${Harfbuzz_VERSION} ")")

Nice catch, but it should be spelled as HarfBuzz_VERSION
Comment 7 Carlos Alberto Lopez Perez 2019-12-10 16:25:15 PST
Comment on attachment 385303 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385303&action=review

>> Source/cmake/OptionsGTK.cmake:27
>> +find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
> 
> Igalia folks is this ok? Latest release is 2.6.4 and 0.9.18 is from May of 2013. WPE sets it as the minimum.
> 
> If not then I have to add back in the version check to see if the ICU library is split off from the main harfbuzz library.

I think it is OK.
Our policy for bumping versions of dependencies is this one: https://trac.webkit.org/wiki/WebKitGTK/DependenciesPolicy
Ubuntu 18.04 LTS has harfbuzz 1.7.2 and Debian 10 Stable version 2.3.1 (and Debian 9 oldstable 1.4.2)
Comment 8 Don Olmstead 2019-12-10 16:49:26 PST
(In reply to Konstantin Tokarev from comment #6)
> Comment on attachment 385303 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=385303&action=review
> 
> Actually, modern versions of HarfBuzz provide cmake config files with
> harfbuzz::harfbuzz and harfbuzz::icu target, though I didn't research in
> which version they were added

It seems like they want to move over to meson at some point in the future. So we'll probably have to have our own or push one to CMake's repo which would take a long time to trickle down to linux distros.

> > Source/cmake/FindHarfBuzz.cmake:60
> > +``HarfBuzz_INCLUDE_DIRS``
> 
> While code below defines HarfBuzz_INCLUDE_DIR, not DIRS.
> 
> FWIW, modern cmake use "*DIRS" naming.

I was looking at the following modules which seemed to be more recently updates.

https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindFontconfig.cmake
https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindTIFF.cmake

They both use _LIBRARY, marking it as advanced, and then create a _LIBRARIES variable off of it. Seems like an ok pattern there.

> > Source/cmake/FindHarfBuzz.cmake:94
> > +    message(FATAL_ERROR "Required version (" ${Harfbuzz_FIND_VERSION} ") is higher than found version (" ${Harfbuzz_VERSION} ")")
> 
> Nice catch, but it should be spelled as HarfBuzz_VERSION

Good catch there!
Comment 9 Don Olmstead 2019-12-10 16:50:44 PST
(In reply to Carlos Alberto Lopez Perez from comment #7)
> Comment on attachment 385303 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=385303&action=review
> 
> >> Source/cmake/OptionsGTK.cmake:27
> >> +find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
> > 
> > Igalia folks is this ok? Latest release is 2.6.4 and 0.9.18 is from May of 2013. WPE sets it as the minimum.
> > 
> > If not then I have to add back in the version check to see if the ICU library is split off from the main harfbuzz library.
> 
> I think it is OK.
> Our policy for bumping versions of dependencies is this one:
> https://trac.webkit.org/wiki/WebKitGTK/DependenciesPolicy
> Ubuntu 18.04 LTS has harfbuzz 1.7.2 and Debian 10 Stable version 2.3.1 (and
> Debian 9 oldstable 1.4.2)

Great thanks for confirming! For those of us who don't use Linux is there a good way to see what the distribution is bundling and what specific version you all are supporting?
Comment 10 Don Olmstead 2019-12-10 16:51:13 PST
Created attachment 385316 [details]
Patch

Fix review comments
Comment 11 Konstantin Tokarev 2019-12-10 17:18:35 PST
> It seems like they want to move over to meson at some point in the future.
> So we'll probably have to have our own or push one to CMake's repo which
> would take a long time to trickle down to linux distros.
> 

Inclusion of modules unto cmake itself is long since discouraged, projects are expected to install their own cmake config files as a part of make install routine
Comment 12 Konstantin Tokarev 2019-12-10 17:23:32 PST
Comment on attachment 385316 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385316&action=review

> Source/cmake/FindHarfBuzz.cmake:31
> +# HarfBuzz_INCLUDE_DIRS - containg the HarfBuzz headers

You still have DIRS here and DIR in code, it needs to be consistent
Comment 13 Carlos Alberto Lopez Perez 2019-12-10 17:42:49 PST
(In reply to Don Olmstead from comment #9)
> (In reply to Carlos Alberto Lopez Perez from comment #7)
> > Comment on attachment 385303 [details]
> > Patch
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=385303&action=review
> > 
> > >> Source/cmake/OptionsGTK.cmake:27
> > >> +find_package(HarfBuzz 0.9.18 REQUIRED COMPONENTS ICU)
> > > 
> > > Igalia folks is this ok? Latest release is 2.6.4 and 0.9.18 is from May of 2013. WPE sets it as the minimum.
> > > 
> > > If not then I have to add back in the version check to see if the ICU library is split off from the main harfbuzz library.
> > 
> > I think it is OK.
> > Our policy for bumping versions of dependencies is this one:
> > https://trac.webkit.org/wiki/WebKitGTK/DependenciesPolicy
> > Ubuntu 18.04 LTS has harfbuzz 1.7.2 and Debian 10 Stable version 2.3.1 (and
> > Debian 9 oldstable 1.4.2)
> 
> Great thanks for confirming! For those of us who don't use Linux is there a
> good way to see what the distribution is bundling and what specific version
> you all are supporting?

Yes, package info and versions for Debian and Ubuntu can be queried at https://packages.debian.org and https://packages.ubuntu.com respectively.
Comment 14 Don Olmstead 2019-12-10 17:45:31 PST
Comment on attachment 385316 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385316&action=review

> Source/cmake/FindHarfBuzz.cmake:179
> +   set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR})

HarfBuzz_INCLUDE_DIRS is set here.

See https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindTIFF.cmake#L75-76 and https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindFontconfig.cmake#L98-101 for CMake bundled find modules that use this pattern. CMake itself isn't exactly internally consistent so I don't care if we go with this or not. Fine with whatever the preference is since we're moving to targets here.
Comment 15 Konstantin Tokarev 2019-12-11 11:56:39 PST
Comment on attachment 385316 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=385316&action=review

>> Source/cmake/FindHarfBuzz.cmake:179
>> +   set(HarfBuzz_INCLUDE_DIRS ${HarfBuzz_INCLUDE_DIR})
> 
> HarfBuzz_INCLUDE_DIRS is set here.
> 
> See https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindTIFF.cmake#L75-76 and https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/FindFontconfig.cmake#L98-101 for CMake bundled find modules that use this pattern. CMake itself isn't exactly internally consistent so I don't care if we go with this or not. Fine with whatever the preference is since we're moving to targets here.

Oops, I've just overlooked this line
Comment 16 WebKit Commit Bot 2019-12-11 12:30:46 PST
Comment on attachment 385316 [details]
Patch

Clearing flags on attachment: 385316

Committed r253388: <https://trac.webkit.org/changeset/253388>
Comment 17 WebKit Commit Bot 2019-12-11 12:30:48 PST
All reviewed patches have been landed.  Closing bug.