]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/win32/build-win32-cross-tools
Fix some trivial errors and implemented the restore of IRIX xattrs.
[bacula/bacula] / bacula / src / win32 / build-win32-cross-tools
index f979b7b531c2f57745275c234e7aa34ba701e529..9d05f88de9e6eb9e87bc385831f7a3f8b8ec4ec4 100755 (executable)
 
 # Directory where cross-tools directory will be placed
 TOPDIR=../../..
+TOPDIR=${DEPKGS:-${TOPDIR}}
 # Cross tools directory name under TOPDIR
 CROSSTOOLS=cross-tools
 # What flavor of GCC cross-compiler are we building? under CROSSTOOLS
 TARGET=mingw32
 
 cwd=`pwd`
+
 cd ${TOPDIR}
 # Make TOPDIR absolute 
 TOPDIR=`pwd`
-BUILDDIR=${TOPDIR}/${CROSSTOOLS}
+TOPDIR=${DEPKGS:-${TOPDIR}}
+
+cd ${cwd}/`dirname $0`
+SCRIPTDIR=`pwd`
 
 cd ${cwd}
 
+BUILDDIR=${TOPDIR}/${CROSSTOOLS}
+
 # Where does the cross-compiler go?
 # This should be the directory into which your cross-compiler
 # will be installed.  Remember that if you set this to a directory
@@ -80,7 +87,8 @@ PURGE_DIR="Y"
 # You need to set both the URL they will be downloaded from
 # and the exact name of the individual component files.
 
-MINGW_URL="http://heanet.dl.sourceforge.net/sourceforge/mingw"
+#MINGW_URL="http://superb-west.dl.sourceforge.net/sourceforge/mingw"
+MINGW_URL="http://www.bacula.org/cross-tools"
 
 # GCC_CORE is required; the other components are optional.
 # Set any you don't want to "".  You need binutils,
@@ -99,16 +107,19 @@ GCC_PATCH=""
 # GCC_JAVA_ARCHIVE="gcc-java-3.4.2-20040916-1-src.tar.gz"
 
 BINUTILS_ARCHIVE="binutils-2.16.91-20060119-1-src.tar.gz"
+BINUTILS_PATCH="binutils_texinfo_version.patch"
 
 MINGW_ARCHIVE="mingw-runtime-3.9.tar.gz"
 
 W32API_ARCHIVE="w32api-3.7.tar.gz"
 
+MINGW_UTILS_ARCHIVE="mingw-utils-0.3-src.tar.gz"
 
 # These are the files from the SDL website
 # These are optional, set them to "" if you don't want them)
 
-SDL_URL="http://www.libsdl.org/extras/win32/common"
+#SDL_URL="http://www.libsdl.org/extras/win32/common"
+SDL_URL="http://www.bacula.org/cross-tools"
 
 OPENGL_ARCHIVE="opengl-devel.tar.gz"
 DIRECTX_ARCHIVE="directx-devel.tar.gz"
@@ -154,7 +165,7 @@ PATH="$PREFIX/bin:$PATH"
 #-----------------------------------------------------
 
 
-function download_files
+download_files()
 {
         # Download a file from a given url, only if it is not present
         mkdir -p "$SRCDIR"
@@ -185,6 +196,10 @@ function download_files
         download_file "$MINGW_ARCHIVE" "$MINGW_URL"
         download_file "$W32API_ARCHIVE" "$MINGW_URL"
 
+        if [ "x$MINGW_UTILS_ARCHIVE" != "x" ]; then
+                download_file "$MINGW_UTILS_ARCHIVE" "$MINGW_URL"
+        fi
+
         if [ "x$OPENGL_ARCHIVE" != "x" ]; then
                 download_file "$OPENGL_ARCHIVE" "$SDL_URL"
         fi
@@ -194,7 +209,7 @@ function download_files
 }
 
 
-function download_file
+download_file()
 {
         cd "$SRCDIR"
         if test ! -f $1 ; then
@@ -211,7 +226,7 @@ function download_file
 }
 
 
-function purge_existing_install
+purge_existing_install()
 {
         echo "Purging the existing files in $PREFIX"
         if cd "$PREFIX"; then
@@ -221,7 +236,7 @@ function purge_existing_install
 }
 
 
-function install_libs
+install_libs()
 {
         echo "Installing cross libs and includes"
         mkdir -p "$PREFIX/$TARGET"
@@ -242,7 +257,7 @@ function install_libs
 }
 
 
-function extract_binutils
+extract_binutils()
 {
         cd "$SRCDIR"
         BINUTILS=`tar -tzf "$SRCDIR/$BINUTILS_ARCHIVE" | head -n 1`
@@ -254,8 +269,18 @@ function extract_binutils
         cd "$BUILDDIR"
 }
 
+patch_binutils()
+{
+        if [ "$BINUTILS_PATCH" != "" ]; then
+                echo "Patching binutils"
+                cd "$SRCDIR/$BINUTILS"
+                patch -p1 < "${cwd}/patches/$BINUTILS_PATCH"
+                cd "$BUILDDIR"
+        fi
+}
+
 
-function configure_binutils
+configure_binutils()
 {
         cd "$BUILDDIR"
         rm -rf "binutils-$TARGET"
@@ -263,16 +288,16 @@ function configure_binutils
         cd "binutils-$TARGET"
         echo "Configuring binutils"
         "$SRCDIR/$BINUTILS/configure" --prefix="$PREFIX" --target=$TARGET --disable-nls \
-                --with-gcc --with-gnu-as --with-gnu-ld --disable-shared &> configure.log
+                --with-gcc --with-gnu-as --with-gnu-ld --disable-shared 2>&1 > configure.log
         cd "$BUILDDIR"
 }
 
 
-function build_binutils
+build_binutils()
 {
         cd "$BUILDDIR/binutils-$TARGET"
         echo "Building binutils"
-        make CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" &> make.log
+        make CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" 2>&1 > make.log
         if test $? -ne 0; then
                 echo "make of binutils failed - log available: binutils-$TARGET/make.log"
                 exit 1
@@ -281,11 +306,11 @@ function build_binutils
 }
 
 
-function install_binutils
+install_binutils()
 {
         cd "$BUILDDIR/binutils-$TARGET"
         echo "Installing binutils"
-        make install &> make-install.log
+        make install 2>&1 > make-install.log
         if test $? -ne 0; then
                 echo "install of binutils failed - log available: binutils-$TARGET/make-install.log"
                 exit 1
@@ -294,7 +319,7 @@ function install_binutils
 }
 
 
-function extract_gcc
+extract_gcc()
 {
         cd "$SRCDIR"
         GCC=`tar -tzf "$SRCDIR/$GCC_CORE_ARCHIVE" | head -n 1`
@@ -326,7 +351,7 @@ function extract_gcc
 }
 
 
-function patch_gcc
+patch_gcc()
 {
         if [ "$GCC_PATCH" != "" ]; then
                 echo "Patching gcc"
@@ -337,7 +362,7 @@ function patch_gcc
 }
 
 
-function configure_gcc
+configure_gcc()
 {
         cd "$BUILDDIR"
         rm -rf "gcc-$TARGET"
@@ -352,23 +377,23 @@ function configure_gcc
                 --disable-win32-registry --disable-shared --enable-sjlj-exceptions --enable-libgcj \
                 --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug \
                 --enable-interpreter --enable-hash-synchronization --enable-libstdcxx-debug \
-                &> configure.log
+                2>&1 > configure.log
         cd "$BUILDDIR"
 }
 
 
-function build_gcc
+build_gcc()
 {
         cd "$BUILDDIR/gcc-$TARGET"
         echo "Building gcc"
-        make CFLAGS="-O2" CXXFLAGS="-O2" GCJFLAGS="-O2" LDFLAGS="-s" DEBUG_FLAGS="-g0" &> make.log
+        make CFLAGS="-O2" CXXFLAGS="-O2" GCJFLAGS="-O2" LDFLAGS="-s" DEBUG_FLAGS="-g0" 2>&1 > make.log
         if test $? -ne 0; then
                 echo "make of gcc failed - log available: gcc-$TARGET/make.log"
                 exit 1
         fi
         if [ "x$GCC_ADA" != "x" ]; then
                 cd gcc
-                make "CFLAGS=-O2" "LDFLAGS=-s" gnatlib_and_tools &> make-gnatlib.log
+                make "CFLAGS=-O2" "LDFLAGS=-s" gnatlib_and_tools 2>&1 > make-gnatlib.log
                 if test $? -ne 0; then
                         echo "make of gnatlib and tools failed - log available: gcc-$TARGET/make-gnatlib.log"
                         exit 1
@@ -378,11 +403,11 @@ function build_gcc
 }
 
 
-function install_gcc
+install_gcc()
 {
         cd "$BUILDDIR/gcc-$TARGET"
         echo "Installing gcc"
-        make install &> make-install.log
+        make install 2>&1 > make-install.log
         if test $? -ne 0; then
                 echo "install of gcc failed - log available: gcc-$TARGET/make-install.log"
                 exit 1
@@ -391,7 +416,68 @@ function install_gcc
 }
 
 
-function final_tweaks
+extract_mingw_utils()
+{
+        cd "$SRCDIR"
+        MINGW_UTILS=`tar -tzf "$SRCDIR/$MINGW_UTILS_ARCHIVE" | head -n 1`
+        if [ "x${MINGW_UTILS}" != "x./" ]; then
+           rm -rf "$MINGW_UTILS"
+        fi
+        echo "Extracting mingw-utils"
+        tar -xzf "$SRCDIR/$MINGW_UTILS_ARCHIVE"
+        cd "$BUILDDIR"
+}
+
+
+patch_mingw_utils()
+{
+        MINGW_UTILS=`tar -tzf "$SRCDIR/$MINGW_UTILS_ARCHIVE" | head -n 1`
+        cd "${SRCDIR}/${MINGW_UTILS}"
+        echo "Patching mingw-utils"
+        patch -p0 < ${SCRIPTDIR}/patches/mingw-utils.patch 2>&1 > patch.log
+        cd "$BUILDDIR"
+}
+
+
+configure_mingw_utils()
+{
+        cd "$BUILDDIR"
+        rm -rf "mingw-utils"
+        mkdir "mingw-utils"
+        cd "mingw-utils"
+        echo "Configuring mingw-utils"
+        "$SRCDIR/$MINGW_UTILS/configure" --disable-nonportable --prefix="${PREFIX}/${TARGET}" 2>&1 > configure.log
+        cd "$BUILDDIR"
+}
+
+
+build_mingw_utils()
+{
+        cd "$BUILDDIR/mingw-utils"
+        echo "Building mingw-utils"
+        make CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" 2>&1 > make.log
+        if test $? -ne 0; then
+                echo "make of mingw-utils failed - log available: mingw-utils/make.log"
+                exit 1
+        fi
+        cd "$BUILDDIR"
+}
+
+
+install_mingw_utils()
+{
+        cd "$BUILDDIR/mingw-utils"
+        echo "Installing mingw-utils"
+        make install 2>&1 > make-install.log
+        if test $? -ne 0; then
+                echo "install of mingw-utils failed - log available: mingw-utils/make-install.log"
+                exit 1
+        fi
+        cd "$BUILDDIR"
+}
+
+
+final_tweaks()
 {
         echo "Finalizing installation"
 
@@ -402,6 +488,9 @@ function final_tweaks
         if [ ! -f "$PREFIX/$TARGET/bin/objdump" ]; then
                 ln "$PREFIX/bin/$TARGET-objdump" "$PREFIX/$TARGET/bin/objdump"
         fi
+        if [ ! -f "$PREFIX/$TARGET/bin/dllwrap" ]; then
+                ln "$PREFIX/bin/$TARGET-dllwrap" "$PREFIX/$TARGET/bin/dllwrap"
+        fi
 
         # make cc and c++ symlinks to gcc and g++
         if [ ! -f "$PREFIX/$TARGET/bin/g++" ]; then
@@ -438,6 +527,7 @@ fi
 install_libs
 
 extract_binutils
+patch_binutils
 configure_binutils
 build_binutils
 install_binutils
@@ -448,6 +538,14 @@ configure_gcc
 build_gcc
 install_gcc
 
+if test -n "${MINGW_UTILS_ARCHIVE}"; then
+        extract_mingw_utils
+        patch_mingw_utils
+        configure_mingw_utils
+        build_mingw_utils
+        install_mingw_utils
+fi
+
 final_tweaks