[CMake] Clean up Web Crypto build targets
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jul 2017 08:45:54 +0000 (08:45 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 17 Jul 2017 08:45:54 +0000 (08:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174253

Reviewed by Michael Catanzaro.

Gather the common WebCrypto source files in CMakeLists.txt, including them
in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
build guards to exclude the code from compilation if the feature is disabled.

PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
Web Crypto build targets.

PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the build
was configured to enable the use of libgcrypt. The new CMake file adds the
libgcrypt-specific Web Crypto build targets to the build if the feature was
enabled, and also sets up libgcrypt include directiories and libraries.

No new tests -- no change in behavior.

* CMakeLists.txt:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* PlatformWPE.cmake:
* platform/GCrypt.cmake: Added.

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

Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebCore/PlatformMac.cmake
Source/WebCore/PlatformWPE.cmake
Source/WebCore/platform/GCrypt.cmake [new file with mode: 0644]

index 4a16505..9f44b68 100644 (file)
@@ -1296,6 +1296,41 @@ set(WebCore_SOURCES
     contentextensions/NFAToDFA.cpp
     contentextensions/URLFilterParser.cpp
 
+    crypto/CryptoAlgorithm.cpp
+    crypto/CryptoAlgorithmRegistry.cpp
+    crypto/CryptoKey.cpp
+    crypto/SubtleCrypto.cpp
+    crypto/WebKitSubtleCrypto.cpp
+
+    crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
+    crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
+    crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
+    crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
+    crypto/algorithms/CryptoAlgorithmAES_KW.cpp
+    crypto/algorithms/CryptoAlgorithmECDH.cpp
+    crypto/algorithms/CryptoAlgorithmECDSA.cpp
+    crypto/algorithms/CryptoAlgorithmHKDF.cpp
+    crypto/algorithms/CryptoAlgorithmHMAC.cpp
+    crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
+    crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
+    crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
+    crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
+    crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
+    crypto/algorithms/CryptoAlgorithmSHA1.cpp
+    crypto/algorithms/CryptoAlgorithmSHA224.cpp
+    crypto/algorithms/CryptoAlgorithmSHA256.cpp
+    crypto/algorithms/CryptoAlgorithmSHA384.cpp
+    crypto/algorithms/CryptoAlgorithmSHA512.cpp
+
+    crypto/keys/CryptoKeyAES.cpp
+    crypto/keys/CryptoKeyDataOctetSequence.cpp
+    crypto/keys/CryptoKeyDataRSAComponents.cpp
+    crypto/keys/CryptoKeyEC.cpp
+    crypto/keys/CryptoKeyHMAC.cpp
+    crypto/keys/CryptoKeyRSA.cpp
+    crypto/keys/CryptoKeyRaw.cpp
+    crypto/keys/CryptoKeySerializationRaw.cpp
+
     css/BasicShapeFunctions.cpp
     css/CSSAspectRatioValue.cpp
     css/CSSBasicShapes.cpp
index d685874..c923895 100644 (file)
@@ -1,3 +1,31 @@
+2017-07-17  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CMake] Clean up Web Crypto build targets
+        https://bugs.webkit.org/show_bug.cgi?id=174253
+
+        Reviewed by Michael Catanzaro.
+
+        Gather the common WebCrypto source files in CMakeLists.txt, including them
+        in the build unconditionally and instead relying on ENABLE_SUBTLE_CRYPTO
+        build guards to exclude the code from compilation if the feature is disabled.
+
+        PlatformGTK.cmake, PlatformMac.cmake and PlatformWPE.cmake can then remove
+        duplicated build targets. PlatformMac.cmake still lists all the Mac-specific
+        Web Crypto build targets.
+
+        PlatformGTK.cmake and PlatformWPE.cmake now include GCrypt.cmake if the build
+        was configured to enable the use of libgcrypt. The new CMake file adds the
+        libgcrypt-specific Web Crypto build targets to the build if the feature was
+        enabled, and also sets up libgcrypt include directiories and libraries.
+
+        No new tests -- no change in behavior.
+
+        * CMakeLists.txt:
+        * PlatformGTK.cmake:
+        * PlatformMac.cmake:
+        * PlatformWPE.cmake:
+        * platform/GCrypt.cmake: Added.
+
 2017-07-16  Michael Catanzaro  <mcatanzaro@igalia.com>
 
         -Wreorder warning caused by GraphicsContext3D cleanup
index 355e919..e1a07e5 100644 (file)
@@ -8,6 +8,10 @@ if (USE_TEXTURE_MAPPER)
     include(platform/TextureMapper.cmake)
 endif ()
 
+if (USE_GCRYPT)
+    include(platform/GCrypt.cmake)
+endif ()
+
 set(WebCore_OUTPUT_NAME WebCoreGTK)
 
 list(APPEND WebCore_INCLUDE_DIRECTORIES
@@ -214,7 +218,6 @@ list(APPEND WebCore_LIBRARIES
     ${GLIB_GOBJECT_LIBRARIES}
     ${GLIB_LIBRARIES}
     ${GUDEV_LIBRARIES}
-    ${LIBGCRYPT_LIBRARIES}
     ${LIBSECRET_LIBRARIES}
     ${LIBSOUP_LIBRARIES}
     ${LIBTASN1_LIBRARIES}
@@ -241,7 +244,6 @@ list(APPEND WebCore_SYSTEM_INCLUDE_DIRECTORIES
     ${GIO_UNIX_INCLUDE_DIRS}
     ${GLIB_INCLUDE_DIRS}
     ${GUDEV_INCLUDE_DIRS}
-    ${LIBGCRYPT_INCLUDE_DIRS}
     ${LIBSECRET_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
     ${LIBTASN1_INCLUDE_DIRS}
@@ -335,61 +337,3 @@ if (ENABLE_SMOOTH_SCROLLING)
         platform/ScrollAnimationSmooth.cpp
     )
 endif ()
-
-if (ENABLE_SUBTLE_CRYPTO)
-    list(APPEND WebCore_SOURCES
-        crypto/CryptoAlgorithm.cpp
-        crypto/CryptoAlgorithmRegistry.cpp
-        crypto/CryptoKey.cpp
-        crypto/SubtleCrypto.cpp
-        crypto/WebKitSubtleCrypto.cpp
-
-        crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
-        crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
-        crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
-        crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
-        crypto/algorithms/CryptoAlgorithmAES_KW.cpp
-        crypto/algorithms/CryptoAlgorithmECDH.cpp
-        crypto/algorithms/CryptoAlgorithmECDSA.cpp
-        crypto/algorithms/CryptoAlgorithmHKDF.cpp
-        crypto/algorithms/CryptoAlgorithmHMAC.cpp
-        crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
-        crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
-        crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
-        crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
-        crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
-        crypto/algorithms/CryptoAlgorithmSHA1.cpp
-        crypto/algorithms/CryptoAlgorithmSHA224.cpp
-        crypto/algorithms/CryptoAlgorithmSHA256.cpp
-        crypto/algorithms/CryptoAlgorithmSHA384.cpp
-        crypto/algorithms/CryptoAlgorithmSHA512.cpp
-
-        crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp
-        crypto/gcrypt/CryptoKeyECGCrypt.cpp
-        crypto/gcrypt/CryptoKeyRSAGCrypt.cpp
-        crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp
-
-        crypto/keys/CryptoKeyAES.cpp
-        crypto/keys/CryptoKeyDataOctetSequence.cpp
-        crypto/keys/CryptoKeyDataRSAComponents.cpp
-        crypto/keys/CryptoKeyEC.cpp
-        crypto/keys/CryptoKeyHMAC.cpp
-        crypto/keys/CryptoKeyRSA.cpp
-        crypto/keys/CryptoKeyRaw.cpp
-        crypto/keys/CryptoKeySerializationRaw.cpp
-    )
-endif ()
index 4240a1d..f443606 100644 (file)
@@ -176,40 +176,6 @@ list(APPEND WebCore_SOURCES
     bridge/objc/objc_utility.mm
 
     crypto/CommonCryptoUtilities.cpp
-    crypto/CryptoAlgorithm.cpp
-    crypto/CryptoAlgorithmRegistry.cpp
-    crypto/CryptoKey.cpp
-    crypto/SubtleCrypto.cpp
-    crypto/WebKitSubtleCrypto.cpp
-
-    crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
-    crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
-    crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
-    crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
-    crypto/algorithms/CryptoAlgorithmAES_KW.cpp
-    crypto/algorithms/CryptoAlgorithmECDH.cpp
-    crypto/algorithms/CryptoAlgorithmECDSA.cpp
-    crypto/algorithms/CryptoAlgorithmHKDF.cpp
-    crypto/algorithms/CryptoAlgorithmHMAC.cpp
-    crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
-    crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
-    crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
-    crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
-    crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
-    crypto/algorithms/CryptoAlgorithmSHA1.cpp
-    crypto/algorithms/CryptoAlgorithmSHA224.cpp
-    crypto/algorithms/CryptoAlgorithmSHA256.cpp
-    crypto/algorithms/CryptoAlgorithmSHA384.cpp
-    crypto/algorithms/CryptoAlgorithmSHA512.cpp
-
-    crypto/keys/CryptoKeyAES.cpp
-    crypto/keys/CryptoKeyDataOctetSequence.cpp
-    crypto/keys/CryptoKeyDataRSAComponents.cpp
-    crypto/keys/CryptoKeyEC.cpp
-    crypto/keys/CryptoKeyHMAC.cpp
-    crypto/keys/CryptoKeyRSA.cpp
-    crypto/keys/CryptoKeyRaw.cpp
-    crypto/keys/CryptoKeySerializationRaw.cpp
 
     crypto/mac/CommonCryptoDERUtilities.cpp
     crypto/mac/CryptoAlgorithmAES_CBCMac.cpp
index d4f2efb..3196f70 100644 (file)
@@ -5,6 +5,10 @@ include(platform/ImageDecoders.cmake)
 include(platform/Linux.cmake)
 include(platform/TextureMapper.cmake)
 
+if (USE_GCRYPT)
+    include(platform/GCrypt.cmake)
+endif ()
+
 # Allow building ANGLE on platforms that don't provide X11 headers.
 list(APPEND ANGLE_PLATFORM_DEFINITIONS "USE_WPE")
 
@@ -167,7 +171,6 @@ list(APPEND WebCore_LIBRARIES
     ${GLIB_LIBRARIES}
     ${GNUTLS_LIBRARIES}
     ${ICU_LIBRARIES}
-    ${LIBGCRYPT_LIBRARIES}
     ${LIBSOUP_LIBRARIES}
     ${LIBTASN1_LIBRARIES}
     ${LIBXML2_LIBRARIES}
@@ -182,7 +185,6 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
     ${GLIB_INCLUDE_DIRS}
     ${GNUTLS_INCLUDE_DIRS}
     ${ICU_INCLUDE_DIRS}
-    ${LIBGCRYPT_INCLUDE_DIRS}
     ${LIBSOUP_INCLUDE_DIRS}
     ${LIBTASN1_INCLUDE_DIRS}
     ${LIBXML2_INCLUDE_DIR}
@@ -203,62 +205,3 @@ target_include_directories(WebCorePlatformWPE SYSTEM PRIVATE
 target_link_libraries(WebCorePlatformWPE
     ${WebCore_LIBRARIES}
 )
-
-if (ENABLE_SUBTLE_CRYPTO)
-    list(APPEND WebCore_SOURCES
-        crypto/CryptoAlgorithm.cpp
-        crypto/CryptoAlgorithmRegistry.cpp
-        crypto/CryptoKey.cpp
-        crypto/SubtleCrypto.cpp
-        crypto/WebKitSubtleCrypto.cpp
-
-        crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
-        crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
-        crypto/algorithms/CryptoAlgorithmAES_CTR.cpp
-        crypto/algorithms/CryptoAlgorithmAES_GCM.cpp
-        crypto/algorithms/CryptoAlgorithmAES_KW.cpp
-        crypto/algorithms/CryptoAlgorithmECDH.cpp
-        crypto/algorithms/CryptoAlgorithmECDSA.cpp
-        crypto/algorithms/CryptoAlgorithmHKDF.cpp
-        crypto/algorithms/CryptoAlgorithmHMAC.cpp
-        crypto/algorithms/CryptoAlgorithmPBKDF2.cpp
-        crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
-        crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp
-        crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
-        crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp
-        crypto/algorithms/CryptoAlgorithmSHA1.cpp
-        crypto/algorithms/CryptoAlgorithmSHA224.cpp
-        crypto/algorithms/CryptoAlgorithmSHA256.cpp
-        crypto/algorithms/CryptoAlgorithmSHA384.cpp
-        crypto/algorithms/CryptoAlgorithmSHA512.cpp
-
-        crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp
-        crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp
-        crypto/gcrypt/CryptoKeyECGCrypt.cpp
-        crypto/gcrypt/CryptoKeyRSAGCrypt.cpp
-        crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp
-
-        crypto/keys/CryptoKeyAES.cpp
-        crypto/keys/CryptoKeyDataOctetSequence.cpp
-        crypto/keys/CryptoKeyDataRSAComponents.cpp
-        crypto/keys/CryptoKeyEC.cpp
-        crypto/keys/CryptoKeyHMAC.cpp
-        crypto/keys/CryptoKeyRSA.cpp
-        crypto/keys/CryptoKeyRaw.cpp
-        crypto/keys/CryptoKeySerializationRaw.cpp
-    )
-endif ()
-
diff --git a/Source/WebCore/platform/GCrypt.cmake b/Source/WebCore/platform/GCrypt.cmake
new file mode 100644 (file)
index 0000000..f8fd532
--- /dev/null
@@ -0,0 +1,29 @@
+if (ENABLE_SUBTLE_CRYPTO)
+    list(APPEND WebCore_SOURCES
+        crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_CFBGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_CTRGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_GCMGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmAES_KWGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmECDSAGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmHKDFGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmPBKDF2GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSAES_PKCS1_v1_5GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSASSA_PKCS1_v1_5GCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSA_OAEPGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRSA_PSSGCrypt.cpp
+        crypto/gcrypt/CryptoAlgorithmRegistryGCrypt.cpp
+        crypto/gcrypt/CryptoKeyECGCrypt.cpp
+        crypto/gcrypt/CryptoKeyRSAGCrypt.cpp
+        crypto/gcrypt/SerializedCryptoKeyWrapGCrypt.cpp
+    )
+endif ()
+
+list(APPEND WebCore_LIBRARIES
+    ${LIBGCRYPT_LIBRARIES}
+)
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    ${LIBGCRYPT_INCLUDE_DIRS}
+)