[WPE][GTK] Avoid duplicating code for dist and distcheck targets
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 18:42:55 +0000 (18:42 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 18:42:55 +0000 (18:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=179154

Reviewed by Carlos Garcia Campos.

.:

This commit just reduces some CMake code duplication between GTK and WPE.

* Source/PlatformGTK.cmake:
* Source/PlatformWPE.cmake:
* Source/cmake/WebKitDist.cmake: Added.

Tools:

Move the script out of Tools/gtk because it is already used by WPE. Also, drop the .py
prefix because it is executable.

* Scripts/make-dist: Renamed from Tools/gtk/make-dist.py.

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

ChangeLog
Source/PlatformGTK.cmake
Source/PlatformWPE.cmake
Source/cmake/WebKitDist.cmake [new file with mode: 0644]
Tools/ChangeLog
Tools/Scripts/make-dist [moved from Tools/gtk/make-dist.py with 100% similarity]

index 0ed16a5..7d81956 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2017-11-03  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [WPE][GTK] Avoid duplicating code for dist and distcheck targets
+        https://bugs.webkit.org/show_bug.cgi?id=179154
+
+        Reviewed by Carlos Garcia Campos.
+
+        This commit just reduces some CMake code duplication between GTK and WPE.
+
+        * Source/PlatformGTK.cmake:
+        * Source/PlatformWPE.cmake:
+        * Source/cmake/WebKitDist.cmake: Added.
+
 2017-11-02  Tim Horton  <timothy_horton@apple.com>
 
         Reduce duplication in the toplevel Makefile
index 041c67a..c42ce34 100644 (file)
@@ -1,3 +1,5 @@
+include(WebKitDist)
+
 add_subdirectory(${WEBCORE_DIR}/platform/gtk/po)
 
 # This allows exposing a 'gir' target which builds all GObject introspection files.
@@ -52,45 +54,6 @@ add_custom_target(check
 )
 
 if (DEVELOPER_MODE)
-    configure_file(
-        ${TOOLS_DIR}/gtk/manifest.txt.in
-        ${CMAKE_BINARY_DIR}/manifest.txt
-    )
-
-    add_custom_command(
-        OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
-        DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
-        DEPENDS ${CMAKE_BINARY_DIR}/manifest.txt
-        DEPENDS WebKit
-        DEPENDS gtkdoc
-        COMMAND ${TOOLS_DIR}/gtk/make-dist.py
-                --source-dir=${CMAKE_SOURCE_DIR}
-                --build-dir=${CMAKE_BINARY_DIR}
-                --version=${PROJECT_VERSION}
-                ${CMAKE_BINARY_DIR}/manifest.txt
-    )
-
-    add_custom_command(
-        OUTPUT ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
-        DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
-        COMMAND xz -f ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
-    )
-
-    add_custom_target(dist
-        DEPENDS ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar.xz
-    )
-
-    add_custom_target(distcheck
-        DEPENDS ${TOOLS_DIR}/gtk/make-dist.py
-        DEPENDS ${CMAKE_BINARY_DIR}/manifest.txt
-        DEPENDS WebKit
-        DEPENDS gtkdoc
-        COMMAND ${TOOLS_DIR}/gtk/make-dist.py
-                --check
-                --source-dir=${CMAKE_SOURCE_DIR}
-                --build-dir=${CMAKE_BINARY_DIR}
-                --version=${PROJECT_VERSION}
-                ${CMAKE_BINARY_DIR}/manifest.txt
-        COMMAND xz -f ${CMAKE_BINARY_DIR}/webkitgtk-${PROJECT_VERSION}.tar
-    )
+    add_custom_target(Documentation DEPENDS gtkdoc)
+    WEBKIT_DECLARE_DIST_TARGETS(GTK webkitgtk ${TOOLS_DIR}/gtk/manifest.txt.in)
 endif ()
index 21596bf..38642e0 100644 (file)
@@ -1,44 +1,7 @@
-if (DEVELOPER_MODE)
-    find_package(Xz REQUIRED)
-
-    configure_file(
-        ${TOOLS_DIR}/wpe/manifest.txt.in
-        ${CMAKE_BINARY_DIR}/manifest.txt
-    )
-
-    add_custom_target(distcheck
-        COMMENT "Checking release tarball: wpewebkit-${PROJECT_VERSION}.tar"
-        DEPENDS "${CMAKE_BINARY_DIR}/manifest.txt"
-                "${TOOLS_DIR}/gtk/make-dist.py"
-        COMMAND "${TOOLS_DIR}/gtk/make-dist.py"
-                "--check" "--port=WPE"
-                "--tarball-name=wpewebkit"
-                "--source-dir=${CMAKE_SOURCE_DIR}"
-                "--build-dir=${CMAKE_BINARY_DIR}"
-                "--version=${PROJECT_VERSION}"
-                "${CMAKE_BINARY_DIR}/manifest.txt"
-        COMMAND "${XZ_EXECUTABLE}" "-evfQ"
-                "${CMAKE_BINARY_DIR}/wpewebkit-${PROJECT_VERSION}.tar"
-        USES_TERMINAL
-    )
+include(WebKitDist)
 
-    add_custom_command(
-        COMMENT "Creating release tarball: wpewebkit-${PROJECT_VERSION}.tar.xz"
-        OUTPUT "${CMAKE_BINARY_DIR}/wpewebkit-${PROJECT_VERSION}.tar.xz"
-        MAIN_DEPENDENCY "${CMAKE_BINARY_DIR}/manifest.txt"
-        DEPENDS "${TOOLS_DIR}/gtk/make-dist.py"
-        COMMAND "${TOOLS_DIR}/gtk/make-dist.py"
-                "--tarball-name=wpewebkit"
-                "--source-dir=${CMAKE_SOURCE_DIR}"
-                "--build-dir=${CMAKE_BINARY_DIR}"
-                "--version=${PROJECT_VERSION}"
-                "${CMAKE_BINARY_DIR}/manifest.txt"
-        COMMAND "${XZ_EXECUTABLE}" "-evfQ"
-                "${CMAKE_BINARY_DIR}/wpewebkit-${PROJECT_VERSION}.tar"
-        USES_TERMINAL
-    )
-
-    add_custom_target(dist
-        DEPENDS "${CMAKE_BINARY_DIR}/wpewebkit-${PROJECT_VERSION}.tar.xz"
-    )
+if (DEVELOPER_MODE)
+    # FIXME: This should depend on a gtkdoc target
+    add_custom_target(Documentation)
+    WEBKIT_DECLARE_DIST_TARGETS(WPE wpewebkit ${TOOLS_DIR}/wpe/manifest.txt.in)
 endif ()
diff --git a/Source/cmake/WebKitDist.cmake b/Source/cmake/WebKitDist.cmake
new file mode 100644 (file)
index 0000000..e820e3e
--- /dev/null
@@ -0,0 +1,48 @@
+macro(WEBKIT_DECLARE_DIST_TARGETS _port _tarball_prefix _manifest)
+    find_package(Xz REQUIRED)
+
+    configure_file(
+        ${_manifest}
+        ${CMAKE_BINARY_DIR}/manifest.txt
+    )
+
+    add_custom_target(distcheck
+        COMMENT "Checking release tarball: ${_tarball_prefix}-${PROJECT_VERSION}.tar"
+        DEPENDS ${CMAKE_BINARY_DIR}/manifest.txt
+        DEPENDS WebKit
+        DEPENDS Documentation
+        COMMAND ${TOOLS_DIR}/Scripts/make-dist
+                --check --port=${_port}
+                --tarball-name=${_tarball_prefix}
+                --source-dir=${CMAKE_SOURCE_DIR}
+                --build-dir=${CMAKE_BINARY_DIR}
+                --version=${PROJECT_VERSION}
+                ${CMAKE_BINARY_DIR}/manifest.txt
+        COMMAND ${XZ_EXECUTABLE} -evfQ
+                ${CMAKE_BINARY_DIR}/${_tarball_prefix}-${PROJECT_VERSION}.tar
+        USES_TERMINAL
+        VERBATIM
+    )
+
+    add_custom_command(
+        COMMENT "Creating release tarball: ${_tarball_prefix}-${PROJECT_VERSION}.tar.xz"
+        OUTPUT ${CMAKE_BINARY_DIR}/${_tarball_prefix}-${PROJECT_VERSION}.tar.xz
+        MAIN_DEPENDENCY ${CMAKE_BINARY_DIR}/manifest.txt
+        COMMAND ${TOOLS_DIR}/Scripts/make-dist
+                --tarball-name=${_tarball_prefix}
+                --source-dir=${CMAKE_SOURCE_DIR}
+                --build-dir=${CMAKE_BINARY_DIR}
+                --version=${PROJECT_VERSION}
+                ${CMAKE_BINARY_DIR}/manifest.txt
+        COMMAND ${XZ_EXECUTABLE} -evfQ
+                ${CMAKE_BINARY_DIR}/${_tarball_prefix}-${PROJECT_VERSION}.tar
+        USES_TERMINAL
+        VERBATIM
+    )
+
+    add_custom_target(dist
+        DEPENDS ${CMAKE_BINARY_DIR}/${_tarball_prefix}-${PROJECT_VERSION}.tar.xz
+        DEPENDS WebKit
+        DEPENDS Documentation
+    )
+endmacro()
index 010fb2b..aacac73 100644 (file)
@@ -1,3 +1,15 @@
+2017-11-03  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        [WPE][GTK] Avoid duplicating code for dist and distcheck targets
+        https://bugs.webkit.org/show_bug.cgi?id=179154
+
+        Reviewed by Carlos Garcia Campos.
+
+        Move the script out of Tools/gtk because it is already used by WPE. Also, drop the .py
+        prefix because it is executable.
+
+        * Scripts/make-dist: Renamed from Tools/gtk/make-dist.py.
+
 2017-11-03  Jonathan Bedard  <jbedard@apple.com>
 
         TestController platformAdjustContext should use provided WKContext for Mac