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