view build-win32.sh @ 235:20ce1339f36b

Remove text format copyright / license information in favour of the "HTML" formatted one.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 07 May 2018 18:36:55 +0300
parents 07e7f254ef16
children f65e0de45c2b
line wrap: on
line source

#!/bin/sh
INSTALL_USB="/mnt/sdb1"
INSTALL_WINE="$HOME/.wine/drive_c/Syntilista/"
TMPFILE="unix2dos.tmp"

BUILDPATH="win32/"

QT5_PREFIX="/misc/packages/qt5-src"
QT5_BASE="${QT5_PREFIX}/qtbase"

MINGWPATH=$(dirname $(i686-w64-mingw32-g++ -print-prog-name=cc1))

do_cpinstall()
{
    # $1 src base path
    # $2 dst base path
    # $3 common sub path
    # $4 filename

    mkdir -p "$2/$3"
    cp -f "$1/$3/$4" "$2/$3/$4"
}

do_install()
{
    TARGET="$1"
    if test -d "$TARGET"; then
        rm -fr "$TARGET"
    else
        echo "ERROR: Target '$TARGET' exists but is not a directory!"
        return 1
    fi
    if ! mkdir -p "$TARGET"; then
        echo "ERROR: Could not create target directory '$TARGET'."
        return 1
    fi

    echo "Installing to '$TARGET' ..."

    do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "platforms" "qwindows.dll"
    do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "sqldrivers" "qsqlite.dll"
    do_cpinstall "$QT5_BASE/plugins/" "$TARGET" "printsupport" "windowsprintersupport.dll"

    for i in Core Gui Sql Widgets PrintSupport Network; do
        cp -f "$QT5_BASE/lib/Qt5$i.dll" "$TARGET"
    done

    for i in libstdc++-6 libgcc_s_sjlj-1; do
        cp -f "$MINGWPATH/$i.dll" "$TARGET"
        strip "$TARGET/$i.dll"
    done

    cp -f "$BUILDPATH/Syntilista.exe" "$TARGET"
    unix2dos -n "COPYING.html" "$TMPFILE" && cp -f "$TMPFILE" "$TARGET/COPYING.txt"
    rm -f "$TMPFILE"
    return 0
}


### Create cross-building makefiles
make -f Makefile.cross-mingw-win32 QT5_PREFIX="$QT5_PREFIX" BINPATH="$BUILDPATH"

### Install to targets
if test -d "$INSTALL_USB" && mount|grep -q "$INSTALL_USB"; then
    do_install "$INSTALL_USB/Syntilista"
else
    echo "INFO: '$INSTALL_USB' is not mounted. Not installing."
fi
do_install "$INSTALL_WINE"