Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Mar 2013 08:13:03 +0800
From:      Martin Wilke <miwi@bsdhash.org>
To:        David Naylor <dbn@FreeBSD.org>
Cc:        svn-ports-head@freebsd.org, svn-ports-all@freebsd.org, ports-committers@freebsd.org
Subject:   Re: svn commit: r315245 - in head/emulators: . i386-wine-devel i386-wine-devel/files
Message-ID:  <552F406F-8274-4FBC-B36A-65C99542E8BF@bsdhash.org>
In-Reply-To: <201303252008.r2PK8jtt049848@svn.freebsd.org>
References:  <201303252008.r2PK8jtt049848@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Why it calls i386-wine-devel? is wine-devel not just enough?


On Mar 26, 2013, at 4:08 AM, David Naylor <dbn@FreeBSD.org> wrote:

> Author: dbn
> Date: Mon Mar 25 20:08:45 2013
> New Revision: 315245
> URL: http://svnweb.freebsd.org/changeset/ports/315245
>=20
> Log:
>  Add emulators/i386-wine-devel, slave to emulators/wine-devel.
>=20
>  This port adds shims to enable wine to run cleanly on an amd64 =
system.
>  This is done by doing a "static link" of the package: including all
>  libraries required by the port.
>=20
>  It is possible to use this package under i386, although it is =
intended
>  for an amd64 system.
>=20
>  Feedback welcome for improvement of the port.
>=20
>  Approved by:	bdrewery (mentor)
>=20
> Added:
>  head/emulators/i386-wine-devel/
>  head/emulators/i386-wine-devel/Makefile   (contents, props changed)
>  head/emulators/i386-wine-devel/files/
>  head/emulators/i386-wine-devel/files/binbounce   (contents, props =
changed)
>  head/emulators/i386-wine-devel/files/nvidia.sh   (contents, props =
changed)
>  head/emulators/i386-wine-devel/files/pkg-install   (contents, props =
changed)
> Modified:
>  head/emulators/Makefile
>=20
> Modified: head/emulators/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- head/emulators/Makefile	Mon Mar 25 19:58:32 2013	=
(r315244)
> +++ head/emulators/Makefile	Mon Mar 25 20:08:45 2013	=
(r315245)
> @@ -58,6 +58,7 @@
>     SUBDIR +=3D hfsutils
>     SUBDIR +=3D higan
>     SUBDIR +=3D hugo
> +    SUBDIR +=3D i386-wine-devel
>     SUBDIR +=3D ia64sim
>     SUBDIR +=3D ines
>     SUBDIR +=3D its
>=20
> Added: head/emulators/i386-wine-devel/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/i386-wine-devel/Makefile	Mon Mar 25 20:08:45 2013	=
(r315245)
> @@ -0,0 +1,75 @@
> +# Created by: David Naylor <dbn@FreeBSD.org>
> +# $FreeBSD$
> +
> +PKGNAMEPREFIX=3D	i386-
> +
> +# Use the wine port to do most of the heavy lifting
> +MASTERDIR=3D	${.CURDIR}/../wine-devel
> +PKGINSTALL=3D	${.CURDIR}/files/pkg-install
> +PKGDEINSTALL=3D	${PKGINSTALL}
> +
> +ACTUAL-PACKAGE-DEPENDS=3D	${DO_NADA}
> +WINELIBDIR=3D	${PREFIX}/lib32
> +CONFIGURE_ARGS+=3D	--bindir=3D${PREFIX}/bin32 =
--libdir=3D${WINELIBDIR}
> +CONFLICTS=3D	wine-[0-9]*
> +PLIST_REINPLACE+=3D	winelib
> +PLIST_REINPLACE_WINELIB=3D	s!lib/!lib32/!g
> +WINE_SLAVE_BUILD=3D	yes
> +USE_LDCONFIG32=3D	${WINELIBDIR} ${WINELIBDIR}/wine
> +
> +# Hook into post-install and do some adapting to make i386 binaries =
work nicely
> +# under FreeBSD/amd64 (include add dependant i386 libs)
> +post-install-script:
> +	# Install bounce script to access the 32bit executables
> +	${INSTALL_SCRIPT} ${.CURDIR}/files/binbounce ${PREFIX}/bin/wine
> +	for i in `grep ^bin ${TMPPLIST} | xargs -n1 basename` ; do \
> +		[ "$${i}" =3D "wine" ] || ${LN} -f ${PREFIX}/bin/wine =
${PREFIX}/bin/$${i} ; \
> +		echo bin32/$${i} >> ${TMPPLIST} ; \
> +	done
> +	if [ -n "${WITH_PKGNG}" ]; then \
> +		echo '@dirrmtry bin32' >> ${TMPPLIST}; \
> +	else \
> +		echo '@unexec rmdir %D/bin32 2>/dev/null || true' >> =
${TMPPLIST}; \
> +	fi
> +	# Find all libraries that are linked too (via ldd(1))
> +	grep -v '[@%]' ${TMPPLIST} | sed "s!^!${PREFIX}/!g" | \
> +	xargs -n1 file -F' ' | grep ELF | cut -f1 -d' ' | \
> +	env LD_LIBRARY_PATH=3D${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
> +	for i in `cat ${WRKDIR}/winelibs` ; do \
> +		${INSTALL_DATA} $${i} ${PREFIX}/lib32/ ; \
> +		echo lib32/`basename $${i}` >> ${TMPPLIST} ; \
> +	done
> +	# Find all soft dependancies (via strings(1))
> +	grep -v '[@%]' ${TMPPLIST} | sed "s!^!${PREFIX}/!g" | \
> +	xargs -n1 file -F' ' | grep ELF | cut -f1 -d' ' | xargs strings =
| \
> +	grep '^lib.*\.so' | sort -u > ${WRKDIR}/winesoftlibs
> +	for i in `cat ${WRKDIR}/winesoftlibs` ; do \
> +		if [ -e ${LOCALBASE}/lib/$${i} ] && [ -z "`grep $${i} =
${TMPPLIST}`" ] ; then \
> +			${INSTALL_DATA} ${LOCALBASE}/lib/$${i} =
${PREFIX}/lib32/ ; \
> +			echo lib32/$${i} >> ${TMPPLIST} ; \
> +		fi ; \
> +	done
> +	if [ -n "${WITH_PKGNG}" ]; then \
> +		echo '@dirrmtry lib32' >> ${TMPPLIST}; \
> +	else \
> +		echo '@unexec rmdir %D/lib32 2>/dev/null || true' >> =
${TMPPLIST}; \
> +	fi
> +	# Install nvidia patching script
> +	${INSTALL_SCRIPT} ${.CURDIR}/files/nvidia.sh =
${DATADIR}/patch-nvidia.sh
> +	echo ${DATADIR:S|$(PREFIX)/||}/patch-nvidia.sh >> ${TMPPLIST}
> +	@${ECHO}
> +	${SETENV} PKG_PREFIX=3D${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} =
PRE-INSTALL
> +	${SETENV} PKG_PREFIX=3D${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} =
POST-INSTALL
> +	@${CAT} ${PKGMESSAGE}
> +
> +post-package-script:
> +	if [ -n "${WITH_PKGNG}" ]; then \
> +		${XZ_CMD} -dc ${PKGFILE} | \
> +		${SED} -e "s/^\(arch: freebsd:.*:x86\):32/\1:64/" | \
> +		${XZ_CMD} > ${WRKDIR}/${PKGNAME}${PKG_SUFX}; \
> +		${MV} ${WRKDIR}/${PKGNAME}${PKG_SUFX} ${PKGFILE}; \
> +	fi
> +
> +.include "${MASTERDIR}/Makefile"
>=20
> Added: head/emulators/i386-wine-devel/files/binbounce
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/i386-wine-devel/files/binbounce	Mon Mar 25 =
20:08:45 2013	(r315245)
> @@ -0,0 +1,32 @@
> +#!/bin/sh
> +
> +TARGET=3D"$0"
> +_count=3D0
> +while [ -L "$TARGET" ]
> +do
> +  _old=3D"$TARGET"
> +  TARGET=3D"`readlink "$TARGET"`"
> +  if [ ! -e "$TARGET" ]
> +  then
> +    TARGET=3D"`dirname "$_old"`/$TARGET"
> +  fi
> +  _count=3D$(($_count + 1))
> +  if [ $_count -gt 100 ]
> +  then
> +    echo "$0: to many symbolic links" > /dev/stderr
> +    exit 1
> +  fi
> +done
> +
> +LOCALBASE=3D`dirname "$TARGET"`/..
> +BINNAME=3D`basename "$TARGET"`
> +
> +if [ `uname -p` =3D i386 ]
> +then
> +  export =
LD_LIBRARY_PATH=3D"$LOCALBASE/lib32":"$LOCALBASE/lib32/wine":"$LD_LIBRARY_=
PATH"
> +else
> +  export =
LD_32_LIBRARY_PATH=3D"$LOCALBASE/lib32":"$LOCALBASE/lib32/wine":"$LD_32_LI=
BRARY_PATH":/usr/lib32
> +fi
> +export PATH=3D"$LOCALBASE/bin32":"$PATH"
> +
> +exec "$LOCALBASE/bin32/$BINNAME" "$@"
>=20
> Added: head/emulators/i386-wine-devel/files/nvidia.sh
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/i386-wine-devel/files/nvidia.sh	Mon Mar 25 =
20:08:45 2013	(r315245)
> @@ -0,0 +1,178 @@
> +#!/bin/sh
> +# Copyright 2010, 2011, 2012 David Naylor <naylor.b.david@gmail.com>.
> +# Copyright 2012 Jan Beich <jbeich@tormail.org>
> +#       All rights reserved.
> +#
> +# Redistribution and use in source and binary forms, with or without
> +# modification, are permitted provided that the following conditions =
are met:
> +#
> +#   1. Redistributions of source code must retain the above copyright =
notice,
> +#      this list of conditions and the following disclaimer.
> +#
> +#   2. Redistributions in binary form must reproduce the above =
copyright notice,
> +#      this list of conditions and the following disclaimer in the =
documentation
> +#      and/or other materials provided with the distribution.
> +#
> +# THIS SOFTWARE IS PROVIDED BY David Naylor ``AS IS'' AND ANY EXPRESS =
OR IMPLIED
> +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES =
OF
> +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE =
DISCLAIMED. IN NO
> +# EVENT SHALL David Naylor OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, =
INDIRECT,
> +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES =
(INCLUDING, BUT NOT
> +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF =
USE, DATA,
> +# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY =
THEORY OF
> +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT =
(INCLUDING
> +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS =
SOFTWARE,
> +# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> +#
> +# The views and conclusions contained in the software and =
documentation are
> +# those of the authors and should not be interpreted as representing =
official
> +# policies, either expressed or implied, of David Naylor.
> +
> +# Version 1.0 - 2010/05/28
> +#  - initial release
> +# Version 1.1 - 2010/10/04
> +#  - add support for 256 driver series
> +#  - use passive connections for FTP
> +#  - allow resuming of downloads if they were interrupted
> +#  - add license and copyright notice
> +# Version 1.2 - 2010/10/17
> +#  - try to save the NVIDIA tarball under $PORTSDIR/distfiles
> +#  - obay $PREFIX
> +#  - extract files directly to destination (avoids using /tmp)
> +# Version 1.3 - 2010/11/02
> +#  - add support for future driver series
> +# Version 1.4 - 2011/05/23
> +#  - add support for legacy drivers
> +# Version 1.5 - 2011/10/23
> +#  - add support for no-fetch mode
> +#  - backup the original openGL.so.1 library
> +# Version 1.6 - 2012/06/06
> +#  - add support for pkgng
> +# Version 1.7 - 2012/06/23
> +#  - make nVidia detection more robust
> +#  - allow mixed pkg/pkgng operation
> +# Version 1.8 - 2012/07/02
> +#  - fix mixed pkg/pkgng operation
> +# Version 1.9 - 2012/10/31
> +#  - fix permission of extracts files
> +
> +set -e
> +
> +PORTSDIR=3D${PORTSDIR:-/usr/ports}
> +PREFIX=3D${PREFIX:-/usr/local}
> +DISTDIR=3D${DISTDIR:-${PORTSDIR}/distfiles}
> +
> +if [ -d $DISTDIR ]
> +then
> +  cd $DISTDIR
> +  NO_REMOVE_NVIDIA=3D"yes"
> +else
> +  cd /tmp/
> +fi
> +
> +terminate() {
> +
> +  echo "!!! $2 !!!"
> +  echo "Terminating..."
> +  exit $1
> +
> +}
> +
> +args=3D`getopt -n $*`
> +if [ $? -ne 0 ]
> +then
> +  echo "Usage: $0 [-n]"
> +  exit 7
> +fi
> +set -- $args
> +while true
> +do
> +  case $1 in
> +    -n)
> +      NO_FETCH=3Dyes
> +      ;;
> +    --)
> +      shift
> +      break
> +      ;;
> +  esac
> +  shift
> +done
> +
> +version() {
> +  local ret pkg=3D"$1"
> +  if [ -f "/usr/local/sbin/pkg" ]
> +  then
> +    ret=3D`pkg query -g '%v' $pkg`
> +  fi
> +
> +  if [ -z "$ret" ]
> +  then
> +    ret=3D`pkg_info -E $pkg'*' | cut -f 3 -d -`
> +  fi
> +  # installed manually or failed to register
> +  if [ -z "$ret" ] && [ "$pkg" =3D "nvidia-driver" ]
> +  then
> +    ret=3D`sed -n "s/.*Version: //p" 2> /dev/null \
> +      $PREFIX/share/doc/NVIDIA_GLX-1.0/README || true`
> +  fi
> +  echo "$ret"
> +}
> +
> +[ `whoami` =3D root ] \
> +  || terminate 254 "This script should be run as root"
> +
> +echo "=3D=3D=3D> Patching wine-fbsd64 to work with =
x11/nvidia-driver:"
> +
> +if [ -z "${WINE}" ]
> +then
> +  WINE=3D`version wine-fbsd64`
> +fi
> +[ -n "$WINE" ] \
> +  || terminate 255 "Unable to detect wine-fbsd64, please install =
first"
> +echo "=3D> Detected wine-fbsd64: ${WINE}"
> +
> +NV=3D`version nvidia-driver`
> +[ -n "$NV" ] \
> +  || terminate 1 "Unable to detect nvidia-driver, please install =
first"
> +echo "=3D> Detected nvidia-driver: ${NV}"
> +
> +NVIDIA=3D${NV}
> +NV=3D`echo ${NV} | cut -f 1 -d _ | cut -f 1 -d ,`
> +
> +if [ ! -f NVIDIA-FreeBSD-x86-${NV}.tar.gz ]
> +then
> +  [ -n "$NO_FETCH" ] \
> +    && terminate 8 "NVIDIA-FreeBSD-x86-${NV}.tar.gz unavailable"
> +  echo "=3D> Downloading NVIDIA-FreeBSD-x86-${NV}.tar.gz from =
ftp://download.nvidia.com..."
> +  fetch -apRr =
ftp://download.nvidia.com/XFree86/FreeBSD-x86/${NV}/NVIDIA-FreeBSD-x86-${N=
V}.tar.gz \
> +    || terminate 2 "Failed to download =
NVIDIA-FreeBSD-x86-${NV}.tar.gz"
> +fi
> +
> +echo "=3D> Extracting NVIDIA-FreeBSD-x86-${NV}.tar.gz to =
$PREFIX/lib32..."
> +EXTRACT_LIST=3D"libGL.so.1"
> +case $NV in
> +  195*|173*|96*|71*)
> +    EXTRACT_LIST=3D"$EXTRACT_LIST libGLcore.so.1 libnvidia-tls.so.1"
> +    ;;
> +  *)
> +    EXTRACT_LIST=3D"$EXTRACT_LIST libnvidia-glcore.so.1 =
libnvidia-tls.so.1"
> +    ;;
> +esac
> +
> +EXTRACT_ARGS=3D"--no-same-owner --no-same-permissions =
--strip-components 2 -C $PREFIX/lib32"
> +for i in $EXTRACT_LIST
> +do
> +  EXTRACT_ARGS=3D"$EXTRACT_ARGS --include =
NVIDIA-FreeBSD-x86-${NV}/obj/$i"
> +done
> +[ -f ${PREFIX}/lib32/libGL.so.1~ ] \
> +  || cp ${PREFIX}/lib32/libGL.so.1 ${PREFIX}/lib32/libGL.so.1~
> +umask 0333
> +tar $EXTRACT_ARGS -xvf NVIDIA-FreeBSD-x86-${NV}.tar.gz \
> +  || terminate 3 "Failed to extract NVIDIA-FreeBSD-x86-${NV}.tar.gz"
> +
> +echo "=3D> Cleaning up..."
> +[ -n "$NO_REMOVE_NVIDIA" ] || rm -vf NVIDIA-FreeBSD-x86-${NV}.tar.gz =
\
> +  || terminate 6 "Failed to remove files"
> +
> +echo "=3D=3D=3D> wine-fbsd64-${WINE} successfully patched for =
nvidia-driver-${NVIDIA}"
>=20
> Added: head/emulators/i386-wine-devel/files/pkg-install
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
> --- /dev/null	00:00:00 1970	(empty, because file is newly added)
> +++ head/emulators/i386-wine-devel/files/pkg-install	Mon Mar 25 =
20:08:45 2013	(r315245)
> @@ -0,0 +1,41 @@
> +#!/bin/sh
> +
> +PKG_PREFIX=3D${PKG_PREFIX-/usr/local}
> +export PREFIX=3D${PKG_PREFIX}
> +export WINE=3D$1
> +
> +case "$2" in
> +  PRE-INSTALL|DEINSTALL)
> +    mv -f ${PKG_PREFIX}/lib32/libGL.so.1~ =
${PKG_PREFIX}/lib32/libGL.so.1 > /dev/null 2>&1
> +    rm -f ${PKG_PREFIX}/lib32/libGLcore.so.1 =
${PKG_PREFIX}/lib32/libnvidia-glcore.so.1 =
${PKG_PREFIX}/lib32/libnvidia-tls.so.1
> +    ;;
> +  POST-INSTALL)
> +    sh ${PKG_PREFIX}/share/wine/patch-nvidia.sh -n > /dev/null 2>&1
> +    case $? in
> +      0)
> +        cat << _EOF
> +$1 has been patched for use with nvidia graphics driver.  If
> +the version of the installed nvidia graphics driver changes execute =
(as root):
> +_EOF
> +        ;;
> +      1)
> +        cat << _EOF
> +This system does not appear to use a nvidia graphics driver.  If this =
changes
> +and then every time the driver's version changes execute (as root)
> +_EOF
> +        ;;
> +      *)
> +        cat << _EOF
> +A NVIDIA GRAPHICS DRIVER HAS BEEN DETECTED ON THIS SYSTEM AND THE =
AUTOMATED
> +PATCHING HAS FAILED, execute (as root)
> +_EOF
> +        ;;
> +    esac
> +    cat << _EOF
> +	sh ${PKG_PREFIX}/share/wine/patch-nvidia.sh
> +to get 2D/3D acceleration to work with the nvidia driver.  Without =
this wine
> +will crash when a program requires 2D/3D graphics acceleration.
> +
> +_EOF
> +    ;;
> +esac
>=20

+-----------------oOO--(_)--OOo-------------------------+
With best Regards,
       Martin Wilke (miwi_(at)_FreeBSD.org)

Mess with the Best, Die like the Rest




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?552F406F-8274-4FBC-B36A-65C99542E8BF>