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 ...@@ -4,4 +4,3 @@ autom4te.cache
config.cache config.cache
config.log config.log
config.status config.status
wine
...@@ -68,6 +68,7 @@ LINTFLAGS = @LINTFLAGS@ ...@@ -68,6 +68,7 @@ LINTFLAGS = @LINTFLAGS@
ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL) ALLLINTFLAGS = $(LINTFLAGS) $(DEFS) $(OPTIONS) $(DIVINCL)
MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs MKINSTALLDIRS= $(TOPSRCDIR)/tools/mkinstalldirs
WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check WINAPI_CHECK = $(TOPSRCDIR)/tools/winapi_check/winapi_check
WINEWRAPPER = $(TOPSRCDIR)/tools/winewrapper
WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild
MAKEDEP = $(TOOLSDIR)/tools/makedep MAKEDEP = $(TOOLSDIR)/tools/makedep
WRC = $(TOOLSDIR)/tools/wrc/wrc WRC = $(TOOLSDIR)/tools/wrc/wrc
...@@ -79,11 +80,11 @@ LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11 ...@@ -79,11 +80,11 @@ LIBTSX11 = -L$(TOPOBJDIR)/tsx11 -lwine_tsx11
LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode LIBUNICODE= -L$(TOPOBJDIR)/unicode -lwine_unicode
LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid LIBUUID = -L$(TOPOBJDIR)/ole -lwine_uuid
WINETEST = $(TOPOBJDIR)/programs/winetest/winetest WINETEST = $(TOPOBJDIR)/programs/winetest/winetest.exe$(DLLEXT)
RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest RUNTEST = $(TOPSRCDIR)/programs/winetest/runtest
RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR) RUNTESTFLAGS = -q -P wine -M $(MODULE) -T $(TOPOBJDIR)
TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok) TESTRESULTS = $(PLTESTS:.pl=.ok) $(CTESTS:.c=.ok)
TESTPROGRAM = tests/$(MODULE:%.dll=%)_test TESTPROGRAM = tests/$(MODULE:%.dll=%)_test.exe
TESTLIST = tests/testlist.c TESTLIST = tests/testlist.c
TESTOBJS = $(TESTMAIN) $(TESTLIST:.c=.o) $(CTESTS:.c=.o) TESTOBJS = $(TESTMAIN) $(TESTLIST:.c=.o) $(CTESTS:.c=.o)
TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o TESTMAIN = $(TOPOBJDIR)/programs/winetest/wtmain.o
...@@ -150,7 +151,7 @@ LINTS = $(C_SRCS:.c=.ln) ...@@ -150,7 +151,7 @@ LINTS = $(C_SRCS:.c=.ln)
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 ) $(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
.c.ok: .c.ok:
$(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM) $< && touch $@ $(RUNTEST) $(RUNTESTFLAGS) -p $(TESTPROGRAM)$(DLLEXT) $< && touch $@
.pl.ok: .pl.ok:
$(RUNTEST) $(RUNTESTFLAGS) $< && touch $@ $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@
...@@ -256,7 +257,7 @@ testclean:: $(SUBDIRS:%=%/__testclean__) ...@@ -256,7 +257,7 @@ testclean:: $(SUBDIRS:%=%/__testclean__)
$(RM) $(TESTRESULTS) $(RM) $(TESTRESULTS)
clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__) 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 # Rules for installing
...@@ -274,10 +275,10 @@ $(SUBDIRS:%=%/__test__): dummy ...@@ -274,10 +275,10 @@ $(SUBDIRS:%=%/__test__): dummy
@cd `dirname $@` && $(MAKE) test @cd `dirname $@` && $(MAKE) test
$(PLTESTS:.c=.ok): $(WINETEST) $(PLTESTS:.c=.ok): $(WINETEST)
$(CTESTS:.c=.ok): $(TESTPROGRAM)$(EXEEXT) $(CTESTS:.c=.ok): $(TESTPROGRAM)$(DLLEXT)
$(WINETEST): $(WINETEST):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest cd $(TOPOBJDIR)/programs/winetest && $(MAKE) winetest.exe$(DLLEXT)
$(TESTMAIN): $(TESTMAIN):
cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o cd $(TOPOBJDIR)/programs/winetest && $(MAKE) wtmain.o
...@@ -285,20 +286,17 @@ $(TESTMAIN): ...@@ -285,20 +286,17 @@ $(TESTMAIN):
$(TESTLIST): Makefile.in $(TESTLIST): Makefile.in
$(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST) $(TOPSRCDIR)/programs/winetest/make_ctests $(CTESTS) >$(TESTLIST) || $(RM) $(TESTLIST)
$(TESTPROGRAM): $(TESTPROGRAM).exe.so $(TESTPROGRAM).so: $(TESTPROGRAM).spec.o $(TESTOBJS)
$(RM) $(TESTPROGRAM) && cd tests && $(LN_S) $(TOPOBJDIR)/../wine `basename $(TESTPROGRAM)` $(LDSHARED) $(LDDLLFLAGS) $(TESTPROGRAM).spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
$(TESTPROGRAM).exe.so: $(TESTPROGRAM).exe.spec.o $(TESTOBJS) $(TESTPROGRAM).tmp.o: $(TESTOBJS)
$(LDSHARED) $(LDDLLFLAGS) $(TESTPROGRAM).exe.spec.o $(TESTOBJS) -o $@ $(LIBWINE) $(LIBS)
$(TESTPROGRAM).exe.tmp.o: $(TESTOBJS)
$(LDCOMBINE) $(TESTOBJS) -o $@ $(LDCOMBINE) $(TESTOBJS) -o $@
-$(STRIP) --strip-unneeded $@ -$(STRIP) --strip-unneeded $@
$(TESTPROGRAM).exe.spec.c: $(TESTPROGRAM).exe.tmp.o $(WINEBUILD) $(TESTPROGRAM).spec.c: $(TESTPROGRAM).tmp.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -sym $(TESTPROGRAM).exe.tmp.o -o $@ -exe $(TESTPROGRAM).exe -mcui -L$(DLLDIR) $(TESTIMPORTS:%=-l%) $(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) $(CC) $(TESTOBJS) -o $@ $(TESTIMPORTS:%=-l%) $(LIBWINE) $(LIBS)
# Misc. rules # Misc. rules
......
...@@ -20,50 +20,33 @@ SRCDIR = @srcdir@ ...@@ -20,50 +20,33 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
LIBEXT = @LIBEXT@ LIBEXT = @LIBEXT@
LDCONFIG = @LDCONFIG@ LDCONFIG = @LDCONFIG@
MODULE = wine MODULE = none
LDIMPORTS = ntdll.dll
# Stand-alone programs # Sub-directories containing stand-alone programs
PROGRAMS = \ PROGSUBDIRS = \
server/wineserver server
# Programs that link with libwine # Sub-directories containing programs that use some Wine dlls
LIBPROGRAMS = \ LIBPROGSUBDIRS = \
debugger \ miscemu \
programs programs
# Libraries (not dlls) to build # Sub-directories containing libraries (not dlls) to build
LIBRARIES = \ LIBSUBDIRS = \
library/libwine.$(LIBEXT) \ library \
ole/libwine_uuid.a \ ole \
tsx11/libwine_tsx11.$(LIBEXT) \ tsx11 \
unicode/libwine_unicode.$(LIBEXT) unicode
# 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 to run make depend/clean/install into # Sub-directories to run make depend/clean/install into
SUBDIRS = \ SUBDIRS = \
debugger \ $(LIBPROGSUBDIRS) \
$(LIBSUBDIRS) \
$(PROGSUBDIRS) \
dlls \ dlls \
documentation \ documentation \
include \ include \
library \ tools
miscemu \
ole \
programs \
server \
tools \
tsx11 \
unicode
# Sub-directories to run make test into # Sub-directories to run make test into
TESTSUBDIRS = \ TESTSUBDIRS = \
...@@ -73,7 +56,7 @@ TESTSUBDIRS = \ ...@@ -73,7 +56,7 @@ TESTSUBDIRS = \
EMUOBJS = \ EMUOBJS = \
miscemu/miscemu.o miscemu/miscemu.o
all: Make.rules $(PROGRAMS) $(LIBPROGRAMS) $(LIBSYMLINKS) wine all: Make.rules $(PROGSUBDIRS) $(LIBPROGSUBDIRS) wine
@echo "Wine build complete." @echo "Wine build complete."
WINAPI_CHECK_EXTRA_FLAGS = --global WINAPI_CHECK_EXTRA_FLAGS = --global
...@@ -84,68 +67,30 @@ Make.rules: Make.rules.in configure ...@@ -84,68 +67,30 @@ Make.rules: Make.rules.in configure
@echo $? is newer than 'Make.rules', please rerun ./configure! @echo $? is newer than 'Make.rules', please rerun ./configure!
@exit 1 @exit 1
wine: $(EMUOBJS) $(LDIMPORTS:%=lib%.$(LIBEXT)) library/libwine.$(LIBEXT) unicode/libwine_unicode.$(LIBEXT) wine: $(WINEWRAPPER)
$(CC) -o wine $(EMUOBJS) -L. $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBS) $(LDFLAGS) $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
install_wine: dummy
$(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) wine $(bindir)/wine
install:: all install_wine $(SUBDIRS:%=%/__install__) install:: all $(SUBDIRS:%=%/__install__)
-$(LDCONFIG) -$(LDCONFIG)
uninstall:: $(SUBDIRS:%=%/__uninstall__) 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 # Dependencies between directories
$(PROGRAMS): tools $(LIBPROGSUBDIRS): tools dlls $(LIBSUBDIRS)
$(EMUOBJS): tools dlls
$(LIBPROGRAMS): tools dlls wine $(PROGSUBDIRS): tools $(LIBSUBDIRS)
server tools: $(LIBRARIES) dlls: tools $(LIBSUBDIRS)
dlls: tools $(LIBRARIES) tools: $(LIBSUBDIRS)
checklink:: checklink::
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c && $(RM) checklink $(CC) -o checklink $(TOPSRCDIR)/library/checklink.c && $(RM) checklink
checklink:: checklink::
@cd dlls && $(MAKE) checklink @cd dlls && $(MAKE) checklink
@cd debugger && $(MAKE) checklink @cd programs && $(MAKE) checklink
test_environment: dummy test_environment: dummy
@cd programs/winetest && $(MAKE) all @cd programs/winetest && $(MAKE) all
......
...@@ -35,14 +35,16 @@ $(MODULE).so: $(ALL_OBJS) Makefile.in ...@@ -35,14 +35,16 @@ $(MODULE).so: $(ALL_OBJS) Makefile.in
# Rules for .dll files # Rules for .dll files
$(MODULE): $(OBJS) $(MODULE).dbg.o $(SPEC_DEF) Makefile.in $(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) $(SPEC_DEF): $(WINEBUILD)
# Rules for checking that no imports are missing # Rules for checking that no imports are missing
CHECKLINK_RPATH = dlls library tsx11 unicode
checklink:: $(MODULE)$(DLLEXT) 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 # Rules for testing
......
...@@ -288,8 +288,6 @@ BOOL X11DRV_CLIPBOARD_LaunchServer() ...@@ -288,8 +288,6 @@ BOOL X11DRV_CLIPBOARD_LaunchServer()
execl( BINDIR "/wineclipsrv", "wineclipsrv", execl( BINDIR "/wineclipsrv", "wineclipsrv",
selMask, dbgClassMask, clearSelection, NULL ); selMask, dbgClassMask, clearSelection, NULL );
execlp( "wineclipsrv", "wineclipsrv", selMask, dbgClassMask, clearSelection, NULL ); execlp( "wineclipsrv", "wineclipsrv", selMask, dbgClassMask, clearSelection, NULL );
execl( "./windows/x11drv/wineclipsrv", "wineclipsrv",
selMask, dbgClassMask, clearSelection, NULL );
/* Exec Failed! */ /* Exec Failed! */
perror("Could not start Wine clipboard server"); perror("Could not start Wine clipboard server");
......
...@@ -65,7 +65,7 @@ $(BOOKNAME).ps: $(BOOK_SRCS) ...@@ -65,7 +65,7 @@ $(BOOKNAME).ps: $(BOOK_SRCS)
db2ps $(BOOKNAME).sgml > /dev/null db2ps $(BOOKNAME).sgml > /dev/null
wine.man: wine.man.in 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:: $(MAN_TARGETS)
$(INSTALL) -d $(mandir)/man$(prog_manext) $(INSTALL) -d $(mandir)/man$(prog_manext)
......
...@@ -107,6 +107,8 @@ WINE REGISTRY Version 2 ...@@ -107,6 +107,8 @@ WINE REGISTRY Version 2
"msacm" = "builtin, native" "msacm" = "builtin, native"
"msacm32" = "builtin, native" "msacm32" = "builtin, native"
"midimap.drv" = "builtin, native" "midimap.drv" = "builtin, native"
; you can specify applications too
"notepad.exe" = "native, builtin"
; default for all other dlls ; default for all other dlls
"*" = "native, builtin, so" "*" = "native, builtin, so"
......
...@@ -254,31 +254,30 @@ processes, it is possible to run a number of truly independent ...@@ -254,31 +254,30 @@ processes, it is possible to run a number of truly independent
.B wine .B wine
processes. processes.
.TP .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 .I WINESERVER
Specifies the path and name of the Specifies the path and name of the
.B wineserver .B wineserver
binary. If not set, a file named "wineserver" is searched in the binary. If not set, Wine will try to load
path and in a few other likely locations. .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 .TP
.I WINELOADER .I WINELOADER
Specifies the path and name of the Specifies the path and name of the
.B wine .B wine
binary to use to launch new Windows processes. If not set, a binary binary to use to launch new Windows processes. If not set, Wine will
named "wine" is searched in the path and in a few other likely try to load
locations. .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 .TP
.I WINEDLLPATH .I WINEDLLPATH
Specifies the path(s) in which to search for builtin dll files. This Specifies the path(s) in which to search for builtin dlls and Winelib
is a list of directories separated by ":". Builtin dlls are also applications. This is a list of directories separated by ":". In
searched in the directories specified by the standard addition to any directory specified in
.I LD_LIBRARY_PATH .I WINEDLLPATH,
if they are not found in the directories listed in Wine will also look in
.I WINEDLLPATH. .B @dlldir@.
.TP .TP
.I DISPLAY .I DISPLAY
Specifies the X11 display to use. Specifies the X11 display to use.
...@@ -378,12 +377,12 @@ The ...@@ -378,12 +377,12 @@ The
.B wine .B wine
debugger debugger
.TP .TP
.I @bindir@/wineclpsrv .I @bindir@/wineclipsrv
The The
.B wine .B wine
clipboard server clipboard server
.TP .TP
.I @libdir@ .I @dlldir@
Directory containing Directory containing
.B wine's .B wine's
shared libraries shared libraries
......
...@@ -186,6 +186,19 @@ enum loadorder_type ...@@ -186,6 +186,19 @@ enum loadorder_type
LOADORDER_NTYPES 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 */ /* module.c */
extern WINE_MODREF *MODULE_AllocModRef( HMODULE hModule, LPCSTR filename ); extern WINE_MODREF *MODULE_AllocModRef( HMODULE hModule, LPCSTR filename );
extern FARPROC MODULE_GetProcAddress( HMODULE hModule, LPCSTR function, BOOL snoop ); 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 ...@@ -197,6 +210,7 @@ extern WINE_MODREF *MODULE_LoadLibraryExA( LPCSTR libname, HFILE hfile, DWORD fl
extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm ); extern BOOL MODULE_FreeLibrary( WINE_MODREF *wm );
extern WINE_MODREF *MODULE_FindModule( LPCSTR path ); extern WINE_MODREF *MODULE_FindModule( LPCSTR path );
extern HMODULE16 MODULE_CreateDummyModule( LPCSTR filename, HMODULE module32 ); 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 FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hmodule, LPCSTR name );
extern SEGPTR WINAPI HasGPHandler16( SEGPTR address ); extern SEGPTR WINAPI HasGPHandler16( SEGPTR address );
extern void MODULE_WalkModref( DWORD id ); extern void MODULE_WalkModref( DWORD id );
...@@ -287,10 +301,5 @@ extern int BUILTIN32_dlclose( void *handle ); ...@@ -287,10 +301,5 @@ extern int BUILTIN32_dlclose( void *handle );
/* scheduler/process.c */ /* scheduler/process.c */
extern void PROCESS_CallUserSignalProc( UINT uCode, HMODULE16 hModule ); 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 */ #endif /* __WINE_MODULE_H */
...@@ -33,8 +33,7 @@ extern void *wine_dlsym( void *handle, const char *symbol, char *error, int erro ...@@ -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 int wine_dlclose( void *handle, char *error, int errorsize );
extern void wine_dll_set_callback( load_dll_callback_t load ); 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( const char *filename, char *error, int errorsize );
extern void *wine_dll_load_main_exe( const char *name, int search_path, extern void *wine_dll_load_main_exe( const char *name, char *error, int errorsize, int test_only );
char *error, int errorsize );
extern void wine_dll_unload( void *handle ); extern void wine_dll_unload( void *handle );
extern int __wine_main_argc; extern int __wine_main_argc;
......
...@@ -118,7 +118,7 @@ inline static int file_exists( const char *name ) ...@@ -118,7 +118,7 @@ inline static int file_exists( const char *name )
/* open a library for a given dll, searching in the dll path /* open a library for a given dll, searching in the dll path
* 'name' must be the Windows dll name (e.g. "kernel32.dll") */ * '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); int i, namelen = strlen(name);
char *buffer, *p; char *buffer, *p;
...@@ -139,17 +139,16 @@ static void *dlopen_dll( const char *name, char *error, int errorsize ) ...@@ -139,17 +139,16 @@ static void *dlopen_dll( const char *name, char *error, int errorsize )
int len = strlen(dll_paths[i]); int len = strlen(dll_paths[i]);
p = buffer + dll_path_maxlen - len; p = buffer + dll_path_maxlen - len;
memcpy( p, dll_paths[i], len ); memcpy( p, dll_paths[i], len );
if ((ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break; if (test_only) /* just test for file existence */
if (file_exists( p )) /* exists but cannot be loaded, return the error */
{ {
free( buffer ); if ((ret = (void *)file_exists( p ))) break;
return NULL; }
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 ); free( buffer );
return ret; return ret;
} }
...@@ -374,7 +373,7 @@ void *wine_dll_load( const char *filename, char *error, int errorsize ) ...@@ -374,7 +373,7 @@ void *wine_dll_load( const char *filename, char *error, int errorsize )
return (void *)1; 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 ) ...@@ -393,46 +392,9 @@ void wine_dll_unload( void *handle )
/*********************************************************************** /***********************************************************************
* wine_dll_load_main_exe * 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; return dlopen_dll( name, error, errorsize, test_only );
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;
} }
Makefile Makefile
wine
wine.spec.c wine.spec.c
...@@ -3,19 +3,32 @@ TOPSRCDIR = @top_srcdir@ ...@@ -3,19 +3,32 @@ TOPSRCDIR = @top_srcdir@
TOPOBJDIR = .. TOPOBJDIR = ..
SRCDIR = @srcdir@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = miscemu MODULE = wine
IMPORTS = ntdll IMPORTS = ntdll
LDIMPORTS = ntdll.dll
SPEC_SRCS = wine.spec SPEC_SRCS = wine.spec
C_SRCS = \ C_SRCS = \
main.c main.c
all: $(MODULE).o all: $(MODULE)
@MAKE_RULES@ @MAKE_RULES@
$(MODULE).o: $(SPEC_SRCS:.spec=.spec.o) $(OBJS) Makefile.in $(TOPSRCDIR)/Make.rules.in ALL_OBJS = $(SPEC_SRCS:.spec=.spec.o) $(OBJS)
$(LDCOMBINE) $(SPEC_SRCS:.spec=.spec.o) $(OBJS) -o $@
$(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: ### Dependencies:
Makefile Makefile
Makeprog.rules Makeprog.rules
wineapploader
...@@ -4,54 +4,106 @@ SRCDIR = @srcdir@ ...@@ -4,54 +4,106 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = none MODULE = none
INSTALLSUBDIRS = \ SUBDIRS = \
$(TOPOBJDIR)/debugger \
avitools \
clock \
cmdlgtst \
control \ control \
expand \ expand \
notepad \ notepad \
osversioncheck \
progman \ progman \
regapi \
regedit \ regedit \
regsvr32 \ regsvr32 \
regtest \
uninstaller \ uninstaller \
view \
wcmd \ wcmd \
wineconsole \ wineconsole \
winemine \ winemine \
winepath \ winepath \
winetest \
winhelp \ winhelp \
winver winver
# Programs that are not generally useful and don't get installed # Programs to install in bin directory
# Use 'make everything' to build them # We don't install everything to avoid polluting /usr/bin too much
OTHERSUBDIRS = \ INSTALLPROGS = \
avitools \ expand \
clock \ notepad \
cmdlgtst \ progman \
osversioncheck \ regedit \
regapi \ regsvr32 \
regtest \ uninstaller \
view \ wcmd \
winetest wineconsole \
winedbg \
SUBDIRS = $(INSTALLSUBDIRS) $(OTHERSUBDIRS) 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@ @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 $(SUBDIRS:%=%/__checklink__): dummy
@cd `dirname $@` && $(MAKE) checklink @cd `dirname $@` && $(MAKE) checklink
checklink:: $(SUBDIRS:%=%/__checklink__)
check test:: $(SUBDIRS:%=%/__test__) 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: ### Dependencies:
...@@ -32,8 +32,8 @@ $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD) ...@@ -32,8 +32,8 @@ $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(WINEBUILD)
$(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in $(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS) $(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS)
$(BASEMODULE): $(MODULE).so $(BASEMODULE): $(WINEWRAPPER)
$(RM) $(BASEMODULE) && $(LN_S) $(TOPOBJDIR)/wine $(BASEMODULE) $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
# Rules for .exe main module # Rules for .exe main module
...@@ -42,8 +42,10 @@ $(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in ...@@ -42,8 +42,10 @@ $(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
# Rules for checking that no imports are missing # Rules for checking that no imports are missing
CHECKLINK_RPATH = library tsx11 unicode
checklink:: $(MODULE).so 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 # Rules for testing
...@@ -51,21 +53,25 @@ $(TESTRESULTS): $(MODULE)$(DLLEXT) ...@@ -51,21 +53,25 @@ $(TESTRESULTS): $(MODULE)$(DLLEXT)
# Rules for installation # 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 install_prog.so: $(MODULE).so
$(MKINSTALLDIRS) $(bindir) $(MKINSTALLDIRS) $(dlldir)
$(INSTALL_PROGRAM) $(MODULE).so $(bindir)/$(MODULE).so $(INSTALL_PROGRAM) $(MODULE).so $(dlldir)/$(MODULE).so
cd $(bindir) && $(RM) $(BASEMODULE) && $(LN_S) wine $(BASEMODULE)
install_prog.exe:: $(MODULE) install_prog: $(MODULE)
$(MKINSTALLDIRS) $(bindir) $(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE) $(INSTALL_PROGRAM) $(MODULE) $(bindir)/$(MODULE)
uninstall_prog.so: dummy
$(RM) $(dlldir)/$(MODULE).so
uninstall_prog: dummy
$(RM) $(bindir)/$(MODULE)
install:: install_prog$(DLLEXT) install:: install_prog$(DLLEXT)
uninstall:: uninstall:: uninstall_prog$(DLLEXT)
$(RM) $(bindir)/$(BASEMODULE) $(bindir)/$(MODULE) $(bindir)/$(MODULE).so
clean:: clean::
$(RM) $(BASEMODULE) $(MODULE) $(RM) $(BASEMODULE) $(MODULE)
...@@ -15,25 +15,25 @@ C_SRCS = \ ...@@ -15,25 +15,25 @@ C_SRCS = \
@MAKE_RULES@ @MAKE_RULES@
all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:%.exe=%$(EXEEXT)) all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:.exe=$(EXEEXT))
aviinfo.exe.spec.c: aviinfo.o $(WINEBUILD) 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) 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) 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 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 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 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 aviinfo.exe: aviinfo.o
$(CC) -o $@ aviinfo.o -lkernel32 $(ALL_LIBS) $(CC) -o $@ aviinfo.o -lkernel32 $(ALL_LIBS)
...@@ -44,38 +44,45 @@ aviplay.exe: aviplay.o ...@@ -44,38 +44,45 @@ aviplay.exe: aviplay.o
icinfo.exe: icinfo.o icinfo.exe: icinfo.o
$(CC) -o $@ icinfo.o -lmsvfw32 -lkernel32 $(ALL_LIBS) $(CC) -o $@ icinfo.o -lmsvfw32 -lkernel32 $(ALL_LIBS)
aviinfo: aviinfo.exe.so $(PROGRAMS:.exe=): $(WINEWRAPPER)
$(RM) aviinfo && $(LN_S) $(TOPOBJDIR)/wine aviinfo $(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
aviplay: aviplay.exe.so # Rules for installation
$(RM) aviplay && $(LN_S) $(TOPOBJDIR)/wine aviplay
icinfo: icinfo.exe.so .PHONY: install_prog install_prog.so uninstall_prog uninstall_prog.so
$(RM) icinfo && $(LN_S) $(TOPOBJDIR)/wine icinfo
.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) install_prog: $(PROGRAMS)
$(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)
$(MKINSTALLDIRS) $(bindir) $(MKINSTALLDIRS) $(bindir)
$(INSTALL_PROGRAM) aviinfo.exe $(bindir)/aviinfo.exe $(INSTALL_PROGRAM) aviinfo.exe $(bindir)/aviinfo.exe
$(INSTALL_PROGRAM) aviplay.exe $(bindir)/aviplay.exe $(INSTALL_PROGRAM) aviplay.exe $(bindir)/aviplay.exe
$(INSTALL_PROGRAM) icinfo.exe $(bindir)/icinfo.exe $(INSTALL_PROGRAM) icinfo.exe $(bindir)/icinfo.exe
uninstall_prog.so:
$(RM) $(PROGRAMS:%=$(dlldir)/%.so)
uninstall_prog:
$(RM) $(PROGRAMS:%=$(bindir)/%)
install:: install_prog$(DLLEXT) install:: install_prog$(DLLEXT)
uninstall:: uninstall:: uninstall_prog$(DLLEXT)
$(RM) $(PROGRAMS:%=$(bindir)/%$(DLLEXT)) $(PROGRAMS:%.exe=$(bindir)/%)
clean::
$(RM) $(PROGRAMS:.exe=)
# Rules for checking that no imports are missing
CHECKLINK_RPATH = library tsx11 unicode
checklink:: $(PROGRAMS:%=%.so) checklink:: $(PROGRAMS:%=%.so)
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviinfo.exe.so && $(RM) checklink $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(TOPSRCDIR)/library/checklink.c aviinfo.exe.so && $(RM) checklink
$(CC) -o checklink $(TOPSRCDIR)/library/checklink.c aviplay.exe.so && $(RM) checklink $(CC) -o checklink $(CHECKLINK_RPATH:%=-Wl,-rpath,$(TOPOBJDIR)/%) $(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 icinfo.exe.so && $(RM) checklink
### Dependencies: ### 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 ...@@ -28,13 +28,6 @@ all: wtmain.o
wine.c: wine.xs wine.c: wine.xs
perl $(XSUBPPDIR)/xsubpp -typemap $(XSUBPPDIR)/typemap $(SRCDIR)/wine.xs >wine.c || $(RM) wine.c 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:: clean::
$(RM) wine.c $(RM) wine.c
......
...@@ -119,11 +119,12 @@ if (defined($topobjdir)) ...@@ -119,11 +119,12 @@ if (defined($topobjdir))
{ {
chop($topobjdir = `cd $topobjdir && pwd`); chop($topobjdir = `cd $topobjdir && pwd`);
$ENV{LD_LIBRARY_PATH} = $topobjdir . ":" . $ENV{LD_LIBRARY_PATH}; $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{WINESERVER} = $topobjdir . "/server/wineserver";
$ENV{WINELOADER} = $topobjdir . "/wine"; $ENV{WINELOADER} = $topobjdir . "/wine";
$ENV{WINETEST_PLATFORM} = $platform || "wine"; $ENV{WINETEST_PLATFORM} = $platform || "wine";
$program ||= $topobjdir . "/programs/winetest/winetest"; $program ||= "winetest.exe";
exec $ENV{WINELOADER}, $program, $infile, @ARGV;
} }
else else
{ {
...@@ -131,7 +132,7 @@ else ...@@ -131,7 +132,7 @@ else
} }
# and now exec the program # and now exec the program
$program ||= "winetest"; $program ||= "winetest.exe";
exec $program, $infile, @ARGV; exec $program, $infile, @ARGV;
print STDERR "Could not exec $program\n"; print STDERR "Could not exec $program\n";
exit 1; exit 1;
...@@ -488,24 +488,12 @@ static void start_server( const char *oldcwd ) ...@@ -488,24 +488,12 @@ static void start_server( const char *oldcwd )
{ {
strcpy( p, "/wineserver" ); strcpy( p, "/wineserver" );
execl( path, "wineserver", NULL ); 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 ); 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" ); fatal_error( "could not exec wineserver\n" );
} }
started = 1; 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) ...@@ -82,7 +82,7 @@ static BOOL start_console_renderer(void)
STARTUPINFOA si; STARTUPINFOA si;
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
HANDLE hEvent = 0; HANDLE hEvent = 0;
LPSTR p, path = NULL; LPSTR p;
OBJECT_ATTRIBUTES attr; OBJECT_ATTRIBUTES attr;
attr.Length = sizeof(attr); attr.Length = sizeof(attr);
...@@ -109,55 +109,6 @@ static BOOL start_console_renderer(void) ...@@ -109,55 +109,6 @@ static BOOL start_console_renderer(void)
ERR("Couldn't launch Wine console from WINECONSOLE env var... trying default access\n"); 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 */ /* then try the regular PATH */
sprintf(buffer, "wineconsole --use-event=%d\n", hEvent); sprintf(buffer, "wineconsole --use-event=%d\n", hEvent);
if (CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi)) if (CreateProcessA(NULL, buffer, NULL, NULL, TRUE, DETACHED_PROCESS, NULL, NULL, &si, &pi))
...@@ -166,7 +117,6 @@ static BOOL start_console_renderer(void) ...@@ -166,7 +117,6 @@ static BOOL start_console_renderer(void)
goto the_end; goto the_end;
succeed: succeed:
if (path) HeapFree(GetProcessHeap(), 0, path);
if (WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0) goto the_end; if (WaitForSingleObject(hEvent, INFINITE) != WAIT_OBJECT_0) goto the_end;
CloseHandle(hEvent); CloseHandle(hEvent);
...@@ -176,7 +126,6 @@ static BOOL start_console_renderer(void) ...@@ -176,7 +126,6 @@ static BOOL start_console_renderer(void)
the_end: the_end:
ERR("Can't allocate console\n"); ERR("Can't allocate console\n");
if (path) HeapFree(GetProcessHeap(), 0, path);
CloseHandle(hEvent); CloseHandle(hEvent);
return FALSE; return FALSE;
} }
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
# #
[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug] [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\AeDebug]
# command line to start a debugger when an exception occurs # 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 # to 0 if a message box has to be presented before running the debugger
"Auto"="1" "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