[EFL][GTK] Get CMake to find Freetype2 properly
authorthiago.lacerda@openbossa.org <thiago.lacerda@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Mar 2014 03:47:26 +0000 (03:47 +0000)
committerthiago.lacerda@openbossa.org <thiago.lacerda@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Mar 2014 03:47:26 +0000 (03:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130150

Reviewed by Martin Robinson.

Newer versions of CMake are not able to find Freetype2 correctly.
FindFreetype2.cmake checks for the version number in freetype.h header, since it seems that bug exists in
freetype2 repo, because a completely different version number is found in freetype2.pc.

.:

* Source/cmake/FindFreetype2.cmake: Added.
* Source/cmake/OptionsEfl.cmake:
* Source/cmake/OptionsGTK.cmake:

Source/WebCore:

* PlatformEfl.cmake:
* PlatformGTK.cmake:

Source/WebKit:

* PlatformEfl.cmake:

Source/WebKit2:

* PlatformEfl.cmake:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@166037 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebKit/ChangeLog
Source/WebKit/PlatformEfl.cmake
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformEfl.cmake
Source/cmake/FindFreetype2.cmake [new file with mode: 0644]
Source/cmake/OptionsEfl.cmake
Source/cmake/OptionsGTK.cmake

index 501e34e..a17722b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-03-20  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        [EFL][GTK] Get CMake to find Freetype2 properly
+        https://bugs.webkit.org/show_bug.cgi?id=130150
+
+        Reviewed by Martin Robinson.
+
+        Newer versions of CMake are not able to find Freetype2 correctly.
+        FindFreetype2.cmake checks for the version number in freetype.h header, since it seems that bug exists in
+        freetype2 repo, because a completely different version number is found in freetype2.pc.
+
+        * Source/cmake/FindFreetype2.cmake: Added.
+        * Source/cmake/OptionsEfl.cmake:
+        * Source/cmake/OptionsGTK.cmake:
+
 2014-03-20  Brian Burg  <bburg@apple.com>
 
         Web Replay: capture and replay mouse events
index bb20ce9..ca6f8ce 100644 (file)
@@ -1,3 +1,17 @@
+2014-03-20  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        [EFL][GTK] Get CMake to find Freetype2 properly
+        https://bugs.webkit.org/show_bug.cgi?id=130150
+
+        Reviewed by Martin Robinson.
+
+        Newer versions of CMake are not able to find Freetype2 correctly.
+        FindFreetype2.cmake checks for the version number in freetype.h header, since it seems that bug exists in
+        freetype2 repo, because a completely different version number is found in freetype2.pc.
+
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+
 2014-03-20  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] Suppress errors about using gdk_threads_enter gdk_threads_leave
index 1886917..149d09b 100644 (file)
@@ -221,7 +221,7 @@ list(APPEND WebCore_LIBRARIES
     ${E_DBUS_EUKIT_LIBRARIES}
     ${E_DBUS_LIBRARIES}
     ${FONTCONFIG_LIBRARIES}
-    ${FREETYPE_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
@@ -248,7 +248,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
     ${EEZE_INCLUDE_DIRS}
     ${EINA_INCLUDE_DIRS}
     ${EVAS_INCLUDE_DIRS}
-    ${FREETYPE_INCLUDE_DIRS}
+    ${FREETYPE2_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIR}
     ${LIBXSLT_INCLUDE_DIR}
     ${SQLITE_INCLUDE_DIR}
index e5380bd..b7384f1 100644 (file)
@@ -293,7 +293,7 @@ list(APPEND WebCore_LIBRARIES
     ${CAIRO_LIBRARIES}
     ${ENCHANT_LIBRARIES}
     ${FONTCONFIG_LIBRARIES}
-    ${FREETYPE_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
     ${GEOCLUE_LIBRARIES}
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GMODULE_LIBRARIES}
@@ -322,7 +322,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
     ${ATK_INCLUDE_DIRS}
     ${CAIRO_INCLUDE_DIRS}
     ${ENCHANT_INCLUDE_DIRS}
-    ${FREETYPE_INCLUDE_DIRS}
+    ${FREETYPE2_INCLUDE_DIRS}
     ${GEOCLUE_INCLUDE_DIRS}
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
index c82595d..a020716 100644 (file)
@@ -1,3 +1,16 @@
+2014-03-20  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        [EFL][GTK] Get CMake to find Freetype2 properly
+        https://bugs.webkit.org/show_bug.cgi?id=130150
+
+        Reviewed by Martin Robinson.
+
+        Newer versions of CMake are not able to find Freetype2 correctly.
+        FindFreetype2.cmake checks for the version number in freetype.h header, since it seems that bug exists in
+        freetype2 repo, because a completely different version number is found in freetype2.pc.
+
+        * PlatformEfl.cmake:
+
 2014-03-20  Beth Dakin  <bdakin@apple.com>
 
         Speculative build fix.
index 139661a..37f05e1 100644 (file)
@@ -149,7 +149,7 @@ list(APPEND WebKit_LIBRARIES
     ${EO_LIBRARIES}
     ${EVAS_LIBRARIES}
     ${FONTCONFIG_LIBRARIES}
-    ${FREETYPE_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${HARFBUZZ_LIBRARIES}
index 6adaa19..f4ac6e7 100644 (file)
@@ -1,3 +1,16 @@
+2014-03-20  Thiago de Barros Lacerda  <thiago.lacerda@openbossa.org>
+
+        [EFL][GTK] Get CMake to find Freetype2 properly
+        https://bugs.webkit.org/show_bug.cgi?id=130150
+
+        Reviewed by Martin Robinson.
+
+        Newer versions of CMake are not able to find Freetype2 correctly.
+        FindFreetype2.cmake checks for the version number in freetype.h header, since it seems that bug exists in
+        freetype2 repo, because a completely different version number is found in freetype2.pc.
+
+        * PlatformEfl.cmake:
+
 2014-03-20  Martin Robinson  <mrobinson@igalia.com>
 
         [GTK] Suppress errors about using gdk_threads_enter gdk_threads_leave
index 2e4ccb7..42498ab 100644 (file)
@@ -278,7 +278,7 @@ list(APPEND WebKit2_LIBRARIES
     ${EO_LIBRARIES}
     ${EVAS_LIBRARIES}
     ${FONTCONFIG_LIBRARIES}
-    ${Freetype_LIBRARIES}
+    ${FREETYPE2_LIBRARIES}
     ${GLIB_GIO_LIBRARIES}
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
diff --git a/Source/cmake/FindFreetype2.cmake b/Source/cmake/FindFreetype2.cmake
new file mode 100644 (file)
index 0000000..fdcc2c9
--- /dev/null
@@ -0,0 +1,88 @@
+# Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+find_package(PkgConfig)
+pkg_check_modules(PC_FREETYPE2 REQUIRED freetype2)
+
+find_path(FREETYPE2_HEADER_DIR
+    NAMES freetype.h
+    HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
+          ${PC_FREETYPE2_INCLUDEDIR}
+    PATH_SUFFIXES freetype
+)
+
+find_path(FREETYPE2_ROOT_INCLUDE_DIR
+    NAMES freetype/freetype.h
+    HINTS ${PC_FREETYPE2_INCLUDE_DIRS}
+          ${PC_FREETYPE2_INCLUDEDIR}
+)
+
+find_library(FREETYPE2_LIBRARIES
+    NAMES freetype
+    HINTS ${PC_FREETYPE2_LIBDIR}
+          ${PC_FREETYPE2_LIBRARY_DIRS}
+)
+
+set(FREETYPE2_INCLUDE_DIRS ${FREETYPE2_HEADER_DIR})
+
+# Since Freetype 2.5.1 there is no freetype/freetype.h, so this variable can be null
+if (FREETYPE2_ROOT_INCLUDE_DIR)
+    list(APPEND FREETYPE2_INCLUDE_DIRS ${FREETYPE2_ROOT_INCLUDE_DIR})
+endif ()
+
+# Inspired in the original FindFreetype.cmake
+if (FREETYPE2_HEADER_DIR AND EXISTS "${FREETYPE2_HEADER_DIR}/freetype.h")
+    file(STRINGS "${FREETYPE2_HEADER_DIR}/freetype.h" freetype_version_str
+         REGEX "^#[\t ]*define[\t ]+FREETYPE_(MAJOR|MINOR|PATCH)[\t ]+[0-9]+$")
+
+    unset(FREETYPE2_VERSION_STRING)
+    foreach (VPART MAJOR MINOR PATCH)
+        foreach (VLINE ${freetype_version_str})
+            if (VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}")
+                string(REGEX REPLACE "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$" "\\1"
+                       FREETYPE2_VERSION_PART "${VLINE}")
+                if (FREETYPE2_VERSION_STRING)
+                    set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_STRING}.${FREETYPE2_VERSION_PART}")
+                else ()
+                    set(FREETYPE2_VERSION_STRING "${FREETYPE2_VERSION_PART}")
+                endif ()
+                unset(FREETYPE2_VERSION_PART)
+            endif ()
+        endforeach ()
+    endforeach ()
+endif ()
+
+set(VERSION_OK TRUE)
+if (FREETYPE2_VERSION_STRING)
+    if (PC_FREETYPE2_FIND_VERSION_EXACT)
+        if (NOT("${Freetype2_FIND_VERSION}" VERSION_EQUAL "${FREETYPE2_VERSION_STRING}"))
+            set(VERSION_OK FALSE)
+        endif ()
+    else ()
+        if ("${FREETYPE2_VERSION_STRING}" VERSION_LESS "${Freetype2_FIND_VERSION}")
+            set(VERSION_OK FALSE)
+        endif ()
+    endif ()
+endif ()
+
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Freetype2 DEFAULT_MSG FREETYPE2_INCLUDE_DIRS FREETYPE2_LIBRARIES VERSION_OK)
index 0b61d07..da95b9f 100644 (file)
@@ -159,7 +159,7 @@ find_package(Eet ${EFL_REQUIRED_VERSION} REQUIRED ${EFL_CONFIG_MODE})
 find_package(Eeze ${EFL_REQUIRED_VERSION} REQUIRED ${EFL_CONFIG_MODE})
 find_package(Efreet ${EFL_REQUIRED_VERSION} REQUIRED ${EFL_CONFIG_MODE})
 
-find_package(Freetype 2.4.2 REQUIRED)
+find_package(Freetype2 2.4.2 REQUIRED)
 find_package(HarfBuzz 0.9.2 REQUIRED)
 add_definitions(-DWTF_USE_FREETYPE=1)
 add_definitions(-DWTF_USE_HARFBUZZ=1)
index 452b280..fda1d60 100644 (file)
@@ -170,7 +170,7 @@ add_definitions(-DMOZ_X11)
 
 find_package(Cairo 1.10.2 REQUIRED)
 find_package(Fontconfig 2.8.0 REQUIRED)
-find_package(Freetype 2.4.2 REQUIRED)
+find_package(Freetype2 2.4.2 REQUIRED)
 find_package(GTK2 2.24.10 REQUIRED)
 find_package(GDK2 2.24.10 REQUIRED)
 find_package(HarfBuzz 0.9.2 REQUIRED)