source: mainline/tools/build_all.sh@ 77578e8

Last change on this file since 77578e8 was 8fd0675f, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Update files with /bin/sh shebang and an extra space

  • Property mode set to 100755
File size: 2.3 KB
Line 
1#!/bin/sh
2#
3# SPDX-FileCopyrightText: 2019 Jiří Zárevúcky
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8# Find out the path to the script.
9SOURCE_DIR=`which -- "$0" 2>/dev/null`
10# Maybe we are running bash.
11[ -z "$SOURCE_DIR" ] && SOURCE_DIR=`which -- "$BASH_SOURCE"`
12[ -z "$SOURCE_DIR" ] && exit 1
13SOURCE_DIR=`dirname -- "$SOURCE_DIR"`
14SOURCE_DIR=`cd $SOURCE_DIR && cd .. && echo $PWD`
15
16# Check command line arguments.
17
18if [ "$#" -gt 1 ] || ( [ "$#" -eq 1 ] && [ "$1" != '--no-images' ] ); then
19 echo "Unknown command-line arguments."
20 echo "Usage:"
21 echo " $0 # Build everything."
22 echo " $0 --no-images # Build all code, but don't create bootable images."
23 exit 1
24fi
25
26if [ "$#" -eq 1 ]; then
27 NO_IMAGES=true
28else
29 NO_IMAGES=false
30fi
31
32# Make sure we don't make a mess in the source root.
33if [ "$PWD" = "$SOURCE_DIR" ]; then
34 mkdir -p build_all
35 cd build_all
36fi
37
38CONFIG_RULES="${SOURCE_DIR}/HelenOS.config"
39
40PROFILES=`sh ${SOURCE_DIR}/tools/list_profiles.sh`
41
42echo
43echo "###################### Configuring all profiles ######################"
44
45echo "Configuring profiles" $PROFILES
46
47for profile in $PROFILES; do
48 # echo "Configuring profile ${profile}"
49
50 mkdir -p ${profile} || exit 1
51 script -q -e /dev/null -c "cd '${profile}' && '${SOURCE_DIR}/configure.sh' '${profile}' && ninja build.ninja" </dev/null >"${profile}/configure_output.log" 2>&1 &
52 echo "$!" >"${profile}/configure.pid"
53done
54
55failed='no'
56
57for profile in $PROFILES; do
58 if ! wait `cat "${profile}/configure.pid"`; then
59 failed='yes'
60 cat "${profile}/configure_output.log"
61 echo
62 echo "Configuration of profile ${profile} failed."
63 echo
64 fi
65done
66
67if [ "$failed" = 'yes' ]; then
68 echo
69 echo "Some configuration jobs failed."
70 exit 1
71else
72 echo "All profiles configured."
73fi
74
75echo
76echo "###################### Building all profiles ######################"
77
78for profile in $PROFILES; do
79 echo
80 ninja -C ${profile} || exit 1
81done
82
83if [ "$NO_IMAGES" = 'true' ]; then
84 echo
85 echo "Bootable images not built due to argument --no-images."
86 exit 0
87fi
88
89echo
90echo "###################### Building all images ######################"
91
92for profile in $PROFILES; do
93 echo
94 ninja -C ${profile} image_path || exit 1
95done
96
97echo
98for profile in $PROFILES; do
99 path=`cat ${profile}/image_path`
100
101 if [ ! -z "$path" ]; then
102 echo "built ${profile}/${path}"
103 fi
104done
Note: See TracBrowser for help on using the repository browser.