Commit 3536316a authored by Alexandre Julliard's avatar Alexandre Julliard

New loading scheme for Winelib apps, makes them behave like builtin

dlls and takes load order into account. Install them in dlldir. Improved MODULE_GetBinaryType to recognize ELF binaries. Added a wrapper script to setup the environment when running directly from inside the source tree.
parent df234a9f
......@@ -4,4 +4,3 @@ autom4te.cache
config.cache
config.log
config.status
wine
......@@ -68,6 +68,7 @@ LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOOLSDIR)/tools/makedep
WRC = $(TOOLSDIR)/tools/wrc/wrc
......@@ -79,11 +80,11 @@ LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid
WINETEST = $(TOPOBJDIR)/programs/winetest/winetest
WINETEST = $(TOPOBJDIR)/programs/winetest/winetest.exe$(DLLEXT)
RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest
RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR)
TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
TESTPROGRAM = tests/$(MODULE:%.dll=%)_test
TESTPROGRAM = tests/$(MODULE:%.dll=%)_test.exe
TESTLIST = tests/testlist.c
TESTOBJS = $(TESTMAIN) $(TESTLIST:.c=.o) $(CTESTS:.c=.o)
TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o
......@@ -150,7 +151,7 @@ LINTS = $(C_SRCS:.c=.ln)
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
.c.ok:
$(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM) $< && touch $@
$(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM)$(DLLEXT) $< && touch $@
.pl.ok:
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
......@@ -256,7 +257,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) $(TESTPROGRAM)$(EXEEXT) $(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) $(PROGRAMS)
# Rules for installing
......@@ -274,10 +275,10 @@ $(SUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test
$(PLTESTS:.c=.ok): $(WINETEST)
$(CTESTS:.c=.ok): $(TESTPROGRAM)$(EXEEXT)
$(CTESTS:.c=.ok): $(TESTPROGRAM)$(DLLEXT)
$(WINETEST):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest.exe$(DLLEXT)
$(TESTMAIN):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
......@@ -285,20 +286,17 @@ $(TESTMAIN):
$(TESTLIST): Makefile.in
$(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
$(TESTPROGRAM): $(TESTPROGRAM).exe.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).exe.so: $(TESTPROGRAM).exe.spec.o $(TESTOBJS)
$(LDSHARED) $(LDDLLFLAGS) $(TESTPROGRAM).exe.spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
$(TESTPROGRAM).exe.tmp.o: $(TESTOBJS)
$(TESTPROGRAM).tmp.o: $(TESTOBJS)
$(LDCOMBINE) $(TESTOBJS) -o $@
-$(STRIP) --strip-unneeded $@
$(TESTPROGRAM).exe.spec.c: $(TESTPROGRAM).exe.tmp.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym $(TESTPROGRAM).exe.tmp.o -o $@ -exe $(TESTPROGRAM).exe -mcui -L$(DLLDIR) $(TESTIMPORTS:%=-l%)
$(TESTPROGRAM).spec.c: $(TESTPROGRAM).tmp.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym $(TESTPROGRAM).tmp.o -o $@ -exe $(TESTPROGRAM) -mcui -L$(DLLDIR) $(TESTIMPORTS:%=-l%)
$(TESTPROGRAM).exe: $(TESTOBJS)
$(TESTPROGRAM): $(TESTOBJS)
$(CC) $(TESTOBJS) -o $@ $(TESTIMPORTS:%=-l%) $(LIBWINE) $(LIBS)
# Misc. rules
......
......@@ -20,50 +20,33 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
LIBEXT = @LIBEXT@
LDCONFIG = @LDCONFIG@
MODULE = wine
LDIMPORTS = ntdll.dll
MODULE = none
# Stand-alone programs
PROGRAMS = \
server/wineserver
# Sub-directories containing stand-alone programs
PROGSUBDIRS = \
server
# Programs that link with libwine
LIBPROGRAMS = \
debugger \
# Sub-directories containing programs that use some Wine dlls
LIBPROGSUBDIRS = \
miscemu \
programs
# Libraries (not dlls) to build
LIBRARIES = \
library/libwine.$(LIBEXT) \
ole/libwine_uuid.a \
tsx11/libwine_tsx11.$(LIBEXT) \
unicode/libwine_unicode.$(LIBEXT)
# Dlls that we need to link against (should go away)
LINKABLE_DLLS = user32.dll gdi32.dll kernel32.dll ntdll.dll
# Libraries symlinks to create at the top level
LIBSYMLINKS = \
$(LINKABLE_DLLS:%=lib%.$(LIBEXT)) \
libwine.$(LIBEXT) \
libwine_tsx11.$(LIBEXT) \
libwine_unicode.$(LIBEXT) \
libwine_uuid.a
# Sub-directories containing libraries (not dlls) to build
LIBSUBDIRS = \
library \
ole \
tsx11 \
unicode
# Sub-directories to run make depend/clean/install into
SUBDIRS = \
debugger \
$(LIBPROGSUBDIRS) \
$(LIBSUBDIRS) \
$(PROGSUBDIRS) \
dlls \
documentation \
include \
library \
miscemu \
ole \
programs \
server \
tools \
tsx11 \
unicode
tools
# Sub-directories to run make test into
TESTSUBDIRS = \
......@@ -73,7 +56,7 @@ TESTSUBDIRS = \
EMUOBJS = \
miscemu/miscemu.o
all: Make.rules $(PROGRAMS) $(LIBPROGRAMS) $(LIBSYMLINKS) wine
all: Make.rules $(PROGSUBDIRS) $(LIBPROGSUBDIRS) wine
@echo "Wine build complete."
WINAPI_CHECK_EXTRA_FLAGS = --global
......@@ -84,68 +67,30 @@ Make.rules: Make.rules.in configure
@echo $? is newer than 'Make.rules', please rerun ./configure!
@exit 1
wine: $(EMUOBJS) $(LDIMPORTS:%=lib%.$(LIBEXT)) library/libwine.$(LIBEXT) unicode/libwine_unicode.$(LIBEXT)
$(CC) -o wine $(EMUOBJS) -L. $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
install_wine: dummy
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wine $(bindir)/wine
wine: $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
install:: all install_wine $(SUBDIRS:%=%/__install__)
install:: all $(SUBDIRS:%=%/__install__)
-$(LDCONFIG)
uninstall:: $(SUBDIRS:%=%/__uninstall__)
$(RM) $(bindir)/wine
$(EMUOBJS) $(PROGRAMS) $(LIBRARIES): dummy
@cd `dirname $@` && $(MAKE) `basename $@`
# Symlinks to libraries that we need to link against
libwine.$(LIBEXT): library/libwine.$(LIBEXT)
$(RM) $@ && $(LN_S) library/libwine.$(LIBEXT) $@
libwine_tsx11.$(LIBEXT): tsx11/libwine_tsx11.$(LIBEXT)
$(RM) $@ && $(LN_S) tsx11/libwine_tsx11.$(LIBEXT) $@
libwine_unicode.$(LIBEXT): unicode/libwine_unicode.$(LIBEXT)
$(RM) $@ && $(LN_S) unicode/libwine_unicode.$(LIBEXT) $@
libwine_uuid.a: ole/libwine_uuid.a
$(RM) $@ && $(LN_S) ole/libwine_uuid.a $@
libuser32.dll.$(LIBEXT): dlls/user32.dll$(DLLEXT)
$(RM) $@ && $(LN_S) dlls/user32.dll$(DLLEXT) $@
libgdi32.dll.$(LIBEXT): dlls/gdi32.dll$(DLLEXT)
$(RM) $@ && $(LN_S) dlls/gdi32.dll$(DLLEXT) $@
libkernel32.dll.$(LIBEXT): dlls/kernel32.dll$(DLLEXT)
$(RM) $@ && $(LN_S) dlls/kernel32.dll$(DLLEXT) $@
libntdll.dll.$(LIBEXT): dlls/ntdll.dll$(DLLEXT)
$(RM) $@ && $(LN_S) dlls/ntdll.dll$(DLLEXT) $@
$(LINKABLE_DLLS:%=dlls/%$(DLLEXT)): dlls
# Dependencies between directories
$(PROGRAMS): tools
$(EMUOBJS): tools dlls
$(LIBPROGSUBDIRS): tools dlls $(LIBSUBDIRS)
$(LIBPROGRAMS): tools dlls wine
$(PROGSUBDIRS): tools $(LIBSUBDIRS)
server tools: $(LIBRARIES)
dlls: tools $(LIBSUBDIRS)
dlls: tools $(LIBRARIES)
tools: $(LIBSUBDIRS)
checklink::
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c && $(RM) checklink
checklink::
@cd dlls && $(MAKE) checklink
@cd debugger && $(MAKE) checklink
@cd programs && $(MAKE) checklink
test_environment: dummy
@cd programs/winetest && $(MAKE) all
......
......@@ -35,14 +35,16 @@ $(MODULE).so: $(ALL_OBJS) Makefile.in
# Rules for .dll files
$(MODULE): $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in
$(DLLWRAP) $(DLLWRAPFLAGS) --def $(SPEC_DEF) --implib $(MODULE:.dll=.a) -o $(MODULE) $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(IMPORTS:%=-l%) $(ALL_LIBS)
$(DLLWRAP) $(DLLWRAPFLAGS) --def $(SPEC_DEF) --implib $(MODULE:.dll=.a) -o $@ $(OBJS) $(MODULE).dbg.o -L$(DLLDIR) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
$(SPEC_DEF): $(WINEBUILD)
# Rules for checking that no imports are missing
CHECKLINK_RPATH = dlls library tsx11 unicode
checklink:: $(MODULE)$(DLLEXT)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) && $(RM) checklink
$(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE)$(DLLEXT) && $(RM) checklink
# Rules for testing
......
......@@ -288,8 +288,6 @@ BOOL X11DRV_CLIPBOARD_LaunchServer()
execl( BINDIR "/wineclipsrv", "wineclipsrv",
selMask, dbgClassMask, clearSelection, NULL );
execlp( "wineclipsrv", "wineclipsrv", selMask, dbgClassMask, clearSelection, NULL );
execl( "./windows/x11drv/wineclipsrv", "wineclipsrv",
selMask, dbgClassMask, clearSelection, NULL );
/* Exec Failed! */
perror("Could not start Wine clipboard server");
......
......@@ -65,7 +65,7 @@ $(BOOKNAME).ps: $(BOOK_SRCS)
db2ps $(BOOKNAME).sgml > /dev/null
wine.man: wine.man.in
sed -e 's,@bindir\@,$(bindir),g' -e 's,@libdir\@,$(libdir),g' $(SRCDIR)/wine.man.in >$@ || $(RM) $@
sed -e 's,@bindir\@,$(bindir),g' -e 's,@dlldir\@,$(dlldir),g' $(SRCDIR)/wine.man.in >$@ || $(RM) $@
install:: $(MAN_TARGETS)
$(INSTALL) -d $(mandir)/man$(prog_manext)
......
......@@ -107,6 +107,8 @@ WINE REGISTRY Version 2
"msacm" = "builtin, native"
"msacm32" = "builtin, native"
"midimap.drv" = "builtin, native"
; you can specify applications too
"notepad.exe" = "native, builtin"
; default for all other dlls
"*" = "native, builtin, so"
......
......@@ -254,31 +254,30 @@ processes, it is possible to run a number of truly independent
.B wine
processes.
.TP
.I WINEPRELOAD
If set, specifies the full name of a shared library that
.B wine
loads and runs as a Winelib application.
.TP
.I WINESERVER
Specifies the path and name of the
.B wineserver
binary. If not set, a file named "wineserver" is searched in the
path and in a few other likely locations.
binary. If not set, Wine will try to load
.B @bindir@/wineserver,
and if this doesn't exist will then look for a file named "wineserver"
in the path and in a few other likely locations.
.TP
.I WINELOADER
Specifies the path and name of the
.B wine
binary to use to launch new Windows processes. If not set, a binary
named "wine" is searched in the path and in a few other likely
locations.
binary to use to launch new Windows processes. If not set, Wine will
try to load
.B @bindir@/wine,
and if this doesn't exist will then look for a file named "wine" in
the path and in a few other likely locations.
.TP
.I WINEDLLPATH
Specifies the path(s) in which to search for builtin dll files. This
is a list of directories separated by ":". Builtin dlls are also
searched in the directories specified by the standard
.I LD_LIBRARY_PATH
if they are not found in the directories listed in
.I WINEDLLPATH.
Specifies the path(s) in which to search for builtin dlls and Winelib
applications. This is a list of directories separated by ":". In
addition to any directory specified in
.I WINEDLLPATH,
Wine will also look in
.B @dlldir@.
.TP
.I DISPLAY
Specifies the X11 display to use.
......@@ -378,12 +377,12 @@ The
.B wine
debugger
.TP
.I @bindir@/wineclpsrv
.I @bindir@/wineclipsrv
The
.B wine
clipboard server
.TP
.I @libdir@
.I @dlldir@
Directory containing
.B wine's
shared libraries
......
......@@ -186,6 +186,19 @@ enum loadorder_type
LOADORDER_NTYPES
};
/* return values for MODULE_GetBinaryType */
enum binary_type
{
BINARY_UNKNOWN,
BINARY_PE_EXE,
BINARY_PE_DLL,
BINARY_WIN16,
BINARY_OS216,
BINARY_DOS,
BINARY_UNIX_EXE,
BINARY_UNIX_LIB
};
/* module.c */
extern WINE_MODREF *MODULE_AllocModRef( HMODULE hModule, LPCSTR filename );
extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, BOOL snoop );
......@@ -197,6 +210,7 @@ extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD fl
extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm );
extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
extern HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 );
extern enum binary_type MODULE_GetBinaryType( HANDLE hfile );
extern FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
extern void MODULE_WalkModref( DWORD id );
......@@ -287,10 +301,5 @@ extern int BUILTIN32_dlclose( void *handle );
/* scheduler/process.c */
extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE16 hModule );
extern BOOL PROCESS_Create( HANDLE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags,
STARTUPINFOA *startup, PROCESS_INFORMATION *info,
LPCSTR lpCurrentDirectory );
#endif /* __WINE_MODULE_H */
......@@ -33,8 +33,7 @@ extern void *wine_dlsym( void *handle, const char *symbol, char *error, int erro
extern int wine_dlclose( void *handle, char *error, int errorsize );
extern void wine_dll_set_callback( load_dll_callback_t load );
extern void *wine_dll_load( const char *filename, char *error, int errorsize );
extern void *wine_dll_load_main_exe( const char *name, int search_path,
char *error, int errorsize );
extern void *wine_dll_load_main_exe( const char *name, char *error, int errorsize, int test_only );
extern void wine_dll_unload( void *handle );
extern int __wine_main_argc;
......
......@@ -118,7 +118,7 @@ inline static int file_exists( const char *name )
/* open a library for a given dll, searching in the dll path
* 'name' must be the Windows dll name (e.g. "kernel32.dll") */
static void *dlopen_dll( const char *name, char *error, int errorsize )
static void *dlopen_dll( const char *name, char *error, int errorsize, int test_only )
{
int i, namelen = strlen(name);
char *buffer, *p;
......@@ -139,17 +139,16 @@ static void *dlopen_dll( const char *name, char *error, int errorsize )
int len = strlen(dll_paths[i]);
p = buffer + dll_path_maxlen - len;
memcpy( p, dll_paths[i], len );
if ((ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break;
if (file_exists( p )) /* exists but cannot be loaded, return the error */
if (test_only) /* just test for file existence */
{
free( buffer );
return NULL;
if ((ret = (void *)file_exists( p ))) break;
}
else
{
if ((ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break;
if (file_exists( p )) break; /* exists but cannot be loaded, return the error */
}
}
/* now try the default dlopen search path */
if (!ret)
ret = wine_dlopen( buffer + dll_path_maxlen + 1, RTLD_NOW, error, errorsize );
free( buffer );
return ret;
}
......@@ -374,7 +373,7 @@ void *wine_dll_load( const char *filename, char *error, int errorsize )
return (void *)1;
}
}
return dlopen_dll( filename, error, errorsize );
return dlopen_dll( filename, error, errorsize, 0 );
}
......@@ -393,46 +392,9 @@ void wine_dll_unload( void *handle )
/***********************************************************************
* wine_dll_load_main_exe
*
* Try to load the .so for the main exe, optionally searching for it in PATH.
* Try to load the .so for the main exe.
*/
void *wine_dll_load_main_exe( const char *name, int search_path, char *error, int errorsize )
void *wine_dll_load_main_exe( const char *name, char *error, int errorsize, int test_only )
{
void *ret = NULL;
const char *path = NULL;
if (search_path) path = getenv( "PATH" );
if (!path)
{
/* no path, try only the specified name */
ret = wine_dlopen( name, RTLD_NOW, error, errorsize );
}
else
{
char buffer[128], *tmp = buffer;
size_t namelen = strlen(name);
size_t pathlen = strlen(path);
if (namelen + pathlen + 2 > sizeof(buffer)) tmp = malloc( namelen + pathlen + 2 );
if (tmp)
{
char *basename = tmp + pathlen;
*basename = '/';
strcpy( basename + 1, name );
for (;;)
{
int len;
const char *p = strchr( path, ':' );
if (!p) p = path + strlen(path);
if ((len = p - path) > 0)
{
memcpy( basename - len, path, len );
if ((ret = wine_dlopen( basename - len, RTLD_NOW, error, errorsize ))) break;
}
if (!*p) break;
path = p + 1;
}
if (tmp != buffer) free( tmp );
}
}
return ret;
return dlopen_dll( name, error, errorsize, test_only );
}
......@@ -3,19 +3,32 @@ TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = miscemu
MODULE = wine
IMPORTS = ntdll
LDIMPORTS = ntdll.dll
SPEC_SRCS = wine.spec
C_SRCS = \
main.c
all: $(MODULE).o
all: $(MODULE)
@MAKE_RULES@
$(MODULE).o: $(SPEC_SRCS:.spec=.spec.o) $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in
$(LDCOMBINE) $(SPEC_SRCS:.spec=.spec.o) $(OBJS) -o $@
ALL_OBJS = $(SPEC_SRCS:.spec=.spec.o) $(OBJS)
$(MODULE): $(ALL_OBJS)
$(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS)
install:: $(MODULE)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wine $(bindir)/wine
uninstall::
$(RM) $(bindir)/wine
clean::
$(RM) $(MODULE)
### Dependencies:
Makefile
Makeprog.rules
wineapploader
......@@ -4,54 +4,106 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
INSTALLSUBDIRS = \
SUBDIRS = \
$(TOPOBJDIR)/debugger \
avitools \
clock \
cmdlgtst \
control \
expand \
notepad \
osversioncheck \
progman \
regapi \
regedit \
regsvr32 \
regtest \
uninstaller \
view \
wcmd \
wineconsole \
winemine \
winepath \
winetest \
winhelp \
winver
# Programs that are not generally useful and don't get installed
# Use 'make everything' to build them
OTHERSUBDIRS = \
avitools \
clock \
cmdlgtst \
osversioncheck \
regapi \
regtest \
view \
winetest
SUBDIRS = $(INSTALLSUBDIRS) $(OTHERSUBDIRS)
# Programs to install in bin directory
# We don't install everything to avoid polluting /usr/bin too much
INSTALLPROGS = \
expand \
notepad \
progman \
regedit \
regsvr32 \
uninstaller \
wcmd \
wineconsole \
winedbg \
winemine \
winepath \
winhelp
all: $(INSTALLSUBDIRS)
# Symlinks to apps that we want to run from inside the source tree
SYMLINKS = \
wineconsole.exe \
winedbg.exe \
winetest.exe
@MAKE_RULES@
everything: $(SUBDIRS)
all: wineapploader $(SUBDIRS) $(SYMLINKS:%=%$(DLLEXT))
wineapploader: wineapploader.in
sed -e 's,@bindir\@,$(bindir),g' $(SRCDIR)/wineapploader.in >$@ || $(RM) $@
# Rules for installation
.PHONY: install-apploader install-progs install-progs.so $(INSTALLPROGS:%=%/__installprog__)
install-apploader: wineapploader dummy
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_SCRIPT) wineapploader $(bindir)/wineapploader
$(INSTALLPROGS:%=%/__installprog__): install-apploader
$(RM) $(bindir)/`dirname $@` && $(LN) $(bindir)/wineapploader $(bindir)/`dirname $@`
install-everything: $(SUBDIRS:%=%/__install__)
install-progs.so: $(INSTALLPROGS:%=%/__installprog__)
$(RM) $(bindir)/wineapploader
uninstall-everything: $(SUBDIRS:%=%/__uninstall__)
install-progs: # nothing to do here
install:: $(INSTALLSUBDIRS:%=%/__install__)
install:: $(SUBDIRS:%=%/__install__) install-progs$(DLLEXT)
uninstall:: $(INSTALLSUBDIRS:%=%/__uninstall__)
uninstall:: $(SUBDIRS:%=%/__uninstall__)
$(RM) $(bindir)/wineapploader $(INSTALLPROGS:%=$(bindir)/%)
-rmdir $(dlldir)
clean::
$(RM) wineapploader $(SYMLINKS)
# Rules for testing
$(SUBDIRS:%=%/__checklink__): dummy
@cd `dirname $@` && $(MAKE) checklink
checklink:: $(SUBDIRS:%=%/__checklink__)
check test:: $(SUBDIRS:%=%/__test__)
checklink:: $(SUBDIRS:%=%/__checklink__)
# Rules for symlinks
wineconsole.exe$(DLLEXT): wineconsole/wineconsole.exe$(DLLEXT)
$(RM) $@ && $(LN_S) wineconsole/wineconsole.exe$(DLLEXT) $@
winedbg.exe$(DLLEXT): $(TOPOBJDIR)/debugger/winedbg.exe$(DLLEXT)
$(RM) $@ && $(LN_S) $(TOPOBJDIR)/debugger/winedbg.exe$(DLLEXT) $@
winetest.exe$(DLLEXT): winetest/winetest.exe$(DLLEXT)
$(RM) $@ && $(LN_S) winetest/winetest.exe$(DLLEXT) $@
wineconsole/wineconsole.exe$(DLLEXT): wineconsole
$(TOPOBJDIR)/debugger/winedbg.exe$(DLLEXT): $(TOPOBJDIR)/debugger
winetest/winetest.exe$(DLLEXT): winetest
### Dependencies:
......@@ -32,8 +32,8 @@ $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
$(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS)
$(BASEMODULE): $(MODULE).so
$(RM) $(BASEMODULE) && $(LN_S) $(TOPOBJDIR)/wine $(BASEMODULE)
$(BASEMODULE): $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
# Rules for .exe main module
......@@ -42,8 +42,10 @@ $(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
# Rules for checking that no imports are missing
CHECKLINK_RPATH = library tsx11 unicode
checklink:: $(MODULE).so
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
$(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c $(MODULE).so && $(RM) checklink
# Rules for testing
......@@ -51,21 +53,25 @@ $(TESTRESULTS): $(MODULE)$(DLLEXT)
# Rules for installation
.PHONY: install_prog install_prog.so
.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
install_prog.so:: $(MODULE).so
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so
cd $(bindir) && $(RM) $(BASEMODULE) && $(LN_S) wine $(BASEMODULE)
install_prog.so: $(MODULE).so
$(MKINSTALLDIRS) $(dlldir)
$(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
install_prog.exe:: $(MODULE)
install_prog: $(MODULE)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
uninstall_prog.so: dummy
$(RM) $(dlldir)/$(MODULE).so
uninstall_prog: dummy
$(RM) $(bindir)/$(MODULE)
install:: install_prog$(DLLEXT)
uninstall::
$(RM) $(bindir)/$(BASEMODULE) $(bindir)/$(MODULE) $(bindir)/$(MODULE).so
uninstall:: uninstall_prog$(DLLEXT)
clean::
$(RM) $(BASEMODULE) $(MODULE)
......@@ -15,25 +15,25 @@ C_SRCS = \
@MAKE_RULES@
all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:%.exe=%$(EXEEXT))
all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:.exe=$(EXEEXT))
aviinfo.exe.spec.c: aviinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym aviinfo.o -o aviinfo.exe.spec.c -exe aviinfo.exe -mgui -L$(DLLDIR) -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -sym aviinfo.o -o $@ -exe aviinfo.exe -mgui -L$(DLLDIR) -lkernel32
aviplay.exe.spec.c: aviplay.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym aviplay.o -o aviplay.exe.spec.c -exe aviplay.exe -mgui -L$(DLLDIR) -lddraw -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -sym aviplay.o -o $@ -exe aviplay.exe -mgui -L$(DLLDIR) -lddraw -lkernel32
icinfo.exe.spec.c: icinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym icinfo.o -o icinfo.exe.spec.c -exe icinfo.exe -mgui -L$(DLLDIR) -lmsvfw32 -lkernel32
$(LDPATH) $(WINEBUILD) $(DEFS) -sym icinfo.o -o $@ -exe icinfo.exe -mgui -L$(DLLDIR) -lmsvfw32 -lkernel32
aviinfo.exe.so: aviinfo.o aviinfo.exe.spec.o
$(LDSHARED) $(LDDLLFLAGS) -o aviinfo.exe.so aviinfo.o aviinfo.exe.spec.o $(ALL_LIBS)
$(LDSHARED) $(LDDLLFLAGS) -o $@ aviinfo.o aviinfo.exe.spec.o $(ALL_LIBS)
aviplay.exe.so: aviplay.o aviplay.exe.spec.o
$(LDSHARED) $(LDDLLFLAGS) -o aviplay.exe.so aviplay.o aviplay.exe.spec.o $(ALL_LIBS)
$(LDSHARED) $(LDDLLFLAGS) -o $@ aviplay.o aviplay.exe.spec.o $(ALL_LIBS)
icinfo.exe.so: icinfo.o icinfo.exe.spec.o
$(LDSHARED) $(LDDLLFLAGS) -o icinfo.exe.so icinfo.o icinfo.exe.spec.o $(ALL_LIBS)
$(LDSHARED) $(LDDLLFLAGS) -o $@ icinfo.o icinfo.exe.spec.o $(ALL_LIBS)
aviinfo.exe: aviinfo.o
$(CC) -o $@ aviinfo.o -lkernel32 $(ALL_LIBS)
......@@ -44,38 +44,45 @@ aviplay.exe: aviplay.o
icinfo.exe: icinfo.o
$(CC) -o $@ icinfo.o -lmsvfw32 -lkernel32 $(ALL_LIBS)
aviinfo: aviinfo.exe.so
$(RM) aviinfo && $(LN_S) $(TOPOBJDIR)/wine aviinfo
$(PROGRAMS:.exe=): $(WINEWRAPPER)
$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
aviplay: aviplay.exe.so
$(RM) aviplay && $(LN_S) $(TOPOBJDIR)/wine aviplay
# Rules for installation
icinfo: icinfo.exe.so
$(RM) icinfo && $(LN_S) $(TOPOBJDIR)/wine icinfo
.PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
.PHONY: install_prog install_prog.so
install_prog.so: $(PROGRAMS:%=%.so)
$(MKINSTALLDIRS) $(dlldir)
$(INSTALL_PROGRAM) aviinfo.exe.so $(dlldir)/aviinfo.exe.so
$(INSTALL_PROGRAM) aviplay.exe.so $(dlldir)/aviplay.exe.so
$(INSTALL_PROGRAM) icinfo.exe.so $(dlldir)/icinfo.exe.so
install_prog.so:: $(PROGRAMS:%=%.so)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) aviinfo.exe.so $(bindir)/aviinfo.exe.so
$(INSTALL_PROGRAM) aviplay.exe.so $(bindir)/aviplay.exe.so
$(INSTALL_PROGRAM) icinfo.exe.so $(bindir)/icinfo.exe.so
cd $(bindir) && $(LN_S) wine aviinfo && $(LN_S) wine aviplay && $(LN_S) wine icinfo
install_prog:: $(PROGRAMS)
install_prog: $(PROGRAMS)
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) aviinfo.exe $(bindir)/aviinfo.exe
$(INSTALL_PROGRAM) aviplay.exe $(bindir)/aviplay.exe
$(INSTALL_PROGRAM) icinfo.exe $(bindir)/icinfo.exe
uninstall_prog.so:
$(RM) $(PROGRAMS:%=$(dlldir)/%.so)
uninstall_prog:
$(RM) $(PROGRAMS:%=$(bindir)/%)
install:: install_prog$(DLLEXT)
uninstall::
$(RM) $(PROGRAMS:%=$(bindir)/%$(DLLEXT)) $(PROGRAMS:%.exe=$(bindir)/%)
uninstall:: uninstall_prog$(DLLEXT)
clean::
$(RM) $(PROGRAMS:.exe=)
# Rules for checking that no imports are missing
CHECKLINK_RPATH = library tsx11 unicode
checklink:: $(PROGRAMS:%=%.so)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviinfo.exe.so && $(RM) checklink
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviplay.exe.so && $(RM) checklink
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c icinfo.exe.so && $(RM) checklink
$(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c aviinfo.exe.so && $(RM) checklink
$(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c aviplay.exe.so && $(RM) checklink
$(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c icinfo.exe.so && $(RM) checklink
### Dependencies:
#!/bin/sh
#
# Wrapper script to start a Winelib application once it is installed
#
# Copyright (C) 2002 Alexandre Julliard
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# determine the app Winelib library name
appname=`basename "$0" .exe`.exe
# first try explicit WINELOADER
if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi
# then default bin directory
if [ -x "@bindir@/wine" ]; then exec "@bindir@/wine" "$appname" "$@"; fi
# now try the directory containing $0
appdir=""
case "$0" in
*/*)
# $0 contains a path, use it
appdir=`dirname "$0"`
;;
*)
# no directory in $0, search in PATH
saved_ifs=$IFS
IFS=:
for d in $PATH
do
IFS=$saved_ifs
if [ -x "$d/$0" ]; then appdir="$d"; break; fi
done
;;
esac
if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi
# finally look in PATH
exec wine "$appname" "$@"
......@@ -28,13 +28,6 @@ all: wtmain.o
wine.c: wine.xs
perl $(XSUBPPDIR)/xsubpp -typemap $(XSUBPPDIR)/typemap $(SRCDIR)/wine.xs >wine.c || $(RM) wine.c
install::
$(MKINSTALLDIRS) $(libdir)
$(INSTALL_DATA) wine.pm $(libdir)/wine.pm
uninstall::
$(RM) $(libdir)/wine.pm
clean::
$(RM) wine.c
......
......@@ -119,11 +119,12 @@ if (defined($topobjdir))
{
chop($topobjdir = `cd $topobjdir && pwd`);
$ENV{LD_LIBRARY_PATH} = $topobjdir . ":" . $ENV{LD_LIBRARY_PATH};
$ENV{WINEDLLPATH} = $topobjdir . "/dlls";
$ENV{WINEDLLPATH} = $topobjdir . "/dlls:" . $topobjdir . "/programs";
$ENV{WINESERVER} = $topobjdir . "/server/wineserver";
$ENV{WINELOADER} = $topobjdir . "/wine";
$ENV{WINETEST_PLATFORM} = $platform || "wine";
$program ||= $topobjdir . "/programs/winetest/winetest";
$program ||= "winetest.exe";
exec $ENV{WINELOADER}, $program, $infile, @ARGV;
}
else
{
......@@ -131,7 +132,7 @@ else
}
# and now exec the program
$program ||= "winetest";
$program ||= "winetest.exe";
exec $program, $infile, @ARGV;
print STDERR "Could not exec $program\n";
exit 1;
......@@ -488,24 +488,12 @@ static void start_server( const char *oldcwd )
{
strcpy( p, "/wineserver" );
execl( path, "wineserver", NULL );
strcpy( p, "/server/wineserver" );
execl( path, "wineserver", NULL );
}
free(path);
free(path);
}
/* now try the path */
/* finally try the path */
execlp( "wineserver", "wineserver", NULL );
/* and finally the current dir */
if (!(path = malloc( strlen(oldcwd) + 20 )))
fatal_error( "out of memory\n" );
p = strcpy( path, oldcwd ) + strlen( oldcwd );
strcpy( p, "/wineserver" );
execl( path, "wineserver", NULL );
strcpy( p, "/server/wineserver" );
execl( path, "wineserver", NULL );
free(path);
fatal_error( "could not exec wineserver\n" );
}
started = 1;
......
#!/bin/sh
#
# Wrapper script to run Wine and Winelib apps from inside the source tree
#
# Copyright (C) 2002 Alexandre Julliard
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# first determine the directory that contains the app itself
appdir=""
case "$0" in
*/*)
# $0 contains a path, use it
appdir=`dirname "$0"`
;;
*)
# no directory in $0, search in PATH
saved_ifs=$IFS
IFS=:
for d in $PATH
do
IFS=$saved_ifs
if [ -x "$d/$0" ]
then
appdir="$d"
break
fi
done
;;
esac
# now find the top-level directory of the source tree
if [ -x "$appdir/server/wineserver" ]
then topdir="$appdir"
elif [ -x "$appdir/../server/wineserver" ]
then topdir="$appdir/.."
elif [ -x "$appdir/../../server/wineserver" ]
then topdir="$appdir/../.."
elif [ -x "$appdir/../../../server/wineserver" ]
then topdir="$appdir/../../.."
else
echo "$0: could not locate Wine source tree"
exit 1
fi
# setup the environment
topdir=`cd "$topdir" && pwd`
if [ -n "$LD_LIBRARY_PATH" ]
then
LD_LIBRARY_PATH="$topdir/dlls:$topdir/library:$topdir/unicode:$topdir/tsx11:$LD_LIBRARY_PATH"
else
LD_LIBRARY_PATH="$topdir/dlls:$topdir/library:$topdir/unicode:$topdir/tsx11"
fi
WINEDLLPATH="$topdir/dlls:$topdir/programs"
WINESERVER="$topdir/server/wineserver"
WINELOADER="$topdir/miscemu/wine"
export LD_LIBRARY_PATH WINEDLLPATH WINESERVER WINELOADER
# and run the application
case "$0" in
wine|*/wine)
exec "$WINELOADER" "$@"
;;
*/*)
[ -f "$0.exe.so" ] && exec "$WINELOADER" "$0.exe.so" "$@"
echo "$0: cannot find corresponding application"
exit 1
;;
*)
[ -f "$appdir/$0.exe.so" ] && exec "$WINELOADER" "$appdir/$0.exe.so" "$@"
echo "$0: cannot find corresponding application"
exit 1
;;
esac
......@@ -82,7 +82,7 @@ static BOOL start_console_renderer(void)
STARTUPINFOA si;
PROCESS_INFORMATION pi;
HANDLE hEvent = 0;
LPSTR p, path = NULL;
LPSTR p;
OBJECT_ATTRIBUTES attr;
attr.Length = sizeof(attr);
......@@ -109,55 +109,6 @@ static BOOL start_console_renderer(void)
ERR("Couldn't launch Wine console from WINECONSOLE env var... trying default access\n");
}
/* then the regular installation dir */
ret = snprintf(buffer, sizeof(buffer), "%s --use-event=%d", BINDIR "/wineconsole", hEvent);
if ((ret > -1) && (ret < sizeof(buffer)) &&
CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
goto succeed;
/* then try the dir where we were started from */
if ((path = HeapAlloc(GetProcessHeap(), 0, strlen(full_argv0) + sizeof(buffer))))
{
int n;
if ((p = strrchr(strcpy( path, full_argv0 ), '/')))
{
p++;
sprintf(p, "wineconsole --use-event=%d", hEvent);
if (CreateProcessA(NULL, path, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
goto succeed;
sprintf(p, "programs/wineconsole/wineconsole --use-event=%d", hEvent);
if (CreateProcessA(NULL, path, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
goto succeed;
}
n = readlink(full_argv0, buffer, sizeof(buffer));
if (n != -1 && n < sizeof(buffer))
{
buffer[n] = 0;
if (buffer[0] == '/') /* absolute path ? */
strcpy(path, buffer);
else if ((p = strrchr(strcpy( path, full_argv0 ), '/')))
{
strcpy(p + 1, buffer);
}
else *path = 0;
if ((p = strrchr(path, '/')))
{
p++;
sprintf(p, "wineconsole --use-event=%d", hEvent);
if (CreateProcessA(NULL, path, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
goto succeed;
sprintf(p, "programs/wineconsole/wineconsole --use-event=%d", hEvent);
if (CreateProcessA(NULL, path, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
goto succeed;
}
} else perror("readlink");
HeapFree(GetProcessHeap(), 0, path); path = NULL;
}
/* then try the regular PATH */
sprintf(buffer, "wineconsole --use-event=%d\n", hEvent);
if (CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
......@@ -166,7 +117,6 @@ static BOOL start_console_renderer(void)
goto the_end;
succeed:
if (path) HeapFree(GetProcessHeap(), 0, path);
if (WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0) goto the_end;
CloseHandle(hEvent);
......@@ -176,7 +126,6 @@ static BOOL start_console_renderer(void)
the_end:
ERR("Can't allocate console\n");
if (path) HeapFree(GetProcessHeap(), 0, path);
CloseHandle(hEvent);
return FALSE;
}
......
......@@ -87,7 +87,7 @@
#
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug]
# command line to start a debugger when an exception occurs
"Debugger"="debugger/winedbg %ld %ld"
"Debugger"="winedbg %ld %ld"
# to 0 if a message box has to be presented before running the debugger
"Auto"="1"
......
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