mozconfig2client-mk 1.7 KB

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