Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | #! /bin/sh |
michael@0 | 2 | # |
michael@0 | 3 | # This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
michael@0 | 6 | |
michael@0 | 7 | # mozconfig2client-mk - Translates .mozconfig into options for client.mk. |
michael@0 | 8 | # Prints defines to stdout. |
michael@0 | 9 | # |
michael@0 | 10 | # See mozconfig2configure for more details |
michael@0 | 11 | |
michael@0 | 12 | print_header() { |
michael@0 | 13 | cat <<EOF |
michael@0 | 14 | # gmake |
michael@0 | 15 | # This file is automatically generated for client.mk. |
michael@0 | 16 | # Do not edit. Edit $FOUND_MOZCONFIG instead. |
michael@0 | 17 | |
michael@0 | 18 | EOF |
michael@0 | 19 | } |
michael@0 | 20 | |
michael@0 | 21 | ac_add_options() { |
michael@0 | 22 | for _opt |
michael@0 | 23 | do |
michael@0 | 24 | case "$_opt" in |
michael@0 | 25 | --target=*) |
michael@0 | 26 | echo $_opt | sed s/--target/CONFIG_GUESS/ |
michael@0 | 27 | ;; |
michael@0 | 28 | *) |
michael@0 | 29 | echo "# $_opt is used by configure (not client.mk)" |
michael@0 | 30 | ;; |
michael@0 | 31 | esac |
michael@0 | 32 | done |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | ac_add_app_options() { |
michael@0 | 36 | echo "# $* is used by configure (not client.mk)" |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | mk_add_options() { |
michael@0 | 40 | for _opt |
michael@0 | 41 | do |
michael@0 | 42 | # Escape shell characters, space, tab, dollar, quote, backslash, |
michael@0 | 43 | # and substitute '@<word>@' with '$(<word>)'. |
michael@0 | 44 | _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'` |
michael@0 | 45 | echo $_opt; |
michael@0 | 46 | done |
michael@0 | 47 | } |
michael@0 | 48 | |
michael@0 | 49 | # Main |
michael@0 | 50 | #-------------------------------------------------- |
michael@0 | 51 | |
michael@0 | 52 | scriptdir=`dirname $0` |
michael@0 | 53 | topsrcdir=$1 |
michael@0 | 54 | |
michael@0 | 55 | # If the path changes, configure should be rerun |
michael@0 | 56 | echo "# PATH=$PATH" |
michael@0 | 57 | |
michael@0 | 58 | # If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out |
michael@0 | 59 | isfoundset=${FOUND_MOZCONFIG+yes} |
michael@0 | 60 | if [ -z $isfoundset ]; then |
michael@0 | 61 | FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir` |
michael@0 | 62 | if [ $? -ne 0 ]; then |
michael@0 | 63 | echo '$(error Fix above errors before continuing.)' |
michael@0 | 64 | else |
michael@0 | 65 | isfoundset=yes |
michael@0 | 66 | fi |
michael@0 | 67 | fi |
michael@0 | 68 | |
michael@0 | 69 | if [ -n $isfoundset ]; then |
michael@0 | 70 | if [ "$FOUND_MOZCONFIG" ] |
michael@0 | 71 | then |
michael@0 | 72 | print_header |
michael@0 | 73 | . "$FOUND_MOZCONFIG" |
michael@0 | 74 | echo "FOUND_MOZCONFIG := $FOUND_MOZCONFIG" |
michael@0 | 75 | fi |
michael@0 | 76 | fi |