From d401003cfc48e327918d910347ca01a71f47e5bc Mon Sep 17 00:00:00 2001 From: "seawood%netscape.com" Date: Mon, 17 Jun 2002 17:09:57 +0000 Subject: [PATCH] Fixing win32 gmake builds lack of debugging information problem by working around a combination MSVC & cygwin make deficiencies: * We must use the full path to the source file when calling MSVC so that debugging information shows up in the object files. * Because of cygwin's use of /cygdrive when using full paths, we must use a cygwin-wrapper script in some cases to allow native win32 programs to use a fully qualified cygwin path. * We have to call configure using the full path so that $(srcdir) contains the full path in the Makefiles. The rules have been changed for win32 so that it always use $(srcdir)/$*.{c,cpp} as the sourcefile name even when the file is in the cwd. This works around both the /cygdrive issue and the msvc's path info optimization. * We still use the wrapper when calling rc.exe & nsinstall. nsinstall frequently takes multiple args and is called all over the tree so changing each calling site is going to be expensive. (I'll have to check the logs again but I think the rc wrapping can go.) * nspr & ldap still use the wrappers for all native win32 progs. Neither nspr nor ldap uses the acoutput-fast.pl script to speed up the substitution of @srcdir@ into their Makefiles so, makefile substitution will break if we use dos-paths. * In the handful of directories where we copy srcfiles from another directory in lieu of using VPATHs, we have to now copy those files to $(srcdir) so that the default rules can find them. Bug #141834 r=leaf,wtc,dmose,mcs git-svn-id: svn://10.0.0.236/trunk@123440 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/client.mk | 15 ++-------- mozilla/configure.in | 28 +++++++++++++++++-- .../expose/ISimpleDOMDocument/Makefile.in | 9 ++++-- .../windows/expose/ISimpleDOMNode/Makefile.in | 9 ++++-- mozilla/xpcom/glue/standalone/Makefile.in | 8 ++++++ mozilla/xpfe/global/Makefile.in | 2 +- 6 files changed, 49 insertions(+), 22 deletions(-) diff --git a/mozilla/client.mk b/mozilla/client.mk index 29402e173aa..00f6d275e4f 100644 --- a/mozilla/client.mk +++ b/mozilla/client.mk @@ -362,17 +362,6 @@ CHECKOUT_CALENDAR := true FASTUPDATE_CALENDAR := true endif - -# because some cygwin tools can't handle native dos-drive paths & vice-versa -# force configure to use a relative path for --srcdir -# need a better check for win32 -# and we need to get OBJDIR earlier -ifdef MOZ_TOOLS -_tmpobjdir := $(shell cygpath -u $(OBJDIR)) -_abs2rel := $(shell cygpath -w $(TOPSRCDIR)/build/unix/abs2rel.pl | sed -e 's|\\|/|g') -_OBJ2SRCPATH := $(shell $(_abs2rel) $(TOPSRCDIR) $(_tmpobjdir)) -endif - ####################################################################### # Rules # @@ -590,8 +579,8 @@ else CONFIGURE := $(TOPSRCDIR)/configure endif -ifdef _OBJ2SRCPATH -CONFIGURE_ARGS := --srcdir=$(_OBJ2SRCPATH) $(CONFIGURE_ARGS) +ifdef MOZ_TOOLS + CONFIGURE := $(TOPSRCDIR)/configure endif $(OBJDIR)/Makefile $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS) diff --git a/mozilla/configure.in b/mozilla/configure.in index 5a6c5ea75d6..857cd6c2af5 100644 --- a/mozilla/configure.in +++ b/mozilla/configure.in @@ -434,6 +434,7 @@ LIB_SUFFIX=a ASM_SUFFIX=s TARGET_MD_ARCH=unix DIRENT_INO=d_ino +CYGWIN_WRAPPER= MOZ_JPEG_CFLAGS= MOZ_JPEG_LIBS='-L$(DIST)/lib -lmozjpeg' @@ -901,16 +902,23 @@ case "$target" in MKSHLIB_FORCE_ALL= MKSHLIB_UNFORCE_ALL= else + CYGWIN_WRAPPER=${srcdir}/build/cygwin-wrapper CC=cl CXX=cl HOST_CC=cl + HOST_CXX=cl LD=link AR='lib -NOLOGO -OUT:"$@"' AR_FLAGS= RANLIB='echo not_ranlib' STRIP='echo not_strip' - RC=rc.exe + RC='$(CYGWIN_WRAPPER) rc.exe' PERL=perl + _WIN32_PERL=$PERL + if test "`${PERL} -v | grep -c cygwin 2>/dev/null`" != 0; then + PERL="${CYGWIN_WRAPPER} -up ${PERL}" + _CYGWIN_PERL=1 + fi XARGS=xargs ZIP=zip UNZIP=unzip @@ -3264,7 +3272,11 @@ if test -z "$MOZ_JSDEBUGGER" && test `echo "$MOZ_EXTENSIONS" | grep -c venkman` fi dnl Remove dupes +if test -n "${_CYGWIN_PERL}"; then MOZ_EXTENSIONS=`${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}` +else +MOZ_EXTENSIONS=`${CYGWIN_WRAPPER} ${PERL} ${srcdir}/build/unix/uniq.pl ${MOZ_EXTENSIONS}` +fi dnl ======================================================== dnl experimental ldap features @@ -4446,6 +4458,7 @@ AC_SUBST(MOZ_COVERAGE) AC_SUBST(MOZ_MAPINFO) AC_SUBST(MOZ_BROWSE_INFO) AC_SUBST(MOZ_TOOLS_DIR) +AC_SUBST(CYGWIN_WRAPPER) dnl Disable profile at startup, hack for tinderbox. if test "$MOZ_BYPASS_PROFILE_AT_STARTUP"; then @@ -4679,7 +4692,18 @@ dnl This does not change the $MAKEFILES variable. dnl dnl OpenVMS gets a line overflow on the long eval command, so use a temp file. dnl -echo $MAKEFILES | $PERL $srcdir/build/autoconf/acoutput-fast.pl > conftest.sh +my_srcdir=$srcdir +case "$target_os" in +msvc*|mksnt*|cygwin*|mingw*) + my_srcdir=`cygpath -w ${srcdir} | sed 's|\\\\|/|g'` + MAKEFILES=`echo $MAKEFILES | sed -e 's|/cygdrive/\(.\)/|\1:/|g'` + my_perl=$_WIN32_PERL + ;; +*) + my_perl=$PERL + ;; +esac +echo $MAKEFILES | $my_perl $my_srcdir/build/autoconf/acoutput-fast.pl > conftest.sh . ./conftest.sh rm conftest.sh diff --git a/mozilla/widget/src/windows/expose/ISimpleDOMDocument/Makefile.in b/mozilla/widget/src/windows/expose/ISimpleDOMDocument/Makefile.in index 6f315d316e5..f81e4966f2a 100644 --- a/mozilla/widget/src/windows/expose/ISimpleDOMDocument/Makefile.in +++ b/mozilla/widget/src/windows/expose/ISimpleDOMDocument/Makefile.in @@ -54,7 +54,7 @@ MIDL_GENERATED_FILES = \ dlldata.c \ $(NULL) -GARBAGE += $(MIDL_GENERATED_FILES) done_gen +GARBAGE += $(MIDL_GENERATED_FILES) done_gen $(CSRCS) FORCE_SHARED_LIB = 1 @@ -63,12 +63,15 @@ include $(topsrcdir)/config/rules.mk $(MIDL_GENERATED_FILES): done_gen done_gen: ISimpleDOMDocument.idl - midl $< + $(MIDL) $(srcdir)/ISimpleDOMDocument.idl cp ISimpleDOMDocument.h ../.. cp ISimpleDOMDocument_i.c ../../ISimpleDOMDocument_iid.h touch $@ -export:: done_gen +$(addprefix $(srcdir)/,$(CSRCS)): %.c: done_gen + cp $(@F) $@ + +export:: done_gen $(addprefix $(srcdir)/,$(CSRCS)) libs:: regsvr32 /s $(DIST)/bin/$(SHARED_LIBRARY) diff --git a/mozilla/widget/src/windows/expose/ISimpleDOMNode/Makefile.in b/mozilla/widget/src/windows/expose/ISimpleDOMNode/Makefile.in index 0983b12cafb..f8cec8b23ce 100644 --- a/mozilla/widget/src/windows/expose/ISimpleDOMNode/Makefile.in +++ b/mozilla/widget/src/windows/expose/ISimpleDOMNode/Makefile.in @@ -54,7 +54,7 @@ MIDL_GENERATED_FILES = \ dlldata.c \ $(NULL) -GARBAGE += $(MIDL_GENERATED_FILES) done_gen +GARBAGE += $(MIDL_GENERATED_FILES) done_gen $(CSRCS) FORCE_SHARED_LIB = 1 @@ -63,12 +63,15 @@ include $(topsrcdir)/config/rules.mk $(MIDL_GENERATED_FILES): done_gen done_gen: ISimpleDOMNode.idl - midl $< + $(MIDL) $(srcdir)/ISimpleDOMNode.idl cp ISimpleDOMNode.h ../.. cp ISimpleDOMNode_i.c ../../ISimpleDOMNode_iid.h touch $@ -export:: done_gen +$(addprefix $(srcdir)/,$(CSRCS)): %.c: done_gen + cp $(@F) $@ + +export:: done_gen $(addprefix $(srcdir)/,$(CSRCS)) libs:: regsvr32 /s $(DIST)/bin/$(SHARED_LIBRARY) diff --git a/mozilla/xpcom/glue/standalone/Makefile.in b/mozilla/xpcom/glue/standalone/Makefile.in index 357632a949d..78e1c3aa713 100644 --- a/mozilla/xpcom/glue/standalone/Makefile.in +++ b/mozilla/xpcom/glue/standalone/Makefile.in @@ -65,10 +65,18 @@ FORCE_USE_PIC = 1 GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX)) +ifeq ($(OS_ARCH),WINNT) +GARBAGE += $(addprefix $(srcdir)/,$(XPCOM_GLUE_SRC_LCSRCS)) +endif + include $(topsrcdir)/config/rules.mk export:: $(XPCOM_GLUE_SRC_CSRCS) +ifeq ($(OS_ARCH),WINNT) + $(INSTALL) $^ $(srcdir) +else $(INSTALL) $^ . +endif DEFINES += -D_IMPL_NS_COM_OFF -DXPCOM_GLUE diff --git a/mozilla/xpfe/global/Makefile.in b/mozilla/xpfe/global/Makefile.in index d650a3fb0f3..3ca922198ba 100644 --- a/mozilla/xpfe/global/Makefile.in +++ b/mozilla/xpfe/global/Makefile.in @@ -46,7 +46,7 @@ GARBAGE += build.dtd build.dtd: build.dtd.in $(DEPTH)/config/build_number @$(RM) -f $@ - $(PERL) -I$(topsrcdir)/config $(topsrcdir)/config/aboutime.pl $@ $(DEPTH)/config/build_number $< + $(PERL) -I$(topsrcdir)/config $(topsrcdir)/config/aboutime.pl $@ $(DEPTH)/config/build_number $(srcdir)/build.dtd.in libs:: @$(REGCHROME) locale en-US/global-platform en-$(CHROME_PLATFORM).jar