forked from Kitware/CMake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap
executable file
·2025 lines (1863 loc) · 62.7 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
die() {
echo "$@" 1>&2 ; exit 1
}
# Compile flag extraction function.
cmake_extract_standard_flags()
{
id="${1:-*}"
lang="${2}"
ver="${3}"
sed -n "s/ *set *( *CMAKE_${lang}${ver}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
"${cmake_source_dir}/Modules/Compiler/"${id}-${lang}.cmake \
2>/dev/null | tr ';' ' '
# Clang's CXX compiler flags are in the common module.
sed -n "s/ *set *( *CMAKE_\\\${lang}${ver}_EXTENSION_COMPILE_OPTION *\"\{0,1\}\([^\")]*\).*/\1/p" \
"${cmake_source_dir}/Modules/Compiler/Clang.cmake" \
2>/dev/null | tr ';' ' '
}
# Version number extraction function.
cmake_version_component()
{
sed -n "
/^set(CMake_VERSION_${1}/ {s/set(CMake_VERSION_${1} *\([0-9]*\)).*/\1/;p;}
" "${cmake_source_dir}/Source/CMakeVersion.cmake"
}
# Install destination extraction function.
cmake_install_dest_default()
{
sed -n '
/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT.*) # '"${2}"'$/ {
s/^ *set(CMAKE_'"${1}"'_DIR_DEFAULT *"\([^"]*\)").*$/\1/
s/${CMake_VERSION_MAJOR}/'"${cmake_version_major}"'/
s/${CMake_VERSION_MINOR}/'"${cmake_version_minor}"'/
s/${CMake_VERSION_PATCH}/'"${cmake_version_patch}"'/
p
q
}
' "${cmake_source_dir}/Source/CMakeInstallDestinations.cmake"
}
cmake_toupper()
{
echo "$1" | tr '[a-z]' '[A-Z]'
}
# Detect system and directory information.
cmake_system=`uname`
cmake_source_dir=`cd "\`dirname \"$0\"\`";pwd`
cmake_binary_dir=`pwd`
# Load version information.
cmake_version_major="`cmake_version_component MAJOR`"
cmake_version_minor="`cmake_version_component MINOR`"
cmake_version_patch="`cmake_version_component PATCH`"
cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}"
cmake_version_rc="`cmake_version_component RC`"
if test "$cmake_version_rc" != ""; then
cmake_version="${cmake_version}-rc${cmake_version_rc}"
fi
cmake_copyright="`grep '^Copyright .* Kitware' "${cmake_source_dir}/Copyright.txt"`"
cmake_bin_dir_keyword="OTHER"
cmake_data_dir_keyword="OTHER"
cmake_doc_dir_keyword="OTHER"
cmake_man_dir_keyword="OTHER"
cmake_xdgdata_dir_keyword="OTHER"
cmake_bin_dir=""
cmake_data_dir=""
cmake_doc_dir=""
cmake_man_dir=""
cmake_xdgdata_dir=""
cmake_init_file=""
cmake_bootstrap_system_libs=""
cmake_bootstrap_qt_gui=""
cmake_bootstrap_qt_qmake=""
cmake_sphinx_info=""
cmake_sphinx_man=""
cmake_sphinx_html=""
cmake_sphinx_qthelp=""
cmake_sphinx_latexpdf=""
cmake_sphinx_build=""
cmake_sphinx_flags=""
# Determine whether this is a Cygwin environment.
if echo "${cmake_system}" | grep CYGWIN >/dev/null 2>&1; then
cmake_system_cygwin=true
cmake_doc_dir_keyword="CYGWIN"
cmake_man_dir_keyword="CYGWIN"
else
cmake_system_cygwin=false
fi
# Determine whether this is a MSYS environment.
if echo "${cmake_system}" | grep MSYS >/dev/null 2>&1; then
cmake_system_msys=true
cmake_doc_dir_keyword="MSYS"
cmake_man_dir_keyword="MSYS"
else
cmake_system_msys=false
fi
# Determine whether this is a MinGW environment.
if echo "${cmake_system}" | grep 'MINGW' >/dev/null 2>&1; then
cmake_system_mingw=true
else
cmake_system_mingw=false
fi
# Determine whether this is OS X
if echo "${cmake_system}" | grep Darwin >/dev/null 2>&1; then
cmake_system_darwin=true
else
cmake_system_darwin=false
fi
# Determine whether this is BeOS
if echo "${cmake_system}" | grep BeOS >/dev/null 2>&1; then
cmake_system_beos=true
cmake_doc_dir_keyword="HAIKU"
cmake_man_dir_keyword="HAIKU"
else
cmake_system_beos=false
fi
# Determine whether this is Haiku
if echo "${cmake_system}" | grep Haiku >/dev/null 2>&1; then
cmake_system_haiku=true
cmake_doc_dir_keyword="HAIKU"
cmake_man_dir_keyword="HAIKU"
else
cmake_system_haiku=false
fi
# Determine whether this is OpenVMS
if echo "${cmake_system}" | grep OpenVMS >/dev/null 2>&1; then
cmake_system_openvms=true
else
cmake_system_openvms=false
fi
# Determine whether this is HP-UX
if echo "${cmake_system}" | grep HP-UX >/dev/null 2>&1; then
die 'CMake no longer compiles on HP-UX. See
https://gitlab.kitware.com/cmake/cmake/-/issues/17137
Use CMake 3.9 or lower instead.'
cmake_system_hpux=true
else
cmake_system_hpux=false
fi
# Determine whether this is Linux
if echo "${cmake_system}" | grep Linux >/dev/null 2>&1; then
cmake_system_linux=true
else
cmake_system_linux=false
fi
# Determine whether this is a PA-RISC machine
# This only works for Linux or HP-UX, not other PA-RISC OSs (BSD maybe?). Also
# may falsely detect parisc on HP-UX m68k
cmake_machine_parisc=false
if ${cmake_system_linux}; then
if uname -m | grep parisc >/dev/null 2>&1; then
cmake_machine_parisc=true
fi
elif ${cmake_system_hpux}; then
if uname -m | grep ia64 >/dev/null 2>&1; then : ; else
cmake_machine_parisc=true
fi
fi
# Choose the generator to use for bootstrapping.
if ${cmake_system_mingw}; then
# Bootstrapping from an MSYS prompt.
cmake_bootstrap_generator="MSYS Makefiles"
else
# Bootstrapping from a standard UNIX prompt.
cmake_bootstrap_generator="Unix Makefiles"
fi
# Choose tools and extensions for this platform.
if ${cmake_system_openvms}; then
_tmp="_tmp"
_cmk="_cmk"
_diff=`which diff`
else
_tmp=".tmp"
_cmk=".cmk"
_diff="diff"
fi
# Construct bootstrap directory name.
cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap${_cmk}"
# Helper function to fix windows paths.
case "${cmake_system}" in
*MINGW*)
cmake_fix_slashes()
{
cmd //c echo "$(echo "$1" | sed 's/\\/\//g')" | sed 's/^"//;s/" *$//'
}
;;
*)
cmake_fix_slashes()
{
echo "$1" | sed 's/\\/\//g'
}
;;
esac
# Choose the default install prefix.
if ${cmake_system_mingw}; then
if test "x${PROGRAMFILES}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"`
elif test "x${ProgramFiles}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"`
elif test "x${SYSTEMDRIVE}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"`
elif test "x${SystemDrive}" != "x"; then
cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"`
else
cmake_default_prefix="c:/Program Files/CMake"
fi
elif ${cmake_system_haiku}; then
cmake_default_prefix=`finddir B_COMMON_DIRECTORY`
else
cmake_default_prefix="/usr/local"
fi
# Lookup default install destinations.
cmake_bin_dir_default="`cmake_install_dest_default BIN ${cmake_bin_dir_keyword}`"
cmake_data_dir_default="`cmake_install_dest_default DATA ${cmake_data_dir_keyword}`"
cmake_doc_dir_default="`cmake_install_dest_default DOC ${cmake_doc_dir_keyword}`"
cmake_man_dir_default="`cmake_install_dest_default MAN ${cmake_man_dir_keyword}`"
cmake_xdgdata_dir_default="`cmake_install_dest_default XDGDATA ${cmake_xdgdata_dir_keyword}`"
CMAKE_KNOWN_C_COMPILERS="cc gcc clang xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ clang++ c++ icc como "
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make smake"
CMAKE_KNOWN_NINJA_PROCESSORS="ninja-build ninja samu"
CMAKE_PROBLEMATIC_FILES="\
CMakeCache.txt \
CMakeSystem.cmake \
CMakeCCompiler.cmake \
CMakeCXXCompiler.cmake \
*/CMakeSystem.cmake \
*/CMakeCCompiler.cmake \
*/CMakeCXXCompiler.cmake \
Source/cmConfigure.h \
Source/CTest/Curl/config.h \
Utilities/cmThirdParty.h \
Utilities/cmcurl/lib/curl_config.h \
Utilities/cmlibarchive/config.h \
Utilities/cmliblzma/config.h \
Utilities/cmnghttp2/config.h \
Utilities/cmzlib/zlibDllConfig.h \
"
CMAKE_UNUSED_SOURCES="\
cmGlobalXCodeGenerator \
cmLocalXCodeGenerator \
cmXCodeObject \
cmXCode21Object \
cmSourceGroup \
"
CMAKE_CXX_SOURCES="\
cmAddCustomCommandCommand \
cmAddCustomTargetCommand \
cmAddDefinitionsCommand \
cmAddDependenciesCommand \
cmAddExecutableCommand \
cmAddLibraryCommand \
cmAddSubDirectoryCommand \
cmAddTestCommand \
cmArgumentParser \
cmBinUtilsLinker \
cmBinUtilsLinuxELFGetRuntimeDependenciesTool \
cmBinUtilsLinuxELFLinker \
cmBinUtilsLinuxELFObjdumpGetRuntimeDependenciesTool \
cmBinUtilsMacOSMachOGetRuntimeDependenciesTool \
cmBinUtilsMacOSMachOLinker \
cmBinUtilsMacOSMachOOToolGetRuntimeDependenciesTool \
cmBinUtilsWindowsPEGetRuntimeDependenciesTool \
cmBinUtilsWindowsPEDumpbinGetRuntimeDependenciesTool \
cmBinUtilsWindowsPELinker \
cmBinUtilsWindowsPEObjdumpGetRuntimeDependenciesTool \
cmBreakCommand \
cmBuildCommand \
cmCMakeLanguageCommand \
cmCMakeMinimumRequired \
cmCMakePath \
cmCMakePathCommand \
cmCMakePolicyCommand \
cmCPackPropertiesGenerator \
cmCacheManager \
cmCommand \
cmCommandArgumentParserHelper \
cmCommands \
cmCommonTargetGenerator \
cmComputeComponentGraph \
cmComputeLinkDepends \
cmComputeLinkInformation \
cmComputeTargetDepends \
cmConsoleBuf \
cmConditionEvaluator \
cmConfigureFileCommand \
cmContinueCommand \
cmCoreTryCompile \
cmCreateTestSourceList \
cmCryptoHash \
cmCustomCommand \
cmCustomCommandGenerator \
cmCustomCommandLines \
cmDefinePropertyCommand \
cmDefinitions \
cmDocumentationFormatter \
cmELF \
cmEnableLanguageCommand \
cmEnableTestingCommand \
cmExecProgramCommand \
cmExecuteProcessCommand \
cmExpandedCommandArgument \
cmExportBuildFileGenerator \
cmExportFileGenerator \
cmExportInstallFileGenerator \
cmExportSet \
cmExportTryCompileFileGenerator \
cmExprParserHelper \
cmExternalMakefileProjectGenerator \
cmFileCommand \
cmFileCopier \
cmFileInstaller \
cmFileSet \
cmFileTime \
cmFileTimeCache \
cmFileTimes \
cmFindBase \
cmFindCommon \
cmFindFileCommand \
cmFindLibraryCommand \
cmFindPackageCommand \
cmFindPathCommand \
cmFindProgramCommand \
cmForEachCommand \
cmFunctionBlocker \
cmFunctionCommand \
cmFSPermissions \
cmGeneratedFileStream \
cmGeneratorExpression \
cmGeneratorExpressionContext \
cmGeneratorExpressionDAGChecker \
cmGeneratorExpressionEvaluationFile \
cmGeneratorExpressionEvaluator \
cmGeneratorExpressionLexer \
cmGeneratorExpressionNode \
cmGeneratorExpressionParser \
cmGeneratorTarget \
cmGetCMakePropertyCommand \
cmGetDirectoryPropertyCommand \
cmGetFilenameComponentCommand \
cmGetPipes \
cmGetPropertyCommand \
cmGetSourceFilePropertyCommand \
cmGetTargetPropertyCommand \
cmGetTestPropertyCommand \
cmGlobalCommonGenerator \
cmGlobalGenerator \
cmGlobVerificationManager \
cmHexFileConverter \
cmIfCommand \
cmIncludeCommand \
cmIncludeGuardCommand \
cmIncludeDirectoryCommand \
cmIncludeRegularExpressionCommand \
cmInstallCommand \
cmInstallCommandArguments \
cmInstallDirectoryGenerator \
cmInstallExportGenerator \
cmInstallFileSetGenerator \
cmInstallFilesCommand \
cmInstallFilesGenerator \
cmInstallGenerator \
cmInstallGetRuntimeDependenciesGenerator \
cmInstallImportedRuntimeArtifactsGenerator \
cmInstallRuntimeDependencySet \
cmInstallRuntimeDependencySetGenerator \
cmInstallScriptGenerator \
cmInstallSubdirectoryGenerator \
cmInstallTargetGenerator \
cmInstallTargetsCommand \
cmInstalledFile \
cmLDConfigLDConfigTool \
cmLDConfigTool \
cmLinkDirectoriesCommand \
cmLinkItem \
cmLinkItemGraphVisitor \
cmLinkLineComputer \
cmLinkLineDeviceComputer \
cmListCommand \
cmListFileCache \
cmLocalCommonGenerator \
cmLocalGenerator \
cmMSVC60LinkLineComputer \
cmMacroCommand \
cmMakeDirectoryCommand \
cmMakefile \
cmMarkAsAdvancedCommand \
cmMathCommand \
cmMessageCommand \
cmMessenger \
cmNewLineStyle \
cmOSXBundleGenerator \
cmOptionCommand \
cmOrderDirectories \
cmOutputConverter \
cmParseArgumentsCommand \
cmPathLabel \
cmPolicies \
cmProcessOutput \
cmProjectCommand \
cmValue \
cmPropertyDefinition \
cmPropertyMap \
cmGccDepfileLexerHelper \
cmGccDepfileReader \
cmReturnCommand \
cmRulePlaceholderExpander \
cmRuntimeDependencyArchive \
cmScriptGenerator \
cmSearchPath \
cmSeparateArgumentsCommand \
cmSetCommand \
cmSetDirectoryPropertiesCommand \
cmSetPropertyCommand \
cmSetSourceFilesPropertiesCommand \
cmSetTargetPropertiesCommand \
cmSetTestsPropertiesCommand \
cmSiteNameCommand \
cmSourceFile \
cmSourceFileLocation \
cmStandardLevelResolver \
cmState \
cmStateDirectory \
cmStateSnapshot \
cmString \
cmStringAlgorithms \
cmStringReplaceHelper \
cmStringCommand \
cmSubcommandTable \
cmSubdirCommand \
cmSystemTools \
cmTarget \
cmTargetCompileDefinitionsCommand \
cmTargetCompileFeaturesCommand \
cmTargetCompileOptionsCommand \
cmTargetIncludeDirectoriesCommand \
cmTargetLinkLibrariesCommand \
cmTargetLinkOptionsCommand \
cmTargetPrecompileHeadersCommand \
cmTargetPropCommandBase \
cmTargetPropertyComputer \
cmTargetSourcesCommand \
cmTest \
cmTestGenerator \
cmTimestamp \
cmTransformDepfile \
cmTryCompileCommand \
cmTryRunCommand \
cmUnsetCommand \
cmUVHandlePtr \
cmUVProcessChain \
cmVersion \
cmWhileCommand \
cmWorkingDirectory \
cmake \
cmakemain \
cmcmd \
"
if ${cmake_system_mingw}; then
CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
cmGlobalMSYSMakefileGenerator \
cmGlobalMinGWMakefileGenerator \
cmVSSetupHelper \
"
fi
CMAKE_STD_CXX_HEADERS="\
filesystem \
memory \
optional \
shared_mutex \
string_view \
utility \
"
CMAKE_STD_CXX_SOURCES="\
fs_path \
string_view \
"
LexerParser_CXX_SOURCES="\
cmCommandArgumentLexer \
cmCommandArgumentParser \
cmExprLexer \
cmExprParser \
cmGccDepfileLexer \
"
LexerParser_C_SOURCES="\
cmListFileLexer \
"
if ${cmake_system_mingw}; then
KWSYS_C_SOURCES="\
EncodingC \
ProcessWin32 \
String \
System \
Terminal"
else
KWSYS_C_SOURCES="\
EncodingC \
ProcessUNIX \
String \
System \
Terminal"
fi
KWSYS_CXX_SOURCES="\
Directory \
EncodingCXX \
FStream \
Glob \
RegularExpression \
Status \
SystemTools"
KWSYS_FILES="\
Directory.hxx \
Encoding.h \
Encoding.hxx \
FStream.hxx \
Glob.hxx \
Process.h \
RegularExpression.hxx \
Status.hxx \
String.h \
String.hxx \
System.h \
SystemTools.hxx \
Terminal.h"
LIBRHASH_C_SOURCES="\
librhash/algorithms.c \
librhash/byte_order.c \
librhash/hex.c \
librhash/md5.c \
librhash/rhash.c \
librhash/sha1.c \
librhash/sha256.c \
librhash/sha3.c \
librhash/sha512.c \
"
if ${cmake_system_mingw}; then
LIBUV_C_SOURCES="\
src/fs-poll.c \
src/idna.c
src/inet.c \
src/threadpool.c \
src/strscpy.c \
src/timer.c \
src/uv-common.c \
src/win/async.c \
src/win/core.c \
src/win/detect-wakeup.c \
src/win/dl.c \
src/win/error.c \
src/win/fs-event.c \
src/win/fs.c \
src/win/getaddrinfo.c \
src/win/getnameinfo.c \
src/win/handle.c \
src/win/loop-watcher.c \
src/win/pipe.c \
src/win/poll.c \
src/win/process-stdio.c \
src/win/process.c \
src/win/signal.c \
src/win/stream.c \
src/win/tcp.c \
src/win/thread.c \
src/win/tty.c \
src/win/udp.c \
src/win/util.c \
src/win/winapi.c \
src/win/winsock.c \
"
else
LIBUV_C_SOURCES="\
src/strscpy.c \
src/timer.c \
src/uv-common.c \
src/unix/cmake-bootstrap.c \
src/unix/core.c \
src/unix/fs.c \
src/unix/loop.c \
src/unix/loop-watcher.c \
src/unix/no-fsevents.c \
src/unix/pipe.c \
src/unix/poll.c \
src/unix/posix-hrtime.c \
src/unix/posix-poll.c \
src/unix/process.c \
src/unix/signal.c \
src/unix/stream.c \
src/unix/tcp.c \
"
fi
# Display CMake bootstrap usage
cmake_usage()
{
echo '
Usage: '"$0"' [<options>...] [-- <cmake-options>...]
Options: [defaults in brackets after descriptions]
Configuration:
--help print this message
--version only print version information
--verbose display more information
--parallel=n bootstrap cmake in parallel, where n is
number of nodes [1]
--generator=<generator> generator to use (MSYS Makefiles, Unix Makefiles,
or Ninja)
--enable-ccache Enable ccache when building cmake
--init=FILE load FILE as script to populate cache
--system-libs use all system-installed third-party libraries
(for use only by package maintainers)
--no-system-libs use all cmake-provided third-party libraries
(default)
--system-curl use system-installed curl library
--no-system-curl use cmake-provided curl library (default)
--system-expat use system-installed expat library
--no-system-expat use cmake-provided expat library (default)
--system-jsoncpp use system-installed jsoncpp library
--no-system-jsoncpp use cmake-provided jsoncpp library (default)
--system-zlib use system-installed zlib library
--no-system-zlib use cmake-provided zlib library (default)
--system-bzip2 use system-installed bzip2 library
--no-system-bzip2 use cmake-provided bzip2 library (default)
--system-liblzma use system-installed liblzma library
--no-system-liblzma use cmake-provided liblzma library (default)
--system-nghttp2 use system-installed nghttp2 library
--no-system-nghttp2 use cmake-provided nghttp2 library (default)
--system-zstd use system-installed zstd library
--no-system-zstd use cmake-provided zstd library (default)
--system-libarchive use system-installed libarchive library
--no-system-libarchive use cmake-provided libarchive library (default)
--system-librhash use system-installed librhash library
--no-system-librhash use cmake-provided librhash library (default)
--system-libuv use system-installed libuv library
--no-system-libuv use cmake-provided libuv library (default)
--bootstrap-system-libuv use system-installed libuv library for bootstrap
--bootstrap-system-jsoncpp use system-installed jsoncpp library for bootstrap
--bootstrap-system-librhash use system-installed librhash library for bootstrap
--qt-gui build the Qt-based GUI (requires Qt >= 4.2)
--no-qt-gui do not build the Qt-based GUI (default)
--qt-qmake=<qmake> use <qmake> as the qmake executable to find Qt
--sphinx-info build Info manual with Sphinx
--sphinx-man build man pages with Sphinx
--sphinx-html build html help with Sphinx
--sphinx-qthelp build qch help with Sphinx
--sphinx-latexpdf build PDF with Sphinx using LaTeX
--sphinx-build=<sb> use <sb> as the sphinx-build executable
--sphinx-flags=<flags> pass <flags> to sphinx-build executable
Directory and file names:
--prefix=PREFIX install files in tree rooted at PREFIX
['"${cmake_default_prefix}"']
--bindir=DIR install binaries in PREFIX/DIR
['"${cmake_bin_dir_default}"']
--datadir=DIR install data files in PREFIX/DIR
['"${cmake_data_dir_default}"']
--docdir=DIR install documentation files in PREFIX/DIR
['"${cmake_doc_dir_default}"']
--mandir=DIR install man pages files in PREFIX/DIR/manN
['"${cmake_man_dir_default}"']
--xdgdatadir=DIR install XDG specific files in PREFIX/DIR
['"${cmake_xdgdata_dir_default}"']
'
exit 10
}
# Display CMake bootstrap usage
cmake_version_display()
{
echo "CMake ${cmake_version}, ${cmake_copyright}"
}
# Display CMake bootstrap error, display the log file and exit
cmake_error()
{
res=$1
shift 1
echo "---------------------------------------------"
echo "Error when bootstrapping CMake:"
echo "$*"
echo "---------------------------------------------"
if test -f cmake_bootstrap.log; then
echo "Log of errors: `pwd`/cmake_bootstrap.log"
#cat cmake_bootstrap.log
echo "---------------------------------------------"
fi
exit ${res}
}
cmake_generate_file_tmp ()
{
OUTFILE="$1"
TMPFILE="$2"
if "${_diff}" "$TMPFILE" "$OUTFILE" > /dev/null 2> /dev/null ; then
rm -f "$TMPFILE"
else
mv -f "$TMPFILE" "$OUTFILE"
fi
}
cmake_generate_file ()
{
OUTFILE="$1"
CONTENT="$2"
echo "$CONTENT" > "$OUTFILE.tmp"
cmake_generate_file_tmp "$OUTFILE" "$OUTFILE.tmp"
}
# Replace KWSYS_NAMESPACE with cmsys
cmake_replace_string ()
{
INFILE="$1"
OUTFILE="$2"
SEARCHFOR="$3"
REPLACEWITH="$4"
if test -f "${INFILE}" || ${cmake_system_openvms}; then
sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}"
if test -f "${OUTFILE}${_tmp}"; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
else
mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
fi
fi
else
cmake_error 1 "Cannot find file ${INFILE}"
fi
}
cmake_kwsys_config_replace_string ()
{
INFILE="$1"
OUTFILE="$2"
shift 2
APPEND="$*"
if test -f "${INFILE}" || ${cmake_system_openvms}; then
echo "${APPEND}" > "${OUTFILE}${_tmp}"
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
s/@KWSYS_LFS_AVAILABLE@/${KWSYS_LFS_AVAILABLE}/g;
s/@KWSYS_LFS_REQUESTED@/${KWSYS_LFS_REQUESTED}/g;
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
s/@KWSYS_STL_HAS_WSTRING@/${KWSYS_STL_HAS_WSTRING}/g;
s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g;
s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g;
}" "${INFILE}" >> "${OUTFILE}${_tmp}"
if test -f "${OUTFILE}${_tmp}"; then
if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then
#echo "Files are the same"
rm -f "${OUTFILE}${_tmp}"
else
mv -f "${OUTFILE}${_tmp}" "${OUTFILE}"
fi
fi
else
cmake_error 2 "Cannot find file ${INFILE}"
fi
}
# Write string into a file
cmake_report ()
{
FILE=$1
shift
echo "$*" >> ${FILE}
}
# Escape spaces in strings for artifacts
cmake_escape_artifact ()
{
if test "${cmake_bootstrap_generator}" = "Ninja"; then
echo $1 | sed "s/ /$ /g"
else
echo $1 | sed "s/ /\\\\ /g"
fi
}
# Escape spaces in strings for shell
cmake_escape_shell ()
{
echo $1 | sed "s/ /\\\\ /g"
}
# Encode object file names.
cmake_obj ()
{
echo $1 | sed 's/\//-/g' | sed 's/$/\.o/'
}
# Strip prefix from argument
cmake_arg ()
{
echo "$1" | sed "s/^${2-[^=]*=}//"
}
# Write message to the log
cmake_log ()
{
echo "$*" >> cmake_bootstrap.log
}
# Return temp file
cmake_tmp_file ()
{
echo "cmake_bootstrap_$$_test"
}
# Run a compiler test. First argument is compiler, second one are compiler
# flags, third one is test source file to be compiled
cmake_try_run ()
{
COMPILER=$1
FLAGS=$2
TESTFILE=$3
if test ! -f "${TESTFILE}"; then
echo "Test file ${TESTFILE} missing. Please verify your CMake source tree."
exit 4
fi
TMPFILE=`cmake_tmp_file`
echo "Try: ${COMPILER}"
echo "Line: ${COMPILER} ${FLAGS} ${TESTFILE} -o ${TMPFILE}"
echo "---------- file -----------------------"
cat "${TESTFILE}"
echo "------------------------------------------"
"${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}"
RES=$?
if test "${RES}" -ne "0"; then
echo "Test failed to compile"
return 1
fi
if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then
echo "Test failed to produce executable"
return 2
fi
./${TMPFILE}
RES=$?
rm -f "${TMPFILE}"
if test "${RES}" -ne "0"; then
echo "Test produced non-zero return code"
return 3
fi
echo "Test succeeded"
return 0
}
# Run a make test. First argument is the make interpreter.
cmake_try_make ()
{
MAKE_PROC="$1"
MAKE_FLAGS="$2"
echo "Try: ${MAKE_PROC}"
"${MAKE_PROC}" ${MAKE_FLAGS}
RES=$?
if test "${RES}" -ne "0"; then
echo "${MAKE_PROC} does not work"
return 1
fi
if test ! -f "test" && test ! -f "test.exe"; then
echo "${COMPILER} does not produce output"
return 2
fi
./test
RES=$?
rm -f "test"
if test "${RES}" -ne "0"; then
echo "${MAKE_PROC} produces strange executable"
return 3
fi
echo "${MAKE_PROC} works"
return 0
}
# Parse arguments
cmake_verbose=
cmake_parallel_make=
cmake_ccache_enabled=
cmake_prefix_dir="${cmake_default_prefix}"
bootstrap_system_libuv=
bootstrap_system_jsoncpp=
bootstrap_system_librhash=
while test $# != 0; do
case "$1" in
--prefix=*) dir=`cmake_arg "$1"`
cmake_prefix_dir=`cmake_fix_slashes "$dir"` ;;
--parallel=*) cmake_parallel_make=`cmake_arg "$1"` ;;
--generator=*) cmake_bootstrap_generator=`cmake_arg "$1"` ;;
--bindir=*) cmake_bin_dir=`cmake_arg "$1"` ;;
--datadir=*) cmake_data_dir=`cmake_arg "$1"` ;;
--docdir=*) cmake_doc_dir=`cmake_arg "$1"` ;;
--mandir=*) cmake_man_dir=`cmake_arg "$1"` ;;
--xdgdatadir=*) cmake_xdgdata_dir=`cmake_arg "$1"` ;;
--init=*) cmake_init_file=`cmake_arg "$1"` ;;
--system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
--no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
--system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-librhash|--system-zlib|--system-liblzma|--system-nghttp2|--system-zstd|--system-libuv)
lib=`cmake_arg "$1" "--system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
--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)
lib=`cmake_arg "$1" "--no-system-"`
cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
--bootstrap-system-libuv) bootstrap_system_libuv="1" ;;
--bootstrap-system-jsoncpp) bootstrap_system_jsoncpp="1" ;;
--bootstrap-system-librhash) bootstrap_system_librhash="1" ;;
--qt-gui) cmake_bootstrap_qt_gui="1" ;;
--no-qt-gui) cmake_bootstrap_qt_gui="0" ;;
--qt-qmake=*) cmake_bootstrap_qt_qmake=`cmake_arg "$1"` ;;
--sphinx-info) cmake_sphinx_info="1" ;;
--sphinx-man) cmake_sphinx_man="1" ;;
--sphinx-html) cmake_sphinx_html="1" ;;
--sphinx-qthelp) cmake_sphinx_qthelp="1" ;;
--sphinx-latexpdf) cmake_sphinx_latexpdf="1" ;;
--sphinx-build=*) cmake_sphinx_build=`cmake_arg "$1"` ;;
--sphinx-flags=*) cmake_sphinx_flags=`cmake_arg "$1"` ;;
--help) cmake_usage ;;
--version) cmake_version_display ; exit 2 ;;
--verbose) cmake_verbose=TRUE ;;
--enable-ccache) cmake_ccache_enabled=TRUE ;;
CC=*) CC=`cmake_arg "$1"` ;;
CXX=*) CXX=`cmake_arg "$1"` ;;
CFLAGS=*) CFLAGS=`cmake_arg "$1"` ;;
CXXFLAGS=*) CXXFLAGS=`cmake_arg "$1"` ;;
LDFLAGS=*) LDFLAGS=`cmake_arg "$1"` ;;
--) shift; break ;;
*) die "Unknown option: $1" ;;
esac
shift
done
# Make sure the generator is valid
case "${cmake_bootstrap_generator}" in
'MSYS Makefiles'|'Unix Makefiles'|'Ninja') ;;
*) cmake_error 10 "Invalid generator: ${cmake_bootstrap_generator}"
esac
# If verbose, display some information about bootstrap
if test -n "${cmake_verbose}"; then
echo "---------------------------------------------"
echo "Source directory: ${cmake_source_dir}"
echo "Binary directory: ${cmake_binary_dir}"
echo "Prefix directory: ${cmake_prefix_dir}"
echo "System: ${cmake_system}"
echo "Generator: ${cmake_bootstrap_generator}"
if test "x${cmake_parallel_make}" != "x"; then
echo "Doing parallel make: ${cmake_parallel_make}"
fi
echo ""
fi
echo "---------------------------------------------"
# Get CMake version
echo "`cmake_version_display`"
# Check for in-source build
cmake_in_source_build=
if test -f "${cmake_binary_dir}/Source/cmake.cxx" &&
test -f "${cmake_binary_dir}/Source/cmake.h"; then
if test -n "${cmake_verbose}"; then
echo "Warning: This is an in-source build"
fi