source: mainline/configure.sh@ 05d97eef

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 05d97eef was e3737eda, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 6 years ago

Cosmetic tweak

  • Property mode set to 100755
File size: 2.3 KB
Line 
1#!/bin/sh
2
3# Find out the path to the script.
4SOURCE_DIR=`which -- "$0" 2>/dev/null`
5# Maybe we are running bash.
6[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
7[ -z "$SOURCE_DIR" ] && exit 1
8SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
9SOURCE_DIR=`cd $SOURCE_DIR && echo $PWD`
10
11CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
12CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
13
14
15test "$#" -eq 1 && { test "$1" = "-h" || test "$1" = "--help"; }
16want_help="$?"
17
18if [ "$#" -gt 1 ] || [ "$want_help" -eq 0 ]; then
19
20 # Find all the leaf subdirectories in the defaults directory.
21 PROFILES=`find ${CONFIG_DEFAULTS} -type d -links 2 -printf "%P\n" | sort`
22
23 echo "Configures the current working directory as a HelenOS build directory."
24 echo "In-tree build is not supported, you must create a separate directory for build."
25 echo
26 echo "Usage:"
27 echo " $0 -h|--help"
28 echo " $0 [PROFILE]"
29 echo
30 echo "If profile is not specified, a graphical configuration utility is launched."
31 echo
32 echo "Possible profiles:"
33 printf "\t%s\n" $PROFILES
34 echo
35
36 exit "$want_help"
37fi
38
39if [ "$PWD" = "$SOURCE_DIR" ]; then
40 echo "We don't support in-tree build."
41 echo "Please create a build directory, cd into it, and run this script from there."
42 echo "Or run \`$0 --help\` to see usage."
43 exit 1
44fi
45
46ninja_help() {
47 echo 'Run `ninja config` to adjust configuration.'
48 echo 'Run `ninja` to build all program and library binaries, but not bootable image.'
49 echo 'Run `ninja image_path` to build boot image. The file image_path will contain path to the boot image file.'
50}
51
52if [ -f build.ninja ]; then
53 echo "This build directory was already configured."
54 echo
55 ninja_help
56 exit 0
57fi
58
59# Run HelenOS config tool.
60if [ "$#" -eq 1 ]; then
61 "${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" hands-off "$1" || exit 1
62else
63 "${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" || exit 1
64fi
65
66PLATFORM=`sed -n '/^PLATFORM\b/p' Makefile.config | sed 's:[^=]*= ::'`
67MACHINE=`sed -n '/^MACHINE\b/p' Makefile.config | sed 's:[^=]*= ::'`
68
69cross_target="$PLATFORM"
70if [ "$PLATFORM" = 'abs32le' ]; then
71 cross_target='ia32'
72fi
73if [ "$MACHINE" = 'bmalta' ]; then
74 cross_target='mips32eb'
75fi
76
77meson "${SOURCE_DIR}" '.' --cross-file "${SOURCE_DIR}/meson/cross/${cross_target}" || exit 1
78
79echo
80echo "Configuration for platform $PLATFORM finished."
81echo
82ninja_help
Note: See TracBrowser for help on using the repository browser.