ports/151747: request to enable emulators/wine on amd64

David Naylor naylor.b.david at gmail.com
Thu Jan 6 10:40:11 UTC 2011


The following reply was made to PR ports/151747; it has been noted by GNATS.

From: David Naylor <naylor.b.david at gmail.com>
To: Gerald Pfeifer <gerald at pfeifer.com>
Cc: bug-followup at freebsd.org,
 kenorb at gmail.com
Subject: Re: ports/151747: request to enable emulators/wine on amd64
Date: Thu, 6 Jan 2011 12:37:02 +0200

 --Boundary-00=_RtZJNMgZpm6BXoB
 Content-Type: Text/Plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 On Sunday 02 January 2011 13:08:48 Gerald Pfeifer wrote:
 > On Mon, 29 Nov 2010, David Naylor wrote:
 > > The patches and packages are now hosted at
 > > http://mediafire.com/wine_fbsd64 .
 > 
 > I had a closer look, and this is really a cool hack.  The problem is
 > that FreeBSD lacks support for mixed 64-bit/32-bit environments, and
 > this approach, among others, would not get (security) updates in one
 > of the basic libraries used; it is the equivalent of static linking.
 
 I never thought of it that way but yes, you are right.  I rebuild everything 
 so updates should propergate every wine release (~ every two weeks).  Maybe it 
 would be easier to get wine to statically link?
  
 > If there is a way to move most of the code into the slave port and
 > have fewer changes to emulators/wine itself, I'd be open to consder
 > those.
 
 I have attempted to do just that.  See attached for the patch.  I have compile 
 tested the patch (for wine and wine-fbsd64) and wine-fbsd64 produce the same 
 list of files for packaging.  
 
 Currently the wine-fbsd64 port is i386 only.  I have considered a method of 
 getting the port to work under amd64: by using the package produced from the 
 i386 build.  Is there any interest in that?  Any ideas on how to do that?
 
 --Boundary-00=_RtZJNMgZpm6BXoB
 Content-Type: text/x-patch;
   charset="ISO-8859-1";
   name="wine-fbsd64.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="wine-fbsd64.diff"
 
 diff -urN /usr/ports/emulators/wine/Makefile wine/Makefile
 --- /usr/ports/emulators/wine/Makefile	2011-01-01 03:08:21.000000000 +0200
 +++ wine/Makefile	2011-01-05 15:26:53.000000000 +0200
 @@ -29,7 +29,7 @@
  LICENSE_FILE=	${WRKSRC}/LICENSE
  
  GNU_CONFIGURE=	yes
 -CONFIGURE_ARGS=	--datadir=${DATADIR} --verbose --disable-tests \
 +CONFIGURE_ARGS+=	--datadir=${DATADIR} --verbose --disable-tests \
  		--with-glu --with-opengl --with-xrandr \
  		--without-capi --without-gphoto --without-gsm \
  		--without-v4l --without-mpg123 --without-sane \
 @@ -37,7 +37,11 @@
  CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
  		LDFLAGS="-L${LOCALBASE}/lib" \
  		FLEX="${LOCALBASE}/bin/flex"
 +CONFLICTS=	wine-fbsd64.*
 +.if !defined(USE_LDCONFIG32)
  USE_LDCONFIG=	${PREFIX}/lib ${PREFIX}/lib/wine
 +.endif
 +WINELIBDIR?=	${PREFIX}/lib
  MAKE_JOBS_SAFE=	yes
  MAN1=		widl.1 wine.1 winebuild.1 winedbg.1 winedump.1 winegcc.1 \
  		winemaker.1 wineserver.1 wmc.1 wrc.1
 @@ -65,6 +69,8 @@
  		OPENAL	"Use OpenAL (3D audio library)"			Off \
  		WINEMAKER "Fully support winemaker (requires Perl)"	Off
  
 +.PHONY: post-install-wine
 +
  .include <bsd.port.pre.mk>
  
  .ifdef WITHOUT_CUPS
 @@ -126,7 +132,12 @@
  pre-build:
  	cd ${WRKSRC} && ${GMAKE} depend
  
 -post-install:
 +# This target allows hooks for wine-fbsd64
 +.if !target(post-install-wine)
 +post-install-wine:
 +.endif
 +
 +post-install: post-install-wine
  	@${RM} -f ${MAN1PREFIX}/man/de.UTF-8/man1/wine.1 \
  	          ${MAN1PREFIX}/man/de.UTF-8/man1/winemaker.1 \
  	          ${MAN1PREFIX}/man/de.UTF-8/man1/wineserver.1 \
 @@ -135,8 +146,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
 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	2011-01-01 12:32:55.000000000 +0200
 @@ -0,0 +1,32 @@
 +#!/bin/sh
 +
 +TARGET="$0"
 +_count=0
 +while [ -L "$TARGET" ]
 +do
 +  _old="$TARGET"
 +  TARGET="`readlink "$TARGET"`"
 +  if [ ! -e "$TARGET" ]
 +  then
 +    TARGET="`dirname "$_old"`/$TARGET"
 +  fi
 +  _count=$(($_count + 1))
 +  if [ $_count -gt 100 ]
 +  then
 +    echo "$0: to many symbolic links" > /dev/stderr
 +    exit 1
 +  fi
 +done
 +
 +LOCALBASE=`dirname "$TARGET"`/..
 +BINNAME=`basename "$TARGET"`
 +
 +if [ `uname -p` = i386 ]
 +then
 +  export LD_LIBRARY_PATH="$LOCALBASE/lib32":"$LOCALBASE/lib32/wine":"$LD_LIBRARY_PATH"
 +else
 +  export LD_32_LIBRARY_PATH="$LOCALBASE/lib32":"$LOCALBASE/lib32/wine":"$LD_32_LIBRARY_PATH"
 +fi
 +export PATH="$LOCALBASE/bin32":"$PATH"
 +
 +exec "$LOCALBASE/bin32/$BINNAME" "$@"
 diff -urN /usr/ports/emulators/wine-fbsd64/ChangeLog wine-fbsd64/ChangeLog
 --- /usr/ports/emulators/wine-fbsd64/ChangeLog	1970-01-01 02:00:00.000000000 +0200
 +++ wine-fbsd64/ChangeLog	2011-01-05 22:56:26.000000000 +0200
 @@ -0,0 +1,35 @@
 +2011/01/05:
 + * Update patch to make it minimally invasive for wine/Makefile
 +
 +2011/01/01:
 + * Update wine to 1.3.10
 +
 +2010/10/17:
 + * Update wine to 1.3.5
 + * Add support for openal (soft dependency)
 +
 +2010/01/18:
 + * Update wine to 1.1.36
 + * Follow relative symbolic links to script
 + * Use readlink (vs `ls -l | sed ...`)
 +
 +2009/12/20:
 + * Correctly set bin/lib directories
 + * Support running on i386
 + * Follow symbolic links to script
 + * Allow spaces in path
 + * Hard link the bin/* files (otherwise symbolic link following breaks)
 +
 +2009/12/19:
 + * Include freetype (it is a soft dependency)
 + * Include libXrender (it is a soft dependency)
 +
 +2009/12/18:
 + * Rename to something with a little more sense (wine-amd64-[V] -> wine-fbsd64.[V])
 + * Fix conflicts (wine conflicts with wine-fbsd64)
 +
 +2009/12/17:
 + * Automatically determine libraries and binaries
 +
 +2009/12/08:
 + * Initial implementation of WINE/i386 on FreeBSD/amd64 
 diff -urN /usr/ports/emulators/wine-fbsd64/Makefile wine-fbsd64/Makefile
 --- /usr/ports/emulators/wine-fbsd64/Makefile	1970-01-01 02:00:00.000000000 +0200
 +++ wine-fbsd64/Makefile	2011-01-05 15:27:45.000000000 +0200
 @@ -0,0 +1,57 @@
 +# New ports collection Makefile for:    wine-fbsd64
 +# Date created:         2011/01/05
 +# Whom:			David Naylor <naylor.b.david at gmail.com>
 +#
 +# $FreeBSD$
 +
 +PKGNAMESUFFIX=	-fbsd64
 +
 +# TODO: mention patch-wine-nvidia.sh
 +
 +# Use the wine port to do most of the heavy lifting
 +MASTERDIR=	${.CURDIR}/../wine
 +
 +ACTUAL-PACKAGE-DEPENDS=${DO_NADA}
 +CONFIGURE_ARGS+=	--bindir=${PREFIX}/bin32 --libdir=${PREFIX}/lib32
 +PLIST_REINPLACE+=	winelib
 +PLIST_REINPLACE_WINELIB=s!lib/!lib32/!g
 +USE_LDCONFIG32=	${PREFIX}/lib32 ${PREFIX}/lib32/wine
 +WINELIBDIR=${PREFIX}/lib32
 +WINE_SOFT_DEPENDS=	libfreetype.so.9 libXrender.so.1
 +
 +# Hook into post-install and do some adapting to make i386 binaries work nicely
 +# under FreeBSD/amd64
 +post-install-wine:
 +	# The following line is also done in port-install (undo it afterwards)
 +	${MV} -f ${WINELIBDIR}/libwine.so.1.0 ${WINELIBDIR}/libwine.so.1
 +	grep -v '[@%]' ${TMPPLIST} | sed "s!^!${PREFIX}/!g" | \
 +	xargs -n1 file -F' ' | grep ELF | cut -f1 -d' ' | \
 +	env LD_LIBRARY_PATH=${PREFIX}/lib32:${LD_LIBRARY_PATH} xargs ldd -f '%p\n' \
 +	| sort -u | grep -v '^\(/usr\)\?/lib' | grep -v "^${PREFIX}/lib32/libwine.so" \
 +	| grep -v "^${PREFIX}/lib32/wine" > ${WRKDIR}/winelibs.list
 +	for i in `cat ${WRKDIR}/winelibs.list` ; do \
 +		${INSTALL_DATA} $${i} ${PREFIX}/lib32/ ; \
 +		echo lib32/`basename $${i}` >> ${TMPPLIST} ; \
 +	done
 +	for i in ${WINE_SOFT_DEPENDS} ; do \
 +		${INSTALL_DATA} ${LOCALBASE}/lib/$${i} ${PREFIX}/lib32/ ; \
 +		echo lib32/$${i} >> ${TMPPLIST} ; \
 +	done
 +	${INSTALL_SCRIPT} ${FILESDIR}/binbounce ${PREFIX}/bin/wine
 +	for i in `grep ^bin ${TMPPLIST} | xargs -n1 basename` ; do \
 +		[ "$${i}" = "wine" ] || ${LN} -f ${PREFIX}/bin/wine ${PREFIX}/bin/$${i} ; \
 +		echo bin32/$${i} >> ${TMPPLIST} ; \
 +	done
 +	echo '@unexec rmdir %D/bin32 2>/dev/null || true' >> ${TMPPLIST}
 +	# Undoing above change (keep consistent for port-install)
 +	${MV} -f ${WINELIBDIR}/libwine.so.1 ${WINELIBDIR}/libwine.so.1.0
 +
 +.include "${MASTERDIR}/Makefile"
 +
 +# Overwrite CONFLICTS to conflict with wine proper
 +CONFLICTS=	wine-[0-9]*
 +
 +# Add soft dependancy based on options specified
 +.ifdef WITH_OPENAL
 +WINE_SOFT_DEPENDS+=	libopenal.so.1
 +.endif
 
 --Boundary-00=_RtZJNMgZpm6BXoB--



More information about the freebsd-ports-bugs mailing list