Bug 779922 - Export Windows-style paths in the in-tree mozconfig.vs2010 when building under Pymake. r=ted
authorSiddharth Agarwal <sid.bugzilla@gmail.com>
Tue, 07 Aug 2012 02:37:11 +0530
changeset 107059 3cc378b302c9513af0f94dc515c99b32a1bccc80
parent 107058 89ea9764f9e98584b04f262ef70562d5e3dca32d
child 107060 9dd1dc9801e61d286280dc89b0ff0dc970f56ac4
push idunknown
push userunknown
push dateunknown
reviewersted
bugs779922
milestone17.0a1
Bug 779922 - Export Windows-style paths in the in-tree mozconfig.vs2010 when building under Pymake. r=ted
build/autoconf/mozconfig2client-mk
build/mozconfig.vs2010-common
build/win32/mozconfig.vs2010
build/win32/mozconfig.vs2010-win64
build/win64/mozconfig.vs2010
client.mk
--- a/build/autoconf/mozconfig2client-mk
+++ b/build/autoconf/mozconfig2client-mk
@@ -27,17 +27,17 @@ ac_add_app_options() {
   echo "# $* is used by configure (not client.mk)"
 }
 
 mk_add_options() {
   for _opt
   do
     # Escape shell characters, space, tab, dollar, quote, backslash,
     # and substitute '@<word>@' with '$(<word>)'.
-    _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
+    _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'`
     echo $_opt;
     opts="${opts:+$opts^}$_opt";
   done
 }
 
 mk_echo_options() {
   echo "Adding client.mk options from $FOUND_MOZCONFIG:" >&2
   IFS=^
new file mode 100644
--- /dev/null
+++ b/build/mozconfig.vs2010-common
@@ -0,0 +1,8 @@
+# Pymake needs Windows-style paths. Use cmd.exe to hack around this.
+mk_export_correct_style() {
+  if test -n "${_PYMAKE}"; then
+    mk_add_options "export $1=$(cmd.exe //c echo %$1%)"
+  else
+    mk_add_options "export $1=$(eval echo \$$1)"
+  fi
+}
--- a/build/win32/mozconfig.vs2010
+++ b/build/win32/mozconfig.vs2010
@@ -1,12 +1,13 @@
 export INCLUDE=/d/msvs10/vc/include:/d/msvs10/vc/atlmfc/include:/d/sdks/v7.0/include:/d/sdks/v7.0/include/atl:/d/msvs8/VC/PlatformSDK/include:/d/sdks/dx10/include
 export LIBPATH=/d/msvs10/vc/lib:/d/msvs10/vc/atlmfc/lib:/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727
 export LIB=/d/msvs10/vc/lib:/d/msvs10/vc/atlmfc/lib:/d/sdks/v7.0/lib:/d/msvs8/VC/PlatformSDK/lib:/d/msvs8/SDK/v2.0/lib:/d/mozilla-build/atlthunk_compat:/d/sdks/dx10/lib/x86
 export PATH="/d/msvs10/VSTSDB/Deploy:/d/msvs10/Common7/IDE/:/d/msvs10/VC/BIN:/d/msvs10/Common7/Tools:/d/msvs10/VC/VCPackages:${PATH}"
 export WIN32_REDIST_DIR=/d/msvs10/VC/redist/x86/Microsoft.VC100.CRT
 
+. $topsrcdir/build/mozconfig.vs2010-common
 
-mk_add_options "export LIB=$LIB"
-mk_add_options "export LIBPATH=$LIBPATH"
-mk_add_options "export PATH=$PATH"
-mk_add_options "export INCLUDE=$INCLUDE"
-mk_add_options "export WIN32_REDIST_DIR=$WIN32_REDIST_DIR"
+mk_export_correct_style LIB
+mk_export_correct_style LIBPATH
+mk_export_correct_style PATH
+mk_export_correct_style INCLUDE
+mk_export_correct_style WIN32_REDIST_DIR
--- a/build/win32/mozconfig.vs2010-win64
+++ b/build/win32/mozconfig.vs2010-win64
@@ -1,13 +1,16 @@
 export INCLUDE=/c/tools/msvs10/vc/include:/c/tools/msvs10/vc/atlmfc/include:/c/tools/sdks/v7.0/include:/c/tools/sdks/v7.0/include/atl:/c/tools/sdks/dx10/include
 export LIBPATH=/c/tools/msvs10/vc/lib:/c/tools/msvs10/vc/atlmfc/lib
 export LIB=/c/tools/msvs10/vc/lib:/c/tools/msvs10/vc/atlmfc/lib:/c/tools/sdks/v7.0/lib:/c/tools/sdks/dx10/lib
 export WIN32_REDIST_DIR=/c/tools/msvs10/VC/redist/x86/Microsoft.VC100.CRT
 export MOZ_TOOLS=C:/mozilla-build/moztools
 export PATH="/c/tools/msvs10/Common7/IDE:/c/tools/msvs10/VC/BIN:/c/tools/msvs10/Common7/Tools:/c/tools/msvs10/VC/VCPackages:/c/mozilla-build/moztools:/c/Tools/sdks/v7.0/bin:${PATH}"
 
-mk_add_options "export LIB=$LIB"
-mk_add_options "export LIBPATH=$LIBPATH"
-mk_add_options "export PATH=$PATH"
-mk_add_options "export INCLUDE=$INCLUDE"
-mk_add_options "export WIN32_REDIST_DIR=$WIN32_REDIST_DIR"
+. $topsrcdir/build/mozconfig.vs2010-common
+
+mk_export_correct_style LIB
+mk_export_correct_style LIBPATH
+mk_export_correct_style PATH
+mk_export_correct_style INCLUDE
+mk_export_correct_style WIN32_REDIST_DIR
+
 mk_add_options "export MOZ_TOOLS=$MOZ_TOOLS"
--- a/build/win64/mozconfig.vs2010
+++ b/build/win64/mozconfig.vs2010
@@ -3,14 +3,15 @@ export LIBPATH=/c/tools/msvs10/vc/lib/am
 export LIB=/c/tools/msvs10/vc/lib/amd64:/c/tools/msvs10/vc/atlmfc/lib/amd64:/c/tools/sdks/v7.0/lib/x64:/c/tools/sdks/dx10/lib/x64
 export PATH="/c/tools/msvs10/Common7/IDE:/c/tools/msvs10/VC/BIN/amd64:/c/tools/msvs10/VC/BIN/x86_amd64:/c/tools/msvs10/VC/BIN:/c/tools/msvs10/Common7/Tools:/c/tools/msvs10/VC/VCPackages:${PATH}"
 export WIN32_REDIST_DIR=/c/tools/msvs10/VC/redist/x64/Microsoft.VC100.CRT
 
 # Use 32bit linker for PGO crash bug.
 # https://connect.microsoft.com/VisualStudio/feedback/details/686117/
 export LD=/c/tools/msvs10/VC/BIN/x86_amd64/link.exe
 
+. $topsrcdir/build/mozconfig.vs2010-common
 
-mk_add_options "export LIB=$LIB"
-mk_add_options "export LIBPATH=$LIBPATH"
-mk_add_options "export PATH=$PATH"
-mk_add_options "export INCLUDE=$INCLUDE"
-mk_add_options "export WIN32_REDIST_DIR=$WIN32_REDIST_DIR"
+mk_export_correct_style LIB
+mk_export_correct_style LIBPATH
+mk_export_correct_style PATH
+mk_export_correct_style INCLUDE
+mk_export_correct_style WIN32_REDIST_DIR
--- a/client.mk
+++ b/client.mk
@@ -98,17 +98,17 @@ MOZCONFIG_MODULES := build/unix/uniq.pl
 define CR
 
 
 endef
 
 # As $(shell) doesn't preserve newlines, use sed to replace them with an
 # unlikely sequence (||), which is then replaced back to newlines by make
 # before evaluation.
-$(eval $(subst ||,$(CR),$(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/')))
+$(eval $(subst ||,$(CR),$(shell _PYMAKE=$(.PYMAKE) $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) 2> $(TOPSRCDIR)/.mozconfig.out | sed 's/$$/||/')))
 
 ifndef MOZ_OBJDIR
   MOZ_OBJDIR = obj-$(CONFIG_GUESS)
 else
 # On Windows Pymake builds check MOZ_OBJDIR doesn't start with "/"
   ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
   ifeq (1_a,$(.PYMAKE)_$(firstword a$(subst /, ,$(MOZ_OBJDIR))))
   $(error For Windows Pymake builds, MOZ_OBJDIR must be a Windows [and not MSYS] style path.)