Sync with trunk r63383 .
[reactos.git] / configure.sh
1 #!/bin/sh
2
3 if [ "x$ROS_ARCH" = "x" ]; then
4 echo Could not detect RosBE.
5 exit 1
6 fi
7
8 BUILD_ENVIRONMENT=MinGW
9 ARCH=$ROS_ARCH
10 REACTOS_SOURCE_DIR=$(cd `dirname $0` && pwd)
11 REACTOS_OUTPUT_PATH=output-$BUILD_ENVIRONMENT-$ARCH
12
13 usage() {
14 echo Invalid parameter given.
15 exit 1
16 }
17
18 CMAKE_GENERATOR="Ninja"
19 while [ $# -gt 0 ]; do
20 case $1 in
21 -D)
22 shift
23 if echo "x$1" | grep 'x?*=*' > /dev/null; then
24 ROS_CMAKEOPTS=$ROS_CMAKEOPTS" -D $1"
25 else
26 usage
27 fi
28 ;;
29
30 -D?*=*|-D?*)
31 ROS_CMAKEOPTS=$ROS_CMAKEOPTS" $1"
32 ;;
33 makefiles|Makefiles)
34 CMAKE_GENERATOR="Unix Makefiles"
35 ;;
36 *)
37 usage
38 esac
39
40 shift
41 done
42
43 if [ "$REACTOS_SOURCE_DIR" = "$PWD" ]; then
44 echo Creating directories in $REACTOS_OUTPUT_PATH
45 mkdir -p "$REACTOS_OUTPUT_PATH"
46 cd "$REACTOS_OUTPUT_PATH"
47 fi
48
49 mkdir -p host-tools reactos
50
51 echo Preparing host tools...
52 cd host-tools
53 rm -f CMakeCache.txt
54
55 REACTOS_BUILD_TOOLS_DIR="$PWD"
56 cmake -G "$CMAKE_GENERATOR" -DARCH:STRING=$ARCH $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR"
57
58 echo Preparing reactos...
59 cd ../reactos
60 rm -f CMakeCache.txt
61
62 cmake -G "$CMAKE_GENERATOR" -DENABLE_CCACHE:BOOL=0 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=toolchain-gcc.cmake -DARCH:STRING=$ARCH -DREACTOS_BUILD_TOOLS_DIR:PATH="$REACTOS_BUILD_TOOLS_DIR" $ROS_CMAKEOPTS "$REACTOS_SOURCE_DIR"
63
64 echo Configure script complete! Enter directories and execute appropriate build commands \(ex: ninja, make, makex, etc...\).