Tijl Coosemans : loader: Introduce FreeBSD loader.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Aug 27 06:07:44 CDT 2007


Module: wine
Branch: master
Commit: 9f5c69c96d122c16fc0a6c131bc3b40605576a86
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9f5c69c96d122c16fc0a6c131bc3b40605576a86

Author: Tijl Coosemans <tijl at ulyssis.org>
Date:   Fri Aug 24 15:46:36 2007 +0200

loader: Introduce FreeBSD loader.

---

 .gitignore         |    2 +
 configure          |    5 ++++
 configure.ac       |    3 ++
 loader/Makefile.in |    9 +++++++
 loader/freebsd.c   |   61 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 80 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
index be3dbc0..95e06ac 100644
--- a/.gitignore
+++ b/.gitignore
@@ -764,6 +764,8 @@ libs/wpp/ppl.yy.c
 libs/wpp/ppy.tab.c
 libs/wpp/ppy.tab.h
 loader/wine
+loader/wine-freebsd
+loader/wine-freebsd-installed
 loader/wine-glibc
 loader/wine-glibc-installed
 loader/wine-kthread
diff --git a/configure b/configure
index ac5c092..a94ced7 100755
--- a/configure
+++ b/configure
@@ -15623,6 +15623,11 @@ MAIN_BINARY="wine-pthread"
 
         EXTRA_BINARIES="wine-kthread wine-pthread wine-preloader"
  ;;
+      freebsd*)
+        MAIN_BINARY="wine-freebsd"
+
+        EXTRA_BINARIES="wine-pthread"
+ ;;
     esac
     ;;
 esac
diff --git a/configure.ac b/configure.ac
index 64be416..16a6370 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1224,6 +1224,9 @@ case $host_cpu in
       linux* | k*bsd*-gnu)
         AC_SUBST(MAIN_BINARY,"wine-glibc")
         AC_SUBST(EXTRA_BINARIES,"wine-kthread wine-pthread wine-preloader") ;;
+      freebsd*)
+        AC_SUBST(MAIN_BINARY,"wine-freebsd")
+        AC_SUBST(EXTRA_BINARIES,"wine-pthread") ;;
     esac
     ;;
 esac
diff --git a/loader/Makefile.in b/loader/Makefile.in
index f94e08f..ef60a56 100644
--- a/loader/Makefile.in
+++ b/loader/Makefile.in
@@ -5,6 +5,7 @@ VPATH     = @srcdir@
 MODULE    = wine
 
 C_SRCS = \
+	freebsd.c \
 	glibc.c \
 	kthread.c \
 	main.c \
@@ -20,6 +21,8 @@ WINE_BINARIES  = $(MAIN_BINARY) $(EXTRA_BINARIES)
 
 PROGRAMS = \
 	wine \
+	wine-freebsd \
+	wine-freebsd-installed \
 	wine-glibc \
 	wine-glibc-installed \
 	wine-kthread \
@@ -40,6 +43,12 @@ all: $(WINE_BINARIES) $(WINE_BINARIES:%=%-installed) $(MODULE) $(MANPAGES)
 LIBPTHREAD  = @LIBPTHREAD@
 LDEXECFLAGS = @LDEXECFLAGS@
 
+wine-freebsd: freebsd.o Makefile.in
+	$(CC) -o $@ freebsd.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
+
+wine-freebsd-installed: freebsd.o Makefile.in
+	$(CC) -o $@ freebsd.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_INSTALL)
+
 wine-glibc: glibc.o Makefile.in
 	$(CC) -o $@ glibc.o $(LIBWINE) $(LIBPORT) $(LIBPTHREAD) $(EXTRALIBS) $(LDFLAGS) $(LDRPATH_LOCAL)
 
diff --git a/loader/freebsd.c b/loader/freebsd.c
new file mode 100644
index 0000000..0d0eb57
--- /dev/null
+++ b/loader/freebsd.c
@@ -0,0 +1,61 @@
+/*
+ * FreeBSD loader
+ *
+ * Copyright 2007 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_SYS_RESOURCE_H
+# include <sys/resource.h>
+#endif
+
+#include "wine/library.h"
+
+/* build a new full path from the specified path and name */
+static const char *build_new_path( const char *path, const char *name )
+{
+    const char *p;
+    char *ret;
+
+    if (!(p = strrchr( path, '/' ))) return name;
+    p++;
+    ret = malloc( (p - path) + strlen(name) + 1 );
+    memcpy( ret, path, p - path );
+    strcpy( ret + (p - path), name );
+    return ret;
+}
+
+/**********************************************************************
+ *           main
+ */
+int main( int argc, char *argv[] )
+{
+    const char *new_argv0 = build_new_path( argv[0], "wine-pthread" );
+    struct rlimit rl;
+    rl.rlim_cur = 0x02000000;
+    rl.rlim_max = 0x02000000;
+    setrlimit( RLIMIT_DATA, &rl );
+    wine_init_argv0_path( new_argv0 );
+    wine_exec_wine_binary( NULL, argv, NULL );
+    fprintf( stderr, "wine: could not exec %s\n", new_argv0 );
+    exit(1);
+}




More information about the wine-cvs mailing list