Script to compile Wine programs on Windows

Pavel Roskin proski at gnu.org
Tue Sep 23 22:02:07 CDT 2003


Hello!

The attached script makes it possible to compile many programs from Wine
under Windows.  The only software needed on Windows is Cygwin with MinGW
libraries and some other utilities (flex, bison).  Simply run setup.exe
from www.cygwin.com and make sure to select MinGW development tools.
Then get Wine sources, and run the attached script in the Cygwin shell
while in the Wine top-level source directory.

There is one minor fix that needs to be applied to the sources to fix
compatibility with MinGW headers (run autoconf and autoheader after
applying):
http://www.winehq.org/hypermail/wine-patches/2003/09/att-0347/01-spawnvp.diff

The configure script is rather slow in Cygwin, so it's instructed not to
create makefiles, only config.h.  Then the necessary libraries are
compiled.  The next step is to link wrc, the Wine resource compiler.

Once wrc is ready, the script starts compiling programs.  I cannot get
windres to compile most Wine's resources directly, so there are compiled
from *.rc to *.res by wrc and then from *.res to *.o by windres.

Programs currently compiled by the script:

clock.exe cmdlgtst.exe notepad.exe progman.exe regedit.exe start.exe
view.exe wcmd.exe winefile.exe winemine.exe winhelp.exe winver.exe

Yes, you can play winemine on Windows now ;-)

-- 
Regards,
Pavel Roskin
-------------- next part --------------
#!/bin/sh

# This script should be run under Cygwin with mingw compiler installed.
# It attempts to compile for Windows some of the Wine programs.

# Run in the Wine source directory or specify WINEDIR
: ${WINEDIR=`pwd`}

WRC=$WINEDIR/tools/wrc/wrc.exe
INCLUDES="-I $WINEDIR/include"
# wrc doesn't understand Cygwin path
WRC_INCLUDES="-I../../include"
export CC="gcc -g -mno-cygwin"

set -ex

cd $WINEDIR
if test ! -s winedefault.reg; then
    echo "incomplete or wrong source directory" 2>&1
    exit 1
fi

if test ! -s include/config.h; then
    sh ./configure --no-create --disable-debug --disable-trace \
	--without-x --without-opengl --without-curses
    sh ./config.status include/config.h
fi

cd $WINEDIR/libs/port
if test ! -s libport.a; then
    $CC -c $INCLUDES mkstemps.c
    ar rc libport.a *.o
fi

cd $WINEDIR/libs/unicode
if test ! -s libunicode.a; then
    $CC -c $INCLUDES *.c
    ar rc libunicode.a *.o
fi

cd $WINEDIR/libs/wpp
if test ! -s libwpp.a; then
    flex -Cf -d -Ppp -olex.yy.c -8 ppl.l
    bison -y -ppp -d -t ppy.y
    $CC -c $INCLUDES *.c
    ar rc libwpp.a *.o
fi

cd $WINEDIR/tools/wrc
if test ! -x wrc.exe; then
    flex -Cf -d -8 parser.l
    bison -y -d -t parser.y
    $CC -c $INCLUDES *.c
    $CC -o wrc.exe *.o ../../libs/wpp/libwpp.a \
	../../libs/unicode/libunicode.a ../../libs/port/libport.a
fi

cd $WINEDIR/programs/clock
if test ! -x clock.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o clock.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/cmdlgtst
if test ! -x cmdlgtst.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES cmdlgr.rc
    windres -o rsrc.o *.res
    $CC -o cmdlgtst.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/notepad
if test ! -x notepad.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o notepad.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/progman
if test ! -x progman.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o progman.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/regedit
if test ! -x regedit.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES -D__WINE__ rsrc.rc
    windres -o rsrc.o *.res
    $CC -o regedit.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/start
if test ! -x start.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o start.exe *.o
fi

cd $WINEDIR/programs/view
if test ! -x view.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES viewrc.rc
    windres -o rsrc.o *.res
    $CC -o view.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/wcmd
if test ! -x wcmd.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES wcmdrc.rc
    windres -o rsrc.o *.res
    $CC -o wcmd.exe *.o
fi

cd $WINEDIR/programs/winefile
if test ! -x winefile.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES -D__WINE__ rsrc.rc
    windres -o rsrc.o *.res
    $CC -o winefile.exe *.o -lgdi32 -lcomctl32 -lole32 -lshell32 -luuid
fi

cd $WINEDIR/programs/winemine
if test ! -x winemine.exe; then
    $CC -c $INCLUDES *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o winemine.exe *.o -lgdi32
fi

cd $WINEDIR/programs/winhelp
if test ! -x winhelp.exe; then
    flex -8 -i *.l
    $CC -c $INCLUDES -DNO_TRACE_MSGS *.c
    $WRC $WRC_INCLUDES rsrc.rc
    windres -o rsrc.o *.res
    $CC -o winhelp.exe *.o -lgdi32 -lcomdlg32
fi

cd $WINEDIR/programs/winver
if test ! -x winver.exe; then
    $CC -c $INCLUDES *.c
    $CC -o winver.exe *.o -lgdi32
fi



More information about the wine-devel mailing list