summaryrefslogtreecommitdiffstats
path: root/bootstrap
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-01-31 23:50:16 (GMT)
committerBrad King <brad.king@kitware.com>2006-01-31 23:50:16 (GMT)
commit576d8b41cb10428a227c0f75ed8cc6d0a37fcd05 (patch)
treef39891a27055debaee2ed29b7f2fb417a422095c /bootstrap
parent0dbe4edcfc2bc07692142567a21f90fafbf88183 (diff)
downloadCMake-576d8b41cb10428a227c0f75ed8cc6d0a37fcd05.zip
CMake-576d8b41cb10428a227c0f75ed8cc6d0a37fcd05.tar.gz
CMake-576d8b41cb10428a227c0f75ed8cc6d0a37fcd05.tar.bz2
ENH: Enabled bootstrapping with MinGW from an MSYS prompt.
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap83
1 files changed, 66 insertions, 17 deletions
diff --git a/bootstrap b/bootstrap
index 8073d1e..a165a06 100755
--- a/bootstrap
+++ b/bootstrap
@@ -17,6 +17,33 @@
#
#=========================================================================
+# Detect system and directory information.
+cmake_system=`uname`
+cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
+cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
+cmake_binary_dir=`pwd`
+cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
+cmake_data_dir="/share/CMake"
+cmake_doc_dir="/doc/CMake"
+cmake_man_dir="/man"
+cmake_init_file=""
+
+# 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
+
+# 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
+
CMAKE_KNOWN_C_COMPILERS="cc gcc xlc icc tcc"
CMAKE_KNOWN_CXX_COMPILERS="aCC xlC CC g++ c++ icc como "
CMAKE_KNOWN_MAKE_PROCESSORS="gmake make"
@@ -66,12 +93,31 @@ CMAKE_CXX_SOURCES="\
cmOrderLinkDirectories \
cmSourceGroup"
+if ${cmake_system_mingw}; then
+ CMAKE_CXX_SOURCES="${CMAKE_CXX_SOURCES}\
+ cmGlobalMSYSMakefileGenerator \
+ cmGlobalMinGWMakefileGenerator \
+ cmWin32ProcessExecution"
+fi
+
CMAKE_C_SOURCES="\
cmListFileLexer \
"
-KWSYS_C_SOURCES="\
- ProcessUNIX"
+if ${cmake_system_mingw}; then
+ KWSYS_C_SOURCES="\
+ ProcessWin32"
+ KWSYS_C_MINGW_SOURCES="\
+ ProcessFwd9x \
+ EncodeExecutable"
+ KWSYS_C_GENERATED_SOURCES="\
+ cmsysProcessFwd9xEnc"
+else
+ KWSYS_C_SOURCES="\
+ ProcessUNIX"
+ KWSYS_C_MINGW_SOURCES=""
+ KWSYS_C_GENERATED_SOURCES=""
+fi
KWSYS_CXX_SOURCES="\
Directory \
@@ -92,17 +138,6 @@ KWSYS_IOS_FILES="
iostream \
sstream"
-cmake_system=`uname`
-
-cmake_source_dir=`echo $0 | sed -n '/\//{s/\/[^\/]*$//;p;}'`
-cmake_source_dir=`(cd "${cmake_source_dir}";pwd)`
-cmake_binary_dir=`pwd`
-cmake_bootstrap_dir="${cmake_binary_dir}/Bootstrap.cmk"
-cmake_data_dir="/share/CMake"
-cmake_doc_dir="/doc/CMake"
-cmake_man_dir="/man"
-cmake_init_file=""
-
# Display CMake bootstrap usage
cmake_usage()
{
@@ -970,7 +1005,7 @@ cmake_compiler_settings_comment="/*
* Sources:
* ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES}
* kwSys Sources:
- * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}
+ * ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}
*/
"
@@ -1056,7 +1091,7 @@ done
# Generate Makefile
dep="cmConfigure.h cmsys/Configure.hxx cmsys/Configure.h `cmake_escape \"${cmake_source_dir}\"`/Source/*.h"
objs=""
-for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES}; do
+for a in ${CMAKE_CXX_SOURCES} ${CMAKE_C_SOURCES} ${KWSYS_CXX_SOURCES} ${KWSYS_C_SOURCES} ${KWSYS_C_GENERATED_SOURCES}; do
objs="${objs} ${a}.o"
done
@@ -1095,7 +1130,7 @@ for a in ${CMAKE_C_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
-for a in ${KWSYS_C_SOURCES}; do
+for a in ${KWSYS_C_SOURCES} ${KWSYS_C_MINGW_SOURCES}; do
src=`cmake_escape "${cmake_source_dir}/Source/kwsys/${a}.c"`
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_c_compiler} ${cmake_c_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
@@ -1105,6 +1140,20 @@ for a in ${KWSYS_CXX_SOURCES}; do
echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
echo " ${cmake_cxx_compiler} ${cmake_cxx_flags} -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
done
+if ${cmake_system_mingw}; then
+ src=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9xEnc.c"`
+ in=`cmake_escape "${cmake_bootstrap_dir}/cmsysProcessFwd9x.exe"`
+ cmd=`cmake_escape "${cmake_bootstrap_dir}/cmsysEncodeExecutable.exe"`
+ a="cmsysProcessFwd9xEnc"
+ echo "${cmd} : EncodeExecutable.o" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} EncodeExecutable.o -o ${cmd}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo "${in} : ProcessFwd9x.o" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmake_c_compiler} ${LDFLAGS} ${cmake_c_flags} ProcessFwd9x.o -o ${in}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo "${src} : ${cmd} ${in}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmd} ${in} ${src} cmsys ProcessFwd9x" >> "${cmake_bootstrap_dir}/Makefile"
+ echo "${a}.o : ${src} ${dep}" >> "${cmake_bootstrap_dir}/Makefile"
+ echo " ${cmake_c_compiler} ${cmake_c_flags} -I`cmake_escape \"${cmake_source_dir}/Source/kwsys\"` -DKWSYS_NAMESPACE=cmsys -c ${src} -o ${a}.o" >> "${cmake_bootstrap_dir}/Makefile"
+fi
cat>>"${cmake_bootstrap_dir}/Makefile"<<EOF
rebuild_cache:
cd "${cmake_binary_dir}" && "${cmake_source_dir}/bootstrap"
@@ -1153,7 +1202,7 @@ export CXX
export MAKE
# Run bootstrap CMake to configure real CMake
-"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake"
+"${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}"
RES=$?
if [ "${RES}" -ne "0" ]; then
cmake_error 11 "Problem while running initial CMake"