Unreviewed, rolling out r188919.
[WebKit-https.git] / Source / cmake / WebKitPackaging.cmake
1 # -----------------------------------------------------------------------------
2 # This file defines the basics of CPack behavior for WebKit
3 #
4 # The following CPack variables will be defined if they were unset:
5 #   - CPACK_PACKAGE_NAME to WebKit-${PORT}
6 #   - CPACK_SOURCE_IGNORE_FILES to a known pattern of good files
7 #
8 # The following variables affect the behavior of packaging:
9 #   - WEBKIT_CPACK_ALL_PORTS if defined and true, will not limit packaging
10 #     to just include files of the port (affects CPACK_SOURCE_IGNORE_FILES,
11 #     just if this variable was not defined before).
12 #   - WEBKIT_CPACK_ADD_TESTS if defined and true, will also add tests
13 #     (affects CPACK_SOURCE_IGNORE_FILES, just if this variable was
14 #     not defined before)
15 #   - WEBKIT_CPACK_ADD_TOOLS if defined and true, will also add tools
16 #     (affects CPACK_SOURCE_IGNORE_FILES, just if this variable was
17 #     not defined before)
18 # -----------------------------------------------------------------------------
19
20 if (NOT DEFINED CPACK_PACKAGE_NAME)
21     set(CPACK_PACKAGE_NAME WebKit-${PORT})
22 endif ()
23
24 if (NOT DEFINED CPACK_SOURCE_IGNORE_FILES)
25     set(CPACK_SOURCE_IGNORE_FILES
26         # Version control:
27         "/CVS/"
28         "/\\\\.svn/"
29         "/\\\\.bzr/"
30         "/\\\\.hg/"
31         "/\\\\.git/"
32         "\\\\.swp$"
33         "\\\\.#"
34         "/#"
35         "/\\\\.gitignore$"
36         "/\\\\.gitattributes$"
37
38         # SVN-only files should be ignored (site, examples...)
39         "/PerformanceTests/"
40         "/Examples/"
41         "/Websites/"
42
43         # Other build systems:
44         # - Makefiles (.mk/Makefile)
45         "\\\\.mk$"
46         "\\\\.make$"
47         "Makefile"
48         # - XCode (Mac)
49         "\\\\.xcodeproj"
50         "\\\\.xcconfig"
51         # - GYP
52         "\\\\.gyp"
53         # - QMake (Qt)
54         "\\\\.pri$"
55         "\\\\.pro$"
56
57         # Development & Runtime created files
58         "~$"
59         "\\\\.mode"
60         "\\\\.pbxuser$"
61         "\\\\.perspective"
62         "\\\\.pyc$"
63         "\\\\.pyo$"
64         "/cmake-build/"
65         "/build/"
66         "/WebKitBuild/"
67         "/Tools/Scripts/webkitpy/thirdparty/autoinstalled/"
68         )
69
70     if (NOT WEBKIT_CPACK_ADD_TESTS)
71         list(APPEND CPACK_SOURCE_IGNORE_FILES
72           "/LayoutTests/"
73           "/ManualTests/"
74           "/tests/"
75           )
76     endif (NOT WEBKIT_CPACK_ADD_TESTS)
77
78     if (NOT WEBKIT_CPACK_ADD_TOOLS)
79         list(APPEND CPACK_SOURCE_IGNORE_FILES
80         "/Tools/"
81         "/manual-tools/"
82         "/tools/"
83         "/PageLoadTools/"
84         )
85     endif (NOT WEBKIT_CPACK_ADD_TOOLS)
86
87
88     if (NOT WEBKIT_CPACK_ALL_PORTS)
89
90         # All file and directory patterns that Efl uses
91         set(FILE_PATTERNS_Efl
92             "/cairo/" "/Cairo/" "cairo\\\\." "Cairo\\\\."
93             "/efl/" "/Efl/" "efl\\\\." "Efl\\\\."
94             "/glib/" "/Glib/" "glib\\\\." "Glib\\\\."
95             "/gobject/" "/Gobject/" "gobject\\\\." "Gobject\\\\."
96             "/icu/" "/Icu/" "icu\\\\." "Icu\\\\."
97             "/posix/" "/Posix/" "posix\\\\." "Posix\\\\."
98             "/soup/" "/Soup/" "soup\\\\." "Soup\\\\."
99             )
100
101         # File and Directory patterns that no CMake-ified port uses
102         set(FILE_PATTERNS_UNKNOWN_PORTS
103             "/carbon/" "/Carbon/" "carbon\\\\." "Carbon\\\\."
104             "/cf/" "/Cf/" "cf\\\\." "Cf\\\\."
105             "/cg/" "/Cg/" "cg\\\\." "Cg\\\\."
106             "/chromium/" "/Chromium/" "chromium\\\\." "Chromium\\\\."
107             "/cocoa/" "/Cocoa/" "cocoa\\\\." "Cocoa\\\\."
108             "/Configurations/" "/Configurations/" "Configurations\\\\." "Configurations\\\\."
109             "/curl/" "/Curl/" "curl\\\\." "Curl\\\\."
110             "/gstreamer/" "/Gstreamer/" "gstreamer\\\\." "Gstreamer\\\\."
111             "/gtk/" "/Gtk/" "gtk\\\\." "Gtk\\\\."
112             "/iphone/" "/Iphone/" "iphone\\\\." "Iphone\\\\."
113             "/mac/" "/Mac/" "mac\\\\." "Mac\\\\."
114             "/opentype/" "/Opentype/" "opentype\\\\." "Opentype\\\\."
115             "/openvg/" "/Openvg/" "openvg\\\\." "Openvg\\\\."
116             "/qscriptengine/" "/Qscriptengine/" "qscriptengine\\\\." "Qscriptengine\\\\."
117             "/qscriptstring/" "/Qscriptstring/" "qscriptstring\\\\." "Qscriptstring\\\\."
118             "/qscriptvalue/" "/Qscriptvalue/" "qscriptvalue\\\\." "Qscriptvalue\\\\."
119             "/qt/" "/Qt/" "qt\\\\." "Qt\\\\."
120             "/qt4/" "/Qt4/" "qt4\\\\." "Qt4\\\\."
121             "/win/" "/Win/" "win\\\\." "Win\\\\."
122             "/wxcode/" "/Wxcode/" "wxcode\\\\." "Wxcode\\\\."
123             "/WebKitLibraries/"
124             "/English\\\\.lproj/"
125             "/Source/WebKit2/"
126             "\\\\.a$"
127             "\\\\.exe$"
128             "\\\\.mm$"
129             )
130
131         # Append all Unknown port patterns
132         foreach (_pattern ${FILE_PATTERNS_UNKNOWN_PORTS})
133             list(FIND FILE_PATTERNS_${PORT} ${_pattern} _pattern_index)
134             if (_pattern_index GREATER -1)
135                 message("pattern ${_pattern} declared of 'no-port' is actually used by ${PORT}")
136             else ()
137                 list(APPEND CPACK_SOURCE_IGNORE_FILES ${_pattern})
138             endif ()
139         endforeach ()
140
141         # Append all "other-ports" patterns
142         foreach (_port ${ALL_PORTS})
143             if (NOT ${_port} STREQUAL ${PORT})
144                 foreach (_pattern ${FILE_PATTERNS_${_port}})
145
146                     list(FIND FILE_PATTERNS_${PORT} ${_pattern} _pattern_index)
147                     if (_pattern_index GREATER -1)
148                         message("pattern ${_pattern} of port ${_port} is also used by ${PORT}")
149                     else ()
150                         list(APPEND CPACK_SOURCE_IGNORE_FILES ${_pattern})
151                     endif ()
152                 endforeach ()
153             endif ()
154         endforeach ()
155
156     endif (NOT WEBKIT_CPACK_ALL_PORTS)
157
158 endif (NOT DEFINED CPACK_SOURCE_IGNORE_FILES)
159
160 # -----------------------------------------------------------------------------
161 # Include CPack that will define targets based on the variables defined before
162 # -----------------------------------------------------------------------------
163 include(CPack)