Ok, so this time around I kept the generation of wineapploader in the Makefile (though I don't really agree with it). However, looking for wine in bindir does not make sense: * I don't install the Winelib applications I compile using Winelib. So I leave prefix to the default value: /usr/local * I always build my application using a Wine source tree. This means that there is strictly nothing of interest in /usr/local/bin. * configure.ac goes to great length to figure out where wrc, winebuild and *wine* are located. So at the end of configure.ac we know very well what the path to wine is. It's '$WINE'. Also: * if appname="foo.exe" and we have a "foo.exe" file in the build directory, then the native application is going to be loaded rather than the Winelib application one wants to test. That's not very practical. * in my tests WINEDLLPATH=$WINEDLLPATH:@winelibdir@ had no effect. If all I have is 'hellowin.exe.so' then the following command fails: WINEDLLPATH="$WINEDLLPATH:." wine hellowin.exe wine: cannot find 'hellowin.exe' '.' is what current makefiles append. But even if I put `pwd` this does not work. So instead one should have appname="foo.exe.so" which is what this patch does. However WINEDLLPATH may have an impact on loading Winelib dlls that would be in the same directory. So maybe we should keep it but then we should gather all the *_DLL_PATH variables of the Makefile, which also means we must generate wineapploader in each Makefile rather than in the toplevel Makefile. The patch also symlinks to the toplevel winepploader file rather than copying it. If they are going to be identical then it seems better this way: * changes in the top level wineapploader are immediately visible in the individual projects * otherwise we should add extra dependencies and build the derived files in a target separate from the main .exe.so target * one thing to check would be whether the install targets preserve the symlink (bad) or copy the file. I'm afraid they are going to preserve the symlink. Anyway, here's take 2. (it's a short patch but maybe I should split it :-) Changelog: Francois Gouget <fgouget@codeweavers.com> * tools/winemaker wineapploader changes: - Use WINE as determined by configure.ac - make the toplevel wineapploader executable - symlink to it rather than copying - One must load 'xxx.exe.so' otherwise wine fails to load the Winelib application - Setting WINEDLLPATH does not seem necessary -- Francois Gouget fgouget@codeweavers.com
Index: tools/winemaker =================================================================== RCS file: /home/wine/wine/tools/winemaker,v retrieving revision 1.54 diff -u -r1.54 winemaker --- tools/winemaker 26 Sep 2002 03:20:59 -0000 1.54 +++ tools/winemaker 26 Sep 2002 21:26:32 -0000 @@ -1852,8 +1852,7 @@ print FILEO "\n\n"; if (@$project[$P_PATH] eq "") { print FILEO "wineapploader: wineapploader.in\n"; - print FILEO "\tsed -e 's,\@bindir\\\@,\$(bindir),g' " . - "-e 's,\@winelibdir\\\@,.,g' " . + print FILEO "\tsed -e 's,\@WINE\@,\$(WINE),g' " . "\$(SRCDIR)/wineapploader.in >\$\@ || \$(RM) \$\@\n"; print FILEO "\n"; } @@ -1931,7 +1929,9 @@ } print FILEO " \$(LDDLLFLAGS) -o \$\@ \$(${canon}_OBJS) @$target[$T_NAME].spec.o \$(${canon}_LIBRARY_PATH) \$(ALL_LIBRARY_PATH) $all_libs \$(LIBS)\n"; if (@$target[$T_TYPE] ne $TT_DLL) { - print FILEO "\ttest -f @$target[$T_NAME] || \$(INSTALL_SCRIPT) wineapploader @$target[$T_NAME]\n"; + my $basename=@$target[$T_NAME]; + $basename=~ s/\.exe$//; + print FILEO "\ttest -f @$target[$T_NAME] || \$(LN_S) \$(TOPOBJDIR)/wineapploader $basename\n"; } print FILEO "\n\n"; } @@ -3155,16 +3170,14 @@ # Copyright (C) 2002 Alexandre Julliard # determine the app Winelib library name -appname=`basename "$0" .exe`.exe - -#allow Wine to load Winelib application from the current directory -export WINEDLLPATH=$WINEDLLPATH:@winelibdir@ +appname=`basename "$0"`.so # 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 +WINE="@WINE@" +if [ -x "$WINE" ]; then exec "$WINE" "$appname" "$@"; fi # now try the directory containing $0 appdir=""