Winelib binaries as ELF executables not .exe.so

   1 
   2 According to vitamin on IRC, as of 09/28/2006 this is "an old effort which doesn't work now."
   3 So do not use it unless you know what you're doing. --Murph
   4 
   5 Index: wine/programs/Makefile.in
   6 ===================================================================
   7 RCS file: /home/wine/wine/programs/Makefile.in,v
   8 retrieving revision 1.46
   9 diff -u -r1.46 Makefile.in
  10 --- wine/programs/Makefile.in    11 Aug 2004 20:59:09 -0000    1.46
  11 +++ wine/programs/Makefile.in    3 Jan 2005 04:07:02 -0000
  12 @@ -123,27 +123,19 @@
  13 
  14  @MAKE_RULES@
  15 
  16 -all: wineapploader winelauncher $(SUBDIRS) $(SYMLINKS)
  17 -
  18 -wineapploader: wineapploader.in
  19 -    sed -e 's,@bindir\@,$(bindir),g' $(SRCDIR)/wineapploader.in >$@ || ($(RM) $@ && false)
  20 +all: winelauncher $(SUBDIRS) $(SYMLINKS)
  21 
  22  winelauncher: winelauncher.in
  23     sed -e 's,@bindir\@,$(bindir),g' -e 's,@libdir\@,$(libdir),g' -e 's,@dlldir\@,$(dlldir),g' $(SRCDIR)/winelauncher.in >$@ || ($(RM) $@ && false)
  24 
  25  # Rules for installation
  26 
  27 -.PHONY: install-apploader install-progs install-progs.so $(INSTALLPROGS:%=%/__installprog__)
  28 -
  29 -install-apploader: wineapploader dummy
  30 -    $(MKINSTALLDIRS) $(bindir)
  31 -    $(INSTALL_SCRIPT) wineapploader $(bindir)/wineapploader
  32 +.PHONY: install-progs install-progs.so $(INSTALLPROGS:%=%/__installprog__)
  33 
  34 -$(INSTALLPROGS:%=%/__installprog__): install-apploader
  35 -    $(RM) $(bindir)/`dirname $@` && $(LN) $(bindir)/wineapploader $(bindir)/`dirname $@`
  36 +$(INSTALLPROGS:%=%/__installprog__):
  37 +    $(RM) $(bindir)/`dirname $@` && $(LN_S) $(dlldir)/`dirname $@`.exe.so $(bindir)/`dirname $@`
  38 
  39  install-progs.so: $(INSTALLPROGS:%=%/__installprog__)
  40 -    $(RM) $(bindir)/wineapploader
  41 
  42  install-progs: # nothing to do here
  43 
  44 @@ -152,11 +144,11 @@
  45     $(INSTALL_SCRIPT) winelauncher $(bindir)/winelauncher
  46 
  47  uninstall::
  48 -    -cd $(bindir) && $(RM) wineapploader winelauncher $(INSTALLPROGS)
  49 +    -cd $(bindir) && $(RM) winelauncher $(INSTALLPROGS)
  50     -rmdir $(dlldir)
  51 
  52  clean::
  53 -    $(RM) wineapploader winelauncher $(SYMLINKS)
  54 +    $(RM) winelauncher $(SYMLINKS)
  55 
  56  # Rules for testing
  57 
  58 Index: wine/tools/winebuild/spec32.c
  59 ===================================================================
  60 RCS file: /home/wine/wine/tools/winebuild/spec32.c,v
  61 retrieving revision 1.84
  62 diff -u -r1.84 spec32.c
  63 --- wine/tools/winebuild/spec32.c    18 Oct 2004 21:27:52 -0000    1.84
  64 +++ wine/tools/winebuild/spec32.c    3 Jan 2005 04:07:02 -0000
  65 @@ -6,6 +6,7 @@
  66   * Copyright 1995, 1996, 1997 Alexandre Julliard
  67   * Copyright 1997 Eric Youngdale
  68   * Copyright 1999 Ulrich Weigand
  69 + * Copyright 2004-2005 Mike Hearn/Vincent Béron
  70   *
  71   * This library is free software; you can redistribute it and/or
  72   * modify it under the terms of the GNU Lesser General Public
  73 @@ -95,6 +96,322 @@
  74 
  75 
  76  /*******************************************************************
  77 + *         output_relaunch_entrypoint
  78 + *
  79 + * Output the entry point for winelib apps so they can launch wine correctly.
  80 + */
  81 +static void output_relaunch_entrypoint( FILE *outfile )
  82 +{
  83 +#if defined(__i386__) && defined(__GNUC__) && (defined(linux) || defined(__FreeBSD__))
  84 +    fprintf( outfile,
  85 +             "\n"
  86 +             "/* this code allows the user to run winelib apps like normal binaries */\n"
  87 +             "/* we can't dynamically link to anything here, nor use malloc */\n"
  88 +             "\n"
  89 +             "#define NULL ((void *)0)\n"
  90 +             "#define ENOENT       2\n"
  91 +             "struct stat\n"
  92 +             "{\n"
  93 +             "    int dummy;\n"
  94 +             "};\n"
  95 +#if defined(linux)
  96 +             "#define SYS_exit     1\n"
  97 +             "#define SYS_write    4\n"
  98 +             "#define SYS_execve   11\n"
  99 +             "#define SYS_stat     106\n"
 100 +             "\n"
 101 +             "#define SYSCALL_RET(ret) (((ret) < 0 && (ret) > -4096) ? -1 : (ret))\n"
 102 +             "\n"
 103 +             "static inline __attribute__((noreturn)) void __wine_relaunch_exit( int code )\n"
 104 +             "{\n"
 105 +             "    for(;;)  /* avoid warning */\n"
 106 +             "        __asm__ __volatile__( \"pushl %%%%ebx; movl %%1,%%%%ebx; int $0x80; popl %%%%ebx\"\n"
 107 +             "                              : : \"a\" (SYS_exit), \"r\" (code) );\n"
 108 +             "}\n"
 109 +             "\n"
 110 +             "static inline unsigned int __wine_relaunch_write( int fd, const void *buffer, unsigned int len )\n"
 111 +             "{\n"
 112 +             "    int ret;"
 113 +             "    __asm__ __volatile__( \"pushl %%%%ebx; movl %%2,%%%%ebx; int $0x80; popl %%%%ebx\"\n"
 114 +             "                          : \"=a\" (ret) : \"0\" (SYS_write), \"r\" (fd), \"c\" (buffer), \"d\" (len) );\n"
 115 +             "    return SYSCALL_RET(ret);\n"
 116 +             "}\n"
 117 +             "\n"
 118 +             "static inline int __wine_relaunch_execve( const char *filename, char *argv[], char *envp[] )\n"
 119 +             "{\n"
 120 +             "    int ret;\n"
 121 +             "    __asm__ __volatile__( \"pushl %%%%ebx; movl %%2,%%%%ebx; int $0x80; popl %%%%ebx\"\n"
 122 +             "                          : \"=a\" (ret) : \"0\" (SYS_execve), \"r\" (filename), \"c\" (argv), \"d\" (envp) );\n"
 123 +             "    return SYSCALL_RET(ret);\n"
 124 +             "}\n"
 125 +             "\n"
 126 +             "static inline int __wine_relaunch_stat( const char *filename, struct stat *s_stat )\n"
 127 +             "{\n"
 128 +             "    int ret;\n"
 129 +             "    __asm__ __volatile__( \"pushl %%%%ebx; movl %%2,%%%%ebx; int $0x80; popl %%%%ebx\"\n"
 130 +             "                          : \"=a\" (ret) : \"0\" (SYS_stat), \"r\" (filename), \"c\" (s_stat) );\n"
 131 +             "    return SYSCALL_RET(ret);\n"
 132 +             "}\n"
 133 +#elif defined(__FreeBSD__)
 134 +             "#define SYS_exit     1\n"
 135 +             "#define SYS_write    4\n"
 136 +             "#define SYS_execve   59\n"
 137 +             "#define SYS_stat     188\n"
 138 +             "\n"
 139 +             "static inline __attribute__((noreturn)) void __wine_relaunch_exit( int code )\n"
 140 +             "{\n"
 141 +             "    for(;;)  /* avoid warning */\n"
 142 +             "        __asm__ __volatile__(\n"
 143 +             "            \"pushl %%1;\"               /* code */\n"
 144 +             "            \".byte 0x9a; .long 0; .word 7;\" /* lcall 7:0... FreeeBSD syscall */\n"
 145 +             "            \"addl $4,%%%%esp\"          /* args cleanup */\n"
 146 +             "            : : \"a\" (SYS_exit), \"r\" (code) );\n"
 147 +             "}\n"
 148 +             "\n"
 149 +             "static inline unsigned int __wine_relaunch_write( int fd, const void *buffer, unsigned int len )\n"
 150 +             "{\n"
 151 +             "    int ret;"
 152 +             "    __asm__ __volatile__(\n"
 153 +             "        \"pushl %%4;\"               /* len */\n"
 154 +             "        \"pushl %%3;\"               /* buffer */\n"
 155 +             "        \"pushl %%2;\"               /* fd */\n"
 156 +             "        \".byte 0x9a; .long 0; .word 7;\" /* lcall 7:0... FreeBSD syscall */\n"
 157 +             "        \"jnc 1f;\"                  /* if there has been an error... */\n"
 158 +             "        \"orl $0x80000000,%%%%eax;\" /* change the sign of %%eax to indicate so */\n"
 159 +             "        \"1:\"\n"
 160 +             "        \"addl $12,%%%%esp\"         /* args cleanup */\n"
 161 +             "        : \"=a\" (ret) : \"0\" (SYS_write), \"r\" (fd), \"r\" (buffer), \"r\" (len) );\n"
 162 +             "    return ret;\n"
 163 +             "}\n"
 164 +             "\n"
 165 +             "static inline int __wine_relaunch_execve( const char *filename, char *argv[], char *envp[] )\n"
 166 +             "{\n"
 167 +             "    int ret;\n"
 168 +             "    __asm__ __volatile__(\n"
 169 +             "        \"pushl %%4;\"               /* envp */\n"
 170 +             "        \"pushl %%3;\"               /* argv */\n"
 171 +             "        \"pushl %%2;\"               /* filename */\n"
 172 +             "        \".byte 0x9a; .long 0; .word 7;\" /* lcall 7:0... FreeBSD syscall */\n"
 173 +             "        \"jnc 1f;\"                  /* if there has been an error... */\n"
 174 +             "        \"orl $0x80000000,%%%%eax;\" /* change the sign of %%eax to indicate so */\n"
 175 +             "        \"1:\"\n"
 176 +             "        \"addl $12,%%%%esp\"         /* args cleanup */\n"
 177 +             "        : \"=a\" (ret) : \"0\" (SYS_execve), \"r\" (filename), \"r\" (argv), \"r\" (envp) );\n"
 178 +             "    return ret;\n"
 179 +             "}\n"
 180 +             "\n"
 181 +             "static inline int __wine_relaunch_stat( const char *filename, struct stat *s_stat )\n"
 182 +             "{\n"
 183 +             "    int ret;\n"
 184 +             "    __asm__ __volatile__(\n"
 185 +             "        \"pushl %%3;\"               /* s_stat */\n"
 186 +             "        \"pushl %%2;\"               /* filename */\n"
 187 +             "        \".byte 0x9a; .long 0; .word 7;\" /* lcall 7:0... FreeBSD syscall */\n"
 188 +             "        \"jnc 1f;\"                  /* if there has been an error... */\n"
 189 +             "        \"orl $0x80000000,%%%%eax;\" /* change the sign of %%eax to indicate so */\n"
 190 +             "        \"1:\"\n"
 191 +             "        \"addl $8,%%%%esp\"         /* args cleanup */\n"
 192 +             "        : \"=a\" (ret) : \"0\" (SYS_execve), \"r\" (filename), \"r\" (s_stat) );\n"
 193 +             "    return ret;\n"
 194 +             "}\n"
 195 +#endif
 196 +             "\n"
 197 +             "asm(\".text\\n\\t.align 4\\n\\t.globl __wine_relaunch_entrypoint\\n\\t\"\n"
 198 +             "    \"__wine_relaunch_entrypoint:\\n\"\n"
 199 +             "    \"\\tpushl %%esp\\n\"\n"
 200 +             "    \"\\tcall __wine_relaunch\\n\"\n"
 201 +             "    \"\\tint $3\\n\");\n"
 202 +             "\n"
 203 +             "static char *__wine_relaunch_strchr( const char *string, int c )\n"
 204 +             "{\n"
 205 +             "    char *str = (char *) string;  /* avoid warning */\n"
 206 +             "    while(*str && *str != c) str++;\n"
 207 +             "    if (*str == c) return str;\n"
 208 +             "    else return NULL;\n"
 209 +             "}\n"
 210 +             "\n"
 211 +             "static char *__wine_relaunch_strrchr( const char *str, int c )\n"
 212 +             "{\n"
 213 +             "    char *end = __wine_relaunch_strchr(str, '\\0');\n"
 214 +             "    while(end != str && *end != c) end--;\n"
 215 +             "    if (*end == c) return end;\n"
 216 +             "    else return NULL;\n"
 217 +             "}\n"
 218 +             "\n"
 219 +             "static int __wine_relaunch_strncmp( const char *str1, const char *str2, unsigned int len )\n"
 220 +             "{\n"
 221 +             "    if (len <= 0) return 0;\n"
 222 +             "    while ((--len > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }\n"
 223 +             "    return *str1 - *str2;\n"
 224 +             "}\n"
 225 +             "\n"
 226 +             "static char *__wine_relaunch_strcpy( char *dest, const char *src )\n"
 227 +             "{\n"
 228 +             "    char *dst = dest;\n"
 229 +             "    while(*src) *dst++ = *src++;\n"
 230 +             "    *dst = '\\0';\n"
 231 +             "    return dest;\n"
 232 +             "}\n"
 233 +             "\n"
 234 +             "static char *__wine_relaunch_strncpy( char *dest, const char *src, unsigned int len )\n"
 235 +             "{\n"
 236 +             "    char *dst = dest;\n"
 237 +             "    while(len-- && *src) *dst++ = *src++;\n"
 238 +             "    len++;\n"
 239 +             "    while(len--) *dst++ = '\\0';\n"
 240 +             "    return dest;\n"
 241 +             "}\n"
 242 +             "\n"
 243 +             "static char *__wine_relaunch_strcat( char *dest, const char *src )\n"
 244 +             "{\n"
 245 +             "    char *end = __wine_relaunch_strchr(dest, '\\0');\n"
 246 +             "    return __wine_relaunch_strcpy(end, src);\n"
 247 +             "}\n"
 248 +             "\n"
 249 +             "static inline void *__wine_relaunch_memset( void *dest, int val, unsigned int len )\n"
 250 +             "{\n"
 251 +             "    char *dst = dest;\n"
 252 +             "    while (len--) *dst++ = val;\n"
 253 +             "    return dest;\n"
 254 +             "}\n"
 255 +             "\n"
 256 +             "static char *__wine_relaunch_find_path( char **envp )\n"
 257 +             "{\n"
 258 +             "    char **elem, *path = NULL;\n"
 259 +             "    static const char message_no_path[] = \"wine: unable to parse the PATH environment variable\\n\";\n"
 260 +             "\n"
 261 +             "    for (elem = envp; *elem; elem++)\n"
 262 +             "    {\n"
 263 +             "        if (!__wine_relaunch_strncmp(*elem, \"PATH=\", 5))\n"
 264 +             "        {\n"
 265 +             "            path = *elem + 5;\n"
 266 +             "            break;\n"
 267 +             "        }\n"
 268 +             "    }\n"
 269 +             "    if (!path)\n"
 270 +             "    {\n"
 271 +             "        __wine_relaunch_write(1, message_no_path, sizeof(message_no_path));\n"
 272 +             "        __wine_relaunch_exit(1);\n"
 273 +             "    }\n"
 274 +             "    return path;\n"
 275 +             "}\n"
 276 +             "\n"
 277 +             "static void __wine_relaunch( void *stack )\n"
 278 +             "{\n"
 279 +             "    int   *pargc;\n"
 280 +             "    char **pargv;\n"
 281 +             "    char **penvp;\n"
 282 +             "    char   self[1024];\n"
 283 +             "    char  *path = NULL;\n"
 284 +             "    char  *ptr, *colon;\n"
 285 +             "    char   s_stat[256]; /* Enough space for a real struct stat */\n"
 286 +             "    int    found_self = 0;\n"
 287 +             "    char  *newargv[256];\n"
 288 +             "    int    i;\n"
 289 +             "    char   buffer[1024];\n"
 290 +             "    char **elem, *wineloader = NULL, *wineloader_bin = NULL;\n"
 291 +             "    static const char message_args[] = \"wine: too many arguments to relaunch successfully\\n\";\n"
 292 +             "    static const char message_no_self[] = \"wine: failed to locate current binary in the path\\n\";\n"
 293 +             "    static const char message_wine_path[] = \"wine: failed to locate wine binary in the path\\n\";\n"
 294 +             "\n"
 295 +             "    /* find the argv and envp pointers */\n"
 296 +             "    pargc = (int *)stack;\n"
 297 +             "    pargv = (char **)pargc + 1;\n"
 298 +             "    penvp = pargv + *pargc + 1;\n"
 299 +             "\n"
 300 +             "    __wine_relaunch_memset(self, 0, sizeof(self));\n"
 301 +             "    /* find the current executable's filename */\n"
 302 +             "    if (__wine_relaunch_strchr(pargv[0], '/'))\n"
 303 +             "    {\n"
 304 +             "        /* if pargv[0] contains a '/', then it has a path and we can use it */\n"
 305 +             "        __wine_relaunch_strcpy(self, pargv[0]);\n"
 306 +             "    } else {\n"
 307 +             "        /* else let's scan $PATH to find it */\n"
 308 +             "        path = __wine_relaunch_find_path(penvp);\n"
 309 +             "        for (ptr = path; ptr; ptr = colon)\n"
 310 +             "        {\n"
 311 +             "            colon = __wine_relaunch_strchr(ptr, ':');\n"
 312 +             "            if (colon)\n"
 313 +             "            {\n"
 314 +             "                __wine_relaunch_strncpy(self, ptr, colon-ptr);\n"
 315 +             "                self[colon-ptr] = '\\0';\n"
 316 +             "                colon++;\n"
 317 +             "            } else {\n"
 318 +             "                __wine_relaunch_strcpy(self, ptr);\n"
 319 +             "            }\n"
 320 +             "            __wine_relaunch_strcat(self, \"/\");\n"
 321 +             "            __wine_relaunch_strcat(self, pargv[0]);\n"
 322 +             "            if (__wine_relaunch_stat(self, (struct stat *) &s_stat) != ENOENT)\n"
 323 +             "            {\n"
 324 +             "                /* bingo, such a file exists */\n"
 325 +             "                found_self = 1;\n"
 326 +             "                break;\n"
 327 +             "            }\n"
 328 +             "        }\n"
 329 +             "        if (!found_self)\n"
 330 +             "        {\n"
 331 +             "            __wine_relaunch_write(1, message_no_self, sizeof(message_no_self));\n"
 332 +             "            __wine_relaunch_exit(1);\n"
 333 +             "        }\n"
 334 +             "    }\n"
 335 +             "\n"
 336 +             "    /* build a new argv array with this binary as the first parameter */\n"
 337 +             "    if (*pargc > sizeof(newargv)/sizeof(char *) - 2)\n"
 338 +             "    {\n"
 339 +             "        __wine_relaunch_write(1, message_args, sizeof(message_args));\n"
 340 +             "        __wine_relaunch_exit(1);\n"
 341 +             "    }\n"
 342 +             "    newargv[0] = \"wine\";\n"
 343 +             "    newargv[1] = self;\n"
 344 +             "    for (i = 0; i < *pargc; i++) newargv[2 + i] = pargv[i + 1];\n"
 345 +             "\n"
 346 +             "    /* now find out how to correctly launch self through Wine */\n"
 347 +             "    /* first try explicit WINELOADER */\n"
 348 +             "    for (elem = penvp; *elem; elem++)\n"
 349 +             "    {\n"
 350 +             "        if(!__wine_relaunch_strncmp(*elem, \"WINELOADER=\", 11))\n"
 351 +             "        {\n"
 352 +             "            wineloader = *elem + 11;\n"
 353 +             "            break;\n"
 354 +             "        }\n"
 355 +             "    }\n"
 356 +             "    if (wineloader)\n"
 357 +             "    {\n"
 358 +             "        wineloader_bin = __wine_relaunch_strrchr(wineloader, '/');\n"
 359 +             "        if(wineloader_bin) newargv[0] = wineloader_bin;\n"
 360 +             "        else newargv[0] = wineloader;\n"
 361 +             "        __wine_relaunch_execve(wineloader, newargv, penvp);\n"
 362 +             "    }\n"
 363 +             "\n"
 364 +             "    /* then look in PATH */\n"
 365 +             "    if (!path)\n"
 366 +             "        path = __wine_relaunch_find_path(penvp);\n"
 367 +             "    for (ptr = path; ptr; ptr = colon)\n"
 368 +             "    {\n"
 369 +             "        colon = __wine_relaunch_strchr(ptr, ':');\n"
 370 +             "        if (colon)\n"
 371 +             "        {\n"
 372 +             "            __wine_relaunch_strncpy(buffer, ptr, colon-ptr);\n"
 373 +             "            buffer[colon-ptr] = '\\0';\n"
 374 +             "            colon++;\n"
 375 +             "        } else {\n"
 376 +             "            __wine_relaunch_strcpy(buffer, ptr);\n"
 377 +             "        }\n"
 378 +             "        __wine_relaunch_strcat(buffer, \"/wine\");\n"
 379 +             "        __wine_relaunch_execve(buffer, newargv, penvp);\n"
 380 +             "    }\n"
 381 +             "    __wine_relaunch_write(1, message_wine_path, sizeof(message_wine_path));\n"
 382 +             "    __wine_relaunch_exit(1);\n"
 383 +             "}\n" );
 384 +#else
 385 +#   warning Please implement __wine_relaunch_entrypoint() for your architecture
 386 +
 387 +    fprintf( outfile, "/* not implemented for this system */\n" );
 388 +    fprintf( outfile, "void __wine_relaunch_entrypoint(void) {}\n" );
 389 +#endif
 390 +}
 391 +
 392 +/*******************************************************************
 393   *         output_debug
 394   *
 395   * Output the debug channels.
 396 @@ -656,6 +973,14 @@
 397          break;
 398      case IMAGE_SUBSYSTEM_WINDOWS_GUI:
 399      case IMAGE_SUBSYSTEM_WINDOWS_CUI:
 400 +
 401 +        /* this function is the entry point for winelib EXE
 402 +         * files. it's here so the user can run the file just like a
 403 +         * normal program, even though it's actually an ELF DSO.
 404 +         */
 405 +
 406 +        output_relaunch_entrypoint( outfile );
 407 +
 408          if (init_func)
 409              fprintf( outfile, "extern int %s( int argc, char *argv[] );\n", init_func );
 410          else
 411 Index: wine/tools/winegcc/winegcc.c
 412 ===================================================================
 413 RCS file: /home/wine/wine/tools/winegcc/winegcc.c,v
 414 retrieving revision 1.34
 415 diff -u -r1.34 winegcc.c
 416 --- wine/tools/winegcc/winegcc.c    7 Dec 2004 17:19:54 -0000    1.34
 417 +++ wine/tools/winegcc/winegcc.c    3 Jan 2005 04:07:02 -0000
 418 @@ -97,45 +97,6 @@
 419 
 420  #include "utils.h"
 421 
 422 -static const char* app_loader_template =
 423 -    "#!/bin/sh\n"
 424 -    "\n"
 425 -    "appname=\"%s\"\n"
 426 -    "# determine the application directory\n"
 427 -    "appdir=''\n"
 428 -    "case \"$0\" in\n"
 429 -    "  */*)\n"
 430 -    "    # $0 contains a path, use it\n"
 431 -    "    appdir=`dirname \"$0\"`\n"
 432 -    "    ;;\n"
 433 -    "  *)\n"
 434 -    "    # no directory in $0, search in PATH\n"
 435 -    "    saved_ifs=$IFS\n"
 436 -    "    IFS=:\n"
 437 -    "    for d in $PATH\n"
 438 -    "    do\n"
 439 -    "      IFS=$saved_ifs\n"
 440 -    "      if [ -x \"$d/$appname\" ]; then appdir=\"$d\"; break; fi\n"
 441 -    "    done\n"
 442 -    "    ;;\n"
 443 -    "esac\n"
 444 -    "\n"
 445 -    "# figure out the full app path\n"
 446 -    "if [ -n \"$appdir\" ]; then\n"
 447 -    "    apppath=\"$appdir/$appname\"\n"
 448 -    "    WINEDLLPATH=\"$appdir:$WINEDLLPATH\"\n"
 449 -    "    export WINEDLLPATH\n"
 450 -    "else\n"
 451 -    "    apppath=\"$appname\"\n"
 452 -    "fi\n"
 453 -    "\n"
 454 -    "# determine the WINELOADER\n"
 455 -    "if [ ! -x \"$WINELOADER\" ]; then WINELOADER=\"wine\"; fi\n"
 456 -    "\n"
 457 -    "# and try to start the app\n"
 458 -    "exec \"$WINELOADER\" \"$apppath\" \"$@\"\n"
 459 -;
 460 -
 461  static int keep_generated = 0;
 462  static strarray* tmp_files;
 463  #ifdef HAVE_SIGSET_T
 464 @@ -363,7 +324,6 @@
 465      const char *spec_c_name, *spec_o_name;
 466      const char *output_name, *spec_file, *lang;
 467      const char* winebuild = getenv("WINEBUILD");
 468 -    int generate_app_loader = 1;
 469      int old_processor;
 470      int j;
 471 
 472 @@ -381,17 +341,6 @@
 473 
 474      output_file = strdup( opts->output_name ? opts->output_name : "a.out" );
 475 
 476 -    /* 'winegcc -o app xxx.exe.so' only creates the load script */
 477 -    if (opts->files->size == 1 && strendswith(opts->files->base[0], ".exe.so"))
 478 -    {
 479 -    create_file(output_file, 0755, app_loader_template, opts->files->base[0]);
 480 -    return;
 481 -    }
 482 -
 483 -    /* generate app loader only for .exe */
 484 -    if (opts->shared || strendswith(output_file, ".exe.so"))
 485 -    generate_app_loader = 0;
 486 -
 487      /* normalize the filename a bit: strip .so, ensure it has proper ext */
 488      if (strendswith(output_file, ".so"))
 489     output_file[strlen(output_file) - 3] = 0;
 490 @@ -569,6 +518,9 @@
 491      strarray_add(link_args, "-o");
 492      strarray_add(link_args, strmake("%s.so", output_file));
 493 
 494 +    if (!opts->shared)
 495 +        strarray_add(link_args, "-Wl,--entry=__wine_relaunch_entrypoint");
 496 +
 497      for ( j = 0 ; j < opts->linker_args->size ; j++ )
 498          strarray_add(link_args, opts->linker_args->base[j]);
 499 
 500 @@ -601,13 +553,6 @@
 501      }
 502 
 503      spawn(opts->prefix, link_args);
 504 -
 505 -    /* create the loader script */
 506 -    if (generate_app_loader)
 507 -    {
 508 -        if (strendswith(output_file, ".exe")) output_file[strlen(output_file) - 4] = 0;
 509 -        create_file(output_file, 0755, app_loader_template, strmake("%s.exe.so", output_name));
 510 -    }
 511  }
 512 
 513 
 514 --- wine/programs/wineapploader.in    2002-05-22 17:32:49.000000000 -0400
 515 +++ /dev/null    2002-08-30 19:31:37.000000000 -0400
 516 @@ -1,52 +0,0 @@
 517 -#!/bin/sh
 518 -#
 519 -# Wrapper script to start a Winelib application once it is installed
 520 -#
 521 -# Copyright (C) 2002 Alexandre Julliard
 522 -#
 523 -# This library is free software; you can redistribute it and/or
 524 -# modify it under the terms of the GNU Lesser General Public
 525 -# License as published by the Free Software Foundation; either
 526 -# version 2.1 of the License, or (at your option) any later version.
 527 -#
 528 -# This library is distributed in the hope that it will be useful,
 529 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
 530 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 531 -# Lesser General Public License for more details.
 532 -#
 533 -# You should have received a copy of the GNU Lesser General Public
 534 -# License along with this library; if not, write to the Free Software
 535 -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 536 -#
 537 -
 538 -# determine the app Winelib library name
 539 -appname=`basename "$0" .exe`.exe
 540 -
 541 -# first try explicit WINELOADER
 542 -if [ -x "$WINELOADER" ]; then exec "$WINELOADER" "$appname" "$@"; fi
 543 -
 544 -# then default bin directory
 545 -if [ -x "@bindir@/wine" ]; then exec "@bindir@/wine" "$appname" "$@"; fi
 546 -
 547 -# now try the directory containing $0
 548 -appdir=""
 549 -case "$0" in
 550 -  */*)
 551 -    # $0 contains a path, use it
 552 -    appdir=`dirname "$0"`
 553 -    ;;
 554 -  *)
 555 -    # no directory in $0, search in PATH
 556 -    saved_ifs=$IFS
 557 -    IFS=:
 558 -    for d in $PATH
 559 -    do
 560 -      IFS=$saved_ifs
 561 -      if [ -x "$d/$0" ]; then appdir="$d"; break; fi
 562 -    done
 563 -    ;;
 564 -esac
 565 -if [ -x "$appdir/wine" ]; then exec "$appdir/wine" "$appname" "$@"; fi
 566 -
 567 -# finally look in PATH
 568 -exec wine "$appname" "$@"
 569 

Winelib binaries as ELF executables not .exe.so (last edited 2008-05-01 04:32:22 by nathan.n)