Showing
1 changed file
with
2039 additions
and
0 deletions
etc_files/bootstrap
0 → 100644
1 | +#!/bin/sh | ||
2 | +# Distributed under the OSI-approved BSD 3-Clause License. See accompanying | ||
3 | +# file Copyright.txt or https://cmake.org/licensing for details. | ||
4 | + | ||
5 | +die() { | ||
6 | + echo "$@" 1>&2 ; exit 1 | ||
7 | +} | ||
8 | + | ||
9 | +# Compile flag extraction function. | ||
10 | +cmake_extract_standard_flags() | ||
11 | +{ | ||
12 | + id="${1:-*}" | ||
13 | + lang="${2}" | ||
14 | + ver="${3}" | ||
15 | + sed -n "s/ *set *( *CMAKE_${lang}${ver}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \ | ||
16 | + "${cmake_source_dir}/Modules/Compiler/"${id}-${lang}.cmake \ | ||
17 | + 2>/dev/null | tr ';' ' ' | ||
18 | + # Clang's CXX compiler flags are in the common module. | ||
19 | + sed -n "s/ *set *( *CMAKE_\\\${lang}${ver}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \ | ||
20 | + "${cmake_source_dir}/Modules/Compiler/Clang.cmake" \ | ||
21 | + 2>/dev/null | tr ';' ' ' | ||
22 | +} | ||
23 | + | ||
24 | +# Version number extraction function. | ||
25 | +cmake_version_component() | ||
26 | +{ | ||
27 | + sed -n " | ||
28 | +/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\)).*/\1/;p;} | ||
29 | +" "${cmake_source_dir}/Source/CMakeVersion.cmake" | ||
30 | +} | ||
31 | + | ||
32 | +# Install destination extraction function. | ||
33 | +cmake_install_dest_default() | ||
34 | +{ | ||
35 | + sed -n ' | ||
36 | +/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ { | ||
37 | + s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/ | ||
38 | + s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/ | ||
39 | + s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/ | ||
40 | + s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/ | ||
41 | + p | ||
42 | + q | ||
43 | +} | ||
44 | +' "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake" | ||
45 | +} | ||
46 | + | ||
47 | +cmake_toupper() | ||
48 | +{ | ||
49 | + echo "$1" | tr '[a-z]' '[A-Z]' | ||
50 | +} | ||
51 | + | ||
52 | +# Detect system and directory information. | ||
53 | +cmake_system=`uname` | ||
54 | +cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd` | ||
55 | +cmake_binary_dir=`pwd` | ||
56 | + | ||
57 | +# Load version information. | ||
58 | +cmake_version_major="`cmake_version_component MAJOR`" | ||
59 | +cmake_version_minor="`cmake_version_component MINOR`" | ||
60 | +cmake_version_patch="`cmake_version_component PATCH`" | ||
61 | +cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" | ||
62 | +cmake_version_rc="`cmake_version_component RC`" | ||
63 | +if test "$cmake_version_rc" != ""; then | ||
64 | + cmake_version="${cmake_version}-rc${cmake_version_rc}" | ||
65 | +fi | ||
66 | + | ||
67 | +cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`" | ||
68 | + | ||
69 | +cmake_bin_dir_keyword="OTHER" | ||
70 | +cmake_data_dir_keyword="OTHER" | ||
71 | +cmake_doc_dir_keyword="OTHER" | ||
72 | +cmake_man_dir_keyword="OTHER" | ||
73 | +cmake_xdgdata_dir_keyword="OTHER" | ||
74 | +cmake_bin_dir="" | ||
75 | +cmake_data_dir="" | ||
76 | +cmake_doc_dir="" | ||
77 | +cmake_man_dir="" | ||
78 | +cmake_xdgdata_dir="" | ||
79 | +cmake_init_file="" | ||
80 | +cmake_bootstrap_system_libs="" | ||
81 | +cmake_bootstrap_qt_gui="" | ||
82 | +cmake_bootstrap_qt_qmake="" | ||
83 | +cmake_sphinx_info="" | ||
84 | +cmake_sphinx_man="" | ||
85 | +cmake_sphinx_html="" | ||
86 | +cmake_sphinx_qthelp="" | ||
87 | +cmake_sphinx_latexpdf="" | ||
88 | +cmake_sphinx_build="" | ||
89 | +cmake_sphinx_flags="" | ||
90 | + | ||
91 | +# Determine whether this is a Cygwin environment. | ||
92 | +if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then | ||
93 | + cmake_system_cygwin=true | ||
94 | + cmake_doc_dir_keyword="CYGWIN" | ||
95 | + cmake_man_dir_keyword="CYGWIN" | ||
96 | +else | ||
97 | + cmake_system_cygwin=false | ||
98 | +fi | ||
99 | + | ||
100 | +# Determine whether this is a MSYS environment. | ||
101 | +if echo "${cmake_system}" | grep MSYS >/dev/null 2>&1; then | ||
102 | + cmake_system_msys=true | ||
103 | + cmake_doc_dir_keyword="MSYS" | ||
104 | + cmake_man_dir_keyword="MSYS" | ||
105 | +else | ||
106 | + cmake_system_msys=false | ||
107 | +fi | ||
108 | + | ||
109 | +# Determine whether this is a MinGW environment. | ||
110 | +if echo "${cmake_system}" | grep 'MINGW' >/dev/null 2>&1; then | ||
111 | + cmake_system_mingw=true | ||
112 | +else | ||
113 | + cmake_system_mingw=false | ||
114 | +fi | ||
115 | + | ||
116 | +# Determine whether this is OS X | ||
117 | +if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then | ||
118 | + cmake_system_darwin=true | ||
119 | +else | ||
120 | + cmake_system_darwin=false | ||
121 | +fi | ||
122 | + | ||
123 | +# Determine whether this is BeOS | ||
124 | +if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then | ||
125 | + cmake_system_beos=true | ||
126 | + cmake_doc_dir_keyword="HAIKU" | ||
127 | + cmake_man_dir_keyword="HAIKU" | ||
128 | +else | ||
129 | + cmake_system_beos=false | ||
130 | +fi | ||
131 | + | ||
132 | +# Determine whether this is Haiku | ||
133 | +if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then | ||
134 | + cmake_system_haiku=true | ||
135 | + cmake_doc_dir_keyword="HAIKU" | ||
136 | + cmake_man_dir_keyword="HAIKU" | ||
137 | +else | ||
138 | + cmake_system_haiku=false | ||
139 | +fi | ||
140 | + | ||
141 | +# Determine whether this is OpenVMS | ||
142 | +if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then | ||
143 | + cmake_system_openvms=true | ||
144 | +else | ||
145 | + cmake_system_openvms=false | ||
146 | +fi | ||
147 | + | ||
148 | +# Determine whether this is HP-UX | ||
149 | +if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then | ||
150 | + die 'CMake no longer compiles on HP-UX. See | ||
151 | + | ||
152 | + https://gitlab.kitware.com/cmake/cmake/-/issues/17137 | ||
153 | + | ||
154 | +Use CMake 3.9 or lower instead.' | ||
155 | + cmake_system_hpux=true | ||
156 | +else | ||
157 | + cmake_system_hpux=false | ||
158 | +fi | ||
159 | + | ||
160 | +# Determine whether this is AIX | ||
161 | +if echo "${cmake_system}" | grep AIX >/dev/null 2>&1; then | ||
162 | + cmake_system_aix=true | ||
163 | +else | ||
164 | + cmake_system_aix=false | ||
165 | +fi | ||
166 | + | ||
167 | +# Determine whether this is Linux | ||
168 | +if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then | ||
169 | + cmake_system_linux=true | ||
170 | +else | ||
171 | + cmake_system_linux=false | ||
172 | +fi | ||
173 | + | ||
174 | +# Determine whether this is a PA-RISC machine | ||
175 | +# This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also | ||
176 | +# may falsely detect parisc on HP-UX m68k | ||
177 | +cmake_machine_parisc=false | ||
178 | +if ${cmake_system_linux}; then | ||
179 | + if uname -m | grep parisc >/dev/null 2>&1; then | ||
180 | + cmake_machine_parisc=true | ||
181 | + fi | ||
182 | +elif ${cmake_system_hpux}; then | ||
183 | + if uname -m | grep ia64 >/dev/null 2>&1; then : ; else | ||
184 | + cmake_machine_parisc=true | ||
185 | + fi | ||
186 | +fi | ||
187 | + | ||
188 | +# Choose the generator to use for bootstrapping. | ||
189 | +if ${cmake_system_mingw}; then | ||
190 | + # Bootstrapping from an MSYS prompt. | ||
191 | + cmake_bootstrap_generator="MSYS Makefiles" | ||
192 | +else | ||
193 | + # Bootstrapping from a standard UNIX prompt. | ||
194 | + cmake_bootstrap_generator="Unix Makefiles" | ||
195 | +fi | ||
196 | + | ||
197 | +# Choose tools and extensions for this platform. | ||
198 | +if ${cmake_system_openvms}; then | ||
199 | + _tmp="_tmp" | ||
200 | + _cmk="_cmk" | ||
201 | + _diff=`which diff` | ||
202 | +else | ||
203 | + _tmp=".tmp" | ||
204 | + _cmk=".cmk" | ||
205 | + _diff="diff" | ||
206 | +fi | ||
207 | + | ||
208 | +# Construct bootstrap directory name. | ||
209 | +cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}" | ||
210 | + | ||
211 | +# Helper function to fix windows paths. | ||
212 | +case "${cmake_system}" in | ||
213 | +*MINGW*) | ||
214 | + cmake_fix_slashes() | ||
215 | + { | ||
216 | + cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//' | ||
217 | + } | ||
218 | + ;; | ||
219 | +*) | ||
220 | + cmake_fix_slashes() | ||
221 | + { | ||
222 | + echo "$1" | sed 's/\\/\//g' | ||
223 | + } | ||
224 | + ;; | ||
225 | +esac | ||
226 | + | ||
227 | +# Choose the default install prefix. | ||
228 | +if ${cmake_system_mingw}; then | ||
229 | + if test "x${PROGRAMFILES}" != "x"; then | ||
230 | + cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"` | ||
231 | + elif test "x${ProgramFiles}" != "x"; then | ||
232 | + cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"` | ||
233 | + elif test "x${SYSTEMDRIVE}" != "x"; then | ||
234 | + cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"` | ||
235 | + elif test "x${SystemDrive}" != "x"; then | ||
236 | + cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"` | ||
237 | + else | ||
238 | + cmake_default_prefix="c:/Program Files/CMake" | ||
239 | + fi | ||
240 | +elif ${cmake_system_haiku}; then | ||
241 | + cmake_default_prefix=`finddir B_COMMON_DIRECTORY` | ||
242 | +else | ||
243 | + cmake_default_prefix="/usr/local" | ||
244 | +fi | ||
245 | + | ||
246 | +# Lookup default install destinations. | ||
247 | +cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`" | ||
248 | +cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`" | ||
249 | +cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`" | ||
250 | +cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`" | ||
251 | +cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`" | ||
252 | + | ||
253 | +CMAKE_KNOWN_C_COMPILERS="cc gcc clang xlc icc tcc" | ||
254 | +CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ clang++ c++ icc como " | ||
255 | +CMAKE_KNOWN_MAKE_PROCESSORS="gmake make smake" | ||
256 | +CMAKE_KNOWN_NINJA_PROCESSORS="ninja-build ninja samu" | ||
257 | + | ||
258 | +CMAKE_PROBLEMATIC_FILES="\ | ||
259 | + CMakeCache.txt \ | ||
260 | + CMakeSystem.cmake \ | ||
261 | + CMakeCCompiler.cmake \ | ||
262 | + CMakeCXXCompiler.cmake \ | ||
263 | + */CMakeSystem.cmake \ | ||
264 | + */CMakeCCompiler.cmake \ | ||
265 | + */CMakeCXXCompiler.cmake \ | ||
266 | + Source/cmConfigure.h \ | ||
267 | + Source/CTest/Curl/config.h \ | ||
268 | + Utilities/cmThirdParty.h \ | ||
269 | + Utilities/cmcurl/lib/curl_config.h \ | ||
270 | + Utilities/cmlibarchive/config.h \ | ||
271 | + Utilities/cmliblzma/config.h \ | ||
272 | + Utilities/cmnghttp2/config.h \ | ||
273 | + Utilities/cmzlib/zlibDllConfig.h \ | ||
274 | + " | ||
275 | + | ||
276 | +CMAKE_UNUSED_SOURCES="\ | ||
277 | + cmGlobalXCodeGenerator \ | ||
278 | + cmLocalXCodeGenerator \ | ||
279 | + cmXCodeObject \ | ||
280 | + cmXCode21Object \ | ||
281 | + cmSourceGroup \ | ||
282 | +" | ||
283 | + | ||
284 | +CMAKE_CXX_SOURCES="\ | ||
285 | + cmAddCustomCommandCommand \ | ||
286 | + cmAddCustomTargetCommand \ | ||
287 | + cmAddDefinitionsCommand \ | ||
288 | + cmAddDependenciesCommand \ | ||
289 | + cmAddExecutableCommand \ | ||
290 | + cmAddLibraryCommand \ | ||
291 | + cmAddSubDirectoryCommand \ | ||
292 | + cmAddTestCommand \ | ||
293 | + cmArgumentParser \ | ||
294 | + cmBinUtilsLinker \ | ||
295 | + cmBinUtilsLinuxELFGetRuntimeDependenciesTool \ | ||
296 | + cmBinUtilsLinuxELFLinker \ | ||
297 | + cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool \ | ||
298 | + cmBinUtilsMacOSMachOGetRuntimeDependenciesTool \ | ||
299 | + cmBinUtilsMacOSMachOLinker \ | ||
300 | + cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool \ | ||
301 | + cmBinUtilsWindowsPEGetRuntimeDependenciesTool \ | ||
302 | + cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool \ | ||
303 | + cmBinUtilsWindowsPELinker \ | ||
304 | + cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool \ | ||
305 | + cmBreakCommand \ | ||
306 | + cmBuildCommand \ | ||
307 | + cmCMakeLanguageCommand \ | ||
308 | + cmCMakeMinimumRequired \ | ||
309 | + cmCMakePath \ | ||
310 | + cmCMakePathCommand \ | ||
311 | + cmCMakePolicyCommand \ | ||
312 | + cmCPackPropertiesGenerator \ | ||
313 | + cmCacheManager \ | ||
314 | + cmCommand \ | ||
315 | + cmCommandArgumentParserHelper \ | ||
316 | + cmCommands \ | ||
317 | + cmCommonTargetGenerator \ | ||
318 | + cmComputeComponentGraph \ | ||
319 | + cmComputeLinkDepends \ | ||
320 | + cmComputeLinkInformation \ | ||
321 | + cmComputeTargetDepends \ | ||
322 | + cmConsoleBuf \ | ||
323 | + cmConditionEvaluator \ | ||
324 | + cmConfigureFileCommand \ | ||
325 | + cmContinueCommand \ | ||
326 | + cmCoreTryCompile \ | ||
327 | + cmCreateTestSourceList \ | ||
328 | + cmCryptoHash \ | ||
329 | + cmCustomCommand \ | ||
330 | + cmCustomCommandGenerator \ | ||
331 | + cmCustomCommandLines \ | ||
332 | + cmDefinePropertyCommand \ | ||
333 | + cmDefinitions \ | ||
334 | + cmDocumentationFormatter \ | ||
335 | + cmELF \ | ||
336 | + cmEnableLanguageCommand \ | ||
337 | + cmEnableTestingCommand \ | ||
338 | + cmExecProgramCommand \ | ||
339 | + cmExecuteProcessCommand \ | ||
340 | + cmExpandedCommandArgument \ | ||
341 | + cmExportBuildFileGenerator \ | ||
342 | + cmExportFileGenerator \ | ||
343 | + cmExportInstallFileGenerator \ | ||
344 | + cmExportSet \ | ||
345 | + cmExportTryCompileFileGenerator \ | ||
346 | + cmExprParserHelper \ | ||
347 | + cmExternalMakefileProjectGenerator \ | ||
348 | + cmFileCommand \ | ||
349 | + cmFileCopier \ | ||
350 | + cmFileInstaller \ | ||
351 | + cmFileSet \ | ||
352 | + cmFileTime \ | ||
353 | + cmFileTimeCache \ | ||
354 | + cmFileTimes \ | ||
355 | + cmFindBase \ | ||
356 | + cmFindCommon \ | ||
357 | + cmFindFileCommand \ | ||
358 | + cmFindLibraryCommand \ | ||
359 | + cmFindPackageCommand \ | ||
360 | + cmFindPathCommand \ | ||
361 | + cmFindProgramCommand \ | ||
362 | + cmForEachCommand \ | ||
363 | + cmFunctionBlocker \ | ||
364 | + cmFunctionCommand \ | ||
365 | + cmFSPermissions \ | ||
366 | + cmGeneratedFileStream \ | ||
367 | + cmGeneratorExpression \ | ||
368 | + cmGeneratorExpressionContext \ | ||
369 | + cmGeneratorExpressionDAGChecker \ | ||
370 | + cmGeneratorExpressionEvaluationFile \ | ||
371 | + cmGeneratorExpressionEvaluator \ | ||
372 | + cmGeneratorExpressionLexer \ | ||
373 | + cmGeneratorExpressionNode \ | ||
374 | + cmGeneratorExpressionParser \ | ||
375 | + cmGeneratorTarget \ | ||
376 | + cmGetCMakePropertyCommand \ | ||
377 | + cmGetDirectoryPropertyCommand \ | ||
378 | + cmGetFilenameComponentCommand \ | ||
379 | + cmGetPipes \ | ||
380 | + cmGetPropertyCommand \ | ||
381 | + cmGetSourceFilePropertyCommand \ | ||
382 | + cmGetTargetPropertyCommand \ | ||
383 | + cmGetTestPropertyCommand \ | ||
384 | + cmGlobalCommonGenerator \ | ||
385 | + cmGlobalGenerator \ | ||
386 | + cmGlobVerificationManager \ | ||
387 | + cmHexFileConverter \ | ||
388 | + cmIfCommand \ | ||
389 | + cmIncludeCommand \ | ||
390 | + cmIncludeGuardCommand \ | ||
391 | + cmIncludeDirectoryCommand \ | ||
392 | + cmIncludeRegularExpressionCommand \ | ||
393 | + cmInstallCommand \ | ||
394 | + cmInstallCommandArguments \ | ||
395 | + cmInstallDirectoryGenerator \ | ||
396 | + cmInstallExportGenerator \ | ||
397 | + cmInstallFileSetGenerator \ | ||
398 | + cmInstallFilesCommand \ | ||
399 | + cmInstallFilesGenerator \ | ||
400 | + cmInstallGenerator \ | ||
401 | + cmInstallGetRuntimeDependenciesGenerator \ | ||
402 | + cmInstallImportedRuntimeArtifactsGenerator \ | ||
403 | + cmInstallRuntimeDependencySet \ | ||
404 | + cmInstallRuntimeDependencySetGenerator \ | ||
405 | + cmInstallScriptGenerator \ | ||
406 | + cmInstallSubdirectoryGenerator \ | ||
407 | + cmInstallTargetGenerator \ | ||
408 | + cmInstallTargetsCommand \ | ||
409 | + cmInstalledFile \ | ||
410 | + cmLDConfigLDConfigTool \ | ||
411 | + cmLDConfigTool \ | ||
412 | + cmLinkDirectoriesCommand \ | ||
413 | + cmLinkItem \ | ||
414 | + cmLinkItemGraphVisitor \ | ||
415 | + cmLinkLineComputer \ | ||
416 | + cmLinkLineDeviceComputer \ | ||
417 | + cmListCommand \ | ||
418 | + cmListFileCache \ | ||
419 | + cmLocalCommonGenerator \ | ||
420 | + cmLocalGenerator \ | ||
421 | + cmMSVC60LinkLineComputer \ | ||
422 | + cmMacroCommand \ | ||
423 | + cmMakeDirectoryCommand \ | ||
424 | + cmMakefile \ | ||
425 | + cmMarkAsAdvancedCommand \ | ||
426 | + cmMathCommand \ | ||
427 | + cmMessageCommand \ | ||
428 | + cmMessenger \ | ||
429 | + cmNewLineStyle \ | ||
430 | + cmOSXBundleGenerator \ | ||
431 | + cmOptionCommand \ | ||
432 | + cmOrderDirectories \ | ||
433 | + cmOutputConverter \ | ||
434 | + cmParseArgumentsCommand \ | ||
435 | + cmPathLabel \ | ||
436 | + cmPolicies \ | ||
437 | + cmProcessOutput \ | ||
438 | + cmProjectCommand \ | ||
439 | + cmValue \ | ||
440 | + cmPropertyDefinition \ | ||
441 | + cmPropertyMap \ | ||
442 | + cmGccDepfileLexerHelper \ | ||
443 | + cmGccDepfileReader \ | ||
444 | + cmReturnCommand \ | ||
445 | + cmRulePlaceholderExpander \ | ||
446 | + cmRuntimeDependencyArchive \ | ||
447 | + cmScriptGenerator \ | ||
448 | + cmSearchPath \ | ||
449 | + cmSeparateArgumentsCommand \ | ||
450 | + cmSetCommand \ | ||
451 | + cmSetDirectoryPropertiesCommand \ | ||
452 | + cmSetPropertyCommand \ | ||
453 | + cmSetSourceFilesPropertiesCommand \ | ||
454 | + cmSetTargetPropertiesCommand \ | ||
455 | + cmSetTestsPropertiesCommand \ | ||
456 | + cmSiteNameCommand \ | ||
457 | + cmSourceFile \ | ||
458 | + cmSourceFileLocation \ | ||
459 | + cmStandardLevelResolver \ | ||
460 | + cmState \ | ||
461 | + cmStateDirectory \ | ||
462 | + cmStateSnapshot \ | ||
463 | + cmString \ | ||
464 | + cmStringAlgorithms \ | ||
465 | + cmStringReplaceHelper \ | ||
466 | + cmStringCommand \ | ||
467 | + cmSubcommandTable \ | ||
468 | + cmSubdirCommand \ | ||
469 | + cmSystemTools \ | ||
470 | + cmTarget \ | ||
471 | + cmTargetCompileDefinitionsCommand \ | ||
472 | + cmTargetCompileFeaturesCommand \ | ||
473 | + cmTargetCompileOptionsCommand \ | ||
474 | + cmTargetIncludeDirectoriesCommand \ | ||
475 | + cmTargetLinkLibrariesCommand \ | ||
476 | + cmTargetLinkOptionsCommand \ | ||
477 | + cmTargetPrecompileHeadersCommand \ | ||
478 | + cmTargetPropCommandBase \ | ||
479 | + cmTargetPropertyComputer \ | ||
480 | + cmTargetSourcesCommand \ | ||
481 | + cmTest \ | ||
482 | + cmTestGenerator \ | ||
483 | + cmTimestamp \ | ||
484 | + cmTransformDepfile \ | ||
485 | + cmTryCompileCommand \ | ||
486 | + cmTryRunCommand \ | ||
487 | + cmUnsetCommand \ | ||
488 | + cmUVHandlePtr \ | ||
489 | + cmUVProcessChain \ | ||
490 | + cmVersion \ | ||
491 | + cmWhileCommand \ | ||
492 | + cmWorkingDirectory \ | ||
493 | + cmake \ | ||
494 | + cmakemain \ | ||
495 | + cmcmd \ | ||
496 | +" | ||
497 | + | ||
498 | +if ${cmake_system_mingw}; then | ||
499 | + CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\ | ||
500 | + cmGlobalMSYSMakefileGenerator \ | ||
501 | + cmGlobalMinGWMakefileGenerator \ | ||
502 | + cmVSSetupHelper \ | ||
503 | + " | ||
504 | +fi | ||
505 | + | ||
506 | +CMAKE_STD_CXX_HEADERS="\ | ||
507 | + filesystem \ | ||
508 | + memory \ | ||
509 | + optional \ | ||
510 | + shared_mutex \ | ||
511 | + string_view \ | ||
512 | + utility \ | ||
513 | +" | ||
514 | +CMAKE_STD_CXX_SOURCES="\ | ||
515 | + fs_path \ | ||
516 | + string_view \ | ||
517 | +" | ||
518 | + | ||
519 | +LexerParser_CXX_SOURCES="\ | ||
520 | + cmCommandArgumentLexer \ | ||
521 | + cmCommandArgumentParser \ | ||
522 | + cmExprLexer \ | ||
523 | + cmExprParser \ | ||
524 | + cmGccDepfileLexer \ | ||
525 | +" | ||
526 | + | ||
527 | +LexerParser_C_SOURCES="\ | ||
528 | + cmListFileLexer \ | ||
529 | +" | ||
530 | + | ||
531 | +if ${cmake_system_mingw}; then | ||
532 | + KWSYS_C_SOURCES="\ | ||
533 | + EncodingC \ | ||
534 | + ProcessWin32 \ | ||
535 | + String \ | ||
536 | + System \ | ||
537 | + Terminal" | ||
538 | +else | ||
539 | + KWSYS_C_SOURCES="\ | ||
540 | + EncodingC \ | ||
541 | + ProcessUNIX \ | ||
542 | + String \ | ||
543 | + System \ | ||
544 | + Terminal" | ||
545 | +fi | ||
546 | + | ||
547 | +KWSYS_CXX_SOURCES="\ | ||
548 | + Directory \ | ||
549 | + EncodingCXX \ | ||
550 | + FStream \ | ||
551 | + Glob \ | ||
552 | + RegularExpression \ | ||
553 | + Status \ | ||
554 | + SystemTools" | ||
555 | + | ||
556 | +KWSYS_FILES="\ | ||
557 | + Directory.hxx \ | ||
558 | + Encoding.h \ | ||
559 | + Encoding.hxx \ | ||
560 | + FStream.hxx \ | ||
561 | + Glob.hxx \ | ||
562 | + Process.h \ | ||
563 | + RegularExpression.hxx \ | ||
564 | + Status.hxx \ | ||
565 | + String.h \ | ||
566 | + String.hxx \ | ||
567 | + System.h \ | ||
568 | + SystemTools.hxx \ | ||
569 | + Terminal.h" | ||
570 | + | ||
571 | +LIBRHASH_C_SOURCES="\ | ||
572 | + librhash/algorithms.c \ | ||
573 | + librhash/byte_order.c \ | ||
574 | + librhash/hex.c \ | ||
575 | + librhash/md5.c \ | ||
576 | + librhash/rhash.c \ | ||
577 | + librhash/sha1.c \ | ||
578 | + librhash/sha256.c \ | ||
579 | + librhash/sha3.c \ | ||
580 | + librhash/sha512.c \ | ||
581 | + " | ||
582 | + | ||
583 | +if ${cmake_system_mingw}; then | ||
584 | + LIBUV_C_SOURCES="\ | ||
585 | + src/fs-poll.c \ | ||
586 | + src/idna.c | ||
587 | + src/inet.c \ | ||
588 | + src/threadpool.c \ | ||
589 | + src/strscpy.c \ | ||
590 | + src/timer.c \ | ||
591 | + src/uv-common.c \ | ||
592 | + src/win/async.c \ | ||
593 | + src/win/core.c \ | ||
594 | + src/win/detect-wakeup.c \ | ||
595 | + src/win/dl.c \ | ||
596 | + src/win/error.c \ | ||
597 | + src/win/fs-event.c \ | ||
598 | + src/win/fs.c \ | ||
599 | + src/win/getaddrinfo.c \ | ||
600 | + src/win/getnameinfo.c \ | ||
601 | + src/win/handle.c \ | ||
602 | + src/win/loop-watcher.c \ | ||
603 | + src/win/pipe.c \ | ||
604 | + src/win/poll.c \ | ||
605 | + src/win/process-stdio.c \ | ||
606 | + src/win/process.c \ | ||
607 | + src/win/signal.c \ | ||
608 | + src/win/stream.c \ | ||
609 | + src/win/tcp.c \ | ||
610 | + src/win/thread.c \ | ||
611 | + src/win/tty.c \ | ||
612 | + src/win/udp.c \ | ||
613 | + src/win/util.c \ | ||
614 | + src/win/winapi.c \ | ||
615 | + src/win/winsock.c \ | ||
616 | + " | ||
617 | +else | ||
618 | + LIBUV_C_SOURCES="\ | ||
619 | + src/strscpy.c \ | ||
620 | + src/timer.c \ | ||
621 | + src/uv-common.c \ | ||
622 | + src/unix/cmake-bootstrap.c \ | ||
623 | + src/unix/core.c \ | ||
624 | + src/unix/fs.c \ | ||
625 | + src/unix/loop.c \ | ||
626 | + src/unix/loop-watcher.c \ | ||
627 | + src/unix/no-fsevents.c \ | ||
628 | + src/unix/pipe.c \ | ||
629 | + src/unix/poll.c \ | ||
630 | + src/unix/posix-hrtime.c \ | ||
631 | + src/unix/posix-poll.c \ | ||
632 | + src/unix/process.c \ | ||
633 | + src/unix/signal.c \ | ||
634 | + src/unix/stream.c \ | ||
635 | + src/unix/tcp.c \ | ||
636 | + " | ||
637 | +fi | ||
638 | + | ||
639 | +# Display CMake bootstrap usage | ||
640 | +cmake_usage() | ||
641 | +{ | ||
642 | +echo ' | ||
643 | +Usage: '"$0"' [<options>...] [-- <cmake-options>...] | ||
644 | +Options: [defaults in brackets after descriptions] | ||
645 | +Configuration: | ||
646 | + --help print this message | ||
647 | + --version only print version information | ||
648 | + --verbose display more information | ||
649 | + --parallel=n bootstrap cmake in parallel, where n is | ||
650 | + number of nodes [1] | ||
651 | + --generator=<generator> generator to use (MSYS Makefiles, Unix Makefiles, | ||
652 | + or Ninja) | ||
653 | + --enable-ccache Enable ccache when building cmake | ||
654 | + --init=FILE load FILE as script to populate cache | ||
655 | + --system-libs use all system-installed third-party libraries | ||
656 | + (for use only by package maintainers) | ||
657 | + --no-system-libs use all cmake-provided third-party libraries | ||
658 | + (default) | ||
659 | + --system-curl use system-installed curl library | ||
660 | + --no-system-curl use cmake-provided curl library (default) | ||
661 | + --system-expat use system-installed expat library | ||
662 | + --no-system-expat use cmake-provided expat library (default) | ||
663 | + --system-jsoncpp use system-installed jsoncpp library | ||
664 | + --no-system-jsoncpp use cmake-provided jsoncpp library (default) | ||
665 | + --system-zlib use system-installed zlib library | ||
666 | + --no-system-zlib use cmake-provided zlib library (default) | ||
667 | + --system-bzip2 use system-installed bzip2 library | ||
668 | + --no-system-bzip2 use cmake-provided bzip2 library (default) | ||
669 | + --system-liblzma use system-installed liblzma library | ||
670 | + --no-system-liblzma use cmake-provided liblzma library (default) | ||
671 | + --system-nghttp2 use system-installed nghttp2 library | ||
672 | + --no-system-nghttp2 use cmake-provided nghttp2 library (default) | ||
673 | + --system-zstd use system-installed zstd library | ||
674 | + --no-system-zstd use cmake-provided zstd library (default) | ||
675 | + --system-libarchive use system-installed libarchive library | ||
676 | + --no-system-libarchive use cmake-provided libarchive library (default) | ||
677 | + --system-librhash use system-installed librhash library | ||
678 | + --no-system-librhash use cmake-provided librhash library (default) | ||
679 | + --system-libuv use system-installed libuv library | ||
680 | + --no-system-libuv use cmake-provided libuv library (default) | ||
681 | + | ||
682 | + --bootstrap-system-libuv use system-installed libuv library for bootstrap | ||
683 | + --bootstrap-system-jsoncpp use system-installed jsoncpp library for bootstrap | ||
684 | + --bootstrap-system-librhash use system-installed librhash library for bootstrap | ||
685 | + | ||
686 | + --qt-gui build the Qt-based GUI (requires Qt >= 4.2) | ||
687 | + --no-qt-gui do not build the Qt-based GUI (default) | ||
688 | + --qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt | ||
689 | + | ||
690 | + --sphinx-info build Info manual with Sphinx | ||
691 | + --sphinx-man build man pages with Sphinx | ||
692 | + --sphinx-html build html help with Sphinx | ||
693 | + --sphinx-qthelp build qch help with Sphinx | ||
694 | + --sphinx-latexpdf build PDF with Sphinx using LaTeX | ||
695 | + --sphinx-build=<sb> use <sb> as the sphinx-build executable | ||
696 | + --sphinx-flags=<flags> pass <flags> to sphinx-build executable | ||
697 | + | ||
698 | +Directory and file names: | ||
699 | + --prefix=PREFIX install files in tree rooted at PREFIX | ||
700 | + ['"${cmake_default_prefix}"'] | ||
701 | + --bindir=DIR install binaries in PREFIX/DIR | ||
702 | + ['"${cmake_bin_dir_default}"'] | ||
703 | + --datadir=DIR install data files in PREFIX/DIR | ||
704 | + ['"${cmake_data_dir_default}"'] | ||
705 | + --docdir=DIR install documentation files in PREFIX/DIR | ||
706 | + ['"${cmake_doc_dir_default}"'] | ||
707 | + --mandir=DIR install man pages files in PREFIX/DIR/manN | ||
708 | + ['"${cmake_man_dir_default}"'] | ||
709 | + --xdgdatadir=DIR install XDG specific files in PREFIX/DIR | ||
710 | + ['"${cmake_xdgdata_dir_default}"'] | ||
711 | +' | ||
712 | + exit 10 | ||
713 | +} | ||
714 | + | ||
715 | +# Display CMake bootstrap usage | ||
716 | +cmake_version_display() | ||
717 | +{ | ||
718 | + echo "CMake ${cmake_version}, ${cmake_copyright}" | ||
719 | +} | ||
720 | + | ||
721 | +# Display CMake bootstrap error, display the log file and exit | ||
722 | +cmake_error() | ||
723 | +{ | ||
724 | + res=$1 | ||
725 | + shift 1 | ||
726 | + echo "---------------------------------------------" | ||
727 | + echo "Error when bootstrapping CMake:" | ||
728 | + echo "$*" | ||
729 | + echo "---------------------------------------------" | ||
730 | + if test -f cmake_bootstrap.log; then | ||
731 | + echo "Log of errors: `pwd`/cmake_bootstrap.log" | ||
732 | + #cat cmake_bootstrap.log | ||
733 | + echo "---------------------------------------------" | ||
734 | + fi | ||
735 | + exit ${res} | ||
736 | +} | ||
737 | + | ||
738 | +cmake_generate_file_tmp () | ||
739 | +{ | ||
740 | + OUTFILE="$1" | ||
741 | + TMPFILE="$2" | ||
742 | + if "${_diff}" "$TMPFILE" "$OUTFILE" > /dev/null 2> /dev/null ; then | ||
743 | + rm -f "$TMPFILE" | ||
744 | + else | ||
745 | + mv -f "$TMPFILE" "$OUTFILE" | ||
746 | + fi | ||
747 | +} | ||
748 | + | ||
749 | +cmake_generate_file () | ||
750 | +{ | ||
751 | + OUTFILE="$1" | ||
752 | + CONTENT="$2" | ||
753 | + echo "$CONTENT" > "$OUTFILE.tmp" | ||
754 | + cmake_generate_file_tmp "$OUTFILE" "$OUTFILE.tmp" | ||
755 | +} | ||
756 | + | ||
757 | +# Replace KWSYS_NAMESPACE with cmsys | ||
758 | +cmake_replace_string () | ||
759 | +{ | ||
760 | + INFILE="$1" | ||
761 | + OUTFILE="$2" | ||
762 | + SEARCHFOR="$3" | ||
763 | + REPLACEWITH="$4" | ||
764 | + if test -f "${INFILE}" || ${cmake_system_openvms}; then | ||
765 | + sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}" | ||
766 | + if test -f "${OUTFILE}${_tmp}"; then | ||
767 | + if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then | ||
768 | + #echo "Files are the same" | ||
769 | + rm -f "${OUTFILE}${_tmp}" | ||
770 | + else | ||
771 | + mv -f "${OUTFILE}${_tmp}" "${OUTFILE}" | ||
772 | + fi | ||
773 | + fi | ||
774 | + else | ||
775 | + cmake_error 1 "Cannot find file ${INFILE}" | ||
776 | + fi | ||
777 | +} | ||
778 | + | ||
779 | +cmake_kwsys_config_replace_string () | ||
780 | +{ | ||
781 | + INFILE="$1" | ||
782 | + OUTFILE="$2" | ||
783 | + shift 2 | ||
784 | + APPEND="$*" | ||
785 | + if test -f "${INFILE}" || ${cmake_system_openvms}; then | ||
786 | + echo "${APPEND}" > "${OUTFILE}${_tmp}" | ||
787 | + sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g; | ||
788 | + s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g; | ||
789 | + s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g; | ||
790 | + s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g; | ||
791 | + s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g; | ||
792 | + s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g; | ||
793 | + s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g; | ||
794 | + s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g; | ||
795 | + }" "${INFILE}" >> "${OUTFILE}${_tmp}" | ||
796 | + if test -f "${OUTFILE}${_tmp}"; then | ||
797 | + if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then | ||
798 | + #echo "Files are the same" | ||
799 | + rm -f "${OUTFILE}${_tmp}" | ||
800 | + else | ||
801 | + mv -f "${OUTFILE}${_tmp}" "${OUTFILE}" | ||
802 | + fi | ||
803 | + fi | ||
804 | + else | ||
805 | + cmake_error 2 "Cannot find file ${INFILE}" | ||
806 | + fi | ||
807 | +} | ||
808 | +# Write string into a file | ||
809 | +cmake_report () | ||
810 | +{ | ||
811 | + FILE=$1 | ||
812 | + shift | ||
813 | + echo "$*" >> ${FILE} | ||
814 | +} | ||
815 | + | ||
816 | +# Escape spaces in strings for artifacts | ||
817 | +cmake_escape_artifact () | ||
818 | +{ | ||
819 | + if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
820 | + echo $1 | sed "s/ /$ /g" | ||
821 | + else | ||
822 | + echo $1 | sed "s/ /\\\\ /g" | ||
823 | + fi | ||
824 | +} | ||
825 | + | ||
826 | +# Escape spaces in strings for shell | ||
827 | +cmake_escape_shell () | ||
828 | +{ | ||
829 | + echo $1 | sed "s/ /\\\\ /g" | ||
830 | +} | ||
831 | + | ||
832 | +# Encode object file names. | ||
833 | +cmake_obj () | ||
834 | +{ | ||
835 | + echo $1 | sed 's/\//-/g' | sed 's/$/\.o/' | ||
836 | +} | ||
837 | + | ||
838 | +# Strip prefix from argument | ||
839 | +cmake_arg () | ||
840 | +{ | ||
841 | + echo "$1" | sed "s/^${2-[^=]*=}//" | ||
842 | +} | ||
843 | + | ||
844 | +# Write message to the log | ||
845 | +cmake_log () | ||
846 | +{ | ||
847 | + echo "$*" >> cmake_bootstrap.log | ||
848 | +} | ||
849 | + | ||
850 | +# Return temp file | ||
851 | +cmake_tmp_file () | ||
852 | +{ | ||
853 | + echo "cmake_bootstrap_$$_test" | ||
854 | +} | ||
855 | + | ||
856 | +# Run a compiler test. First argument is compiler, second one are compiler | ||
857 | +# flags, third one is test source file to be compiled | ||
858 | +cmake_try_run () | ||
859 | +{ | ||
860 | + COMPILER=$1 | ||
861 | + FLAGS=$2 | ||
862 | + TESTFILE=$3 | ||
863 | + if test ! -f "${TESTFILE}"; then | ||
864 | + echo "Test file ${TESTFILE} missing. Please verify your CMake source tree." | ||
865 | + exit 4 | ||
866 | + fi | ||
867 | + TMPFILE=`cmake_tmp_file` | ||
868 | + echo "Try: ${COMPILER}" | ||
869 | + echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}" | ||
870 | + echo "---------- file -----------------------" | ||
871 | + cat "${TESTFILE}" | ||
872 | + echo "------------------------------------------" | ||
873 | + "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}" | ||
874 | + RES=$? | ||
875 | + if test "${RES}" -ne "0"; then | ||
876 | + echo "Test failed to compile" | ||
877 | + return 1 | ||
878 | + fi | ||
879 | + if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then | ||
880 | + echo "Test failed to produce executable" | ||
881 | + return 2 | ||
882 | + fi | ||
883 | + ./${TMPFILE} | ||
884 | + RES=$? | ||
885 | + rm -f "${TMPFILE}" | ||
886 | + if test "${RES}" -ne "0"; then | ||
887 | + echo "Test produced non-zero return code" | ||
888 | + return 3 | ||
889 | + fi | ||
890 | + echo "Test succeeded" | ||
891 | + return 0 | ||
892 | +} | ||
893 | + | ||
894 | +# Run a make test. First argument is the make interpreter. | ||
895 | +cmake_try_make () | ||
896 | +{ | ||
897 | + MAKE_PROC="$1" | ||
898 | + MAKE_FLAGS="$2" | ||
899 | + echo "Try: ${MAKE_PROC}" | ||
900 | + "${MAKE_PROC}" ${MAKE_FLAGS} | ||
901 | + RES=$? | ||
902 | + if test "${RES}" -ne "0"; then | ||
903 | + echo "${MAKE_PROC} does not work" | ||
904 | + return 1 | ||
905 | + fi | ||
906 | + if test ! -f "test" && test ! -f "test.exe"; then | ||
907 | + echo "${COMPILER} does not produce output" | ||
908 | + return 2 | ||
909 | + fi | ||
910 | + ./test | ||
911 | + RES=$? | ||
912 | + rm -f "test" | ||
913 | + if test "${RES}" -ne "0"; then | ||
914 | + echo "${MAKE_PROC} produces strange executable" | ||
915 | + return 3 | ||
916 | + fi | ||
917 | + echo "${MAKE_PROC} works" | ||
918 | + return 0 | ||
919 | +} | ||
920 | + | ||
921 | +# Parse arguments | ||
922 | +cmake_verbose= | ||
923 | +cmake_parallel_make= | ||
924 | +cmake_ccache_enabled= | ||
925 | +cmake_prefix_dir="${cmake_default_prefix}" | ||
926 | +bootstrap_system_libuv= | ||
927 | +bootstrap_system_jsoncpp= | ||
928 | +bootstrap_system_librhash= | ||
929 | +while test $# != 0; do | ||
930 | + case "$1" in | ||
931 | + --prefix=*) dir=`cmake_arg "$1"` | ||
932 | + cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;; | ||
933 | + --parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;; | ||
934 | + --generator=*) cmake_bootstrap_generator=`cmake_arg "$1"` ;; | ||
935 | + --bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;; | ||
936 | + --datadir=*) cmake_data_dir=`cmake_arg "$1"` ;; | ||
937 | + --docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;; | ||
938 | + --mandir=*) cmake_man_dir=`cmake_arg "$1"` ;; | ||
939 | + --xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;; | ||
940 | + --init=*) cmake_init_file=`cmake_arg "$1"` ;; | ||
941 | + --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;; | ||
942 | + --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;; | ||
943 | + --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-nghttp2|--system-zstd|--system-libuv) | ||
944 | + lib=`cmake_arg "$1" "--system-"` | ||
945 | + cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;; | ||
946 | + --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-librhash|--no-system-zlib|--no-system-liblzma|--no-system-nghttp2|--no-system-zstd|--no-system-libuv) | ||
947 | + lib=`cmake_arg "$1" "--no-system-"` | ||
948 | + cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;; | ||
949 | + --bootstrap-system-libuv) bootstrap_system_libuv="1" ;; | ||
950 | + --bootstrap-system-jsoncpp) bootstrap_system_jsoncpp="1" ;; | ||
951 | + --bootstrap-system-librhash) bootstrap_system_librhash="1" ;; | ||
952 | + --qt-gui) cmake_bootstrap_qt_gui="1" ;; | ||
953 | + --no-qt-gui) cmake_bootstrap_qt_gui="0" ;; | ||
954 | + --qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;; | ||
955 | + --sphinx-info) cmake_sphinx_info="1" ;; | ||
956 | + --sphinx-man) cmake_sphinx_man="1" ;; | ||
957 | + --sphinx-html) cmake_sphinx_html="1" ;; | ||
958 | + --sphinx-qthelp) cmake_sphinx_qthelp="1" ;; | ||
959 | + --sphinx-latexpdf) cmake_sphinx_latexpdf="1" ;; | ||
960 | + --sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;; | ||
961 | + --sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;; | ||
962 | + --help) cmake_usage ;; | ||
963 | + --version) cmake_version_display ; exit 2 ;; | ||
964 | + --verbose) cmake_verbose=TRUE ;; | ||
965 | + --enable-ccache) cmake_ccache_enabled=TRUE ;; | ||
966 | + CC=*) CC=`cmake_arg "$1"` ;; | ||
967 | + CXX=*) CXX=`cmake_arg "$1"` ;; | ||
968 | + CFLAGS=*) CFLAGS=`cmake_arg "$1"` ;; | ||
969 | + CXXFLAGS=*) CXXFLAGS=`cmake_arg "$1"` ;; | ||
970 | + LDFLAGS=*) LDFLAGS=`cmake_arg "$1"` ;; | ||
971 | + --) shift; break ;; | ||
972 | + *) die "Unknown option: $1" ;; | ||
973 | + esac | ||
974 | + shift | ||
975 | +done | ||
976 | + | ||
977 | +# Make sure the generator is valid | ||
978 | +case "${cmake_bootstrap_generator}" in | ||
979 | + 'MSYS Makefiles'|'Unix Makefiles'|'Ninja') ;; | ||
980 | + *) cmake_error 10 "Invalid generator: ${cmake_bootstrap_generator}" | ||
981 | +esac | ||
982 | + | ||
983 | +# If verbose, display some information about bootstrap | ||
984 | +if test -n "${cmake_verbose}"; then | ||
985 | + echo "---------------------------------------------" | ||
986 | + echo "Source directory: ${cmake_source_dir}" | ||
987 | + echo "Binary directory: ${cmake_binary_dir}" | ||
988 | + echo "Prefix directory: ${cmake_prefix_dir}" | ||
989 | + echo "System: ${cmake_system}" | ||
990 | + echo "Generator: ${cmake_bootstrap_generator}" | ||
991 | + if test "x${cmake_parallel_make}" != "x"; then | ||
992 | + echo "Doing parallel make: ${cmake_parallel_make}" | ||
993 | + fi | ||
994 | + echo "" | ||
995 | +fi | ||
996 | + | ||
997 | +echo "---------------------------------------------" | ||
998 | +# Get CMake version | ||
999 | +echo "`cmake_version_display`" | ||
1000 | + | ||
1001 | +# Check for in-source build | ||
1002 | +cmake_in_source_build= | ||
1003 | +if test -f "${cmake_binary_dir}/Source/cmake.cxx" && | ||
1004 | + test -f "${cmake_binary_dir}/Source/cmake.h"; then | ||
1005 | + if test -n "${cmake_verbose}"; then | ||
1006 | + echo "Warning: This is an in-source build" | ||
1007 | + fi | ||
1008 | + cmake_in_source_build=TRUE | ||
1009 | +fi | ||
1010 | + | ||
1011 | +# If this is not an in-source build, then Bootstrap stuff should not exist. | ||
1012 | +if test -z "${cmake_in_source_build}"; then | ||
1013 | + # Did somebody bootstrap in the source tree? | ||
1014 | + if test -d "${cmake_source_dir}/Bootstrap${_cmk}"; then | ||
1015 | + cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\". | ||
1016 | +Looks like somebody did bootstrap CMake in the source tree, but now you are | ||
1017 | +trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk} | ||
1018 | +directory from the source tree." | ||
1019 | + fi | ||
1020 | + # Is there a cache in the source tree? | ||
1021 | + for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do | ||
1022 | + if test -f "${cmake_source_dir}/${cmake_problematic_file}"; then | ||
1023 | + cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\". | ||
1024 | +Looks like somebody tried to build CMake in the source tree, but now you are | ||
1025 | +trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\" | ||
1026 | +from the source tree." | ||
1027 | + fi | ||
1028 | + done | ||
1029 | +fi | ||
1030 | + | ||
1031 | +# Make bootstrap directory | ||
1032 | +test -d "${cmake_bootstrap_dir}" || mkdir "${cmake_bootstrap_dir}" | ||
1033 | +if test ! -d "${cmake_bootstrap_dir}"; then | ||
1034 | + cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake." | ||
1035 | +fi | ||
1036 | +cd "${cmake_bootstrap_dir}" | ||
1037 | + | ||
1038 | +test -d "cmsys" || mkdir "cmsys" | ||
1039 | +if test ! -d "cmsys"; then | ||
1040 | + cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" | ||
1041 | +fi | ||
1042 | + | ||
1043 | +# Delete all the bootstrap files | ||
1044 | +rm -f "${cmake_bootstrap_dir}/cmake_bootstrap.log" | ||
1045 | +rm -f "${cmake_bootstrap_dir}/cmConfigure.h${_tmp}" | ||
1046 | +rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}" | ||
1047 | + | ||
1048 | +# If building in-source, remove any cmConfigure.h that may | ||
1049 | +# have been created by a previous run of the bootstrap cmake. | ||
1050 | +if test -n "${cmake_in_source_build}"; then | ||
1051 | + rm -f "${cmake_source_dir}/Source/cmConfigure.h" | ||
1052 | +fi | ||
1053 | + | ||
1054 | +# If exist compiler flags, set them | ||
1055 | +cmake_c_flags=${CFLAGS} | ||
1056 | +cmake_cxx_flags=${CXXFLAGS} | ||
1057 | +cmake_ld_flags=${LDFLAGS} | ||
1058 | + | ||
1059 | +# Add generator-specific files | ||
1060 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1061 | + CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES} \ | ||
1062 | + cmFortranParserImpl \ | ||
1063 | + cmGlobalNinjaGenerator \ | ||
1064 | + cmLocalNinjaGenerator \ | ||
1065 | + cmNinjaLinkLineComputer \ | ||
1066 | + cmNinjaLinkLineDeviceComputer \ | ||
1067 | + cmNinjaNormalTargetGenerator \ | ||
1068 | + cmNinjaTargetGenerator \ | ||
1069 | + cmNinjaUtilityTargetGenerator \ | ||
1070 | + " | ||
1071 | + | ||
1072 | + LexerParser_CXX_SOURCES="${LexerParser_CXX_SOURCES} \ | ||
1073 | + cmFortranLexer \ | ||
1074 | + cmFortranParser \ | ||
1075 | + " | ||
1076 | + | ||
1077 | + JSONCPP_CXX_SOURCES="\ | ||
1078 | + src/lib_json/json_reader.cpp \ | ||
1079 | + src/lib_json/json_value.cpp \ | ||
1080 | + src/lib_json/json_writer.cpp \ | ||
1081 | + " | ||
1082 | +else | ||
1083 | + CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES} \ | ||
1084 | + cmDepends \ | ||
1085 | + cmDependsC \ | ||
1086 | + cmDependsCompiler \ | ||
1087 | + cmGlobalUnixMakefileGenerator3 \ | ||
1088 | + cmLocalUnixMakefileGenerator3 \ | ||
1089 | + cmMakefileExecutableTargetGenerator \ | ||
1090 | + cmMakefileLibraryTargetGenerator \ | ||
1091 | + cmMakefileTargetGenerator \ | ||
1092 | + cmMakefileUtilityTargetGenerator \ | ||
1093 | + cmProcessTools \ | ||
1094 | + " | ||
1095 | + | ||
1096 | + JSONCPP_CXX_SOURCES= | ||
1097 | +fi | ||
1098 | + | ||
1099 | +# Add Cygwin-specific flags | ||
1100 | +if ${cmake_system_cygwin} || ${cmake_system_msys}; then | ||
1101 | + cmake_ld_flags="${LDFLAGS} -Wl,--enable-auto-import" | ||
1102 | +fi | ||
1103 | + | ||
1104 | +# Add CoreFoundation framework on Darwin | ||
1105 | +if ${cmake_system_darwin}; then | ||
1106 | + cmake_ld_flags="${LDFLAGS} -framework CoreFoundation" | ||
1107 | +fi | ||
1108 | + | ||
1109 | +# Add BeOS toolkits... | ||
1110 | +if ${cmake_system_beos}; then | ||
1111 | + cmake_ld_flags="${LDFLAGS} -lroot -lbe" | ||
1112 | +fi | ||
1113 | + | ||
1114 | +# Add Haiku toolkits... | ||
1115 | +if ${cmake_system_haiku}; then | ||
1116 | + cmake_ld_flags="${LDFLAGS} -lroot -lbe" | ||
1117 | +fi | ||
1118 | + | ||
1119 | +# Add AIX arch-specific link flags. | ||
1120 | +if ${cmake_system_aix}; then | ||
1121 | + if uname -p | grep powerpc >/dev/null 2>&1; then | ||
1122 | + cmake_ld_flags="${LDFLAGS} -Wl,-bbigtoc" | ||
1123 | + fi | ||
1124 | +fi | ||
1125 | + | ||
1126 | +#----------------------------------------------------------------------------- | ||
1127 | +# Detect known toolchains on some platforms. | ||
1128 | +cmake_toolchains='' | ||
1129 | +case "${cmake_system}" in | ||
1130 | + *AIX*) cmake_toolchains='XL GNU' ;; | ||
1131 | + *CYGWIN*) cmake_toolchains='GNU' ;; | ||
1132 | + *MSYS*) cmake_toolchains='GNU' ;; | ||
1133 | + *Darwin*) cmake_toolchains='Clang GNU' ;; | ||
1134 | + *Linux*) cmake_toolchains='GNU Clang XL PGI PathScale' ;; | ||
1135 | + *MINGW*) cmake_toolchains='GNU' ;; | ||
1136 | +esac | ||
1137 | + | ||
1138 | +# Toolchain compiler name table. | ||
1139 | +cmake_toolchain_Clang_CC='clang' | ||
1140 | +cmake_toolchain_Clang_CXX='clang++' | ||
1141 | +cmake_toolchain_GNU_CC='gcc' | ||
1142 | +cmake_toolchain_GNU_CXX='g++' | ||
1143 | +cmake_toolchain_PGI_CC='pgcc' | ||
1144 | +cmake_toolchain_PGI_CXX='pgCC' | ||
1145 | +cmake_toolchain_PathScale_CC='pathcc' | ||
1146 | +cmake_toolchain_PathScale_CXX='pathCC' | ||
1147 | +cmake_toolchain_XL_CC='xlc' | ||
1148 | +cmake_toolchain_XL_CXX='xlC' | ||
1149 | + | ||
1150 | +cmake_toolchain_try() | ||
1151 | +{ | ||
1152 | + tc="$1" | ||
1153 | + TMPFILE=`cmake_tmp_file` | ||
1154 | + | ||
1155 | + eval "tc_CC=\${cmake_toolchain_${tc}_CC}" | ||
1156 | + echo 'int main() { return 0; }' > "${TMPFILE}.c" | ||
1157 | + cmake_try_run "$tc_CC" "" "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1 | ||
1158 | + tc_result_CC="$?" | ||
1159 | + rm -f "${TMPFILE}.c" | ||
1160 | + test "${tc_result_CC}" = "0" || return 1 | ||
1161 | + | ||
1162 | + eval "tc_CXX=\${cmake_toolchain_${tc}_CXX}" | ||
1163 | + echo 'int main() { return 0; }' > "${TMPFILE}.cpp" | ||
1164 | + cmake_try_run "$tc_CXX" "" "${TMPFILE}.cpp" >> cmake_bootstrap.log 2>&1 | ||
1165 | + tc_result_CXX="$?" | ||
1166 | + rm -f "${TMPFILE}.cpp" | ||
1167 | + test "${tc_result_CXX}" = "0" || return 1 | ||
1168 | + | ||
1169 | + cmake_toolchain="$tc" | ||
1170 | +} | ||
1171 | + | ||
1172 | +cmake_toolchain_detect() | ||
1173 | +{ | ||
1174 | + cmake_toolchain= | ||
1175 | + for tc in ${cmake_toolchains}; do | ||
1176 | + echo "Checking for $tc toolchain" >> cmake_bootstrap.log 2>&1 | ||
1177 | + cmake_toolchain_try "$tc" && | ||
1178 | + echo "Found $tc toolchain" && | ||
1179 | + break | ||
1180 | + done | ||
1181 | +} | ||
1182 | + | ||
1183 | +if test -z "${CC}" && test -z "${CXX}"; then | ||
1184 | + cmake_toolchain_detect | ||
1185 | +fi | ||
1186 | + | ||
1187 | +thread_flags='' | ||
1188 | +case "${cmake_system}" in | ||
1189 | + *AIX*) thread_flags='-pthread' ;; | ||
1190 | +esac | ||
1191 | + | ||
1192 | +#----------------------------------------------------------------------------- | ||
1193 | +# Test C compiler | ||
1194 | +cmake_c_compiler= | ||
1195 | + | ||
1196 | +# If CC is set, use that for compiler, otherwise use list of known compilers | ||
1197 | +if test -n "${cmake_toolchain}"; then | ||
1198 | + eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}" | ||
1199 | +elif test -n "${CC}"; then | ||
1200 | + cmake_c_compilers="${CC}" | ||
1201 | +else | ||
1202 | + cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}" | ||
1203 | +fi | ||
1204 | + | ||
1205 | +# Check if C compiler works | ||
1206 | +TMPFILE=`cmake_tmp_file` | ||
1207 | +echo ' | ||
1208 | +#ifdef __cplusplus | ||
1209 | +# error "The CMAKE_C_COMPILER is set to a C++ compiler" | ||
1210 | +#endif | ||
1211 | + | ||
1212 | +#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE) | ||
1213 | +#error "On AIX with GNU we need the -pthread flag." | ||
1214 | +#endif | ||
1215 | + | ||
1216 | +#if defined(__sun) && __STDC_VERSION__ < 199901L | ||
1217 | +#error "On Solaris we need C99." | ||
1218 | +#endif | ||
1219 | + | ||
1220 | +#if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409) | ||
1221 | +#error "On HP-UX we need GCC 4.9 or higher." | ||
1222 | +#endif | ||
1223 | + | ||
1224 | +#include <stdio.h> | ||
1225 | + | ||
1226 | +int main(int argc, char* argv[]) | ||
1227 | +{ | ||
1228 | + printf("%d%c", (argv != 0), (char)0x0a); | ||
1229 | + return argc - 1; | ||
1230 | +} | ||
1231 | +' > "${TMPFILE}.c" | ||
1232 | +for std in 11 99 90; do | ||
1233 | + std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" C \"${std}\"`" | ||
1234 | + for compiler in ${cmake_c_compilers}; do | ||
1235 | + for std_flag in '' $std_flags; do | ||
1236 | + for thread_flag in '' $thread_flags; do | ||
1237 | + echo "Checking whether '${compiler} ${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 | ||
1238 | + if cmake_try_run "${compiler}" "${cmake_c_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ | ||
1239 | + "${TMPFILE}.c" >> cmake_bootstrap.log 2>&1; then | ||
1240 | + cmake_c_compiler="${compiler}" | ||
1241 | + cmake_c_flags="${cmake_c_flags} ${std_flag} ${thread_flag}" | ||
1242 | + break 4 | ||
1243 | + fi | ||
1244 | + done | ||
1245 | + done | ||
1246 | + done | ||
1247 | +done | ||
1248 | +rm -f "${TMPFILE}.c" | ||
1249 | + | ||
1250 | +if test -z "${cmake_c_compiler}"; then | ||
1251 | + cmake_error 6 "Cannot find appropriate C compiler on this system. | ||
1252 | +Please specify one using environment variable CC. | ||
1253 | +See cmake_bootstrap.log for compilers attempted. | ||
1254 | +" | ||
1255 | +fi | ||
1256 | +echo "C compiler on this system is: ${cmake_c_compiler} ${cmake_c_flags}" | ||
1257 | + | ||
1258 | +#----------------------------------------------------------------------------- | ||
1259 | +# Test CXX compiler | ||
1260 | +cmake_cxx_compiler= | ||
1261 | + | ||
1262 | +# On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler. | ||
1263 | + | ||
1264 | +# If CC is set, use that for compiler, otherwise use list of known compilers | ||
1265 | +if test -n "${cmake_toolchain}"; then | ||
1266 | + eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}" | ||
1267 | +elif test -n "${CXX}"; then | ||
1268 | + cmake_cxx_compilers="${CXX}" | ||
1269 | +else | ||
1270 | + cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}" | ||
1271 | +fi | ||
1272 | + | ||
1273 | +# Check if C++ compiler works | ||
1274 | +TMPFILE=`cmake_tmp_file` | ||
1275 | +echo ' | ||
1276 | +#include <iostream> | ||
1277 | +#include <memory> | ||
1278 | +#include <unordered_map> | ||
1279 | + | ||
1280 | +#if __cplusplus < 201103L | ||
1281 | +#error "Compiler is not in a mode aware of C++11." | ||
1282 | +#endif | ||
1283 | + | ||
1284 | +#if defined(_AIX) && defined(__GNUC__) && !defined(_THREAD_SAFE) | ||
1285 | +#error "On AIX with GNU we need the -pthread flag." | ||
1286 | +#endif | ||
1287 | + | ||
1288 | +#if defined(__SUNPRO_CC) && __SUNPRO_CC < 0x5140 | ||
1289 | +#error "SunPro <= 5.13 mode not supported due to bug in move semantics." | ||
1290 | +#endif | ||
1291 | + | ||
1292 | +#if defined(__hpux) && !(defined(__GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 409) | ||
1293 | +#error "On HP-UX we need GCC 4.9 or higher." | ||
1294 | +#endif | ||
1295 | + | ||
1296 | +#if __cplusplus > 201103L | ||
1297 | +#include <iterator> | ||
1298 | +int check_cxx14() | ||
1299 | +{ | ||
1300 | + int a[] = { 0, 1, 2 }; | ||
1301 | + auto ai = std::cbegin(a); | ||
1302 | + | ||
1303 | + int b[] = { 2, 1, 0 }; | ||
1304 | + auto bi = std::cend(b); | ||
1305 | + | ||
1306 | + return *ai + *(bi - 1); | ||
1307 | +} | ||
1308 | +#else | ||
1309 | +int check_cxx14() | ||
1310 | +{ | ||
1311 | + return 0; | ||
1312 | +} | ||
1313 | +#endif | ||
1314 | + | ||
1315 | +#if (__cplusplus >= 201703L || defined(__INTEL_COMPILER) && defined(__cpp_deduction_guides)) | ||
1316 | +#include <optional> | ||
1317 | +template <typename T, | ||
1318 | + typename std::invoke_result<decltype(&T::get), T>::type = nullptr> | ||
1319 | +typename T::pointer get_ptr(T& item) | ||
1320 | +{ | ||
1321 | + return item.get(); | ||
1322 | +} | ||
1323 | + | ||
1324 | +int check_cxx17() | ||
1325 | +{ | ||
1326 | + // Intel compiler do not handle correctly 'decltype' inside 'invoke_result' | ||
1327 | + std::unique_ptr<int> u(new int(0)); | ||
1328 | + get_ptr(u); | ||
1329 | + std::optional<int> oi = 0; | ||
1330 | + return oi.value(); | ||
1331 | +} | ||
1332 | +#else | ||
1333 | +int check_cxx17() | ||
1334 | +{ | ||
1335 | + return 0; | ||
1336 | +} | ||
1337 | +#endif | ||
1338 | + | ||
1339 | +class Class | ||
1340 | +{ | ||
1341 | +public: | ||
1342 | + int Get() const { return this->Member; } | ||
1343 | +private: | ||
1344 | + int Member = 1; | ||
1345 | +}; | ||
1346 | +int main() | ||
1347 | +{ | ||
1348 | + auto const c = std::unique_ptr<Class>(new Class); | ||
1349 | + std::cout << c->Get() << check_cxx14() << check_cxx17() << std::endl; | ||
1350 | + return 0; | ||
1351 | +} | ||
1352 | +' > "${TMPFILE}.cxx" | ||
1353 | +for std in 17 14 11; do | ||
1354 | + std_flags="`cmake_extract_standard_flags \"${cmake_toolchain}\" CXX \"${std}\"`" | ||
1355 | + for compiler in ${cmake_cxx_compilers}; do | ||
1356 | + for std_flag in '' $std_flags; do | ||
1357 | + for thread_flag in '' $thread_flags; do | ||
1358 | + echo "Checking whether '${compiler} ${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}' works." >> cmake_bootstrap.log 2>&1 | ||
1359 | + if cmake_try_run "${compiler}" "${cmake_cxx_flags} ${cmake_ld_flags} ${std_flag} ${thread_flag}" \ | ||
1360 | + "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1361 | + cmake_cxx_compiler="${compiler}" | ||
1362 | + cmake_cxx_flags="${cmake_cxx_flags} ${std_flag} ${thread_flag} " | ||
1363 | + break 4 | ||
1364 | + fi | ||
1365 | + done | ||
1366 | + done | ||
1367 | + done | ||
1368 | +done | ||
1369 | +rm -f "${TMPFILE}.cxx" | ||
1370 | + | ||
1371 | +if test -z "${cmake_cxx_compiler}"; then | ||
1372 | +cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags. | ||
1373 | +Please specify one using environment variable CXX. | ||
1374 | +The C++ flags are \"$cmake_cxx_flags\". | ||
1375 | +They can be changed using the environment variable CXXFLAGS. | ||
1376 | +See cmake_bootstrap.log for compilers attempted." | ||
1377 | +fi | ||
1378 | +echo "C++ compiler on this system is: ${cmake_cxx_compiler} ${cmake_cxx_flags}" | ||
1379 | + | ||
1380 | +#----------------------------------------------------------------------------- | ||
1381 | +# Test CXX features | ||
1382 | + | ||
1383 | +cmake_cxx_features="make_unique filesystem" | ||
1384 | + | ||
1385 | +for feature in ${cmake_cxx_features}; do | ||
1386 | + eval "cmake_have_cxx_${feature}=0" | ||
1387 | + echo "Checking whether '${cmake_cxx_compiler} ${cmake_cxx_flags} ${cmake_ld_flags}' supports '${feature}'." >> cmake_bootstrap.log 2>&1 | ||
1388 | + if cmake_try_run "${cmake_cxx_compiler}" "${cmake_cxx_flags} ${cmake_ld_flags}" \ | ||
1389 | + "${cmake_source_dir}/Source/Checks/cm_cxx_${feature}.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1390 | + eval "cmake_have_cxx_${feature}=1" | ||
1391 | + fi | ||
1392 | +done | ||
1393 | + | ||
1394 | +cmake_have_cxx_features="" | ||
1395 | +for feature in ${cmake_cxx_features}; do | ||
1396 | + feature_variable="cmake_have_cxx_${feature}" | ||
1397 | + eval "feature_value=\${${feature_variable}}" | ||
1398 | + if test "${feature_value}" -eq "1"; then | ||
1399 | + cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}" | ||
1400 | + fi | ||
1401 | +done | ||
1402 | + | ||
1403 | +cmake_generate_file "${cmake_bootstrap_dir}/cmSTL.hxx" "" | ||
1404 | + | ||
1405 | + | ||
1406 | +#----------------------------------------------------------------------------- | ||
1407 | +# Test Make | ||
1408 | + | ||
1409 | +cmake_make_processor= | ||
1410 | +cmake_make_flags= | ||
1411 | + | ||
1412 | +# If MAKE is set, use that for make processor, otherwise use list of known make | ||
1413 | +if test -n "${MAKE}"; then | ||
1414 | + cmake_make_processors="${MAKE}" | ||
1415 | +elif test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1416 | + cmake_make_processors="${CMAKE_KNOWN_NINJA_PROCESSORS}" | ||
1417 | +else | ||
1418 | + cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}" | ||
1419 | +fi | ||
1420 | + | ||
1421 | +TMPFILE="`cmake_tmp_file`_dir" | ||
1422 | +rm -rf "${cmake_bootstrap_dir}/${TMPFILE}" | ||
1423 | +mkdir "${cmake_bootstrap_dir}/${TMPFILE}" | ||
1424 | +cd "${cmake_bootstrap_dir}/${TMPFILE}" | ||
1425 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1426 | + echo ' | ||
1427 | +rule cc | ||
1428 | + command = "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o $out $in | ||
1429 | +build test: cc test.c | ||
1430 | +'>"build.ninja" | ||
1431 | +else | ||
1432 | + echo ' | ||
1433 | +test: test.c | ||
1434 | + "'"${cmake_c_compiler}"'" '"${cmake_ld_flags} ${cmake_c_flags}"' -o test test.c | ||
1435 | +'>"Makefile" | ||
1436 | +fi | ||
1437 | +echo ' | ||
1438 | +#include <stdio.h> | ||
1439 | +int main(){ printf("1%c", (char)0x0a); return 0; } | ||
1440 | +' > "test.c" | ||
1441 | +cmake_original_make_flags="${cmake_make_flags}" | ||
1442 | +if test "x${cmake_parallel_make}" != "x"; then | ||
1443 | + cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" | ||
1444 | +fi | ||
1445 | +for a in ${cmake_make_processors}; do | ||
1446 | + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then | ||
1447 | + cmake_make_processor="${a}" | ||
1448 | + fi | ||
1449 | +done | ||
1450 | +cmake_full_make_flags="${cmake_make_flags}" | ||
1451 | +if test "x${cmake_original_make_flags}" != "x${cmake_make_flags}"; then | ||
1452 | + if test -z "${cmake_make_processor}"; then | ||
1453 | + cmake_make_flags="${cmake_original_make_flags}" | ||
1454 | + for a in ${cmake_make_processors}; do | ||
1455 | + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then | ||
1456 | + cmake_make_processor="${a}" | ||
1457 | + fi | ||
1458 | + done | ||
1459 | + fi | ||
1460 | +fi | ||
1461 | +cd "${cmake_bootstrap_dir}" | ||
1462 | + | ||
1463 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1464 | + mf_str=Ninja | ||
1465 | +else | ||
1466 | + mf_str=Makefile | ||
1467 | +fi | ||
1468 | +if test -z "${cmake_make_processor}"; then | ||
1469 | + cmake_error 8 "Cannot find appropriate ${mf_str} processor on this system. | ||
1470 | +Please specify one using environment variable MAKE." | ||
1471 | +fi | ||
1472 | +rm -rf "${cmake_bootstrap_dir}/${TMPFILE}" | ||
1473 | +echo "${mf_str} processor on this system is: ${cmake_make_processor}" | ||
1474 | +if test "x${cmake_full_make_flags}" != "x${cmake_make_flags}"; then | ||
1475 | + echo "---------------------------------------------" | ||
1476 | + echo "${mf_str} processor ${cmake_make_processor} does not support parallel build" | ||
1477 | + echo "---------------------------------------------" | ||
1478 | +fi | ||
1479 | + | ||
1480 | +# Test for kwsys features | ||
1481 | +KWSYS_NAME_IS_KWSYS=0 | ||
1482 | +KWSYS_BUILD_SHARED=0 | ||
1483 | +KWSYS_LFS_AVAILABLE=0 | ||
1484 | +KWSYS_LFS_REQUESTED=0 | ||
1485 | +KWSYS_STL_HAS_WSTRING=0 | ||
1486 | +KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=0 | ||
1487 | +KWSYS_CXX_HAS_SETENV=0 | ||
1488 | +KWSYS_CXX_HAS_UNSETENV=0 | ||
1489 | +KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=0 | ||
1490 | +KWSYS_CXX_HAS_UTIMENSAT=0 | ||
1491 | +KWSYS_CXX_HAS_UTIMES=0 | ||
1492 | +KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP=1 | ||
1493 | + | ||
1494 | +if cmake_try_run "${cmake_cxx_compiler}" \ | ||
1495 | + "${cmake_cxx_flags} ${cmake_ld_flags} -DTEST_KWSYS_CXX_HAS_SETENV" \ | ||
1496 | + "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1497 | + KWSYS_CXX_HAS_SETENV=1 | ||
1498 | + echo "${cmake_cxx_compiler} has setenv" | ||
1499 | +else | ||
1500 | + echo "${cmake_cxx_compiler} does not have setenv" | ||
1501 | +fi | ||
1502 | + | ||
1503 | +if cmake_try_run "${cmake_cxx_compiler}" \ | ||
1504 | + "${cmake_cxx_flags} ${cmake_ld_flags} -DTEST_KWSYS_CXX_HAS_UNSETENV" \ | ||
1505 | + "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1506 | + KWSYS_CXX_HAS_UNSETENV=1 | ||
1507 | + echo "${cmake_cxx_compiler} has unsetenv" | ||
1508 | +else | ||
1509 | + echo "${cmake_cxx_compiler} does not have unsetenv" | ||
1510 | +fi | ||
1511 | + | ||
1512 | +if cmake_try_run "${cmake_cxx_compiler}" \ | ||
1513 | + "${cmake_cxx_flags} ${cmake_ld_flags} -DTEST_KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H" \ | ||
1514 | + "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1515 | + KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=1 | ||
1516 | + echo "${cmake_cxx_compiler} has environ in stdlib.h" | ||
1517 | +else | ||
1518 | + echo "${cmake_cxx_compiler} does not have environ in stdlib.h" | ||
1519 | +fi | ||
1520 | + | ||
1521 | +if cmake_try_run "${cmake_cxx_compiler}" \ | ||
1522 | + "${cmake_cxx_flags} ${cmake_ld_flags} -DTEST_KWSYS_STL_HAS_WSTRING" \ | ||
1523 | + "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1524 | + KWSYS_STL_HAS_WSTRING=1 | ||
1525 | + echo "${cmake_cxx_compiler} has stl wstring" | ||
1526 | +else | ||
1527 | + echo "${cmake_cxx_compiler} does not have stl wstring" | ||
1528 | +fi | ||
1529 | + | ||
1530 | +if cmake_try_run "${cmake_cxx_compiler}" \ | ||
1531 | + "${cmake_cxx_flags} ${cmake_ld_flags} -DTEST_KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H" \ | ||
1532 | + "${cmake_source_dir}/Source/kwsys/kwsysPlatformTestsCXX.cxx" >> cmake_bootstrap.log 2>&1; then | ||
1533 | + KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H=1 | ||
1534 | + echo "${cmake_cxx_compiler} has <ext/stdio_filebuf.h>" | ||
1535 | +else | ||
1536 | + echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>" | ||
1537 | +fi | ||
1538 | + | ||
1539 | +if test -n "${cmake_ccache_enabled}"; then | ||
1540 | + echo "Building CMake with ccache" | ||
1541 | + cmake_c_compiler="ccache ${cmake_c_compiler}" | ||
1542 | + cmake_cxx_compiler="ccache ${cmake_cxx_compiler}" | ||
1543 | +fi | ||
1544 | + | ||
1545 | +# Just to be safe, let us store compiler and flags to the header file | ||
1546 | + | ||
1547 | +cmake_bootstrap_version='$Revision$' | ||
1548 | +cmake_compiler_settings_comment="/* | ||
1549 | + * Generated by ${cmake_source_dir}/bootstrap | ||
1550 | + * Version: ${cmake_bootstrap_version} | ||
1551 | + * | ||
1552 | + * Source directory: ${cmake_source_dir} | ||
1553 | + * Binary directory: ${cmake_bootstrap_dir} | ||
1554 | + * | ||
1555 | + * C compiler: ${cmake_c_compiler} | ||
1556 | + * C flags: ${cmake_c_flags} | ||
1557 | + * | ||
1558 | + * C++ compiler: ${cmake_cxx_compiler} | ||
1559 | + * C++ flags: ${cmake_cxx_flags} | ||
1560 | + * | ||
1561 | + * Make: ${cmake_make_processor} | ||
1562 | + * | ||
1563 | + * Sources: | ||
1564 | + * ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} | ||
1565 | + * STD Sources: | ||
1566 | + * ${CMAKE_STD_CXX_HEADERS} ${CMAKE_STD_CXX_SOURCES} | ||
1567 | + * LexerParser Sources: | ||
1568 | + * ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} | ||
1569 | + * kwSys Sources: | ||
1570 | + * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} | ||
1571 | + * libuv Sources: | ||
1572 | + * ${LIBUV_C_SOURCES} | ||
1573 | + * jsoncpp Sources: | ||
1574 | + * ${JSONCPP_CXX_SOURCES} | ||
1575 | + * librhash Sources: | ||
1576 | + * ${LIBRHASH_C_SOURCES} | ||
1577 | + */ | ||
1578 | +" | ||
1579 | + | ||
1580 | +cmake_report cmConfigure.h${_tmp} "${cmake_compiler_settings_comment}" | ||
1581 | + | ||
1582 | +# When bootstrapping on MinGW with MSYS we must convert the source | ||
1583 | +# directory to a windows path. | ||
1584 | +if ${cmake_system_mingw}; then | ||
1585 | + CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W` | ||
1586 | + CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W` | ||
1587 | +else | ||
1588 | + CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}" | ||
1589 | + CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}" | ||
1590 | +fi | ||
1591 | + | ||
1592 | +# Write CMake version | ||
1593 | +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MAJOR ${cmake_version_major}" | ||
1594 | +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}" | ||
1595 | +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}" | ||
1596 | +cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\"" | ||
1597 | +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\"" | ||
1598 | +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\"" | ||
1599 | +cmake_report cmConfigure.h${_tmp} "#define CMake_DEFAULT_RECURSION_LIMIT 400" | ||
1600 | +cmake_report cmConfigure.h${_tmp} "#define CMAKE_BIN_DIR \"/bootstrap-not-insalled\"" | ||
1601 | +cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\"" | ||
1602 | +cmake_report cmConfigure.h${_tmp} "#define CM_FALLTHROUGH" | ||
1603 | + | ||
1604 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1605 | + cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_NINJA" | ||
1606 | +else | ||
1607 | + cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_MAKEFILES" | ||
1608 | +fi | ||
1609 | + | ||
1610 | +if ${cmake_system_mingw}; then | ||
1611 | + cmake_report cmConfigure.h${_tmp} "#if defined(_WIN32) && !defined(NOMINMAX)" | ||
1612 | + cmake_report cmConfigure.h${_tmp} "# define NOMINMAX" | ||
1613 | + cmake_report cmConfigure.h${_tmp} "#endif" | ||
1614 | +fi | ||
1615 | + | ||
1616 | +# Regenerate configured headers | ||
1617 | +for h in Configure VersionConfig; do | ||
1618 | + if "${_diff}" cm${h}.h cm${h}.h${_tmp} > /dev/null 2> /dev/null; then | ||
1619 | + rm -f cm${h}.h${_tmp} | ||
1620 | + else | ||
1621 | + mv -f cm${h}.h${_tmp} cm${h}.h | ||
1622 | + fi | ||
1623 | +done | ||
1624 | + | ||
1625 | +# Prepare KWSYS | ||
1626 | +cmsys_header_files="cmsys/Configure.h cmsys/Configure.hxx" | ||
1627 | +cmake_kwsys_config_replace_string \ | ||
1628 | + "${cmake_source_dir}/Source/kwsys/Configure.hxx.in" \ | ||
1629 | + "${cmake_bootstrap_dir}/cmsys/Configure.hxx" \ | ||
1630 | + "${cmake_compiler_settings_comment}" | ||
1631 | +cmake_kwsys_config_replace_string \ | ||
1632 | + "${cmake_source_dir}/Source/kwsys/Configure.h.in" \ | ||
1633 | + "${cmake_bootstrap_dir}/cmsys/Configure.h" \ | ||
1634 | + "${cmake_compiler_settings_comment}" | ||
1635 | + | ||
1636 | +for a in ${KWSYS_FILES}; do | ||
1637 | + cmake_replace_string "${cmake_source_dir}/Source/kwsys/${a}.in" \ | ||
1638 | + "${cmake_bootstrap_dir}/cmsys/${a}" KWSYS_NAMESPACE cmsys | ||
1639 | + cmsys_header_files="${cmsys_header_files} cmsys/${a}" | ||
1640 | +done | ||
1641 | + | ||
1642 | +echo "#pragma once" > "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" | ||
1643 | +if test "x${bootstrap_system_libuv}" != "x"; then | ||
1644 | + echo "#define CMAKE_USE_SYSTEM_LIBUV" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" | ||
1645 | +fi | ||
1646 | +if test "x${bootstrap_system_jsoncpp}" != "x"; then | ||
1647 | + echo "#define CMAKE_USE_SYSTEM_JSONCPP" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" | ||
1648 | +fi | ||
1649 | +if test "x${bootstrap_system_librhash}" != "x"; then | ||
1650 | + echo "#define CMAKE_USE_SYSTEM_LIBRHASH" >> "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" | ||
1651 | +fi | ||
1652 | +cmake_generate_file_tmp "${cmake_bootstrap_dir}/cmThirdParty.h" "${cmake_bootstrap_dir}/cmThirdParty.h.tmp" | ||
1653 | + | ||
1654 | +# Generate Makefile | ||
1655 | +dep="cmConfigure.h ${cmsys_header_files}" | ||
1656 | +for h in "${cmake_source_dir}"/Source/*.hxx; do | ||
1657 | + dep="${dep} `cmake_escape_artifact \"${h}\"`" | ||
1658 | +done | ||
1659 | +for h in "${cmake_source_dir}"/Source/*.h; do | ||
1660 | + dep="${dep} `cmake_escape_artifact \"${h}\"`" | ||
1661 | +done | ||
1662 | +for h in ${CMAKE_STD_CXX_HEADERS}; do | ||
1663 | + dep="${dep} `cmake_escape_artifact \"${cmake_source_dir}\"`/Utilities/std/cm/${h}" | ||
1664 | +done | ||
1665 | +objs="" | ||
1666 | +for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${CMAKE_STD_CXX_SOURCES} ${LexerParser_CXX_SOURCES} ${LexerParser_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do | ||
1667 | + objs="${objs} ${a}.o" | ||
1668 | +done | ||
1669 | +if test "x${bootstrap_system_libuv}" = "x"; then | ||
1670 | + for a in ${LIBUV_C_SOURCES}; do | ||
1671 | + objs="${objs} uv-`cmake_obj ${a}`" | ||
1672 | + done | ||
1673 | +fi | ||
1674 | +if test "x${bootstrap_system_librhash}" = "x"; then | ||
1675 | + for a in ${LIBRHASH_C_SOURCES}; do | ||
1676 | + objs="${objs} rhash-`cmake_obj ${a}`" | ||
1677 | + done | ||
1678 | +fi | ||
1679 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1680 | + if test "x${bootstrap_system_jsoncpp}" = "x"; then | ||
1681 | + for a in ${JSONCPP_CXX_SOURCES}; do | ||
1682 | + objs="${objs} jsoncpp-`cmake_obj ${a}`" | ||
1683 | + done | ||
1684 | + fi | ||
1685 | +fi | ||
1686 | + | ||
1687 | +libs="" | ||
1688 | + | ||
1689 | +uv_c_flags="" | ||
1690 | +if ${cmake_system_mingw}; then | ||
1691 | + uv_c_flags="${uv_c_flags} -DWIN32_LEAN_AND_MEAN -D_WIN32_WINNT=0x0600" | ||
1692 | + libs="${libs} -lws2_32 -lpsapi -liphlpapi -lshell32 -luserenv -lole32 -loleaut32" | ||
1693 | +else | ||
1694 | + case "${cmake_system}" in | ||
1695 | + *AIX*) | ||
1696 | + uv_c_flags="${uv_c_flags} -D_ALL_SOURCE -D_XOPEN_SOURCE=500 -D_LINUX_SOURCE_COMPAT" | ||
1697 | + libs="${libs} -lperfstat" | ||
1698 | + ;; | ||
1699 | + *Darwin*) | ||
1700 | + uv_c_flags="${uv_c_flags} -D_DARWIN_USE_64_BIT_INODE=1 -D_DARWIN_UNLIMITED_SELECT=1" | ||
1701 | + ;; | ||
1702 | + *HP-UX*) | ||
1703 | + uv_c_flags="${uv_c_flags} -D_XOPEN_SOURCE_EXTENDED" | ||
1704 | + ;; | ||
1705 | + *Linux*) | ||
1706 | + uv_c_flags="${uv_c_flags} -D_GNU_SOURCE" | ||
1707 | + libs="${libs} -ldl -lrt" | ||
1708 | + ;; | ||
1709 | + *kFreeBSD*) | ||
1710 | + libs="${libs} -lkvm -lfreebsd-glue" | ||
1711 | + ;; | ||
1712 | + *BSD*) | ||
1713 | + libs="${libs} -lkvm" | ||
1714 | + ;; | ||
1715 | + *SunOS*) | ||
1716 | + # Normally libuv uses '-D_XOPEN_SOURCE=500 -std=c90' on Solaris 5.10, | ||
1717 | + # but we do not need to do that because we bootstrap using POSIX APIs. | ||
1718 | + uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600" | ||
1719 | + libs="${libs} -lkstat -lnsl -lsendfile -lsocket -lrt" | ||
1720 | + ;; | ||
1721 | + *QNX*) | ||
1722 | + uv_c_flags="${uv_c_flags} -D_XOPEN_SOURCE=700" | ||
1723 | + libs="${libs} -lsocket" | ||
1724 | + ;; | ||
1725 | + esac | ||
1726 | +fi | ||
1727 | +if test "x${bootstrap_system_libuv}" = "x"; then | ||
1728 | + uv_c_flags="${uv_c_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmlibuv/include"`" | ||
1729 | + if ${cmake_system_mingw}; then | ||
1730 | + uv_c_flags="${uv_c_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmlibuv/src/win"`" | ||
1731 | + else | ||
1732 | + uv_c_flags="${uv_c_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmlibuv/src/unix"`" | ||
1733 | + fi | ||
1734 | + uv_c_flags="${uv_c_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmlibuv/src"`" | ||
1735 | +else | ||
1736 | + if test `which pkg-config`; then | ||
1737 | + use_uv_flags="`pkg-config --cflags libuv`" | ||
1738 | + cmake_c_flags="${cmake_c_flags} ${use_uv_flags}" | ||
1739 | + cmake_cxx_flags="${cmake_cxx_flags} ${use_uv_flags}" | ||
1740 | + fi | ||
1741 | + libs="${libs} -luv" | ||
1742 | +fi | ||
1743 | + | ||
1744 | +if test "x${bootstrap_system_librhash}" != "x"; then | ||
1745 | + if test `which pkg-config`; then | ||
1746 | + use_librhash_flags="`pkg-config --cflags librhash`" | ||
1747 | + cmake_c_flags="${cmake_c_flags} ${use_librhash_flags}" | ||
1748 | + cmake_cxx_flags="${cmake_cxx_flags} ${use_librhash_flags}" | ||
1749 | + fi | ||
1750 | + libs="${libs} -lrhash" | ||
1751 | +fi | ||
1752 | + | ||
1753 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1754 | + jsoncpp_cxx_flags= | ||
1755 | + if test "x${bootstrap_system_jsoncpp}" = "x"; then | ||
1756 | + jsoncpp_cxx_flags="${jsoncpp_cxx_flags} `cmake_escape_shell "-I${cmake_source_dir}/Utilities/cmjsoncpp/include"`" | ||
1757 | + else | ||
1758 | + if test `which pkg-config`; then | ||
1759 | + use_jsoncpp_flags="`pkg-config --cflags jsoncpp`" | ||
1760 | + cmake_cxx_flags="${cmake_cxx_flags} ${use_jsoncpp_flags}" | ||
1761 | + fi | ||
1762 | + libs="${libs} -ljsoncpp" | ||
1763 | + fi | ||
1764 | +fi | ||
1765 | + | ||
1766 | +if test "x${cmake_ansi_cxx_flags}" != "x"; then | ||
1767 | + cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}" | ||
1768 | +fi | ||
1769 | + | ||
1770 | +system_flags='' | ||
1771 | +case "${cmake_system}" in | ||
1772 | + # Ensure filesystem access uses 64-bit offsets even on 32-bit hosts. | ||
1773 | + *Linux*) system_flags='-D_FILE_OFFSET_BITS=64' ;; | ||
1774 | +esac | ||
1775 | +if test "x${system_flags}" != "x"; then | ||
1776 | + cmake_c_flags="${cmake_c_flags} ${system_flags}" | ||
1777 | + cmake_cxx_flags="${cmake_cxx_flags} ${system_flags}" | ||
1778 | +fi | ||
1779 | + | ||
1780 | +if test "x${cmake_c_flags}" != "x"; then | ||
1781 | + cmake_c_flags="${cmake_c_flags} " | ||
1782 | +fi | ||
1783 | + | ||
1784 | +if test "x${cmake_cxx_flags}" != "x"; then | ||
1785 | + cmake_cxx_flags="${cmake_cxx_flags} " | ||
1786 | +fi | ||
1787 | + | ||
1788 | +write_source_rule() { | ||
1789 | + lang="$1" | ||
1790 | + obj="$2" | ||
1791 | + src="$3" | ||
1792 | + src_flags="$4" | ||
1793 | + | ||
1794 | + if test "${lang}" = "c"; then | ||
1795 | + ninja_rule=cc | ||
1796 | + compiler="${cmake_c_compiler}" | ||
1797 | + flags="${cmake_c_flags}" | ||
1798 | + elif test "${lang}" = "cxx"; then | ||
1799 | + ninja_rule=cxx | ||
1800 | + compiler="${cmake_cxx_compiler}" | ||
1801 | + flags="${cmake_cxx_flags}" | ||
1802 | + fi | ||
1803 | + | ||
1804 | + if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1805 | + echo "build ${obj} : ${ninja_rule} ${src} | ${dep}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1806 | + echo " srcflags = ${src_flags}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1807 | + else | ||
1808 | + echo "${obj} : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile" | ||
1809 | + echo " ${compiler} ${flags} ${src_flags} -c ${src} -o ${obj}" >> "${cmake_bootstrap_dir}/Makefile" | ||
1810 | + fi | ||
1811 | +} | ||
1812 | + | ||
1813 | +cmake_c_flags_String="-DKWSYS_STRING_C" | ||
1814 | +if ${cmake_system_mingw}; then | ||
1815 | + cmake_c_flags_EncodingC="-DKWSYS_ENCODING_DEFAULT_CODEPAGE=CP_ACP" | ||
1816 | + cmake_cxx_flags_EncodingCXX="${cmake_c_flags_EncodingC}" | ||
1817 | + cmake_cxx_flags_cmProcessOutput="${cmake_c_flags_EncodingC}" | ||
1818 | +fi | ||
1819 | +cmake_cxx_flags_SystemTools=" | ||
1820 | + -DKWSYS_CXX_HAS_SETENV=${KWSYS_CXX_HAS_SETENV} | ||
1821 | + -DKWSYS_CXX_HAS_UNSETENV=${KWSYS_CXX_HAS_UNSETENV} | ||
1822 | + -DKWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H=${KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H} | ||
1823 | + -DKWSYS_CXX_HAS_UTIMENSAT=${KWSYS_CXX_HAS_UTIMENSAT} | ||
1824 | + -DKWSYS_CXX_HAS_UTIMES=${KWSYS_CXX_HAS_UTIMES} | ||
1825 | +" | ||
1826 | +cmake_c_flags="${cmake_c_flags} \ | ||
1827 | + -DCMAKE_BOOTSTRAP \ | ||
1828 | + -I`cmake_escape_shell \"${cmake_bootstrap_dir}\"` \ | ||
1829 | + -I`cmake_escape_shell \"${cmake_source_dir}/Source\"` \ | ||
1830 | + -I`cmake_escape_shell \"${cmake_source_dir}/Source/LexerParser\"` \ | ||
1831 | + -I`cmake_escape_shell \"${cmake_source_dir}/Utilities\"`" | ||
1832 | +cmake_cxx_flags="${cmake_cxx_flags} \ | ||
1833 | + -DCMAKE_BOOTSTRAP \ | ||
1834 | + ${cmake_have_cxx_features} \ | ||
1835 | + -I`cmake_escape_shell \"${cmake_bootstrap_dir}\"` \ | ||
1836 | + -I`cmake_escape_shell \"${cmake_source_dir}/Source\"` \ | ||
1837 | + -I`cmake_escape_shell \"${cmake_source_dir}/Source/LexerParser\"` \ | ||
1838 | + -I`cmake_escape_shell \"${cmake_source_dir}/Utilities/std\"` \ | ||
1839 | + -I`cmake_escape_shell \"${cmake_source_dir}/Utilities\"`" | ||
1840 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1841 | + echo "cc = ${cmake_c_compiler}" > "${cmake_bootstrap_dir}/build.ninja" | ||
1842 | + echo "cxx = ${cmake_cxx_compiler}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1843 | + echo "cflags = ${cmake_c_flags}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1844 | + echo "cxxflags = ${cmake_cxx_flags}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1845 | + echo "ldflags = ${cmake_ld_flags}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1846 | + echo "rule cc" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1847 | + echo " command = \$cc \$cflags \$srcflags -c \$in -o \$out" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1848 | + echo "rule cxx" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1849 | + echo " command = \$cxx \$cxxflags \$srcflags -c \$in -o \$out" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1850 | + echo "rule link" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1851 | + echo " command = \$cxx \$ldflags \$cxxflags \$in \$libs -o \$out" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1852 | + echo "build cmake: link ${objs}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1853 | + echo " libs = ${libs}" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1854 | +else | ||
1855 | + echo "cmake: ${objs}" > "${cmake_bootstrap_dir}/Makefile" | ||
1856 | + echo " ${cmake_cxx_compiler} ${cmake_ld_flags} ${cmake_cxx_flags} ${objs} ${libs} -o cmake" >> "${cmake_bootstrap_dir}/Makefile" | ||
1857 | +fi | ||
1858 | +for a in ${CMAKE_CXX_SOURCES}; do | ||
1859 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/${a}.cxx"` | ||
1860 | + src_flags=`eval echo \\${cmake_cxx_flags_\${a}}` | ||
1861 | + write_source_rule "cxx" "${a}.o" "${src}" "${src_flags}" | ||
1862 | +done | ||
1863 | +for a in ${CMAKE_C_SOURCES}; do | ||
1864 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/${a}.c"` | ||
1865 | + write_source_rule "c" "${a}.o" "${src}" "" | ||
1866 | +done | ||
1867 | +for a in ${CMAKE_STD_CXX_SOURCES}; do | ||
1868 | + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/std/cm/bits/${a}.cxx"` | ||
1869 | + src_flags=`eval echo \\${cmake_cxx_flags_\${a}}` | ||
1870 | + write_source_rule "cxx" "${a}.o" "${src}" "${src_flags}" | ||
1871 | +done | ||
1872 | +for a in ${LexerParser_CXX_SOURCES}; do | ||
1873 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/LexerParser/${a}.cxx"` | ||
1874 | + src_flags=`eval echo \\${cmake_cxx_flags_\${a}}` | ||
1875 | + write_source_rule "cxx" "${a}.o" "${src}" "${src_flags}" | ||
1876 | +done | ||
1877 | +for a in ${LexerParser_C_SOURCES}; do | ||
1878 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/LexerParser/${a}.c"` | ||
1879 | + write_source_rule "c" "${a}.o" "${src}" "" | ||
1880 | +done | ||
1881 | +for a in ${KWSYS_C_SOURCES}; do | ||
1882 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/kwsys/${a}.c"` | ||
1883 | + src_flags="`eval echo \\${cmake_c_flags_\${a}}` -DKWSYS_NAMESPACE=cmsys" | ||
1884 | + write_source_rule "c" "${a}.o" "${src}" "${src_flags}" | ||
1885 | +done | ||
1886 | +for a in ${KWSYS_CXX_SOURCES}; do | ||
1887 | + src=`cmake_escape_artifact "${cmake_source_dir}/Source/kwsys/${a}.cxx"` | ||
1888 | + src_flags="`eval echo \\${cmake_cxx_flags_\${a}}` -DKWSYS_NAMESPACE=cmsys" | ||
1889 | + write_source_rule "cxx" "${a}.o" "${src}" "${src_flags}" | ||
1890 | +done | ||
1891 | +if test "x${bootstrap_system_libuv}" = "x"; then | ||
1892 | + for a in ${LIBUV_C_SOURCES}; do | ||
1893 | + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmlibuv/${a}"` | ||
1894 | + write_source_rule "c" "uv-`cmake_obj ${a}`" "${src}" "${uv_c_flags}" | ||
1895 | + done | ||
1896 | +fi | ||
1897 | +if test "x${bootstrap_system_librhash}" = "x"; then | ||
1898 | + for a in ${LIBRHASH_C_SOURCES}; do | ||
1899 | + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmlibrhash/${a}"` | ||
1900 | + write_source_rule "c" "rhash-`cmake_obj ${a}`" "${src}" "" | ||
1901 | + done | ||
1902 | +fi | ||
1903 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1904 | + if test "x${bootstrap_system_jsoncpp}" = "x"; then | ||
1905 | + for a in ${JSONCPP_CXX_SOURCES}; do | ||
1906 | + src=`cmake_escape_artifact "${cmake_source_dir}/Utilities/cmjsoncpp/${a}"` | ||
1907 | + write_source_rule "cxx" "jsoncpp-`cmake_obj ${a}`" "${src}" "${jsoncpp_cxx_flags}" | ||
1908 | + done | ||
1909 | + fi | ||
1910 | +fi | ||
1911 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1912 | + echo " | ||
1913 | +rule rebuild_cache | ||
1914 | + command = cd \"${cmake_binary_dir}\" && \"${cmake_source_dir}/bootstrap\" --generator=\"${cmake_bootstrap_generator}\" | ||
1915 | + generator = 1 | ||
1916 | +build build.ninja : rebuild_cache | ||
1917 | +" >> "${cmake_bootstrap_dir}/build.ninja" | ||
1918 | +else | ||
1919 | + echo " | ||
1920 | +rebuild_cache: | ||
1921 | + cd \"${cmake_binary_dir}\" && \"${cmake_source_dir}/bootstrap\" --generator=\"${cmake_bootstrap_generator}\" | ||
1922 | +" >> "${cmake_bootstrap_dir}/Makefile" | ||
1923 | +fi | ||
1924 | + | ||
1925 | +# Write our default settings to Bootstrap${_cmk}/InitialCacheFlags.cmake. | ||
1926 | +echo ' | ||
1927 | +# Generated by '"${cmake_source_dir}"'/bootstrap | ||
1928 | +# Default cmake settings. These may be overridden any settings below. | ||
1929 | +set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build.") # not FORCE to preserve defaults specified elsewhere | ||
1930 | +set (CMAKE_INSTALL_PREFIX "'"${cmake_prefix_dir}"'" CACHE PATH "Install path prefix, prepended onto install directories." FORCE) | ||
1931 | +set (CMAKE_DOC_DIR "'"${cmake_doc_dir}"'" CACHE PATH "Install location for documentation (relative to prefix)." FORCE) | ||
1932 | +set (CMAKE_MAN_DIR "'"${cmake_man_dir}"'" CACHE PATH "Install location for man pages (relative to prefix)." FORCE) | ||
1933 | +set (CMAKE_BIN_DIR "'"${cmake_bin_dir}"'" CACHE PATH "Install location for binaries (relative to prefix)." FORCE) | ||
1934 | +set (CMAKE_DATA_DIR "'"${cmake_data_dir}"'" CACHE PATH "Install location for data (relative to prefix)." FORCE) | ||
1935 | +set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location for XDG specific files (relative to prefix)." FORCE) | ||
1936 | +' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1937 | + | ||
1938 | +# Add configuration settings given as command-line options. | ||
1939 | +if test "x${cmake_bootstrap_qt_gui}" != "x"; then | ||
1940 | + echo ' | ||
1941 | +set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE) | ||
1942 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1943 | +fi | ||
1944 | +if test "x${cmake_bootstrap_qt_qmake}" != "x"; then | ||
1945 | + echo ' | ||
1946 | +set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE) | ||
1947 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1948 | +fi | ||
1949 | +if test "x${cmake_sphinx_info}" != "x"; then | ||
1950 | + echo ' | ||
1951 | +set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE) | ||
1952 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1953 | +fi | ||
1954 | +if test "x${cmake_sphinx_man}" != "x"; then | ||
1955 | + echo ' | ||
1956 | +set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE) | ||
1957 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1958 | +fi | ||
1959 | +if test "x${cmake_sphinx_html}" != "x"; then | ||
1960 | + echo ' | ||
1961 | +set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE) | ||
1962 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1963 | +fi | ||
1964 | +if test "x${cmake_sphinx_qthelp}" != "x"; then | ||
1965 | + echo ' | ||
1966 | +set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE) | ||
1967 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1968 | +fi | ||
1969 | +if test "x${cmake_sphinx_latexpdf}" != "x"; then | ||
1970 | + echo ' | ||
1971 | +set (SPHINX_LATEXPDF "'"${cmake_sphinx_latexpdf}"'" CACHE BOOL "Build PDF help with Sphinx using LaTeX" FORCE) | ||
1972 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1973 | +fi | ||
1974 | +if test "x${cmake_sphinx_build}" != "x"; then | ||
1975 | + echo ' | ||
1976 | +set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE) | ||
1977 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1978 | +fi | ||
1979 | +if test "x${cmake_sphinx_flags}" != "x"; then | ||
1980 | + echo ' | ||
1981 | +set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE) | ||
1982 | +' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1983 | +fi | ||
1984 | + | ||
1985 | +# Add user-specified settings. Handle relative-path case for | ||
1986 | +# specification of cmake_init_file. | ||
1987 | +( | ||
1988 | +cd "${cmake_binary_dir}" | ||
1989 | +if test -f "${cmake_init_file}"; then | ||
1990 | + cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" | ||
1991 | +fi | ||
1992 | +) | ||
1993 | + | ||
1994 | +echo "---------------------------------------------" | ||
1995 | + | ||
1996 | +# Run make to build bootstrap cmake | ||
1997 | +if test "${cmake_bootstrap_generator}" = "Ninja"; then | ||
1998 | + ninja_v=-v | ||
1999 | +else | ||
2000 | + ninja_v= | ||
2001 | +fi | ||
2002 | +if test "x${cmake_parallel_make}" != "x"; then | ||
2003 | + ${cmake_make_processor} ${cmake_make_flags} ${ninja_v} | ||
2004 | +else | ||
2005 | + ${cmake_make_processor} ${ninja_v} | ||
2006 | +fi | ||
2007 | +RES=$? | ||
2008 | +if test "${RES}" -ne "0"; then | ||
2009 | + cmake_error 9 "Problem while running ${cmake_make_processor}" | ||
2010 | +fi | ||
2011 | +cd "${cmake_binary_dir}" | ||
2012 | + | ||
2013 | +# Set C, CXX, and MAKE environment variables, so that real real cmake will be | ||
2014 | +# build with same compiler and make | ||
2015 | +CC="${cmake_c_compiler}" | ||
2016 | +CXX="${cmake_cxx_compiler}" | ||
2017 | +MAKE="${cmake_make_processor}" | ||
2018 | +export CC | ||
2019 | +export CXX | ||
2020 | +export MAKE | ||
2021 | +export CFLAGS | ||
2022 | +export CXXFLAGS | ||
2023 | +export LDFLAGS | ||
2024 | + | ||
2025 | +# Run bootstrap CMake to configure real CMake | ||
2026 | +cmake_options="-DCMAKE_BOOTSTRAP=1" | ||
2027 | +if test -n "${cmake_verbose}"; then | ||
2028 | + cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1" | ||
2029 | +fi | ||
2030 | +"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@" | ||
2031 | +RES=$? | ||
2032 | +if test "${RES}" -ne "0"; then | ||
2033 | + cmake_error 11 "Problem while running initial CMake" | ||
2034 | +fi | ||
2035 | + | ||
2036 | +echo "---------------------------------------------" | ||
2037 | + | ||
2038 | +# And we are done. Now just run make | ||
2039 | +echo "CMake has bootstrapped. Now run ${cmake_make_processor}." |
-
Please register or login to post a comment