diff --git a/packaging/win32/README b/packaging/win32/README index 4140befd6b..7761bd3d24 100644 --- a/packaging/win32/README +++ b/packaging/win32/README @@ -1,8 +1,12 @@ These scripts try to download and install a Windows/mingw32 build -environment for GnuCash on Windows. +environment for GnuCash on Windows. -For cross-compiling the windows executable on Linux, see the lower -section of this file. +These scripts support two ways to build a Windows/mingw32 version of GnuCash: +- directly on a Windows PC +- via cross-compilation on Linux + +1. Build GnuCash directly on a Windows PC +----------------------------------------- Before you start with the automated build, you have to complete these steps manually. The directory variables are set in `defaults.sh' and optionally @@ -59,7 +63,8 @@ completed: More information is collected on http://wiki.gnucash.org/wiki/Windows --------------------------- +2. Cross-compile GnuCash/win32 on a linux PC +-------------------------------------------- Cross-compiling a Windows/mingw32 executable of GnuCash on a Linux host system. (Note: This used to work unchangedly in Sept'2006 but @@ -67,19 +72,21 @@ probably not any longer.) These steps need to be performed: -1. Edit the file create_cross_mingw.sh and set the PREFIX= variable to - the preferred prefix of the mingw32 gcc/binutils on your - Linux. (It is strongly recommended to choose a different prefix - than your normal compiler tool chain in order to distinguish - your native vs. cross compiler more easily.) Then run the - script create_cross_mingw.sh - it will - download, compile, and install a mingw32 toolchain. +1. Look at defaults.sh and create a file named custom.sh to specify adapted + directory variables. If you want verbose output of any script + step, add "set -x" to that file. Particularly for cross-compiling, + set these variables: + * cross_compile: should be set to yes + * GLOBAL_DIR: the base directory for all other directory definitions, + unless you explicitly override it for some directories. + * MINGW_DIR: set this to your preferred prefix of the mingw32 gcc/binutils + on your Linux installation. + (It is strongly recommended to choose a prefix different + from your normal compiler tool chain in order to distinguish + your native vs. cross compiler more easily.) -2. Edit the file defaults.sh: Make a global search-and-replace of - '\\' into '/' so that all directories are specified in unix - conventions. Set the variable cross_compile to "yes". Then - adjust the directories in defaults.sh according to your - preferred installation, especially $GLOBAL_DIR. +2. Then run the script create_cross_mingw.sh - it will + download, compile, and install a mingw32 tool chain. 3. Download a binary windows packages for "guile" e.g. from http://www.tu-harburg.de/~et2cs/gnc/ and unpack it into the @@ -87,7 +94,7 @@ These steps need to be performed: the build system for guile doesn't support cross-compiling.) 4. Call install.sh, which will read the directory settings from - defaults.sh. It should download, compile, and install everything + defaults.sh/custom.sh. It should download, compile, and install everything automatically. Eventually the windows gnucash is installed into $GNUCASH_DIR. diff --git a/packaging/win32/create_cross_mingw.sh b/packaging/win32/create_cross_mingw.sh index ecfa971fb6..7cda3b4e08 100755 --- a/packaging/win32/create_cross_mingw.sh +++ b/packaging/win32/create_cross_mingw.sh @@ -41,92 +41,6 @@ qpushd "$(dirname "$0")" # # Updated by Igor Mikolic-Torreira - - -#----------------------------------------------------- -# -# BEGIN USER SETTINGS -# -# You need to review and adjust the macros that follow -# -#----------------------------------------------------- - - -# What flavor of GCC cross-compiler are we building? - -TARGET=${TARGET:-mingw32} - -# What directory will the cross-compiler be built in? -# This is the directory into which source archives will -# be downloaded, expanded, compiled, etc. You need to -# have write-access to this directory. If you leave it -# blank, it defaults to the current directory. - -BUILDDIR=`unix_path $TMP_DIR` - -# 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 -# that only root has write access to, you will need to run this -# script as root. - -_PREFIX=`unix_path $MINGW_DIR` -PREFIX=${PREFIX:-$_PREFIX} - -# Purge anything and everything already in the $PREFIX -#(also known as the destination or installation) directory? -# Set to "Y" to purge, any other value omits the purge step. - -PURGE_DIR=${PURGE_DIR:-N} - - -# Set the following to the files from the current MinGW release -# (or whichever MinGW release you wish to build and install) -# 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" - -# GCC_CORE is required; the other components are optional. -# Set any you don't want to "". You need binutils, -# mingw runtime and w32api; do not ever set those to "". -# gcc 3.4.5-20060117-3 is the same source of 3.4.5-20060117-2 -# see release notes -GCC_CORE_ARCHIVE="gcc-core-3.4.5-20060117-2-src.tar.gz" -GCC_GPP_ARCHIVE="gcc-g++-3.4.5-20060117-2-src.tar.gz" -GCC_G77_ARCHIVE="" #gcc-g77-3.4.5-20060117-1-src.tar.gz" -GCC_OBJC_ARCHIVE="" #gcc-objc-3.4.5-20060117-1-src.tar.gz" -GCC_JAVA_ARCHIVE="" #gcc-java-3.4.5-20060117-1-src.tar.gz" -GCC_ADA_ARCHIVE="" -GCC_PATCH="" - -BINUTILS_ARCHIVE="binutils-2.20.1-src.tar.gz" - -MINGW_ARCHIVE="mingwrt-3.15.1-mingw32.tar.gz" - -W32API_ARCHIVE="w32api-3.13-mingw32-dev.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" - -OPENGL_ARCHIVE="" #opengl-devel.tar.gz" -DIRECTX_ARCHIVE="" #directx-devel.tar.gz" - - - -#----------------------------------------------------- -# -# END USER SETTINGS -# -# The remainder of the script should not neet any edits -# -#----------------------------------------------------- - - - # Make sure these are initialized as we want them GCC_CORE="" @@ -136,17 +50,32 @@ GCC_LANGS="c" # Set our build directory and where our sources will go -if [ "x$BUILDDIR" = "x" ]; then - # Default to the current directory - BUILDDIR=$(pwd) +if [ "x$XC_BUILD_DIR" = "x" ]; then + # Default to the current directory + XC_BUILD_DIR=$(pwd) fi -SRCDIR="$BUILDDIR/source" +SRCDIR="$XC_BUILD_DIR/source" # Need install directory first on the path so gcc can find binutils PATH="$PREFIX/bin:$PATH" +# Prepare directories used by download function + +DOWNLOAD_UDIR=`unix_path $DOWNLOAD_DIR` +TMP_UDIR=`unix_path $TMP_DIR` +mkdir -p "$TMP_UDIR" +mkdir -p "$DOWNLOAD_UDIR" +mkdir -p "$SRCDIR" + +# Make sure wget is installed +if test "x`which wget`" = "x" ; then + echo "You need to install wget." + exit 1 +fi + +qpushd "$XC_BUILD_DIR" #----------------------------------------------------- @@ -156,270 +85,201 @@ PATH="$PREFIX/bin:$PATH" #----------------------------------------------------- -function download_files -{ - # Download a file from a given url, only if it is not present - mkdir -p "$SRCDIR" - - # Make sure wget is installed - if test "x`which wget`" = "x" ; then - echo "You need to install wget." - exit 1 - fi - download_file "$GCC_CORE_ARCHIVE" "$MINGW_URL" - if [ "x$GCC_GPP_ARCHIVE" != "x" ]; then - download_file "$GCC_GPP_ARCHIVE" "$MINGW_URL" - fi - if [ "x$GCC_G77_ARCHIVE" != "x" ]; then - download_file "$GCC_G77_ARCHIVE" "$MINGW_URL" - fi - if [ "x$GCC_OBJC_ARCHIVE" != "x" ]; then - download_file "$GCC_OBJC_ARCHIVE" "$MINGW_URL" - fi - if [ "x$GCC_JAVA_ARCHIVE" != "x" ]; then - download_file "$GCC_JAVA_ARCHIVE" "$MINGW_URL" - fi - if [ "x$GCC_ADA_ARCHIVE" != "x" ]; then - download_file "$GCC_ADA_ARCHIVE" "$MINGW_URL" - fi - - download_file "$BINUTILS_ARCHIVE" "$MINGW_URL" - download_file "$MINGW_ARCHIVE" "$MINGW_URL" - download_file "$W32API_ARCHIVE" "$MINGW_URL" - - if [ "x$OPENGL_ARCHIVE" != "x" ]; then - download_file "$OPENGL_ARCHIVE" "$SDL_URL" - fi - if [ "x$DIRECTX_ARCHIVE" != "x" ]; then - download_file "$DIRECTX_ARCHIVE" "$SDL_URL" - fi -} - - -function download_file -{ - cd "$SRCDIR" - if test ! -f $1 ; then - echo "Downloading $1" - wget "$2/$1" - if test ! -f $1 ; then - echo "Could not download $1" - exit 1 - fi - else - echo "Found $1 in the srcdir $SRCDIR" - fi - cd "$BUILDDIR" -} - - function purge_existing_install { - echo "Purging the existing files in $PREFIX" - if cd "$PREFIX"; then - rm -rf * - fi - cd "$BUILDDIR" + echo "Purging the existing files in $PREFIX" + mkdir -p "$PREFIX" + if cd "$PREFIX"; then + rm -rf * + fi + cd "$XC_BUILD_DIR" } function install_libs { - echo "Installing cross libs and includes" - mkdir -p "$PREFIX/$TARGET" - cd "$PREFIX/$TARGET" + echo "Installing cross libs and includes" + mkdir -p "$PREFIX/$TARGET" - tar -xzf "$SRCDIR/$MINGW_ARCHIVE" - tar -xzf "$SRCDIR/$W32API_ARCHIVE" + wget_unpacked "$MINGW_RT_URL" "$DOWNLOAD_DIR" "$PREFIX/$TARGET" + wget_unpacked "$W32API_URL" "$DOWNLOAD_DIR" "$PREFIX/$TARGET" - if [ "x$OPENGL_ARCHIVE" != "x" ]; then - tar -xzf "$SRCDIR/$OPENGL_ARCHIVE" - fi - - if [ "x$DIRECTX_ARCHIVE" != "x" ]; then - tar -xzf "$SRCDIR/$DIRECTX_ARCHIVE" - fi - - cd "$BUILDDIR" -} - - -function extract_binutils -{ - cd "$SRCDIR" - BINUTILS=`tar -tzf "$SRCDIR/$BINUTILS_ARCHIVE" | head -n 1` - rm -rf "$BINUTILS" - echo "Extracting binutils" - tar -xzf "$SRCDIR/$BINUTILS_ARCHIVE" - cd "$BUILDDIR" -} - - -function configure_binutils -{ - cd "$BUILDDIR" - rm -rf "binutils-$TARGET" - mkdir "binutils-$TARGET" - 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 - cd "$BUILDDIR" -} - - -function build_binutils -{ - cd "$BUILDDIR/binutils-$TARGET" - echo "Building binutils" - make CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" &> make.log - if test $? -ne 0; then - echo "make of binutils failed - log available: binutils-$TARGET/make.log" - exit 1 - fi - cd "$BUILDDIR" + if [ "x$OPENGL_URL" != "x" ]; then + wget_unpacked "$GCC_OPENGL_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + if [ "x$DIRECTX_URL" != "x" ]; then + wget_unpacked "$GCC_DIRECTX_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi } function install_binutils { - cd "$BUILDDIR/binutils-$TARGET" - echo "Installing binutils" + setup " binutils (cross-compile)" + + if quiet $PREFIX/bin/$TARGET-ld --version + then + echo "binutils already installed. skipping." + else + wget_unpacked "$BINUTILS_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + BINUTILS_SRC_DIR=$_EXTRACT_UDIR + + BINUTILS_BUILD_DIR="$XC_BUILD_DIR/binutils-$TARGET" + rm -rf "$BINUTILS_BUILD_DIR" + mkdir "$BINUTILS_BUILD_DIR" + qpushd "$BINUTILS_BUILD_DIR" + + echo -n "Configuring ... " + "$BINUTILS_SRC_DIR/configure" --prefix="$PREFIX" --target=$TARGET --disable-nls \ + --with-gcc --with-gnu-as --with-gnu-ld --disable-shared &> configure.log + echo done + + echo -n "Building ... " + make CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" &> make.log + if test $? -ne 0; then + echo "failed - log available: $BINUTILS_BUILD_DIR/make.log" + exit 1 + fi + echo done + + echo -n "Installing ... " make install &> make-install.log if test $? -ne 0; then - echo "install of binutils failed - log available: binutils-$TARGET/make-install.log" - exit 1 + echo "failed - log available: $BINUTILS_BUILD_DIR/make-install.log" + exit 1 fi - cd "$BUILDDIR" -} + echo done - -function extract_gcc -{ - cd "$SRCDIR" - GCC=`tar -tzf "$SRCDIR/$GCC_CORE_ARCHIVE" | head -n 1` - rm -rf "$GCC" - echo "Extracting gcc" - tar -xzf "$SRCDIR/$GCC_CORE_ARCHIVE" - if [ "x$GCC_GPP_ARCHIVE" != "x" ]; then - GCC_LANGS=${GCC_LANGS}",c++" - tar -xzf "$SRCDIR/$GCC_GPP_ARCHIVE" - fi - if [ "x$GCC_G77_ARCHIVE" != "x" ]; then - GCC_LANGS=${GCC_LANGS}",f77" - tar -xzf "$SRCDIR/$GCC_G77_ARCHIVE" - fi - if [ "x$GCC_OBJC_ARCHIVE" != "x" ]; then - GCC_LANGS=${GCC_LANGS}",objc" - tar -xzf "$SRCDIR/$GCC_OBJC_ARCHIVE" - fi - if [ "x$GCC_JAVA_ARCHIVE" != "x" ]; then - GCC_LANGS=${GCC_LANGS}",java" - tar -xzf "$SRCDIR/$GCC_JAVA_ARCHIVE" - fi - if [ "x$GCC_ADA_ARCHIVE" != "x" ]; then - GCC_LANGS=${GCC_LANGS}",ada" - tar -xzf "$SRCDIR/$GCC_ADA_ARCHIVE" - fi - cd "$BUILDDIR" -} - - -function patch_gcc -{ - if [ "$GCC_PATCH" != "" ]; then - echo "Patching gcc" - cd "$SRCDIR/$GCC" - patch -p1 < "$SRCDIR/$GCC_PATCH" - cd "$BUILDDIR" - fi -} - - -function configure_gcc -{ - cd "$BUILDDIR" - rm -rf "gcc-$TARGET" - mkdir "gcc-$TARGET" - cd "gcc-$TARGET" - echo "Configuring gcc" - "$SRCDIR/$GCC/configure" -v \ - --prefix="$PREFIX" --target=$TARGET \ - --with-headers="$PREFIX/$TARGET/include" \ - --with-gcc --with-gnu-ld --with-gnu-as \ - --enable-threads --disable-nls --enable-languages=$GCC_LANGS \ - --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 - cd "$BUILDDIR" -} - - -function build_gcc -{ - cd "$BUILDDIR/gcc-$TARGET" - echo "Building gcc" - make CFLAGS="-O2" CXXFLAGS="-O2" GCJFLAGS="-O2" LDFLAGS="-s" DEBUG_FLAGS="-g0" &> 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 - if test $? -ne 0; then - echo "make of gnatlib and tools failed - log available: gcc-$TARGET/make-gnatlib.log" - exit 1 - fi - fi - cd "$BUILDDIR" + qpopd + fi } function install_gcc { - cd "$BUILDDIR/gcc-$TARGET" - echo "Installing gcc" + setup " gcc (cross-compile)" + + if quiet $PREFIX/bin/$TARGET-g++ --version + then + echo "gcc already installed. skipping." + else + # Filename doesn't match expanded directory, let's fix that + TARGET_FILE=${GCC_CORE_SRC_URL##*/} + TARGET_FILE=${TARGET_FILE/-core-/-} + wget_unpacked "$GCC_CORE_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" $TARGET_FILE + GCC_SRC_DIR=$_EXTRACT_UDIR + + if [ "x$GCC_GPP_SRC_URL" != "x" ]; then + GCC_LANGS=${GCC_LANGS}",c++" + wget_unpacked "$GCC_GPP_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + if [ "x$GCC_G77_SRC_URL" != "x" ]; then + GCC_LANGS=${GCC_LANGS}",f77" + wget_unpacked "$GCC_G77_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + if [ "x$GCC_OBJC_SRC_URL" != "x" ]; then + GCC_LANGS=${GCC_LANGS}",objc" + wget_unpacked "$GCC_OBJC_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + if [ "x$GCC_JAVA_SRC_URL" != "x" ]; then + GCC_LANGS=${GCC_LANGS}",java" + wget_unpacked "$GCC_JAVA_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + if [ "x$GCC_ADA_SRC_URL" != "x" ]; then + GCC_LANGS=${GCC_LANGS}",ada" + wget_unpacked "$GCC_ADA_SRC_URL" "$DOWNLOAD_DIR" "$SRCDIR" + fi + + if [ "$GCC_PATCH" != "" ]; then + echo -n "Patching ... " + qpushd "$GCC_SRC_DIR" + patch -p1 < "$SRCDIR/$GCC_PATCH" + qpopd + echo done + fi + + GCC_BUILD_DIR="$XC_BUILD_DIR/gcc-$TARGET" + rm -rf "$GCC_BUILD_DIR" + mkdir "$GCC_BUILD_DIR" + qpushd "$GCC_BUILD_DIR" + + echo -n "Configuring ... " + "$GCC_SRC_DIR/configure" -v \ + --prefix="$PREFIX" --target=$TARGET \ + --with-headers="$PREFIX/$TARGET/include" \ + --with-gcc --with-gnu-ld --with-gnu-as \ + --enable-threads --disable-nls --enable-languages=$GCC_LANGS \ + --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 + echo done + + echo -n "Building ... " + make CFLAGS="-O2" CXXFLAGS="-O2" GCJFLAGS="-O2" LDFLAGS="-s" DEBUG_FLAGS="-g0" &> make.log + if test $? -ne 0; then + echo "failed - log available: $GCC_BUILD_DIR/make.log" + exit 1 + fi + echo done + + # 2010-04-28 I doubt the code below is ever called. GCC_ADA is never defined + # Should this be GCC_ADA_SRC_URL ? + if [ "x$GCC_ADA" != "x" ]; then + qpushd gcc + echo -n "Building gnatlib ... " + make "CFLAGS=-O2" "LDFLAGS=-s" gnatlib_and_tools &> make-gnatlib.log + if test $? -ne 0; then + echo "failed - log available: $GCC_BUILD_DIR/gcc/make-gnatlib.log" + exit 1 + fi + echo done + qpopd + fi + + echo "Installing ... " make install &> make-install.log if test $? -ne 0; then - echo "install of gcc failed - log available: gcc-$TARGET/make-install.log" - exit 1 + echo "failed - log available: $GCC_BUILD_DIR/make-install.log" + exit 1 fi - cd "$BUILDDIR" + echo done + + qpopd + fi } function final_tweaks { - echo "Finalizing installation" + echo "Finalizing installation" - # remove gcc build headers - rm -rf "$PREFIX/$TARGET/sys-include" + # remove gcc build headers + rm -rf "$PREFIX/$TARGET/sys-include" - # Add extra binary links - if [ ! -f "$PREFIX/$TARGET/bin/objdump" ]; then - ln "$PREFIX/bin/$TARGET-objdump" "$PREFIX/$TARGET/bin/objdump" - fi + # Add extra binary links + if [ ! -f "$PREFIX/$TARGET/bin/objdump" ]; then + ln "$PREFIX/bin/$TARGET-objdump" "$PREFIX/$TARGET/bin/objdump" + fi - # make cc and c++ symlinks to gcc and g++ - if [ ! -f "$PREFIX/$TARGET/bin/g++" ]; then - ln "$PREFIX/bin/$TARGET-g++" "$PREFIX/$TARGET/bin/g++" - fi - if [ ! -f "$PREFIX/$TARGET/bin/cc" ]; then - ln -s "gcc" "$PREFIX/$TARGET/bin/cc" - fi - if [ ! -f "$PREFIX/$TARGET/bin/c++" ]; then - ln -s "g++" "$PREFIX/$TARGET/bin/c++" - fi + # make cc and c++ symlinks to gcc and g++ + if [ ! -f "$PREFIX/$TARGET/bin/g++" ]; then + ln "$PREFIX/bin/$TARGET-g++" "$PREFIX/$TARGET/bin/g++" + fi + if [ ! -f "$PREFIX/$TARGET/bin/cc" ]; then + ln -s "gcc" "$PREFIX/$TARGET/bin/cc" + fi + if [ ! -f "$PREFIX/$TARGET/bin/c++" ]; then + ln -s "g++" "$PREFIX/$TARGET/bin/c++" + fi - # strip all the binaries - ls "$PREFIX"/bin/* "$PREFIX/$TARGET"/bin/* | egrep -v '.dll$' | egrep -v 'gccbug$' | - while read file; do - strip "$file" - done + # strip all the binaries + ls "$PREFIX"/bin/* "$PREFIX/$TARGET"/bin/* | egrep -v '.dll$' | egrep -v 'gccbug$' | + while read file; do + strip "$file" + done - echo "Installation complete!" + echo "Installation complete!" } @@ -427,29 +287,15 @@ function final_tweaks # # Main part of the script # - -download_files - -if [ "x$PURGE_DIR" = "xY" ]; then - purge_existing_install +if [ "x$PURGE_DIR" = "xyes" ]; then + purge_existing_install fi install_libs - -extract_binutils -configure_binutils -build_binutils install_binutils - -extract_gcc -patch_gcc -configure_gcc -build_gcc install_gcc - final_tweaks - # # End # diff --git a/packaging/win32/defaults.sh b/packaging/win32/defaults.sh index 0197833c18..e074d0aeb1 100644 --- a/packaging/win32/defaults.sh +++ b/packaging/win32/defaults.sh @@ -75,20 +75,9 @@ set_default CUTECASH_BUILD_DIR $GNUCASH_DIR\\build-cutecash #### -set_default LD ld -set_default CC gcc -set_default DLLTOOL dlltool -set_default RANLIB ranlib - # For cross-compiling, change this to "yes" set_default CROSS_COMPILE "no" -if [ "$CROSS_COMPILE" = yes ]; then - # Insert your cross-compiler mingw32 bin-directories here - set_default HOST_XCOMPILE "--host=mingw32" -fi -#### - # If "yes", build without optimizations (-O0) and ease debugging set_default DISABLE_OPTIMIZATIONS no @@ -108,14 +97,75 @@ set_default GNOME_WIN32_DEPS_URL "$GNOME_WIN32_URL/dependencies" set_default DTK_URL "$SF_MIRROR/mingw/msysDTK-1.0.1.exe" set_default M4_URL "$SF_MIRROR/mingw/m4-1.4.7-MSYS.tar.bz2" -set_default BINUTILS_URL "$SF_MIRROR/mingw/binutils-2.19-mingw32-bin.tar.gz" -set_default GCC_CORE_URL "$SF_MIRROR/mingw/gcc-core-3.4.5-20060117-3.tar.gz" -set_default GCC_GPP_URL "$SF_MIRROR/mingw/gcc-g++-3.4.5-20060117-3.tar.gz" set_default MINGW_RT_URL "$SF_MIRROR/mingw/mingwrt-3.15.1-mingw32.tar.gz" set_default W32API_URL "$SF_MIRROR/mingw/w32api-3.13-mingw32-dev.tar.gz" set_default MINGW_MAKE_URL "$SF_MIRROR/mingw/mingw32-make-3.81-20080326-3.tar.gz" set_default MINGW_DIR $GLOBAL_DIR\\mingw +if [ "$CROSS_COMPILE" != yes ]; then + # Use native toolchain + set_default LD ld + set_default CC gcc + set_default DLLTOOL dlltool + set_default RANLIB ranlib + + # For native build on Windows we can use precompiled binaries + set_default BINUTILS_URL "$SF_MIRROR/mingw/binutils-2.19-mingw32-bin.tar.gz" + set_default GCC_CORE_URL "$SF_MIRROR/mingw/gcc-core-3.4.5-20060117-3.tar.gz" + set_default GCC_GPP_URL "$SF_MIRROR/mingw/gcc-g++-3.4.5-20060117-3.tar.gz" +else + # What flavor of GCC cross-compiler are we building? + set_default TARGET "mingw32" + + # Insert your cross-compiler mingw32 bin-directories here + set_default HOST_XCOMPILE "--host=$TARGET" + + # 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 + # that only root has write access to, you will need to run this + # script as root. + set_default PREFIX `unix_path $MINGW_DIR` + + # Use native toolchain + set_default LD $TARGET-ld + set_default CC $TARGET-gcc + set_default DLLTOOL $TARGET-dlltool + set_default RANLIB $TARGET-ranlib + + # For cross compilation we need to build our own toolchain + set_default BINUTILS_SRC_URL "$SF_MIRROR/mingw/binutils-2.20.1-src.tar.gz" + set_default GCC_CORE_SRC_URL "$SF_MIRROR/mingw/gcc-core-3.4.5-20060117-2-src.tar.gz" + set_default GCC_GPP_SRC_URL "$SF_MIRROR/mingw/gcc-g++-3.4.5-20060117-2-src.tar.gz" + # Not required for GnuCash + set_default GCC_G77_SRC_URL "" #"$SF_MIRROR/mingw/gcc-g77-3.4.5-20060117-2-src.tar.gz" + set_default GCC_OBJC_SRC_URL "" #"$SF_MIRROR/mingw/gcc-objc-3.4.5-20060117-2-src.tar.gz" + set_default GCC_JAVA_SRC_URL "" #"$SF_MIRROR/mingw/gcc-java-3.4.5-20060117-2-src.tar.gz" + set_default GCC_ADA_SRC_URL "" #"$SF_MIRROR/mingw/gcc-ada-3.4.5-20060117-2-src.tar.gz" + + # What directory will the cross-compiler be built in? + # This is the directory into which source archives will + # be downloaded, expanded, compiled, etc. You need to + # have write-access to this directory. If you leave it + # blank, it defaults to the current directory. + set_default XC_BUILD_DIR `unix_path $TMP_DIR` + + # Purge anything and everything already in the $PREFIX + #(also known as the destination or installation) directory? + # Set to "yes" to purge, any other value omits the purge step. + set_default PURGE_DIR "no" + + # If you wish to apply a patch to GCC, put it in the SRC_DIR + # and add its filename here. + set_default GCC_PATCH "" + + # These are the files from the SDL website + # These are optional, set them to "" if you don't want them + set_default SDL_URL "" #http://www.libsdl.org/extras/win32/common" + set_default OPENGL_URL "" #"$SDL_URL/opengl-devel.tar.gz" + set_default DIRECTX_URL "" #$SDL_URL/directx-devel.tar.gz" +fi + set_default CROSS_GCC_SRC_URL "$SF_MIRROR/mingw/gcc-4.4.0-src.tar.bz2" set_default CROSS_GCC_SRC2_URL "$SF_MIRROR/mingw/gcc-4.4.0-mingw32-src-2.tar.gz" #set_default CROSS_GCC_SRC_URL "$SF_MIRROR/mingw/gcc-4.5.0-1-mingw32-src.tar.lzma" diff --git a/packaging/win32/install.sh b/packaging/win32/install.sh index b726825729..5e5091409a 100644 --- a/packaging/win32/install.sh +++ b/packaging/win32/install.sh @@ -153,7 +153,6 @@ function inst_mingw() { setup MinGW _MINGW_UDIR=`unix_path $MINGW_DIR` _MINGW_WFSDIR=`win_fs_path $MINGW_DIR` - [ "$CROSS_COMPILE" = "yes" ] && add_to_env $_MINGW_UDIR/mingw32/bin PATH [ "$CROSS_COMPILE" = "yes" ] && add_to_env $_MINGW_UDIR/bin PATH if quiet test_for_mingw @@ -272,7 +271,8 @@ function inst_autotools() { quiet autoconf --help && quiet automake --help || die "autoconf/automake not installed correctly" rm -rf ${TMP_UDIR}/autoconf-* ${TMP_UDIR}/automake-* fi - if quiet libtoolize --help + if quiet libtoolize --help && \ + quiet ${LD} $AUTOTOOLS_LDFLAGS -lltdl -o $TMP_UDIR/ofile then echo "libtool/libtoolize already installed. skipping." else @@ -284,7 +284,8 @@ function inst_autotools() { make make install qpopd - quiet libtoolize --help || die "libtool/libtoolize not installed correctly" + quiet libtoolize --help && \ + quiet ${LD} $AUTOTOOLS_LDFLAGS -lltdl -o $TMP_UDIR/ofile || die "libtool/libtoolize not installed correctly" rm -rf ${TMP_UDIR}/libtool-* fi [ ! -d $_AUTOTOOLS_UDIR/share/aclocal ] || add_to_env "-I $_AUTOTOOLS_UDIR/share/aclocal" ACLOCAL_FLAGS @@ -649,6 +650,13 @@ EOF mv tmp lib/pkgconfig/libgtkhtml-3.14.pc rm -rf $TMP_UDIR/gtk-doc-* qpopd + + if [ "$CROSS_COMPILE" = "yes" ]; then + qpushd $_GNOME_UDIR/lib/pkgconfig + perl -pi.bak -e"s!^prefix=.*\$!prefix=$_GNOME_UDIR!" *.pc + #perl -pi.bak -e's!^Libs: !Libs: -L\${prefix}/bin !' *.pc + qpopd + fi wget_unpacked $PIXMAN_URL $DOWNLOAD_DIR $TMP_DIR assert_one_dir $TMP_UDIR/pixman-* qpushd $TMP_UDIR/pixman-* @@ -664,12 +672,6 @@ EOF quiet ${PKG_CONFIG} --exists gconf-2.0 libgnome-2.0 libgnomeui-2.0 libgtkhtml-3.14 && quiet intltoolize --version || die "gnome not installed correctly" fi - if [ "$CROSS_COMPILE" = "yes" ]; then - qpushd $_GNOME_UDIR/lib/pkgconfig - perl -pi.bak -e"s!^prefix=.*\$!prefix=$_GNOME_UDIR!" *.pc - #perl -pi.bak -e's!^Libs: !Libs: -L\${prefix}/bin !' *.pc - qpopd - fi [ ! -d $_GNOME_UDIR/share/aclocal ] || add_to_env "-I $_GNOME_UDIR/share/aclocal" ACLOCAL_FLAGS } @@ -1345,20 +1347,21 @@ function inst_gnucash() { AQBANKING_UPATH="${_OPENSSL_UDIR}/bin:${_GWENHYWFAR_UDIR}/bin:${_AQBANKING_UDIR}/bin" LIBOFX_OPTIONS="--enable-ofx --with-ofx-prefix=${_LIBOFX_UDIR}" + if [ "$CROSS_COMPILE" = "yes" ]; then + # Set these variables manually because of cross-compiling + export GUILE_LIBS="${GUILE_LDFLAGS} -lguile -lguile-ltdl" + export GUILE_INCS="${GUILE_CPPFLAGS}" + export BUILD_GUILE=yes + export name_build_guile=/usr/bin/guile-config + fi + qpushd $REPOS_DIR - if [ "$CROSS_COMPILE" = "yes" ]; then - # Set these variables manually because of cross-compiling - export GUILE_LIBS="${GUILE_LDFLAGS} -lguile -lguile-ltdl" - export GUILE_INCS="${GUILE_CPPFLAGS}" - export BUILD_GUILE=yes - export name_build_guile=/usr/bin/guile-config - fi if [ "$BUILD_FROM_TARBALL" != "yes" ]; then ./autogen.sh fi qpopd - qpushd $BUILD_DIR + qpushd $_BUILD_UDIR $_REL_REPOS_UDIR/configure ${HOST_XCOMPILE} \ --prefix=$_INSTALL_WFSDIR \ --enable-debug \