source: mainline/configure.sh@ e50bdd4e

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

Add standalone configure.sh script

  • 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
35 exit "$want_help"
36fi
37
38if [ "$PWD" = "$SOURCE_DIR" ]; then
39 echo "We don't support in-tree build."
40 echo "Please create a build directory, cd into it, and run this script from there."
41 echo "Or run \`$0 --help\` to see usage."
42 exit 1
43fi
44
45ninja_help() {
46 echo 'Run `ninja config` to adjust configuration.'
47 echo 'Run `ninja` to build all program and library binaries, but not bootable image.'
48 echo 'Run `ninja image_path` to build boot image. The file image_path will contain path to the boot image file.'
49}
50
51if [ -f build.ninja ]; then
52 echo "This build directory was already configured."
53 echo
54 ninja_help
55 exit 0
56fi
57
58# Run HelenOS config tool.
59if [ "$#" -eq 1 ]; then
60 "${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" hands-off "$1" || exit 1
61else
62 "${SOURCE_DIR}/tools/config.py" "${CONFIG_RULES}" "${CONFIG_DEFAULTS}" || exit 1
63fi
64
65PLATFORM=`sed -n '/^PLATFORM\b/p' Makefile.config | sed 's:[^=]*= ::'`
66MACHINE=`sed -n '/^MACHINE\b/p' Makefile.config | sed 's:[^=]*= ::'`
67
68cross_target="$PLATFORM"
69if [ "$PLATFORM" = 'abs32le' ]; then
70 cross_target='ia32'
71fi
72if [ "$MACHINE" = 'bmalta' ]; then
73 cross_target='mips32eb'
74fi
75
76meson "${SOURCE_DIR}" '.' --cross-file "${SOURCE_DIR}/meson/cross/${cross_target}" || exit 1
77
78echo
79echo "Configuration for platform $PLATFORM finished."
80echo
81ninja_help
Note: See TracBrowser for help on using the repository browser.