1#!/bin/sh
2# This Source Code Form is subject to the terms of the Mozilla Public
3# License, v. 2.0. If a copy of the MPL was not distributed with this
4# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6# This script provides an execution environment for mozconfig scripts.
7# This script is not meant to be called by users. Instead, some
8# higher-level driver invokes it and parses the machine-tailored output.
9
10set -e
11
12ac_add_options() {
13  for _mozconfig_opt; do
14    case "$_mozconfig_opt" in
15    --target=*)
16      echo "------BEGIN_MK_OPTION"
17      echo $_mozconfig_opt | sed s/--target/CONFIG_GUESS/
18      echo "------END_MK_OPTION"
19      ;;
20    esac
21    echo "------BEGIN_AC_OPTION"
22    echo $_mozconfig_opt
23    echo "------END_AC_OPTION"
24  done
25}
26
27mk_add_options() {
28  for _mozconfig_opt; do
29    echo "------BEGIN_MK_OPTION"
30    echo $_mozconfig_opt
31    echo "------END_MK_OPTION"
32  done
33}
34
35echo "------BEGIN_ENV_BEFORE_SOURCE"
36$3 $4
37echo "------END_ENV_BEFORE_SOURCE"
38
39echo "------BEGIN_BEFORE_SOURCE"
40set
41echo "------END_BEFORE_SOURCE"
42
43topsrcdir=$1
44
45. $2
46
47unset topsrcdir
48
49echo "------BEGIN_AFTER_SOURCE"
50set
51echo "------END_AFTER_SOURCE"
52
53echo "------BEGIN_ENV_AFTER_SOURCE"
54$3 $4
55echo "------END_ENV_AFTER_SOURCE"
56