Commit fc01b729 authored by Alexandre Julliard's avatar Alexandre Julliard

Added some support for cross-compilation using mingw32.

parent b93f1114
......@@ -37,18 +37,23 @@ LIBS = @LIBS@
YACC = @YACC@
LEX = @LEX@
LEXLIB = @LEXLIB@
EXEEXT = @EXEEXT@
OBJEXT = @OBJEXT@
LIBEXT = @LIBEXT@
DLLEXT = @DLLEXT@
LDSHARED = @LDSHARED@
DLLWRAP = @DLLWRAP@
DLLWRAPFLAGS = --add-stdcall-alias
AR = @AR@ rc
RANLIB = @RANLIB@
STRIP = @STRIP@
WINDRES = @WINDRES@
LN_S = @LN_S@
TOOLSDIR = @TOOLSDIR@
DIVINCL = -I$(SRCDIR) -I. -I$(TOPSRCDIR)/include -I$(TOPOBJDIR)/include $(EXTRAINCL)
ALLCFLAGS = $(DIVINCL) $(CFLAGS) $(DEFS) $(OPTIONS) $(X_CFLAGS)
LDCOMBINE = @LDCOMBINE@
LDFLAGS = @LDFLAGS@
AR = ar rc
RM = rm -f
MV = mv
C2MAN = @C2MAN@
......@@ -62,10 +67,10 @@ LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
WINEBUILD = $(TOPOBJDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOPOBJDIR)/tools/makedep
WRC = $(TOPOBJDIR)/tools/wrc/wrc
WMC = $(TOPOBJDIR)/tools/wmc/wmc
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOOLSDIR)/tools/makedep
WRC = $(TOOLSDIR)/tools/wrc/wrc
WMC = $(TOOLSDIR)/tools/wmc/wmc
LDPATH = @LDPATH@
DLLDIR = $(TOPOBJDIR)/dlls
LIBWINE = -L$(TOPOBJDIR)/library -lwine
......@@ -100,7 +105,7 @@ dlldir = @libdir@/wine
prog_manext = 1
conf_manext = 5
includedir = @includedir@/wine
CLEAN_FILES = *.o *.a *.so *.ln \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
CLEAN_FILES = *.o *.a *.so *.ln *.$(LIBEXT) \\\#*\\\# *~ *% .\\\#* *.bak *.orig *.rej \
*.flc *.spec.c *.spec.def *.glue.c y.tab.c y.tab.h @LEX_OUTPUT_ROOT@.c core
OBJS = $(C_SRCS:.c=.o) $(GEN_C_SRCS:.c=.o) $(GEN_ASM_SRCS:.s=.o) \
......@@ -110,7 +115,7 @@ LINTS = $(C_SRCS:.c=.ln)
# Implicit rules
.SUFFIXES: .mc .rc .mc.rc .res .spec .spec.c .spec.def .glue.c .pl .ok
.SUFFIXES: .mc .rc .mc.rc .res .res.o .spec .spec.c .spec.def .glue.c .pl .ok
.c.o:
$(CC) -c $(ALLCFLAGS) -o $@ $<
......@@ -127,11 +132,14 @@ LINTS = $(C_SRCS:.c=.ln)
.rc.res:
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -r $<
.res.res.o:
$(WINDRES) -i $< -o $@
.spec.spec.c:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -spec $<
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -spec $<
.spec.spec.def:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -L$(DLLDIR) -o $@ -def $<
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -def $<
.c.glue.c:
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -o $@ -glue $<
......@@ -158,27 +166,27 @@ filter:
$(MODULE).tmp.o: $(SPEC_SRCS:.spec=.spec.o) $(OBJS) Makefile.in
$(LDCOMBINE) $(SPEC_SRCS:.spec=.spec.o) $(OBJS) -o $@
-strip --strip-unneeded $@
-$(STRIP) --strip-unneeded $@
# Rule to rebuild the resource compiler
$(WRC):
cd $(TOPOBJDIR)/tools/wrc && $(MAKE) wrc
cd $(TOOLSDIR)/tools/wrc && $(MAKE) wrc
# Rule to rebuild the message compiler
$(WMC):
cd $(TOPOBJDIR)/tools/wmc && $(MAKE) wmc
cd $(TOOLSDIR)/tools/wmc && $(MAKE) wmc
# Rule to rebuild the 'makedep' program
$(MAKEDEP):
cd $(TOPOBJDIR)/tools && $(MAKE) makedep
cd $(TOOLSDIR)/tools && $(MAKE) makedep
# Rule to rebuild the 'winebuild' program
$(WINEBUILD):
cd $(TOPOBJDIR)/tools/winebuild && $(MAKE) winebuild
cd $(TOOLSDIR)/tools/winebuild && $(MAKE) winebuild
# Rules for makefile
......@@ -241,7 +249,7 @@ testclean:: $(SUBDIRS:%=%/__testclean__)
$(RM) $(TESTRESULTS)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(TESTLIST) $(PROGRAMS)
$(RM) $(CLEAN_FILES) $(GEN_C_SRCS) $(GEN_ASM_SRCS) $(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res) $(MC_SRCS:.mc=.mc.rc) $(TESTRESULTS) $(TESTLIST) $(TESTPROGRAM)$(EXEEXT) $(PROGRAMS)
# Rules for installing
......@@ -259,7 +267,7 @@ $(SUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(PLTESTS:.c=.ok): $(WINETEST)
$(CTESTS:.c=.ok): $(TESTPROGRAM).so
$(CTESTS:.c=.ok): $(TESTPROGRAM)$(EXEEXT)
$(WINETEST):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
......@@ -270,16 +278,22 @@ $(TESTMAIN):
$(TESTLIST): Makefile.in
$(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
$(TESTPROGRAM): $(TESTPROGRAM).so
$(RM) $(TESTPROGRAM) && cd tests && $(LN_S) $(TOPOBJDIR)/../wine `basename $(TESTPROGRAM)`
$(TESTPROGRAM).so: $(TESTPROGRAM).spec.o $(TESTOBJS)
$(LDSHARED) $(LDDLLFLAGS) $(TESTPROGRAM).spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
$(TESTPROGRAM).tmp.o: $(TESTOBJS)
$(LDCOMBINE) $(TESTOBJS) -o $@
-strip --strip-unneeded $@
-$(STRIP) --strip-unneeded $@
$(TESTPROGRAM).spec.c: $(TESTPROGRAM).tmp.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ -sym $(TESTPROGRAM).tmp.o -o $@ -exe $(TESTPROGRAM) -mcui -L$(DLLDIR) $(TESTIMPORTS:%=-l%)
$(TESTPROGRAM).exe: $(TESTOBJS)
$(CC) $(TESTOBJS) -o $@ $(TESTIMPORTS:%=-l%) $(LIBWINE) $(LIBS)
# Misc. rules
$(SPEC_SRCS:.spec=.spec.c): $(WINEBUILD)
......
......@@ -18,7 +18,8 @@ LIBEXT=so # library type .so or .a
AC_ARG_ENABLE(debug, AC_HELP_STRING([--disable-debug],[compile out all debugging messages]))
AC_ARG_ENABLE(trace, AC_HELP_STRING([--disable-trace],[compile out TRACE messages]))
AC_ARG_ENABLE(opengl,AC_HELP_STRING([--enable-opengl],[force usage of OpenGL even if the latter is thread-safe via pthread]))
AC_ARG_WITH(curses, AC_HELP_STRING([--without-curses],[do not use curses]))
AC_ARG_WITH(curses, AC_HELP_STRING([--without-curses],[do not use curses]))
AC_ARG_WITH(wine-tools,AC_HELP_STRING([--with-wine-tools=<dir>],[use Wine tools from directory <dir>]))
AC_SUBST(OPTIONS)
if test "x$enable_debug" = "xno"
......@@ -32,10 +33,28 @@ fi
dnl **** Check for some programs ****
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CPP
AC_CACHE_CHECK([for the directory containing the Wine tools], wine_cv_toolsdir,
[if test -z "$with_wine_tools"; then
if test "$cross_compiling" = "yes"; then
AC_MSG_ERROR([you must use the --with-wine-tools option when cross-compiling.])
else
wine_cv_toolsdir="\$(TOPOBJDIR)"
fi
elif test -d "$with_wine_tools/tools/winebuild"; then
case $with_wine_tools in
/*) wine_cv_toolsdir="$with_wine_tools" ;;
*) wine_cv_toolsdir="\$(TOPOBJDIR)/$with_wine_tools" ;;
esac
else
AC_MSG_ERROR([could not find Wine tools in $with_wine_tools.])
fi])
AC_SUBST(TOOLSDIR,$wine_cv_toolsdir)
AC_PATH_XTRA
AC_PROG_YACC
AC_PROG_LEX
......@@ -52,12 +71,23 @@ if test "$XLEX" = "none"
then
AC_MSG_ERROR([no suitable lex found. Please install the 'flex' package.])
fi
AC_CHECK_TOOL(AR,ar,ar)
AC_PROG_RANLIB
AC_CHECK_TOOL(STRIP,strip,strip)
AC_CHECK_TOOL(WINDRES,windres,false)
AC_PROG_INSTALL
AC_PROG_LN_S
AC_CHECK_PROG(C2MAN,c2man,c2man,\$(TOPSRCDIR)/tools/c2man.pl)
AC_PATH_PROG(LDCONFIG, ldconfig, true, [/sbin /usr/sbin $PATH])
case $host_os in
cygwin*|mingw32*)
AC_CHECK_TOOL(LDCOMBINE,[ld -r --enable-stdcall-fixup],[ld -r --enable-stdcall-fixup]) ;;
*)
AC_CHECK_TOOL(LDCOMBINE,[ld -r],[ld -r]) ;;
esac
dnl Check for lint
AC_CHECK_PROGS(LINT, lclint lint)
if test "$LINT" = "lint"
......@@ -68,12 +98,6 @@ fi
AC_SUBST(LINT)
AC_SUBST(LINTFLAGS)
case $host_os in
*cygwin*) LDCOMBINE="ld -r --enable-stdcall-fixup" ;;
*) LDCOMBINE="ld -r" ;;
esac
AC_SUBST(LDCOMBINE)
dnl **** Check for some libraries ****
dnl Check for -lm
......@@ -700,14 +724,14 @@ LDSHARED=""
LDDLLFLAGS=""
DLLIBS=""
case $target_os in
cygwin|mingw32)
AC_CHECK_PROG(DLLWRAP,dllwrap,dllwrap,false)
if test "$DLLWRAP" = "dllwrap"; then
case $host_os in
cygwin*|mingw32*)
AC_CHECK_TOOL(DLLWRAP,dllwrap,false)
if test "$DLLWRAP" = "false"; then
LIBEXT="a"
else
dnl FIXME - check whether dllwrap works correctly...
LIBEXT="dll"
else
LIBEXT="a"
fi
;;
*)
......@@ -759,18 +783,22 @@ If you are using Linux, you will need a newer binutils.]
fi
DLLFLAGS=""
LDPATH=""
if test "$LIBEXT" = "so"; then
DLLFLAGS="-fPIC"
DLLEXT=".so"
LDPATH="LD_LIBRARY_PATH=\"\$(TOPOBJDIR)/library:\$(TOPOBJDIR)/unicode:\$\$LD_LIBRARY_PATH\""
elif test "$LIBEXT" = "dll"; then
#DLLFLAGS="-fPIC" # -fPIC doesn't work(at least in cygwin-b20) - FIXME
DLLEXT=""
LDPATH="PATH=\"\$(TOPOBJDIR)/library:\$(TOPOBJDIR)/unicode:\$\$PATH\""
fi
case $build_os in
cygwin*|mingw32*)
LDPATH="PATH=\"\$(TOOLSDIR)/library:\$(TOOLSDIR)/unicode:\$\$PATH\"" ;;
*)
LDPATH="LD_LIBRARY_PATH=\"\$(TOOLSDIR)/library:\$(TOOLSDIR)/unicode:\$\$LD_LIBRARY_PATH\"" ;;
esac
AC_SUBST(DLLIBS)
AC_SUBST(DLLFLAGS)
AC_SUBST(DLLEXT)
......@@ -1191,7 +1219,7 @@ WINE_CHECK_STRUCT_MEMBER(sockaddr_un,sun_len,
dnl *** check for the need to define __i386__
case $target_cpu in
case $host_cpu in
*i[3456789]86* )
AC_CACHE_CHECK([whether we need to define __i386__],ac_cv_cpp_def_i386,
AC_EGREP_CPP(yes,[#ifndef __i386__
......
......@@ -137,29 +137,7 @@ static int init(void)
{
myARGC = winetest_get_mainargs( &myARGV );
if (!GetCurrentDirectoryA(sizeof(base), base)) return 0;
if (strcmp(winetest_platform, "windows"))
{
char* ptr = getenv("WINELOADER");
char* root;
if (!ptr) return 0;
root = grab_memory(strlen(ptr) + 1);
strcpy(root, ptr);
ptr = strrchr(root, '/');
if (!ptr) return 0;
*ptr = '\0';
/* be sure to use absolute pathnames so we can change dirs whenever we want */
sprintf(selfname,
"%s/programs/winetest/runtest -q -P wine -M kernel32.dll -T %s -p %s/dlls/kernel/tests/kernel32_test",
root, root, root);
}
else
{
strcpy(selfname, myARGV[0]);
}
strcpy(selfname, myARGV[0]);
return 1;
}
......
......@@ -43,10 +43,14 @@ install_a: libwine.a
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine.a $(libdir)/libwine.a
install:: all $(LIBEXT:%=install_%)
install_dll: libwine.dll
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine.dll $(libdir)/libwine.dll
install:: $(LIBEXT:%=install_%)
uninstall::
$(RM) $(libdir)/libwine.a $(libdir)/libwine.so $(libdir)/libwine.so.$(SOVERSION)
$(RM) $(libdir)/libwine.a $(libdir)/libwine.dll $(libdir)/libwine.so $(libdir)/libwine.so.$(SOVERSION)
clean::
$(RM) libwine.so.$(SOVERSION)
......
......@@ -11,21 +11,21 @@
DEFS = @DLLFLAGS@ -DSTRICT -DNONAMELESSUNION -DNONAMELESSSTRUCT $(EXTRADEFS)
LDDLLFLAGS = @LDDLLFLAGS@
ALL_OBJS = $(MODULE).spec.o $(OBJS)
ALL_LIBS = $(LIBWINE) $(EXTRALIBS) $(LIBS)
SYMBOLFILE = $(MODULE).tmp.o
TESTIMPORTS = $(DELAYIMPORTS) $(IMPORTS)
all: $(MODULE)
RCOBJS = $(RC_SRCS:.rc=.res.o)
@MAKE_RULES@
all: $(MODULE)$(EXEEXT)
# Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) @DLLFLAGS@ $(SYMBOLFILE:%=-sym %) -o $@ -exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:%.rc=-res %.res) -L$(DLLDIR) $(DELAYIMPORTS:%=-dl%) $(IMPORTS:%=-l%)
# Rules for main module
# Rules for .so main module
$(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(OBJS) -o $@ $(ALL_LIBS)
......@@ -33,6 +33,11 @@ $(MODULE).so: $(MODULE).spec.o $(OBJS) Makefile.in
$(MODULE): $(MODULE).so
$(RM) $(MODULE) && $(LN_S) $(TOPOBJDIR)/wine $(MODULE)
# Rules for .exe main module
$(MODULE).exe: $(OBJS) $(RCOBJS) Makefile.in
$(CC) $(OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
# Rules for checking that no imports are missing
checklink:: $(MODULE).so
......@@ -49,13 +54,21 @@ debug_channels: dummy
# Rules for installation
install:: $(MODULE).so
.PHONY: install_prog$(EXEEXT)
install_prog:: $(MODULE).so
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so
cd $(bindir) && $(RM) $(MODULE) && $(LN_S) wine $(MODULE)
install_prog.exe:: $(MODULE).exe
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).exe $(bindir)/$(MODULE).exe
install:: install_prog$(EXEEXT)
uninstall::
$(RM) $(bindir)/$(MODULE) $(bindir)/$(MODULE).so
$(RM) $(bindir)/$(MODULE)$(EXEEXT) $(bindir)/$(MODULE).so
clean::
$(RM) $(MODULE)
$(RM) $(MODULE)$(EXEEXT)
......@@ -123,9 +123,7 @@ if (defined($topobjdir))
$ENV{WINESERVER} = $topobjdir . "/server/wineserver";
$ENV{WINELOADER} = $topobjdir . "/wine";
$ENV{WINETEST_PLATFORM} = $platform || "wine";
$ENV{WINEPRELOAD}=($program || ($topobjdir . "/programs/winetest/winetest")) . ".so";
# try to exec the wine loader directly; if it fails continue on to normal exec
exec $ENV{WINELOADER}, $infile, @ARGV;
$program ||= $topobjdir . "/programs/winetest/winetest";
}
else
{
......
......@@ -95,9 +95,9 @@ libwine_unicode.a: $(OBJS)
$(AR) $@ $(OBJS)
$(RANLIB) $@
# --export-all don't work correctly because of dllwrap's bug
# --export-all doesn't work correctly because of dllwrap's bug
libwine_unicode.dll: $(OBJS) wine_unicode.def
$(DLLWRAP) $(DLLWRAPFLAGS) --def wine_unicode.def --implib libwine_unicode.a -o libwine_unicode.dll $(OBJS)
$(DLLWRAP) $(DLLWRAPFLAGS) --def $(SRCDIR)/wine_unicode.def --implib libwine_unicode.a -o libwine_unicode.dll $(OBJS)
install_so: libwine_unicode.so.$(SOVERSION)
$(MKINSTALLDIRS) $(libdir)
......@@ -108,10 +108,14 @@ install_a: libwine_unicode.a
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine_unicode.a $(libdir)/libwine_unicode.a
install:: all $(LIBEXT:%=install_%)
install_dll: libwine_unicode.dll
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) libwine_unicode.dll $(libdir)/libwine_unicode.dll
install:: $(LIBEXT:%=install_%)
uninstall::
$(RM) $(libdir)/libwine_unicode.a $(libdir)/libwine_unicode.so $(libdir)/libwine_unicode.so.$(SOVERSION)
$(RM) $(libdir)/libwine_unicode.a $(libdir)/libwine_unicode.dll $(libdir)/libwine_unicode.so $(libdir)/libwine_unicode.so.$(SOVERSION)
clean::
$(RM) libwine_unicode.so.$(SOVERSION)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment