source: mainline/tools/build_all.sh@ e50bdd4e

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

Move build_all.sh to tools

  • 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 && cd .. && echo $PWD`
10
11# Check command line arguments.
12
13if [ "$#" -gt 1 ] || [ "$#" -eq 1 -a "$1" != '--no-images' ]; then
14 echo "Unknown command-line arguments."
15 echo "Usage:"
16 echo "\t$0 # Build everything."
17 echo "\t$0 --no-images # Build all code, but don't create bootable images."
18 exit 1
19fi
20
21if [ "$#" -eq 1 ]; then
22 NO_IMAGES=true
23else
24 NO_IMAGES=false
25fi
26
27# Make sure we don't make a mess in the source root.
28if [ "$PWD" = "$SOURCE_DIR" ]; then
29 mkdir -p build_all
30 cd build_all
31fi
32
33CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
34CONFIG_DEFAULTS="${SOURCE_DIR}/defaults"
35
36# Find all the leaf subdirectories in the defaults directory.
37PROFILES=`find ${CONFIG_DEFAULTS} -type d -links 2 -printf "%P\n" | sort`
38
39
40echo
41echo "###################### Configuring all profiles ######################"
42
43echo "Configuring profiles" $PROFILES
44
45for profile in $PROFILES; do
46 # echo "Configuring profile ${profile}"
47
48 mkdir -p ${profile} || exit 1
49 script -q -e /dev/null -c "cd '${profile}' && '${SOURCE_DIR}/configure.sh' '${profile}' && ninja build.ninja" </dev/null >"${profile}/configure_output.log" 2>&1 &
50 echo "$!" >"${profile}/configure.pid"
51done
52
53failed='no'
54
55for profile in $PROFILES; do
56 if ! wait `cat "${profile}/configure.pid"`; then
57 failed='yes'
58 cat "${profile}/configure_output.log"
59 echo
60 echo "Configuration of profile ${profile} failed."
61 echo
62 fi
63done
64
65if [ "$failed" = 'yes' ]; then
66 echo
67 echo "Some configuration jobs failed."
68 exit 1
69else
70 echo "All profiles configured."
71fi
72
73echo
74echo "###################### Building all profiles ######################"
75
76for profile in $PROFILES; do
77 echo
78 ninja -C ${profile} || exit 1
79done
80
81if [ "$NO_IMAGES" = 'true' ]; then
82 echo
83 echo "Bootable images not built due to argument --no-images."
84 exit 0
85fi
86
87echo
88echo "###################### Building all images ######################"
89
90for profile in $PROFILES; do
91 echo
92 ninja -C ${profile} image_path || exit 1
93done
94
95echo
96for profile in $PROFILES; do
97 path=`cat ${profile}/image_path`
98
99 if [ ! -z "$path" ]; then
100 echo "built ${profile}/${path}"
101 fi
102done
Note: See TracBrowser for help on using the repository browser.