David Naylor | 8 Dec 14:24
Picon

[WIP] wine/i386 on FreeBSD/amd64

Hi,

I have developed a port that allows wine to be installed as a package under 
FreeBSD/amd64.  This avoids having a i386 chroot environment (and is much 
easier to setup, once the package is built).  

To get this working apply the attached patch and build the emulators/wine-
amd64 port under FreeBSD/i386 then transfer that package to the amd64 host:

(On FreeBSD/i386)
# cd /usr/ports/emulators
# patch < /tmp/wine-amd64.diff
# cd wine-amd64
# make package clean

(On FreeBSD/amd64)
# pkg_add wine-amd64-8-1.1.34,1.tbz

I have such a package for FreeBSD-8 if anyone is willing to host it.  

There are a few TODO items (port options not supported).  Any 
comments/suggestions are welcome.  

Word of warning: nvidia-driver breaks everything.  Make sure it is not 
installed on both i386/amd64 systems.  If one really wants wine with nvidia-
driver support then install the beta on both i386 and amd64 (very important it 
is the same version of the driver) and copy libGL.so.1, libGLcore.so.1 and 
libnvidia-tls.so.1 from i386 to $PREFIX/lib32 (on amd64).  

Regards,

David 

P.S. This should be a no-op for emulators/wine
diff -urN /usr/ports/emulators/wine/Makefile wine/Makefile
--- /usr/ports/emulators/wine/Makefile	2009-12-08 08:27:51.000000000 +0200
+++ wine/Makefile	2009-12-08 11:40:12.000000000 +0200
@@ -30,12 +30,10 @@
 		--without-sane --without-xcursor
 CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
 		LDFLAGS="-L${LOCALBASE}/lib"
-USE_LDCONFIG=	${PREFIX}/lib ${PREFIX}/lib/wine
 MAKE_JOBS_SAFE=	yes
 MAN1=		widl.1 wine.1 winebuild.1 winedbg.1 winedump.1 winegcc.1 \
 		winemaker.1 wineprefixcreate.1 wineserver.1 wmc.1 wrc.1
 MLINKS=		winegcc.1 wineg++.1
-ONLY_FOR_ARCHS=	i386
 USE_BISON=	build
 USE_BZIP2=	yes
 USE_GMAKE=	yes
@@ -50,6 +48,18 @@
 		LDAP	"Use LDAP"					Off \
 		LIBXSLT	"Use libxslt (only used by msxml3.dll)"		Off

+WINELIBS=	libGL.so.1 libICE.so.6 libSM.so.6 libX11-xcb.so.1 libX11.so.6 \
+		libXau.so.6 libXdamage.so.1 libXdmcp.so.6 libXext.so.6 \
+		libXfixes.so.3 libXrender.so.1 libXxf86vm.so.1 libdrm.so.2 \
+		libfreetype.so.9 libiconv.so.3 libpthread-stubs.so.0 \
+		libxcb-glx.so.0 libxcb.so.2 libxml2.so.5
+
+# wine not on this list as it acts as the master script
+WINEBINS=	function_grep.pl msiexec notepad regedit regsvr32 widl \
+		wineboot winebuild winecfg wineconsole winecpp winedbg \
+		winedump winefile wineg++ winegcc winemaker winemine winepath \
+		wineprefixcreate wineserver wmc wrc
+
 .include <bsd.port.pre.mk>

 .ifdef WITHOUT_CUPS
@@ -57,11 +67,15 @@
 .else
 CONFIGURE_ARGS+=	--with-cups
 LIB_DEPENDS+=	cups.2:${PORTSDIR}/print/cups-base
+# TODO
+#WINELIBS+=
 .endif

 .ifdef WITH_HAL
 CONFIGURE_ARGS+=	--with-hal
 LIB_DEPENDS+=	hal.1:${PORTSDIR}/sysutils/hal
+# TODO
+#WINELIBS+=
 .else
 CONFIGURE_ARGS+=	--without-hal
 .endif
@@ -69,6 +83,8 @@
 .ifdef WITH_LDAP
 CONFIGURE_ARGS+=	--with-ldap
 USE_OPENLDAP=	yes
+# TODO
+#WINELIBS+=
 .else
 CONFIGURE_ARGS+=	--without-ldap
 .endif
@@ -76,14 +92,47 @@
 .ifdef WITH_LIBXSLT
 CONFIGURE_ARGS+=	--with-xslt
 LIB_DEPENDS+=	xslt.2:${PORTSDIR}/textproc/libxslt
+# TODO
+#WINELIBS+=
 .else
 CONFIGURE_ARGS+=	--without-xslt
 .endif

+# TODO: when does FreeBSD/i386 work properly under FreeBSD/amd64?
 .if ${OSVERSION} < 603000
 IGNORE=		fails to properly work on versions of FreeBSD before 6.3
 .endif

+.ifdef WINE_CROSS_BUILD
+
+CONFIGURE_ARGS+=	--bindir=${PREFIX}/bin32 --libdir=${PREFIX}/lib32
+CONFLICTS=	wine-[0-9]*
+ONLY_FOR_ARCHS=	i386 amd64
+USE_LDCONFIG32=	${PREFIX}/lib32 ${PREFIX}/lib32/wine
+WINELIBDIR=${PREFIX}/lib32
+
+.for i in ${WINEBINS}
+PLIST_FILES+=	bin32/${i}
+.endfor
+.for i in ${WINELIBS}
+PLIST_FILES+=	lib32/${i}
+.endfor
+PLIST_FILES+=	bin32/wine
+#PLIST_FILES+=	@dirrmtry bin32
+
+PLIST_REINPLACE+=	winelib
+PLIST_REINPLACE_WINELIB=s!lib/!lib32/!g
+
+ACTUAL-PACKAGE-DEPENDS=${DO_NADA}
+
+.else
+
+ONLY_FOR_ARCHS=	i386
+USE_LDCONFIG=	${PREFIX}/lib ${PREFIX}/lib/wine
+WINELIBDIR=${PREFIX}/lib
+
+.endif
+
 post-patch:
 .if ${OSVERSION} < 700041
 	${REINPLACE_CMD} 's/-lpthread/-lthr/g' ${WRKSRC}/configure
@@ -99,8 +148,8 @@
 	          ${MAN1PREFIX}/man/fr.UTF-8/man1/wineserver.1
 	@-${RMDIR} -p ${MAN1PREFIX}/man/de.UTF-8/man1 \
 	              ${MAN1PREFIX}/man/fr.UTF-8/man1
-	${MV} -f ${PREFIX}/lib/libwine.so.1.0 ${PREFIX}/lib/libwine.so.1
-	${LN} -sf libwine.so.1 ${PREFIX}/lib/libwine.so
+	${MV} -f ${WINELIBDIR}/libwine.so.1.0 ${WINELIBDIR}/libwine.so.1
+	${LN} -sf libwine.so.1 ${WINELIBDIR}/libwine.so
 .if !defined(NOPORTDOCS)
 	-@${MKDIR} ${DOCSDIR}
 .for i in README ANNOUNCE AUTHORS LICENSE
@@ -109,6 +158,15 @@
 	@${INSTALL_DATA} ${WRKSRC}/programs/winedbg/README ${DOCSDIR}/README.winedbg
 	@${INSTALL_DATA} ${WRKSRC}/tools/winedump/README ${DOCSDIR}/README.winedump
 .endif
+.ifdef WINE_CROSS_BUILD
+.for i in ${WINELIBS}
+	${INSTALL_DATA} ${LOCALBASE}/lib/${i} ${PREFIX}/lib32/
+.endfor
+	${INSTALL_SCRIPT} ${FILESDIR}/binbounce ${PREFIX}/bin/wine
+.for i in ${WINEBINS}
+	${LN} -sf wine ${PREFIX}/bin/${i}
+.endfor
+.endif
 	@${MKDIR} ${DESKTOPDIR}
 	@${MV} ${DATADIR}/applications/wine.desktop ${DESKTOPDIR}/
 	@${ECHO}
diff -urN /usr/ports/emulators/wine/files/binbounce wine/files/binbounce
--- /usr/ports/emulators/wine/files/binbounce	1970-01-01 02:00:00.000000000 +0200
+++ wine/files/binbounce	2009-12-01 13:54:52.000000000 +0200
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+LOCALBASE=`dirname $0`/..
+BINNAME=`basename $0`
+
+while [ $# -gt 0 ]
+do
+  ARGS="$ARGS \"$1\""
+  shift
+done
+
+
+export LD_32_LIBRARY_PATH=$LOCALBASE/lib32:$LOCALBASE/lib32/wine
+export PATH=$LOCALBASE/bin32:$PATH
+eval exec $LOCALBASE/bin32/$BINNAME $ARGS
diff -urN /usr/ports/emulators/wine-amd64/Makefile wine-amd64/Makefile
--- /usr/ports/emulators/wine-amd64/Makefile	1970-01-01 02:00:00.000000000 +0200
+++ wine-amd64/Makefile	2009-12-08 11:39:39.000000000 +0200
@@ -0,0 +1,13 @@
+PORTNAME=	wine
+PKGNAMESUFFIX=	-amd64-${OSVERSION:C/([0-9]).*/\1/}
+
+WINE_CROSS_BUILD=yes
+
+MASTERDIR=	${.CURDIR}/../wine
+
+#.if ${ARCH} == "amd64"
+# TODO: install from package (how?)
+#.endif
+
+.include "${MASTERDIR}/Makefile"
+

Gmane