mozilla
Your Search Results

    Building on Windows with SFU (Interix)

     

    Introduction

    These notes are meant to supplement the existing Windows Build Documentation. Windows Services for Unix (SFU, or Interix) is not a supported build platform, but it can be made to work with enough patience. Updating a CVS tree to the trunk takes me only 8 minutes using the Interix cvs client compared to 24 minutes for the MSYS cvs client. For a depend-only build (i.e. verifying that the previous build completed) it is roughly 20% faster than MSYS. For a -j3 parallel clean build (excluding checkout and configure) it is only 3.7% faster. By comparison a -j3 SFU build is 25% faster than a -j1 SFU build.

    Software Requirements

    The following software needs to be installed for a standard Windows build using SFU.

    Windows Services for Unix

    Windows Services for UNIX version provides a full range of cross-platform services for integrating Windows into existing UNIX-based environments.

    Download the self-extracting archive of the Windows Services for UNIX 3.5 product from here. If you choose to include the development tools this will automatically install host gcc for you, but you will still need MSVC to produce the Windows binary.

    The terminal configuration files provided with SFU do not work correctly. If you intend to do a lot of editing then you will probably appreciate the following:

    Patch for /usr/share/termcap
    --- termcap
    +++ termcap
    @@ -50,9 +50,9 @@
         :k0=\EFA:k1=\EF1:k2=\EF2:k3=\EF3:k4=\EF4:k5=\EF5:\
         :k6=\EF6:k7=\EF7:k8=\EF8:k9=\EF9:kB=\E[Z:\
    -    :kN=\E[T:kP=\E[S:kU=\E[U:kb=^H:kd=\E[B:kD=\E[M:kH=\E[U:kI=\E[L:\
    +    :kN=\E[T:kP=\E[S:kH=\E[U:kb=^H:kd=\E[B:kD=\177:kh=\E[H:kI=\E[L:\
         :kl=\E[D:kr=\E[C:ku=\E[A:\
         :le=^H:LE=\E[%dD:ll=\E[U:md=\E[1m:me=\E[0m:mr=\E[7m:\
    -    :nd=\E[C:nw=\r\n:rc=\E[u:RI=\E%dC:rs=\Ec:\
    -    :sc=\E[s:se=\E[m:sf=\E[S:SF=\E[%S:so=\E[1m:sr=\E[T:SR=\E%dT:\
    +    :nd=\E[C:nw=\r\n:rc=\E[u:RI=\E[%dC:rs=\Ec:\
    +    :sc=\E[s:se=\E[m:sf=\E[S:SF=\E[%dS:so=\E[1m:sr=\E[T:SR=\E%dT:\
         :ta=^I:te=\E[2b\E[u\r\E[K:ti=\E[s\E[1b:\
         :ue=\E[m:up=\E[A:UP=\E[%dA:us=\E[4m:
    
    Patch for /usr/share/terminfo.src
    --- terminfo.src
    +++ terminfo.src
    @@ -479,41 +479,41 @@
     
     #### OpenNT 
     # This is the entry for the OpenNT terminal.
     # The ntconsole name is for backward compatability.
     # This is for OpenNT 2.0 and later.
     
     interix|opennt|opennt-25|ntconsole|ntconsole-25|OpenNT-term compatible with color, 
    -    am, bw, msgr, 
    +    am, msgr, 
         colors#8, cols#80, lines#25, ncv#3, pairs#64, 
         acsc=`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~q\304r\362s_t\303u\264v\301w\302x\263y\371z\372{\373|\374}\375~\376.\031-\030\054\021+^P0\333p\304r\304y\363z\362{\343|\330}\234,
         bel=^G, bold=\E[1m,
         cbt=\E[Z, clear=\E[2J,
         cub1=\E[D, cub=\E[%p1%dD, cud=\E[%p1%dB, cud1=^J,
         cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH,
         cuu=\E[%p1%dA, cuu1=\E[A, dl=\E[%p1%dM, dl1=\E[M,
         ed=\E[J, el=\E[K,
         home=\E[H, ht=^I,
         il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS,
         kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A,
    -    kdch1=\E[M, kend=\E[U, kich1=\E[L,
    +    kdch1=\177, kend=\E[U,
         kf0=\EFA, kf1=\EF1, kf2=\EF2, kf3=\EF3, kf4=\EF4,
         kf5=\EF5, kf6=\EF6, kf7=\EF7, kf8=\EF8, kf9=\EF9,
         kf10=\EFA, kf11=\EFB, kf12=\EFC, kf13=\EFD, kf14=\EFE,
         kf15=\EFF, kf16=\EFG, kf17=\EFH, kf18=\EFI, kf19=\EFJ,
         kf20=\EFK, kf21=\EFL, kf22=\EFM, kf23=\EFN, kf24=\EFO,
         kf25=\EFP, kf26=\EFQ, kf27=\EFR, kf28=\EFS, kf29=\EFT,
         kf30=\EFU, kf31=\EFV, kf32=\EFW, kf33=\EFX, kf34=\EFY,
         kf35=\EFZ, kf36=\EFa, kf37=\EFb, kf38=\EFc, kf39=\EFd,
         kf40=\EFe, kf41=\EFf, kf42=\EFg, kf43=\EFh, kf44=\EFi,
         kf45=\EFj, kf46=\EFk, kf47=\EFm, kf48=\EFn, kf49=\EFo,
         kf50=\EFp, kf51=\EFq, kf52=\EFr, kf53=\EFs, kf54=\EFt,
         kf55=\EFu, kf56=\EFv, kf57=\EFw, kf58=\EFx, kf59=\EFy,
         kf60=\EFz, kf61=\EF+, kf62=\EF-, kf63=\EF^, kf64=\EF$,
    -    kll=\E[U, knp=\E[T, kpp=\E[S,
    +    khome=\E[H, kich1=\E[L, kll=\E[U, knp=\E[T, kpp=\E[S,
         ll=\E[U,
         nel=\r\n,
         op=\E[m,
         rc=\E[u, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT,
         rmcup=\E[2b\E[u\r\E[K, rmso=\E[m, rmul=\E[m, rs1=\Ec,
         sc=\E[s,
         setab=\E[4%p1%dm, setaf=\E[3%p1%dm,
    

    After applying the patch, use tic /usr/share/termcap.src to recompile.

    Suggested ~/.inputrc
    DEL: delete-char
    Suggested ~/.vimrc
    fixdel
    set autoindent
    set expandtab
    set fileformats=unix,dos
    set listchars+=precedes:<,extends:>
    set makeprg=gmake
    set nocompatible
    set shiftwidth=2
    set smartindent
    

    SFU Packages

    Once you have installed SFU, you will then need to register and log into the Interix Tools Warehouse. First download the Bootstrap installer, then install the following packages using pkg_update -L:

    • bash (optional; does not work with DEP)
    • cvs
    • flip
    • gmake
    • libncurses
    • m4_gnu
    • python
    • unzip
    • wget
    • zip

    You will also need to use pkg_add to install the autoconf-2.13 package. There is a bug in the package and it will not install the autoconf macros.

    $ cd /usr/local
    $ wget ftp://ftp.interopsystems.com/pkgs/3.5-prev/autoconf-2.13-bin.tgz
    $ pkg_add autoconf-2.13-bin.tgz
    $ tar xfzP autoconf-2.13-bin.tgz

    The autoconf macros do not work correctly with Microsoft C; (It may be possible to build a POSIX executable with gcc but you would also need to compile updated versions of some libraries such as pango.) Microsoft C requires CPP files to end with .cpp and produces output with MS-DOS line endings, so you need to delete all the .m4f files and apply the following patch:

    diff -u acgeneral.m4
    --- acgeneral.m4
    +++ acgeneral.m4
    @@ -1237,7 +1237,7 @@
     dnl AC_LANG_CPLUSPLUS()
     AC_DEFUN(AC_LANG_CPLUSPLUS,
     [define([AC_LANG], [CPLUSPLUS])dnl
    -ac_ext=C
    +ac_ext=cpp
     # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
     ac_cpp='$CXXCPP $CPPFLAGS'
     ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC'
    @@ -1669,7 +1669,7 @@
     dnl with ` +' to stderr in eval and subshells.
     ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
     AC_TRY_EVAL(ac_try)
    -ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    +ac_err=`dos2unix < conftest.out | grep -v '^ *+' | grep -v "^conftest.${ac_ext}\$"`
     if test -z "$ac_err"; then
       ifelse([$2], , :, [rm -rf conftest*
       $2])
    
    Mercurial and inttypes.h

    While it is possible to use the Mercurial package, you may wish to download and compile a newer version from source. As SFU3.5 does not provide inttypes.h, create the following /usr/local/include/inttypes.h file:

    typedef unsigned long long uint64_t;
    
     Path translating compiler wrappers

    Since SFU deals with UNIX-style paths, while the Microsoft compilers expect Windows-style paths, all calls to the compilers must have their paths translated. This used to be done for cygwin using the cygwin-wrapper shell script. A similar approach is used here, but as an explicit wrapper would confuse the configure scripts we use the fact that SFU scripts have no extension while the Microsoft compilers have a .exe extension and define wrappers called cl, lib, link, midl, mt (VC2005 or later) and rc. These are saved in /usr/local/bin so that mt is discovered before the utility in /bin. This example wrapper uses $0 so as to work whichever compiler is being wrapped. The unset LINK command is necessary as the security Makefiles inexplicably use LINK to override the Windows version of the linker, rather than LD as all the other Makefiles and platforms do. Some of the utilities get confused if -nologo appears multiple times on the command line.

    #!/bin/sh
    #fix nss
    unset LINK
    
    args=""
    process=1
    
    # Convert the mountpoint in parameters to Win32 filenames
    # For instance: /dev/fs/C/foo -> C:/foo
    for i in "${@}"
    do
        if test "${i}" = "-nologo"; then
            nologo=-nologo
        else
            if test "${i}" = "-NOLOGO"; then
                nologo=-nologo
            else
                if test "${i}" = "-wrap"; then
                    process=1
                else
                    if test "${i}" = "-nowrap"; then
                        process=
                    else
                        if test -n "${process}"; then
                            leader=${i%%/dev/fs/[a-zA-Z]/*}
                            if ! test "${leader}" = "${i}"; then
                                eval 'pathname=${i#'${leader}'/dev/fs/[a-zA-Z]/}'
                                eval 'no_mountpoint=${i#'${leader}'/dev/fs/}'
                                driveletter=${no_mountpoint%%/*}
                                i=${leader}${driveletter}:/${pathname}
                            fi
                            leader=${i%%\\dev\\fs\\[a-zA-Z]\\*}
                            if ! test "${leader}" = "${i}"; then
                                eval 'pathname=${i#'${leader}'\\dev\\fs\\[a-zA-Z]\}'
                                eval 'no_mountpoint=${i#'${leader}'\\dev\\fs\}'
                                driveletter=${no_mountpoint%%\\*}
                                i=${leader}${driveletter}:\\${pathname}
                            fi
                        fi
                        args="${args} ${i}"
                    fi
                fi
            fi
        fi
    done
    
    ${0##*/}.exe $nologo $args
    

    Netscape wintools

    • Most of the programs in MOZ_TOOLS/bin are obsolete, see Bug 255460. Also, the include files in the original archive have corrupted End-of-Line sequences. Instead, grab the new moztools.zip archive from Bug 274221 attachment 189071 and extract it in a convenient location (e.g. C:\); it will create a "moztools" directory tree wherever you extract it.
    • Be sure to set the MOZ_TOOLS environment variable to point to the installation, and add MOZ_TOOLS/bin to your path.
    glib/libIDL

    You may need to compile glib and libIDL manually. The glib 1.2.10 sources for Interix can be found at Interix tools warehouse. The supplied ltconfig expects you to use configure --host=interix as indicated in the Interix readme at the same place. libIDL source code can be fond on mozilla.org (configure as --host=i586-pc-interix3 or similar). It is necessary to modify lexer.c to use strtoq instead of sscanf as Interix sscanf does not support 64-bit integers. Make libIDL once to generate lexer.c, then apply the patch and remake and install:

    --- lexer.c
    +++ lexer.c
    @@ -1,3 +1,7 @@
    +#include <sys/types.h>
    +extern u_quad_t strtouq(const char *nptr, char **endptr, int base);
    +extern quad_t strtoq(const char *nptr, char **endptr, int base);
    +
     /* A lexical scanner generated by flex */
     
     /* Scanner skeleton version:
    @@ -1131,7 +1135,7 @@
     YY_RULE_SETUP
     #line 199 "./lexer.l"
     {
    -	sscanf (__IDL_text, "%" IDL_LL "o", &__IDL_lval.integer);
    +        __IDL_lval.integer = strtoq(__IDL_text, 0, 8);
     	tokreturn (TOK_INTEGER);
     }
     	YY_BREAK
    @@ -1139,7 +1143,7 @@
     YY_RULE_SETUP
     #line 203 "./lexer.l"
     {
    -	sscanf (__IDL_text, "%" IDL_LL "d", &__IDL_lval.integer);
    +        __IDL_lval.integer = strtoq(__IDL_text, 0, 10);
     	tokreturn (TOK_INTEGER);
     }
     	YY_BREAK
    @@ -1147,7 +1151,7 @@
     YY_RULE_SETUP
     #line 207 "./lexer.l"
     {
    -	sscanf (__IDL_text, "%" IDL_LL "u", &__IDL_lval.integer);
    +        __IDL_lval.integer = strtouq(__IDL_text, 0, 10);
     	tokreturn (TOK_INTEGER);
     }
     	YY_BREAK
    @@ -1155,7 +1159,7 @@
     YY_RULE_SETUP
     #line 211 "./lexer.l"
     {
    -	sscanf (__IDL_text + 2, "%" IDL_LL "x", &__IDL_lval.integer);
    +        __IDL_lval.integer = strtoq(__IDL_text + 2, 0, 16);
     	tokreturn (TOK_INTEGER);
     }
     	YY_BREAK<sys types.h=""/>
    

    Compiler & Linker

    This procedure has only been tested with the Microsoft Visual C++ suite.

    Configure the Enviroment

    • Because standard autoconf does not correctly detect SFU you need to add mk_add_options RUN_AUTOCONF_LOCALLY=1 to your .mozconfig
    • SFU uses its own copy of the environment. It is simplest if you add the necessary environment variables to your SFU ~/.profile

    Sample .profile

    This .profile is for Microsoft Visual C++ Express 2008 with both the Vista and 2003 R2 SDKs. Note that the PATH is a UNIX-style path, but INCLUDE and LIB use the Windows style. Since Windows doesn't understand SFU3.5's symbolic links we set NSDISTMODE=copy here, although one alternative is to provide a custom nsinstall that uses hard links instead.

    export PATH="/usr/local/bin:/bin:/opt/gcc.3.3/bin:/usr/contrib/bin:/usr/X11R6/bin:/usr/local/bin:/usr/contrib/win32/bin:/dev/fs/C/Program Files/Microsoft Visual Studio 9.0/Common7/IDE:/dev/fs/C/Program Files/Microsoft Visual Studio 9.0/VC/bin:/dev/fs/C/Program Files/Microsoft Visual Studio 9.0/Common7/Tools:/dev/fs/C/Program Files/Microsoft SDKs/Windows/v6.0A/bin:/dev/fs/C/Program Files/Microsoft Platform SDK for Windows Server 2003 R2/Bin"
    export INCLUDE="C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\include;C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Include;C:\\Program Files\\Microsoft Platform SDK for Windows Server 2003 R2\\Include\\atl"
    export LIB="C:\Program Files\Microsoft Visual Studio 9.0\VC\LIB;C:\Program Files\Microsoft SDKs\Windows\v6.0A\lib"
    export NSDISTMODE=copy
    

    Sample .mozconfig

    By default, configure will detect SFU as a flavour of NetBSD, so we need to tell it that we want a Windows build target. We have to add -NOLOGO to the flags because some of the configure tests don't expect compiler output, but the version test does. If you are using a recent SDK then you need the -NODEFAULTLIB:atlthunk to work around the #pragma in atlbase.h but older SDKs (such as the one provided with the full version of VC7.1) do not have this problem. We need to define the host compilers because otherwise configure assumes they are the same as the cross compilers. We need to define -DGETCWD_CANT_MALLOC because nsinstall expects it.

    export CROSS_COMPILE=1
    export CC=cl
    export CXX=cl
    export CPP="cl -E"
    export LD=link
    export MIDL=midl
    export CFLAGS=-NOLOGO
    export CPPFLAGS=-NOLOGO
    export LDFLAGS="-NOLOGO -NODEFAULTLIB:atlthunk"
    export RCFLAGS=-D_X86_
    export OS_TARGET=WINNT
    export CPU_ARCH=x86
    export HOST_CFLAGS="-D_ALL_SOURCE -DNO_X11 -DGETCWD_CANT_MALLOC"
    export HOST_CXXFLAGS="-D_ALL_SOURCE -DNO_X11 -DGETCWD_CANT_MALLOC"
    export HOST_CC=gcc
    export HOST_CXX=g++
    export HOST_CPP=cpp
    export HOST_LD=ld
    export HOST_AS=as
    export HOST_AR=ar
    export HOST_LIBIDL_CONFIG=libIDL-config
    export GLIB_PREFIX=/dev/fs/C/moztools
    export LIBIDL_PREFIX=/dev/fs/C/moztools
    mk_add_options AUTOCONF=autoconf
    mk_add_options RUN_AUTOCONF_LOCALLY=1
    mk_add_options MOZ_CO_PROJECT=suite
    mk_add_options MOZ_MAKE_FLAGS=-j3
    mk_add_options MOZ_OBJDIR=..
    ac_add_options --enable-application=suite
    ac_add_options --disable-installer
    ac_add_options --disable-crashreporter
    ac_add_options --target=i686-pc-mingw32
    ac_add_options --enable-win32-target=WIN95
    ac_add_options --without-x
    ac_add_options --host=i586-pc-netbsd
    

    Getting the source

    Pulling

    Your initial pull works in exactly the same way as it does for a regular comm-central or mozilla-central build. However, because we will be running autoconf locally, we need to remove the NSPR (and LDAP) configure scripts, so that they will be regenerated with the correct autoconf.

    Patches

    After checking out the build for the first time, some or all of these patches are required before you can build, for the following reasons:

    • Like VMS, Interix changes a file's modification time when the file is closed.
    • We need to invoke the manifest utility as mt so that we can wrap it
    • We need AC_EXEEXT so that configure can detect successful compilation
    • We need HOST_LD as it is not the same as LD
    • We need to change _MSVC_VER_FILTER as Interix does not have GNU sed
    • We need HOST_AR as it is not the same as AR
    • We need HOST_AR_FLAGS as it is not the same as AR_FLAGS
    • We need AR_FLAGS to exclude quotes as it breaks cross-compiling NSS
    • We need to invoke the resource compiler as rc so that we can wrap it
    • We need to separate AR and AR_FLAGS as they are not the same as HOST_AR and HOST_AR_FLAGS
    • We need to sync NSPR nsinstall.c with the mozilla version so that it supports GETCWD_CANT_MALLOC
    • We need to tell NSPR to compile host programs using the host outoption and the host compiler, and LDAP to use the host LDFLAGS too
    • We need NSPR and LDAP to install DLLs as executable
    • We need to tell NSS not to use backslashes
    Patch for mozilla-central
    diff -r 17ff98827b9c config/nsinstall.c
    --- a/config/nsinstall.c	Sun Feb 22 11:09:10 2009 -0800
    +++ b/config/nsinstall.c	Mon Feb 23 23:48:44 2009 +0000
    @@ -207,13 +207,6 @@
       if (ftruncate(tofd, sb.st_size) < 0)
         fail("cannot truncate %s", toname);
     #if !defined(VMS)
    -  if (dotimes)
    -  {
    -    utb.actime = sb.st_atime;
    -    utb.modtime = sb.st_mtime;
    -    if (utime(toname, &utb) < 0)
    -      fail("cannot set times of %s", toname);
    -  }
     #ifdef HAVE_FCHMOD
       if (fchmod(tofd, mode) < 0)
     #else
    @@ -231,6 +224,7 @@
     #if defined(VMS)
       if (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0)
         fail("cannot change mode of %s", toname);
    +#endif
       if (dotimes)
       {
         utb.actime = sb.st_atime;
    @@ -238,7 +232,6 @@
         if (utime(toname, &utb) < 0)
           fail("cannot set times of %s", toname);
       }
    -#endif
     }
     
     static void
    diff -r 17ff98827b9c config/rules.mk
    --- a/config/rules.mk	Sun Feb 22 11:09:10 2009 -0800
    +++ b/config/rules.mk	Mon Feb 23 23:48:44 2009 +0000
    @@ -1015,9 +1015,9 @@
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
     		if test -f "$(srcdir)/$@.manifest"; then \
    -			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		else \
    -			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		fi; \
     		rm -f $@.manifest; \
     	fi
    @@ -1052,7 +1052,7 @@
     	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1081,7 +1081,7 @@
     	$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1304,7 +1304,7 @@
     ifdef MSMANIFEST_TOOL
     ifdef EMBED_MANIFEST_AT
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
     		rm -f $@.manifest; \
     	fi
     endif   # EMBED_MANIFEST_AT
    diff -r 17ff98827b9c configure.in
    --- a/configure.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/configure.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -228,6 +228,7 @@
     dnl ========================================================
     
     if test "$COMPILE_ENVIRONMENT"; then
    +AC_EXEEXT
     
     dnl Do some special WinCE toolchain stuff
     case "$target" in
    @@ -393,6 +394,9 @@
         if test -z "$HOST_CXXFLAGS"; then
             HOST_CXXFLAGS="$CXXFLAGS"
         fi
    +    if test -z "$HOST_LD"; then
    +        HOST_LD="$LD"
    +    fi
         if test -z "$HOST_LDFLAGS"; then
             HOST_LDFLAGS="$LDFLAGS"
         fi
    @@ -500,18 +504,18 @@
             AC_LANG_RESTORE
             
             changequote(,)
    -        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
    +        _MSVC_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\){0,1}\).*|\1|p'
             changequote([,])
             
             # Determine compiler version
    -        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
             _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
             _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
             _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
             _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
     
    -        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
     
             if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
    @@ -575,7 +579,7 @@
             fi
     
             # Check linker version
    -        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
    @@ -583,7 +587,7 @@
             INCREMENTAL_LINKER=1
     
             # Check midl version
    -        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
             _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
             _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
    @@ -1041,8 +1045,7 @@
     CYGWIN_WRAPPER=
     WIN_TOP_SRC=
     MOZ_USER_DIR=".mozilla"
    -HOST_AR='$(AR)'
    -HOST_AR_FLAGS='$(AR_FLAGS)'
    +HOST_AR_FLAGS='cr $@'
     
     MOZ_JPEG_CFLAGS=
     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/jpeg)'
    @@ -1641,7 +1644,7 @@
     *cygwin*|*mingw*|*mks*|*msvc*|*wince)
         if test -n "$_WIN32_MSVC"; then
             HOST_AR=lib
    -        HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
    +        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
             HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
             HOST_RANLIB='echo ranlib'
         else
    @@ -1999,7 +2002,7 @@
         AR_LIST="$AR -list"
         AR_EXTRACT="$AR -extract"
         AR_DELETE="$AR d"
    -    AR_FLAGS='-OUT:"$@"'
    +    AR_FLAGS='-OUT:$@'
     
         if test "$AS_BIN"; then
             AS="$AS_BIN"
    @@ -2025,7 +2028,7 @@
             
         WARNINGS_AS_ERRORS='-WX'
         MOZ_OPTIMIZE_FLAGS='-Ox'
    -    AR_FLAGS='-NOLOGO -OUT:"$@"'
    +    AR_FLAGS='-NOLOGO -OUT:$@'
         ASM_SUFFIX=asm
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
    @@ -2096,7 +2099,7 @@
         DSO_CFLAGS=
         DSO_PIC_CFLAGS=
         DLL_SUFFIX=.dll
    -    RC=rc.exe
    +    RC=rc
         # certain versions of cygwin's makedepend barf on the 
         # #include <string> vs -I./dist/include/string issue so don't use it
         SYSTEM_MAKEDEPEND=
    @@ -2122,11 +2125,8 @@
             IMPORT_LIB_SUFFIX=dll.a
         else
             TARGET_COMPILER_ABI=msvc
    -        HOST_CC='$(CC)'
    -        HOST_CXX='$(CXX)'
    -        HOST_LD='$(LD)'
    -        AR='lib -NOLOGO -OUT:"$@"'
    -        AR_FLAGS=
    +        AR=lib
    +        AR_FLAGS='-NOLOGO -OUT:$@'
             RANLIB='echo not_ranlib'
             STRIP='echo not_strip'
             XARGS=xargs
    diff -r 17ff98827b9c js/src/config/nsinstall.c
    --- a/js/src/config/nsinstall.c	Sun Feb 22 11:09:10 2009 -0800
    +++ b/js/src/config/nsinstall.c	Mon Feb 23 23:48:44 2009 +0000
    @@ -207,13 +207,6 @@
       if (ftruncate(tofd, sb.st_size) < 0)
         fail("cannot truncate %s", toname);
     #if !defined(VMS)
    -  if (dotimes)
    -  {
    -    utb.actime = sb.st_atime;
    -    utb.modtime = sb.st_mtime;
    -    if (utime(toname, &utb) < 0)
    -      fail("cannot set times of %s", toname);
    -  }
     #ifdef HAVE_FCHMOD
       if (fchmod(tofd, mode) < 0)
     #else
    @@ -231,6 +224,7 @@
     #if defined(VMS)
       if (chmod(toname, (mode & (S_IREAD | S_IWRITE))) < 0)
         fail("cannot change mode of %s", toname);
    +#endif
       if (dotimes)
       {
         utb.actime = sb.st_atime;
    @@ -238,7 +232,6 @@
         if (utime(toname, &utb) < 0)
           fail("cannot set times of %s", toname);
       }
    -#endif
     }
     
     static void
    diff -r 17ff98827b9c js/src/config/rules.mk
    --- a/js/src/config/rules.mk	Sun Feb 22 11:09:10 2009 -0800
    +++ b/js/src/config/rules.mk	Mon Feb 23 23:48:44 2009 +0000
    @@ -1015,9 +1015,9 @@
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
     		if test -f "$(srcdir)/$@.manifest"; then \
    -			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		else \
    -			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		fi; \
     		rm -f $@.manifest; \
     	fi
    @@ -1052,7 +1052,7 @@
     	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1081,7 +1081,7 @@
     	$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1304,7 +1304,7 @@
     ifdef MSMANIFEST_TOOL
     ifdef EMBED_MANIFEST_AT
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
     		rm -f $@.manifest; \
     	fi
     endif   # EMBED_MANIFEST_AT
    diff -r 17ff98827b9c js/src/configure.in
    --- a/js/src/configure.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/js/src/configure.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -199,6 +199,7 @@
     dnl ========================================================
     
     if test "$COMPILE_ENVIRONMENT"; then
    +AC_EXEEXT
     
     if test "$target" != "$host"; then
         echo "cross compiling from $host to $target"
    @@ -317,6 +318,9 @@
         if test -z "$HOST_CXXFLAGS"; then
             HOST_CXXFLAGS="$CXXFLAGS"
         fi
    +    if test -z "$HOST_LD"; then
    +        HOST_LD="$LD"
    +    fi
         if test -z "$HOST_LDFLAGS"; then
             HOST_LDFLAGS="$LDFLAGS"
         fi
    @@ -423,18 +427,18 @@
             AC_LANG_RESTORE
             
             changequote(,)
    -        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
    +        _MSVC_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\){0,1}\).*|\1|p'
             changequote([,])
             
             # Determine compiler version
    -        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
             _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
             _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
             _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
             _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
     
    -        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
     
             if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
    @@ -498,7 +502,7 @@
             fi
     
             # Check linker version
    -        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
    @@ -914,8 +918,7 @@
     CYGWIN_WRAPPER=
     WIN_TOP_SRC=
     MOZ_USER_DIR=".mozilla"
    -HOST_AR='$(AR)'
    -HOST_AR_FLAGS='$(AR_FLAGS)'
    +HOST_AR_FLAGS='cr $@'
     
     MOZ_JS_LIBS='-L$(libdir) -lmozjs'
     MOZ_FIX_LINK_PATHS='-Wl,-rpath-link,$(LIBXUL_DIST)/bin -Wl,-rpath-link,$(PREFIX)/lib'
    @@ -1519,7 +1524,7 @@
     *cygwin*|*mingw*|*mks*|*msvc*|*wince)
         if test -n "$_WIN32_MSVC"; then
             HOST_AR=lib
    -        HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
    +        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
             HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
             HOST_RANLIB='echo ranlib'
         else
    @@ -1864,7 +1869,7 @@
         AR_LIST="$AR -list"
         AR_EXTRACT="$AR -extract"
         AR_DELETE="$AR d"
    -    AR_FLAGS='-OUT:"$@"'
    +    AR_FLAGS='-OUT:$@'
     
         if test -z "$AS_BIN"; then
             AS="$AS_BIN"
    @@ -1874,7 +1879,7 @@
         DLL_SUFFIX=.dll
         BIN_SUFFIX='.exe'
         if test -z "$RC"; then 
    -        RC=rc.exe  
    +        RC=rc.exe
         fi
         # certain versions of cygwin's makedepend barf on the 
         # #include <string> vs -I./dist/include/string issue so don't use it
    @@ -1890,7 +1895,7 @@
             
         WARNINGS_AS_ERRORS='-WX'
     	MOZ_OPTIMIZE_FLAGS='-O1'
    -    AR_FLAGS='-NOLOGO -OUT:"$@"'
    +    AR_FLAGS='-NOLOGO -OUT:$@'
         ASM_SUFFIX=asm
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
    @@ -1949,7 +1954,7 @@
         DSO_CFLAGS=
         DSO_PIC_CFLAGS=
         DLL_SUFFIX=.dll
    -    RC=rc.exe
    +    RC=rc
         # certain versions of cygwin's makedepend barf on the 
         # #include <string> vs -I./dist/include/string issue so don't use it
         SYSTEM_MAKEDEPEND=
    @@ -1975,11 +1980,8 @@
             IMPORT_LIB_SUFFIX=dll.a
         else
             TARGET_COMPILER_ABI=msvc
    -        HOST_CC='$(CC)'
    -        HOST_CXX='$(CXX)'
    -        HOST_LD='$(LD)'
    -        AR='lib -NOLOGO -OUT:"$@"'
    -        AR_FLAGS=
    +        AR=lib
    +        AR_FLAGS='-NOLOGO -OUT:$@'
             RANLIB='echo not_ranlib'
             STRIP='echo not_strip'
             XARGS=xargs
    diff -r 17ff98827b9c nsprpub/config/nsinstall.c
    --- a/nsprpub/config/nsinstall.c	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/config/nsinstall.c	Mon Feb 23 23:48:44 2009 +0000
    @@ -70,7 +70,7 @@
      * Does getcwd() take NULL as the first argument and malloc
      * the result buffer?
      */
    -#if !defined(DARWIN) && !defined(NEXTSTEP) && !defined(VMS)
    +#if !defined(DARWIN) && !defined(NEXTSTEP) && !defined(VMS) && !defined(GETCWD_CANT_MALLOC)
     #define GETCWD_CAN_MALLOC
     #endif
     
    @@ -373,12 +373,6 @@
     	    ** have to utime() last since fchown/chmod alter the timestamps.
     	    */
     #ifndef VMS
    -	    if (dotimes) {
    -		utb.actime = sb.st_atime;
    -		utb.modtime = sb.st_mtime;
    -		if (utime(toname, &utb) < 0)
    -		    fail("cannot set times of %s", toname);
    -	    }
     #ifdef HAVE_FCHMOD
     	    if (fchmod(tofd, mode) < 0)
     #else
    @@ -396,13 +390,13 @@
     #ifdef VMS
     	    if (chmod(toname, mode) < 0)
     		fail("cannot change mode of %s", toname);
    +#endif
     	    if (dotimes) {
     		utb.actime = sb.st_atime;
     		utb.modtime = sb.st_mtime;
     		if (utime(toname, &utb) < 0)
     		    fail("cannot set times of %s", toname);
     	    }
    -#endif
     	}
     
     	free(toname);
    diff -r 17ff98827b9c nsprpub/config/rules.mk
    --- a/nsprpub/config/rules.mk	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/config/rules.mk	Mon Feb 23 23:48:44 2009 +0000
    @@ -90,6 +90,8 @@
     CFLAGS=$(HOST_CFLAGS)
     CXXFLAGS=$(HOST_CXXFLAGS)
     LDFLAGS=$(HOST_LDFLAGS)
    +OUTOPTION=$(HOST_OUTOPTION)
    +NS_USE_GCC=1
     endif
     endif
     endif
    diff -r 17ff98827b9c nsprpub/configure.in
    --- a/nsprpub/configure.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/configure.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -122,9 +122,7 @@
     esac
     
     if test -n "$_WIN32_MSVC"; then
    -    SKIP_PATH_CHECKS=1
    -    SKIP_COMPILER_CHECKS=1
    -    SKIP_LIBRARY_CHECKS=1
    +    AC_EXEEXT
     fi
     
     dnl ========================================================
    @@ -1517,7 +1515,7 @@
             AR_FLAGS=
             RANLIB='echo not_ranlib'
             STRIP='echo not_strip'
    -        RC=rc.exe
    +        RC=rc
             GARBAGE='$(OBJDIR)/vc20.pdb $(OBJDIR)/vc40.pdb'
             OBJ_SUFFIX=obj
             LIB_SUFFIX=lib
    diff -r 17ff98827b9c nsprpub/lib/ds/Makefile.in
    --- a/nsprpub/lib/ds/Makefile.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/lib/ds/Makefile.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -179,10 +179,8 @@
     ifdef SHARED_LIBRARY
     ifeq ($(OS_ARCH),HP-UX)
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
    +endif
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
    -else
    -	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
    -endif
     endif
     ifeq ($(MOZ_BITS),16)
     	$(INSTALL) -m 444 $(HEADERS) $(MOZ_INCL)
    diff -r 17ff98827b9c nsprpub/lib/libc/src/Makefile.in
    --- a/nsprpub/lib/libc/src/Makefile.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/lib/libc/src/Makefile.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -180,10 +180,8 @@
     ifdef SHARED_LIBRARY
     ifeq ($(OS_ARCH),HP-UX)
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
    +endif
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
    -else
    -	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
    -endif
     endif
     ifeq ($(MOZ_BITS),16)
     	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
    diff -r 17ff98827b9c nsprpub/pr/src/Makefile.in
    --- a/nsprpub/pr/src/Makefile.in	Sun Feb 22 11:09:10 2009 -0800
    +++ b/nsprpub/pr/src/Makefile.in	Mon Feb 23 23:48:44 2009 +0000
    @@ -393,10 +393,8 @@
     ifdef SHARED_LIBRARY
     ifeq ($(OS_ARCH),HP-UX)
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_libdir)
    +endif
     	$(INSTALL) -m 755 $(SHARED_LIBRARY) $(dist_bindir)
    -else
    -	$(INSTALL) -m 444 $(SHARED_LIBRARY) $(dist_bindir)
    -endif
     endif
     ifeq ($(MOZ_BITS),16)
     	$(INSTALL) -m 444 $(TARGETS) $(MOZ_DIST)/lib
    diff -r 17ff98827b9c security/coreconf/nsinstall/nsinstall.c
    --- a/security/coreconf/nsinstall/nsinstall.c	Sun Feb 22 11:09:10 2009 -0800
    +++ b/security/coreconf/nsinstall/nsinstall.c	Mon Feb 23 23:48:44 2009 +0000
    @@ -412,12 +412,6 @@
     	    ** have to utime() last since fchown/chmod alter the timestamps.
     	    */
     #ifndef VMS
    -	    if (dotimes) {
    -		utb.actime = sb.st_atime;
    -		utb.modtime = sb.st_mtime;
    -		if (utime(toname, &utb) < 0)
    -		    fail("cannot set times of %s", toname);
    -	    }
     #ifdef HAVE_FCHMOD
     	    if (fchmod(tofd, mode) < 0)
     #else
    @@ -435,13 +429,13 @@
     #ifdef VMS
     	    if (chmod(toname, mode) < 0)
     		fail("cannot change mode of %s", toname);
    +#endif
     	    if (dotimes) {
     		utb.actime = sb.st_atime;
     		utb.modtime = sb.st_mtime;
     		if (utime(toname, &utb) < 0)
     		    fail("cannot set times of %s", toname);
     	    }
    -#endif
     	}
     
     	free(toname);
    diff -r 17ff98827b9c security/coreconf/rules.mk
    --- a/security/coreconf/rules.mk	Sun Feb 22 11:09:10 2009 -0800
    +++ b/security/coreconf/rules.mk	Mon Feb 23 23:48:44 2009 +0000
    @@ -402,7 +402,7 @@
     ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
     NEED_ABSOLUTE_PATH := 1
     PWD := $(shell pwd)
    -ifeq (,$(findstring ;,$(PATH)))
    +ifeq (,$(NATIVE_CC)$(findstring ;,$(PATH)))
     ifndef USE_MSYS
     PWD := $(subst \,/,$(shell cygpath -w $(PWD)))
     endif
    
    Patch for comm-central
     diff -r 720d3a1ea63d client.mk
    --- a/client.mk	Sun Feb 22 22:22:07 2009 +0000
    +++ b/client.mk	Mon Feb 23 23:49:17 2009 +0000
    @@ -165,6 +165,8 @@
     CONFIGURES := $(TOPSRCDIR)/configure
     CONFIGURES += $(TOPSRCDIR)/mozilla/configure
     CONFIGURES += $(TOPSRCDIR)/mozilla/js/src/configure
    +CONFIGURES += $(TOPSRCDIR)/mozilla/nsprpub/configure
    +CONFIGURES += $(TOPSRCDIR)/directory/c-sdk/configure
     
     #######################################################################
     # Rules
    @@ -261,9 +263,7 @@
     	$(TOPSRCDIR)/allmakefiles.sh \
     	$(TOPSRCDIR)/.mozconfig.mk \
     	$(TOPSRCDIR)/mozilla/allmakefiles.sh \
    -	$(wildcard $(TOPSRCDIR)/mozilla/nsprpub/configure) \
     	$(wildcard $(TOPSRCDIR)/mozilla/config/milestone.txt) \
    -	$(wildcard $(TOPSRCDIR)/directory/c-sdk/configure) \
     	$(wildcard $(addsuffix confvars.sh,$(wildcard $(TOPSRCDIR)/*/))) \
     	$(NULL)
     
    diff -r 720d3a1ea63d config/rules.mk
    --- a/config/rules.mk	Sun Feb 22 22:22:07 2009 +0000
    +++ b/config/rules.mk	Mon Feb 23 23:49:17 2009 +0000
    @@ -1006,9 +1006,9 @@
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
     		if test -f "$(srcdir)/$@.manifest"; then \
    -			mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		else \
    -			mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +			mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		fi; \
     		rm -f $@.manifest; \
     	fi
    @@ -1043,7 +1043,7 @@
     	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1072,7 +1072,7 @@
     	$(LD) -nologo -out:$@ -pdb:$(LINK_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
     ifdef MSMANIFEST_TOOL
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
     		rm -f $@.manifest; \
     	fi
     endif	# MSVC with manifest tool
    @@ -1295,7 +1295,7 @@
     ifdef MSMANIFEST_TOOL
     ifdef EMBED_MANIFEST_AT
     	@if test -f $@.manifest; then \
    -		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
    +		mt -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;$(EMBED_MANIFEST_AT); \
     		rm -f $@.manifest; \
     	fi
     endif   # EMBED_MANIFEST_AT
    diff -r 720d3a1ea63d configure.in
    --- a/configure.in	Sun Feb 22 22:22:07 2009 +0000
    +++ b/configure.in	Mon Feb 23 23:49:17 2009 +0000
    @@ -237,6 +237,7 @@
     dnl ========================================================
     
     if test "$COMPILE_ENVIRONMENT"; then
    +AC_EXEEXT
     
     dnl Do some special WinCE toolchain stuff
     case "$target" in
    @@ -383,6 +384,9 @@
         if test -z "$HOST_CXXFLAGS"; then
             HOST_CXXFLAGS="$CXXFLAGS"
         fi
    +    if test -z "$HOST_LD"; then
    +        HOST_LD="$LD"
    +    fi
         if test -z "$HOST_LDFLAGS"; then
             HOST_LDFLAGS="$LDFLAGS"
         fi
    @@ -490,18 +494,18 @@
             AC_LANG_RESTORE
             
             changequote(,)
    -        _MSVC_VER_FILTER='s|.* ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?).*|\1|p'
    +        _MSVC_VER_FILTER='s|.* \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(\.[0-9][0-9]*\){0,1}\).*|\1|p'
             changequote([,])
             
             # Determine compiler version
    -        CC_VERSION=`"${CC}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CC_VERSION=`"${CC}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CC_MAJOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $1 }'`
             _CC_MINOR_VERSION=`echo ${CC_VERSION} | $AWK -F\. '{ print $2 }'`
             _CC_RELEASE=`echo ${CC_VERSION} | $AWK -F\. '{ print $3 }'`
             _CC_BUILD=`echo ${CC_VERSION} | $AWK -F\. '{ print $4 }'`
             _MSC_VER=${_CC_MAJOR_VERSION}${_CC_MINOR_VERSION}
     
    -        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        CXX_VERSION=`"${CXX}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _CXX_MAJOR_VERSION=`echo ${CXX_VERSION} | $AWK -F\. '{ print $1 }'`
     
             if test "$_CC_MAJOR_VERSION" != "$_CXX_MAJOR_VERSION"; then
    @@ -565,7 +569,7 @@
             fi
     
             # Check linker version
    -        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _LD_MAJOR_VERSION=`echo ${_LD_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
             if test "$_LD_MAJOR_VERSION" != "$_CC_SUITE"; then
                 AC_MSG_ERROR([The linker major version, $_LD_FULL_VERSION,  does not match the compiler suite version, $_CC_SUITE.])
    @@ -573,7 +577,7 @@
             INCREMENTAL_LINKER=1
     
             # Check midl version
    -        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -nre "$_MSVC_VER_FILTER"`
    +        _MIDL_FULL_VERSION=`"${MIDL}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
             _MIDL_MAJOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $1 }'`
             _MIDL_MINOR_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $2 }'`
             _MIDL_REV_VERSION=`echo ${_MIDL_FULL_VERSION} | $AWK -F\. '{ print $3 }'`
    @@ -977,8 +981,7 @@
     CYGWIN_WRAPPER=
     WIN_TOP_SRC=
     MOZ_USER_DIR=".mozilla"
    -HOST_AR='$(AR)'
    -HOST_AR_FLAGS='$(AR_FLAGS)'
    +HOST_AR_FLAGS='cr $@'
     
     MOZ_JPEG_CFLAGS=
     MOZ_JPEG_LIBS='$(call EXPAND_LIBNAME_PATH,mozjpeg,$(DEPTH)/mozilla/jpeg)'
    @@ -1541,7 +1544,7 @@
     *cygwin*|*mingw*|*mks*|*msvc*|*wince)
         if test -n "$_WIN32_MSVC"; then
             HOST_AR=lib
    -        HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
    +        HOST_AR_FLAGS='-NOLOGO -OUT:$@'
             HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
             HOST_RANLIB='echo ranlib'
         else
    @@ -1914,7 +1917,7 @@
         AR_LIST="$AR -list"
         AR_EXTRACT="$AR -extract"
         AR_DELETE="$AR d"
    -    AR_FLAGS='-OUT:"$@"'
    +    AR_FLAGS='-OUT:$@'
     
         if test -z "$AS_BIN"; then
             AS="$AS_BIN"
    @@ -1940,7 +1943,7 @@
             
         WARNINGS_AS_ERRORS='-WX'
     	MOZ_OPTIMIZE_FLAGS='-O1'
    -    AR_FLAGS='-NOLOGO -OUT:"$@"'
    +    AR_FLAGS='-NOLOGO -OUT:$@'
         ASM_SUFFIX=asm
         CFLAGS="$CFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
         CXXFLAGS="$CXXFLAGS -W3 -Gy -Fd\$(COMPILE_PDBFILE)"
    @@ -2001,7 +2004,7 @@
         DSO_CFLAGS=
         DSO_PIC_CFLAGS=
         DLL_SUFFIX=.dll
    -    RC=rc.exe
    +    RC=rc
         # certain versions of cygwin's makedepend barf on the 
         # #include <string> vs -I./dist/include/string issue so don't use it
         SYSTEM_MAKEDEPEND=
    @@ -2027,11 +2030,8 @@
             IMPORT_LIB_SUFFIX=dll.a
         else
             TARGET_COMPILER_ABI=msvc
    -        HOST_CC='$(CC)'
    -        HOST_CXX='$(CXX)'
    -        HOST_LD='$(LD)'
    -        AR='lib -NOLOGO -OUT:"$@"'
    -        AR_FLAGS=
    +        AR=lib
    +        AR_FLAGS='-NOLOGO -OUT:$@'
             RANLIB='echo not_ranlib'
             STRIP='echo not_strip'
             XARGS=xargs
    
    Patch for ldap
    Index: configure.in
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/configure.in,v
    retrieving revision 5.64
    diff -u -r5.64 configure.in
    --- configure.in	11 Sep 2008 14:38:34 -0000	5.64
    +++ configure.in	23 Feb 2009 23:55:09 -0000
    @@ -938,6 +938,7 @@
     dnl ========================================================
     dnl Override of system specific host options
     dnl ========================================================
    +WIN_TOP_SRC="$srcdir"
     case "$host" in
     *-mingw*)
         NSINSTALL=nsinstall
    Index: config/nsinstall.c
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/config/nsinstall.c,v
    retrieving revision 5.2
    diff -u -r5.2 nsinstall.c
    --- config/nsinstall.c	10 Oct 2003 15:03:43 -0000	5.2
    +++ config/nsinstall.c	23 Feb 2009 23:55:10 -0000
    @@ -379,12 +379,6 @@
     
     	    if (ftruncate(tofd, sb.st_size) < 0)
     		fail("cannot truncate %s", toname);
    -	    if (dotimes) {
    -		utb.actime = sb.st_atime;
    -		utb.modtime = sb.st_mtime;
    -		if (utime(toname, &utb) < 0)
    -		    fail("cannot set times of %s", toname);
    -	    }
     #ifdef HAVE_FCHMOD
     	    if (fchmod(tofd, mode) < 0)
     #else
    @@ -398,6 +392,12 @@
     	    if (close(tofd) < 0)
     		fail("cannot write to %s", toname);
     	    close(fromfd);
    +	    if (dotimes) {
    +		utb.actime = sb.st_atime;
    +		utb.modtime = sb.st_mtime;
    +		if (utime(toname, &utb) < 0)
    +		    fail("cannot set times of %s", toname);
    +	    }
     	}
     
     	free(toname);
    Index: config/rules.mk
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/config/rules.mk,v
    retrieving revision 5.9
    diff -u -r5.9 rules.mk
    --- config/rules.mk	15 Feb 2008 16:21:01 -0000	5.9
    +++ config/rules.mk	23 Feb 2009 23:55:10 -0000
    @@ -87,6 +87,9 @@
     CCC=$(HOST_CXX)
     CFLAGS=$(HOST_CFLAGS)
     CXXFLAGS=$(HOST_CXXFLAGS)
    +LDFLAGS=$(HOST_LDFLAGS)
    +OUTOPTION=$(HOST_OUTOPTION)
    +NS_USE_GCC=1
     endif
     endif
     endif
    Index: ldap/libraries/libldap/Makefile.in
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in,v
    retrieving revision 5.24
    diff -u -r5.24 Makefile.in
    --- ldap/libraries/libldap/Makefile.in	11 Sep 2008 14:38:34 -0000	5.24
    +++ ldap/libraries/libldap/Makefile.in	23 Feb 2009 23:55:11 -0000
    @@ -363,7 +363,7 @@
     ifdef MKSHLIB
     	$(INSTALL) -m 444 $(LIBLDAP) $(dist_libdir)
     	$(INSTALL) -m 444 $(DLLLDAP) $(dist_libdir)
    -	$(INSTALL) -m 444 $(DLLLDAP) $(dist_bindir)
    +	$(INSTALL) -m 755 $(DLLLDAP) $(dist_bindir)
     endif
     ifeq ($(OS_ARCH), WINNT)
     	$(INSTALL) -m 444 $(LIBLDAP) $(dist_libdir)
    Index: ldap/libraries/libldif/Makefile.in
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/ldap/libraries/libldif/Makefile.in,v
    retrieving revision 5.10
    diff -u -r5.10 Makefile.in
    --- ldap/libraries/libldif/Makefile.in	11 Sep 2008 14:38:34 -0000	5.10
    +++ ldap/libraries/libldif/Makefile.in	23 Feb 2009 23:55:12 -0000
    @@ -162,5 +162,5 @@
     ifdef MKSHLIB
     	$(INSTALL) -m 444 $(LIBLDIF) $(dist_libdir)
     	$(INSTALL) -m 444 $(DLLLDIF) $(dist_libdir)
    -	$(INSTALL) -m 444 $(DLLLDIF) $(dist_bindir)
    +	$(INSTALL) -m 755 $(DLLLDIF) $(dist_bindir)
     endif
    Index: ldap/libraries/libprldap/Makefile.in
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in,v
    retrieving revision 5.19
    diff -u -r5.19 Makefile.in
    --- ldap/libraries/libprldap/Makefile.in	11 Sep 2008 14:38:35 -0000	5.19
    +++ ldap/libraries/libprldap/Makefile.in	23 Feb 2009 23:55:12 -0000
    @@ -246,5 +246,5 @@
     endif
     ifdef MKSHLIB
     	$(INSTALL) -m 555 $(DLLPRLDAP) $(dist_libdir)
    -	$(INSTALL) -m 444 $(DLLPRLDAP) $(dist_bindir)
    +	$(INSTALL) -m 755 $(DLLPRLDAP) $(dist_bindir)
     endif
    Index: ldap/libraries/libssldap/Makefile.in
    ===================================================================
    RCS file: /cvsroot/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in,v
    retrieving revision 5.16
    diff -u -r5.16 Makefile.in
    --- ldap/libraries/libssldap/Makefile.in	11 Sep 2008 14:38:35 -0000	5.16
    +++ ldap/libraries/libssldap/Makefile.in	23 Feb 2009 23:55:12 -0000
    @@ -239,5 +239,5 @@
     endif
     ifdef MKSHLIB
     	$(INSTALL) -m 555 $(DLLSSLDAP) $(dist_libdir)
    -	$(INSTALL) -m 444 $(DLLSSLDAP) $(dist_bindir)
    +	$(INSTALL) -m 755 $(DLLSSLDAP) $(dist_bindir)
     endif
    
    

     

    Updating

    Since we have run autoconf locally, we need to revert the modified configures before we pull to avoid merge conflicts. As before, we then have to remove the configures again after the pull before building. This is a sample script for comm-central:

    rm -f directory/c-sdk/configure &&
    hg revert -R mozilla mozilla/nsprpub/configure &&
    python client.py checkout &&
    rm directory/c-sdk/configure mozilla/nsprpub/configure &&
    gmake -f client.mk configure build
    

    Testing

    You cannot use SFU to test, since all the utilities expect Windows paths. However, you can install Windows python separately and use that to run the tests, but you will need to specify Windows paths to all the relevant command-line options as automation.py will have had Interix paths embedded within it.

    Document Tags and Contributors

    Contributors to this page: Mook, Neil
    Last updated by: Neil,