[Libreoffice-commits] .: 3 commits - bootstrap.1 configure.in set_soenv.in solenv/bin solenv/inc

Tor Lillqvist tml at kemper.freedesktop.org
Wed May 18 09:42:33 PDT 2011


 bootstrap.1           |    4 
 configure.in          |  224 ++++++++++++++++++++++++++++----------------------
 set_soenv.in          |    8 +
 solenv/bin/build.pl   |   14 +--
 solenv/inc/wntgcci.mk |    4 
 5 files changed, 145 insertions(+), 109 deletions(-)

New commits:
commit 8493fe51d6f634cff6e7932999834d71fceb5c26
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed May 18 18:56:37 2011 +0300

    Check build platform instead of host platform when appropriate

diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl
index 22ab1f0..9dda986 100755
--- a/solenv/bin/build.pl
+++ b/solenv/bin/build.pl
@@ -266,7 +266,7 @@
         if (open (CMD_FILE, ">>$cmd_file")) {
             select CMD_FILE;
             $echo = 'echo ';
-            if ($ENV{GUI} ne 'UNX') {
+            if ($ENV{GUI_FOR_BUILD} ne 'UNX') {
                 $new_line = "echo.\n";
                 print "\@$echo off\npushd\n";
             } else {
@@ -306,7 +306,7 @@
         print $new_line;
         do_exit(1) if ($checkparents);
     };
-    if (($ENV{GUI} ne 'UNX') && $cmd_file) {
+    if (($ENV{GUI_FOR_BUILD} ne 'UNX') && $cmd_file) {
         print "popd\n";
     };
     $ENV{mk_tmp} = '';
@@ -791,7 +791,7 @@ sub dmake_dir {
         #if dmake fails, have a go at regenerating the dependencies
         #and try again. dmakes normal failure is 255, while death on signal is 254
         my $real_exit_code = $error_code >> 8;
-        if (($real_exit_code == 255) && ($ENV{nodep} eq '') && ($ENV{depend} eq '')) {
+        if (($ENV{GUI_FOR_BUILD} eq 'WNT') && ($real_exit_code == 255) && ($ENV{nodep} eq '') && ($ENV{depend} eq '')) {
             print "Retrying $job_name\n";
             $error_code = run_job($dmake, $job_name);
         }
@@ -1118,7 +1118,7 @@ sub get_commands {
     check_dmake();
 
     if ($cmd_file) {
-        if ($ENV{GUI} eq 'UNX') {
+        if ($ENV{GUI_FOR_BUILD} eq 'UNX') {
             $check_error_string = "if \"\$?\" != \"0\" exit\n";
         } else {
             $check_error_string = "if \"\%?\" != \"0\" quit\n";
@@ -1741,7 +1741,7 @@ sub store_error {
     }
 
     my $child_nick = $processes_hash{$pid};
-    if ($ENV{GUI} eq 'WNT') {
+    if ($ENV{GUI_FOR_BUILD} eq 'WNT') {
         if (!defined $had_error{$child_nick}) {
             $had_error{$child_nick}++;
             return 1;
@@ -2052,7 +2052,7 @@ sub do_custom_job {
         $error_code = run_job($job, $module_paths{$module}, $module_job);
         if ($error_code) {
             # give windows one more chance
-            if ($ENV{GUI} eq 'WNT') {
+            if ($ENV{GUI_FOR_BUILD} eq 'WNT') {
                 $error_code = run_job($job, $module_paths{$module}, $module_job);
             };
         };
@@ -3239,7 +3239,7 @@ sub start_server_on_port {
     my $port = shift;
     my $socket_obj = shift;
     $client_timeout = 1 if (!$parent_process);
-    if ($ENV{GUI} eq 'WNT') {
+    if ($ENV{GUI_FOR_BUILD} eq 'WNT') {
         $$socket_obj = new IO::Socket::INET (#LocalAddr => hostname(),
                                   LocalPort => $port,
                                   Proto     => 'tcp',
commit 5a03e7af6963a6371aadad824c79e1823969fdcd
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed May 18 18:55:07 2011 +0300

    Unset more variables when building dmake when cross-compiling

diff --git a/bootstrap.1 b/bootstrap.1
index fa9cc06..c67a7a7 100755
--- a/bootstrap.1
+++ b/bootstrap.1
@@ -20,11 +20,11 @@ if test "$BUILD_DMAKE" != "NO"; then
         # If cross-compiling then don't use the cross compilers to build dmake.
         if test "$GUI_FOR_BUILD" = "WNT"; then
             # Let the Cygwin gcc be found
-            export CC=""
-            export CXX=""
+            unset CC CXX AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
         elif test "$CROSS_COMPILING" = "YES"; then
             export CC="$CC_FOR_BUILD"
             export CXX="$CXX_FOR_BUILD"
+            unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
         fi
 
         # For normal unixy systems
commit eee94b4b6eb58941951eec0d258f6ff2ca4ab858
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Wed May 18 18:52:04 2011 +0300

    More cross-compiling work and cleanup
    
    Re-introduce the old --with-mingw option but now called
    --with-mingw-cross-compiler. Its purpose is now specifically to give
    the cross-compiler used when building the ODK, if Java is enabled, and
    if building the unowinreg.dll. It has now nothing to do with
    cross-compiling LibreOffice itself.
    
    Correspondingly, the WITH_MINGW variable now has meaning only when
    building LibreOffice for Windows: If using MinGW, whether natively on
    Windows itself (which we as such don't intend to support, I hope), or
    cross-compiling, it is set to "yes".
    
    Automate and simplify the search for the MinGW cross-compiler when
    intending to build unowinreg.dll on Unix.
    
    Look for the usual tool-chain tools ar, nm, objdump, pkg-config,
    ranlib, strip, and for Windows alto dlltool and windres using
    AC_CHECK_TOOL so that the proper cross tools are found when
    needed. Propagate to environment. As such these are not used except in
    the MinGW mk files so far.
    
    Other minor cleanups.

diff --git a/configure.in b/configure.in
index 89f6858..0fedf8f 100755
--- a/configure.in
+++ b/configure.in
@@ -1,4 +1,4 @@
-dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil -*-
+dnl -*- Mode: Autoconf; tab-width: 8; indent-tabs-mode: nil -*-
 dnl configure.in serves as input for the GNU autoconf package 
 dnl in order to create a configure script.
 
@@ -1247,6 +1247,17 @@ AC_ARG_WITH(zip-home,
     ],
 ,)
 
+AC_ARG_WITH(mingw-cross-compiler,
+    AS_HELP_STRING([--with-mingw-cross-compiler],
+        [Specify the MinGW cross-compiler to use.])
+    [
+                          Usage:     --with-mingw-cross-compiler=<mingw32-g++ command>
+
+                          When building on the ODK on Unix and building unowinreg.dll,
+                          specify the MinGW C++ cross-compiler.
+    ],
+,)
+
 AC_ARG_WITH(build-version,
     AS_HELP_STRING([--with-build-version],
         [Allows the builder to add a custom version tag that will appear in the
@@ -1415,21 +1426,37 @@ case "$host_os" in
         _os=GNU
         ;;
     cygwin*|interix*|mingw32*) # Windows
+
+        # When building on Windows normally with MSVC under Cygwin,
+        # configure thinks that the host platform (the platform the
+        # built code will run on) is Cygwin, even if it obviously is
+        # Windows, which in Autoconf terminology is called
+        # "mingw32". (Which is misleading as MinGW is the name of the
+        # tool-chain, not an operating system.)
+
+        # Somewhat confusing, yes. But this configure script doesn't
+        # look at $host etc that much, it mostly uses its own $_os
+        # variable, set here in this case statement.
+
+        # When cross-compiling to Windows from Unix, the host platform
+        # is "mingw32" (because in that case it is the MinGW
+        # tool-chain that is used).
+
         test_cups=no
         test_randr=no
         test_freetype=no
         test_cairo=no
         test_fontconfig=no
         _os=WINNT
-	# Confusingly, if the host OS matches "mingw32*", that means
-	# we are using the MinGW compiler, either natively (unlikely)
-	# or cross-compiling. We use WITH_MINGW to indicate
-	# use of MinGW in both cases
-	case "$host_os" in
-	    mingw32*)
-		WITH_MINGW=yes
-		;;
-	esac
+        # Confusingly, if the host OS matches "mingw32*", that means
+        # we are using the MinGW compiler, either natively (unlikely)
+        # or cross-compiling. We use WITH_MINGW to indicate
+        # use of MinGW in both cases.
+        case "$host_os" in
+            mingw32*)
+            WITH_MINGW=yes
+            ;;
+        esac
         ;;
     darwin*) # Mac OS X or iOS
         test_gtk=yes
@@ -1538,21 +1565,19 @@ if test $build_os = "cygwin"; then
    dnl ===================================================================
    dnl As long as awk instead of $AWK is used somewhere in the sources,
    dnl check for $AWK and awk. $AWK is pointing to gawk in Cygwin.
-      if test -L $AWK -o -L `which awk` -o -L `which tar` -o -L `which gunzip` ; then
-         AC_MSG_ERROR([$AWK, awk, tar or gunzip is a Cygwin symlink!
+   if test -L $AWK -o -L `which awk` -o -L `which tar` -o -L `which gunzip` ; then
+      AC_MSG_ERROR([$AWK, awk, tar or gunzip is a Cygwin symlink!
 Native Windows programs cannot use Cygwin symlinks. Remove the symbolic
 link, and copy the program to the name of the link.])
-      fi
+   fi
+   AC_MSG_RESULT([ok])
+
    dnl ===================================================================
    dnl If $CC is set to a MinGW compiler, set WITH_MINGW
    dnl ===================================================================
-      if test "$WITH_MINGW" != "yes" -a -n "$CC"; then
-         if test "`$CC -dumpmachine 2>/dev/null | $SED -e 's/^.*-//'`" = "mingw32"; then
-            WITH_MINGW="yes"
-         fi
-      fi
-   dnl ===================================================================
-   AC_MSG_RESULT([ok])
+   if test "$WITH_MINGW" != "yes" -a -n "$CC" -a "`$CC -dumpmachine 2>/dev/null | $SED -e 's/^.*-//'`" = "mingw32"; then
+      WITH_MINGW="yes"
+   fi
 fi
 
 dnl ===================================================================
@@ -1688,7 +1713,9 @@ if test "$cross_compiling" = "yes"; then
 	makefile.rc \
 	bin/repo-list.in | (cd $tmpdir && tar xf -)
   (
-    unset COM GUI GUIBASE OS CPU CPUNAME CC CXX CFLAGS PKG_CONFIG
+    unset COM GUI GUIBASE OS CPU CPUNAME
+    unset CC CXX CFLAGS
+    unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP
     test -n "$CC_FOR_BUILD" && export CC="$CC_FOR_BUILD"
     test -n "$CXX_FOR_BUILD" && export CXX="$CXX_FOR_BUILD"
     test -n "$PKG_CONFIG_FOR_BUILD" && export PKG_CONFIG="$PKG_CONFIG_FOR_BUILD"
@@ -2167,6 +2194,7 @@ AC_SUBST(PERL)
 dnl ===================================================================
 dnl Testing for required Perl modules
 dnl ===================================================================
+
 AC_MSG_CHECKING([for required Perl modules])
 if `$PERL -e 'use Archive::Zip;'`; then
     AC_MSG_RESULT([all modules found])
@@ -2335,16 +2363,17 @@ if test "$_os" = "WINNT"; then
 	AC_SUBST(LIBMGR_X64_BINARY)
 
     else
-        AC_MSG_CHECKING([the MinGW C++ Compiler])
-        if test `$CC -dumpmachine | $SED -e 's/^.*-//'` = "mingw32"; then
-            AC_MSG_RESULT([found.])
+        AC_MSG_CHECKING([the compiler is MinGW])
+        MACHINE_PREFIX=`$CC -dumpmachine`
+        if echo $MACHINE_PREFIX | grep -q mingw32; then
+            AC_MSG_RESULT([yes])
             if $CC -dumpspecs | grep -q "mno-cygwin"; then
                 USE_MINGW="cygwin"
             else
                 USE_MINGW="pure-mingw"
             fi
         else
-            AC_MSG_ERROR([MinGW C++ Compiler not found.])
+            AC_MSG_ERROR([Compiler is not MinGW.])
         fi
     fi
 fi
@@ -2352,6 +2381,32 @@ AC_SUBST(COMEX)
 AC_SUBST(MSPDB_PATH)
 AC_SUBST(USE_MINGW)
 
+if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
+
+   # If you use CC=/path/to/compiler/foo-gcc or even CC="ccache
+   # /path/to/compiler/foo-gcc" you need to set the AR etc env vars
+   # explicitly. Or put /path/to/compiler in PATH yourself.
+
+   AC_CHECK_TOOL(AR,ar)
+   AC_CHECK_TOOL(NM,nm)
+   AC_CHECK_TOOL(OBJDUMP,objdump)
+   AC_CHECK_TOOL(PKG_CONFIG,pkg-config)
+   AC_CHECK_TOOL(RANLIB,ranlib)
+   AC_CHECK_TOOL(STRIP,strip)
+   if test "$_os" = "WINNT"; then
+      AC_CHECK_TOOL(DLLTOOL,dlltool)
+      AC_CHECK_TOOL(WINDRES,windres)
+   fi
+fi
+AC_SUBST(AR)
+AC_SUBST(DLLTOOL)
+AC_SUBST(NM)
+AC_SUBST(OBJDUMP)
+AC_SUBST(PKG_CONFIG)
+AC_SUBST(RANLIB)
+AC_SUBST(STRIP)
+AC_SUBST(WINDRES)
+
 dnl ===================================================================
 dnl  .NET needs special treatment
 dnl (does the above comment really mean .NET, or is it misusing
@@ -2448,30 +2503,33 @@ if test "$build_os" = "cygwin"; then
 fi
 
 dnl ===================================================================
-dnl Check if stdc headers are available excluding Windows.
+dnl Check if stdc headers are available excluding MSVC.
 dnl ===================================================================
 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
    AC_HEADER_STDC
 fi
 
-dnl ===================================================================
-dnl Find pre-processors.
-dnl ===================================================================
 if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
+   dnl ===================================================================
+   dnl Find pre-processors.
+   dnl ===================================================================
+
    AC_PROG_CXXCPP
 
-dnl Check whether there's a C pre-processor.
-dnl ===================================================================
-dnl When using SunStudio compiler, there is a bug with the cc
-dnl preprocessor, so use CC preprocessor as the cc preprocessor
-dnl See Issuezilla #445.
-dnl ===================================================================
+   dnl Check whether there's a C pre-processor.
+   dnl ===================================================================
+   dnl When using SunStudio compiler, there is a bug with the cc
+   dnl preprocessor, so use CC preprocessor as the cc preprocessor
+   dnl See Issuezilla #445.
+   dnl ===================================================================
    if test "$_os" = "SunOS"; then
       CPP=$CXXCPP
    else
       AC_PROG_CPP
    fi
 
+   dnl Find integral type sizes and alignments
+
    AC_CHECK_SIZEOF(long)
    AC_CHECK_SIZEOF(short)
    AC_CHECK_SIZEOF(int)
@@ -3928,7 +3986,7 @@ dnl # Note that if there is a possibility the first call to
 dnl # PKG_CHECK_MODULES might not happen, you should be sure to include an
 dnl # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac
 dnl ===================================================================
-if test "$_os" != "WNT"; then
+if test "$_os" != "WINNT" -o "$WITH_MINGW" = "yes"; then
     PKG_PROG_PKG_CONFIG
 fi
 
@@ -3951,70 +4009,44 @@ dnl ===================================================================
 AC_MSG_CHECKING([whether to build the ODK])
 if test "z$enable_odk" = "z" -o "$enable_odk" != "no"; then
    AC_MSG_RESULT([yes])
+
    if test "$WITH_JAVA" != "no"; then
-   AC_MSG_CHECKING([whether to build unowinreg.dll])
-   if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
-        # build on Win by default
-        enable_build_unowinreg=yes
-   fi
-   if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
-      AC_MSG_RESULT([no])
-      BUILD_UNOWINREG=NO
-   else
-      AC_MSG_RESULT([yes])
-      BUILD_UNOWINREG=YES
-   fi
-   if test "$_os" != "WINNT" && test "$BUILD_UNOWINREG" = "YES"; then
-      if test -z "$WITH_MINGW" || test "$WITH_MINGW" = "0"; then
-         AC_MSG_ERROR([for rebuilding unowinreg.dll you need the MinGW C++ compiler.
-         Specify mingw32 g++ executable name with --with-mingw.
-         Or use prebuilt one from http://tools.openoffice.org/unowinreg_prebuild/680/ and
-         put it into external/unowinreg])
-      fi
-      if echo "$WITH_MINGW" | $EGREP -q "/"; then
-         if ! test -x "$WITH_MINGW"; then MINGWCXX=false; else MINGWCXX=`basename $WITH_MINGW`; fi
-      else
-         AC_CHECK_TOOL(MINGWCXX, $WITH_MINGW, false)
-      fi
-      if test "$MINGWCXX" = "false"; then
-         AC_MSG_ERROR(specified MinGW32 C++ cross-compiler not found. Install it or correct name.)
-      fi
-      AC_MSG_CHECKING(whether we are using the MinGW32 cross C++ compiler)
-      if ! echo "`$MINGWCXX -dumpmachine`" | grep -q mingw32; then
-         AC_MSG_ERROR(no)
-      else
-         AC_MSG_RESULT(yes)
+      AC_MSG_CHECKING([whether to build unowinreg.dll])
+      if test "$_os" = "WINNT" -a "z$enable_build_unowinreg" = "z" ; then
+           # build on Win by default
+           enable_build_unowinreg=yes
       fi
-      if echo "$WITH_MINGW" | $EGREP -q "/"; then
-         if ! test -x "`echo $WITH_MINGW | $SED -e s/[cg]++/strip/`"; then MINGWSTRIP=false; else MINGWSTRIP=$(basename $(echo $WITH_MINGW | $SED -e s/[cg]++/strip/)); fi
+      if test "z$enable_build_unowinreg" = "z" -o "$enable_build_unowinreg" = "no"; then
+         AC_MSG_RESULT([no])
+         BUILD_UNOWINREG=NO
       else
-         AC_CHECK_TOOL(MINGWSTRIP, `echo $WITH_MINGW | $SED -e s/[cg]++/strip/`, false)
-      fi
-      if test "$MINGWSTRIP" = "false"; then
-         AC_MSG_ERROR(MinGW32 binutils needed. Install them.)
+         AC_MSG_RESULT([yes])
+         BUILD_UNOWINREG=YES
       fi
-      AC_LANG_PUSH([C++])
-      save_CXX=$CXX
-      save_CXXCPP=$CXXCPP
-      CXX=$MINGWCXX
-      CXXCPP="$MINGWCXX -E"
-      save_CXXFLAGS=$CXXFLAGS
-      save_CPPFLAGS=$CPPFLAGS
-      CXXFLAGS="$CXXFLAGS -I$JAVA_HOME/include"
-      CPPFLAGS="$CPPFLAGS -I$JAVA_HOME/include"
-      # LIBS contains -lcrypt etc due to teh AC_CHECK_LIBS which obviously
-      # do not make sense here (and 'd make the check fail)
-      save_LIBS=$LIBS
-      LIBS=""
-      AC_HAVE_LIBRARY(kernel32)
-      AC_HAVE_LIBRARY(advapi32)
-      AC_CHECK_HEADER(windows.h, [], [AC_MSG_ERROR([windows.h missing])])
-      CXXFLAGS=$save_CXXFLAGS
-      CPPFLAGS=$save_CPPFLAGS
-      CXX=$save_CXX
-      CXXCPP=$save_CXXCPP
-      LIBS=$save_LIBS
-      AC_LANG_POP([C++])
+      if test "$_os" != "WINNT" -a "$BUILD_UNOWINREG" = "YES"; then
+         if test -z "$with_mingw_cross_compiler"; then
+            dnl Guess...
+            AC_CHECK_PROGS(MINGWCXX,i386-mingw32msvc-g++ i586-pc-mingw32-g++ i686-pc-mingw32-g++ i686-w64-mingw32-g++,false)
+         elif test -x "$with_mingw_cross_compiler"; then 
+             MINGWCXX="$with_mingw_cross_compiler"
+         else
+            AC_CHECK_TOOL(MINGWCXX, "$with_mingw_cross_compiler", false)
+         fi
+
+         if test "$MINGWCXX" = "false"; then
+            AC_MSG_ERROR([MinGW32 C++ cross-compiler not found.])
+         fi
+
+         mingwstrip_test="`echo $MINGWCXX | $SED -e s/g++/strip/`"
+         if test -x "$mingwstrip_test"; then
+            MINGWSTRIP="$mingwstrip_test"
+         else
+            AC_CHECK_TOOL(MINGWSTRIP, "$mingwstrip_test", false)
+         fi
+
+         if test "$MINGWSTRIP" = "false"; then
+            AC_MSG_ERROR(MinGW32 binutils not found.)
+         fi
       fi
    fi
    BUILD_TYPE="$BUILD_TYPE ODK"
diff --git a/set_soenv.in b/set_soenv.in
index 32ff542..f6602c7 100755
--- a/set_soenv.in
+++ b/set_soenv.in
@@ -1732,6 +1732,14 @@ ToFile( "COMP_ENV",          $COMP_ENV,          "e" );
 ToFile( "JAVAHOME",          $JAVAHOME,          "e" );
 ToFile( "CC",                $CC,                "e" );
 ToFile( "CROSS_COMPILING",   "@CROSS_COMPILING@","e" );
+ToFile( "AR",                "@AR@",             "e" );
+ToFile( "DLLTOOL",           "@DLLTOOL@",        "e" );
+ToFile( "NM",                "@NM@",             "e" );
+ToFile( "OBJDUMP",           "@OBJDUMP@",        "e" );
+ToFile( "PKG_CONFIG",        "@PKG_CONFIG@",     "e" );
+ToFile( "RANLIB",            "@RANLIB@",         "e" );
+ToFile( "STRIP",             "@STRIP@",          "e" );
+ToFile( "WINDRES",           "@WINDRES@",        "e" );
 ToFile( "BUILD_PLATFORM",    "@build@",          "e" );
 ToFile( "HOST_PLATFORM",     "@host@",           "e" );
 if ( '@CROSS_COMPILING@' ne '' )
diff --git a/solenv/inc/wntgcci.mk b/solenv/inc/wntgcci.mk
index b0cdddd..3f8dd7e 100644
--- a/solenv/inc/wntgcci.mk
+++ b/solenv/inc/wntgcci.mk
@@ -42,10 +42,6 @@ ARCH_FLAGS*=-march=pentium
 
 CC*=i686-w64-mingw32-gcc
 CXX*=i686-w64-mingw32-g++
-NM*=i686-w64-mingw32-nm
-AR*=i686-w64-mingw32-ar
-WINDRES*=i686-w64-mingw32-windres -v
-DLLTOOL*=i686-w64-mingw32-dlltool
 
 CFLAGS+=-fmessage-length=0 -c
 


More information about the Libreoffice-commits mailing list