1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-14 07:43:06 +00:00

Improve 3D acceleration for emulators/i386-wine-devel.

- Install the dri library drivers that are required by mesaGL
 - Teach binbounce about LIBGL_LIBRARY_PATH
 - Prevent recursive definitions by binbounce
 - Follow the example of mesagl/nvidia-driver wrt library handing
 - Lay initial ground work to handle "old" and "new" xorg

WARNING: there appears to be a problem with FREEBSD32 which prevents
    3D-acceleration support from working, further investigation is required
    HELP WANTED TO SOLVE THIS PROBLEM

Approved by:	eadler,bdrewery (mentors, implicit)
This commit is contained in:
David Naylor 2013-06-09 17:42:57 +00:00
parent 453305d0b7
commit d2e0f93fef
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=320362
4 changed files with 74 additions and 43 deletions

View File

@ -12,6 +12,8 @@ MASTERDIR= ${.CURDIR}/../wine-devel
PKGINSTALL= ${.CURDIR}/files/pkg-install
PKGDEINSTALL= ${PKGINSTALL}
RUN_DEPENDS= dri>0:${PORTSDIR}/graphics/dri
ACTUAL-PACKAGE-DEPENDS= ${DO_NADA}
WINELIBDIR= ${PREFIX}/lib32
CONFIGURE_ARGS+= --bindir=${PREFIX}/bin32 --libdir=${WINELIBDIR}
@ -22,7 +24,7 @@ WINE_SLAVE_BUILD= yes
USE_LDCONFIG32= ${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)
# under FreeBSD/amd64
post-install-script:
# Install bounce script to access the 32bit executables
${INSTALL_SCRIPT} ${.CURDIR}/files/binbounce ${PREFIX}/bin/wine
@ -30,11 +32,15 @@ post-install-script:
[ "$${i}" = "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
echo '@dirrm lib32/.libGL/dri' >> ${TMPPLIST}
echo '@dirrm lib32/.libGL' >> ${TMPPLIST}
echo '@dirrm bin32' >> ${TMPPLIST}
# Install dri libraries (internal libGL requirements)
${MKDIR} ${PREFIX}/lib32/.libGL/dri
for i in ${LOCALBASE}/lib/dri/*.so; do \
${INSTALL_DATA} $${i} ${PREFIX}/lib32/.libGL/dri/ ; \
echo lib32/.libGL/dri/$${i##*/} >> ${TMPPLIST} ; \
done
# 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' ' | \
@ -42,8 +48,13 @@ post-install-script:
| 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} ; \
if [ `basename $${i}` != libGL.so.1 ]; then \
${INSTALL_DATA} $${i} ${PREFIX}/lib32/ ; \
echo lib32/$${i##*/} >> ${TMPPLIST} ; \
else \
${INSTALL_DATA} $${i} ${PREFIX}/lib32/.libGL/ ; \
echo lib32/.libGL/libGL.so.1 >> ${TMPPLIST} ; \
fi ; \
done
# Find all soft dependancies (via strings(1))
grep -v '[@%]' ${TMPPLIST} | sed "s!^!${PREFIX}/!g" | \

View File

@ -1,32 +1,20 @@
#!/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
TARGET="`realpath $0`"
LOCALBASE=`dirname "$TARGET"`/..
BINNAME=`basename "$TARGET"`
LOCALBASE=${TARGET%/*}/..
BINNAME=${TARGET##*/}
if [ `uname -p` = i386 ]
if [ -z "$__BINBOUNCE_BOOTSTRAP" ]
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":/usr/lib32
export LIBGL_DRIVERS_PATH=$LOCALBASE/lib32/dri
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":/usr/lib32
fi
export PATH="$LOCALBASE/bin32":"$PATH"
fi
export PATH="$LOCALBASE/bin32":"$PATH"
exec "$LOCALBASE/bin32/$BINNAME" "$@"

View File

@ -56,8 +56,11 @@
# Version 1.9 - 2012/10/31
# - fix permission of extracts files
# Version 1.10 - 2013/05/06
# - s/wine-fbsd64/i386-wine/
# - s/wine-fbsd64/i386-wine/g
# - fix unwanted failures due to `set -e`
# Version 1.11 - 2013/05/26
# - install libGL.so.1 to ${PREFIX}/lib32/.nvidia and link to it
# - add deinstall option
set -e
@ -81,7 +84,7 @@ terminate() {
}
args=`getopt -n $*`
args=`getopt -dn $*`
if [ $? -ne 0 ]
then
echo "Usage: $0 [-n]"
@ -91,6 +94,19 @@ set -- $args
while true
do
case $1 in
-d)
rm -f ${PREFIX}/lib32/libGL.so.1
rm -f ${PREFIX}/lib32/libGLcore.so.1 ${PREFIX}/lib32/libnvidia-tls.so.1
rm -f ${PREFIX}/lib32/libnvidia-glcore.so.1 ${PREFIX}/lib32/libnvidia-tls.so.1
rm -rf ${PREFIX}/lib32/.nvidia/
if [ -d ${PREFIX}/lib32/.libGL-new ]
then
ln -s .libGL-new/libGL.so.1 ${PREFIX}/lib32/libGL.so.1
else
ln -s .libGL/libGL.so.1 ${PREFIX}/lib32/libGL.so.1
fi
exit 0
;;
-n)
NO_FETCH=yes
;;
@ -168,11 +184,15 @@ for i in $EXTRACT_LIST
do
EXTRACT_ARGS="$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"
mkdir -p ${PREFIX}/lib32/.nvidia \
|| terminate 9 "Failed to create .nvidia shadow directory"
mv ${PREFIX}/lib32/libGL.so.1 ${PREFIX}/lib32/.nvidia/ \
|| terminate 10 "Failed to move libGL.so.1 to .nvidia/ shadow directory"
ln -s .nvidia/libGL.so.1 ${PREFIX}/lib32/libGL.so.1 \
|| terminate 11 "Failed to link to .nvidia/libGL.so.1 in the shadow directory"
echo "=> Cleaning up..."
[ -n "$NO_REMOVE_NVIDIA" ] || rm -vf NVIDIA-FreeBSD-x86-${NV}.tar.gz \

View File

@ -1,16 +1,28 @@
#!/bin/sh
PKG_PREFIX=${PKG_PREFIX-/usr/local}
export PREFIX=${PKG_PREFIX}
export PREFIX=${PKG_PREFIX:-/usr/local}
export WINE=$1
if [ -d ${PREFIX}/lib32/.libGL-new ]
then
LIBGLDIR=.libGL-new
else
LIBGLDIR=.libGL
fi
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
DEINSTALL)
sh ${PREFIX}/share/wine/patch-nvidia.sh -d
rm -r ${PREFIX}/lib32/libGL.so.1 ${PREFIX}/lib32/dri
;;
POST-INSTALL)
sh ${PKG_PREFIX}/share/wine/patch-nvidia.sh -n > /dev/null 2>&1
ln -s ${LIBGLDIR}/libGL.so.1 ${PREFIX}/lib32/libGL.so.1
mkdir -p ${PREFIX}/lib32/dri
for dri in $(cd ${PREFIX}/lib32/${LIBGLDIR}/dri/; echo *.so)
do
ln -s ../${LIBGLDIR}/dri/${dri} ${PREFIX}/lib32/dri/${dri}
done
sh ${PREFIX}/share/wine/patch-nvidia.sh -n > /dev/null 2>&1
case $? in
0)
cat << _EOF
@ -32,7 +44,7 @@ _EOF
;;
esac
cat << _EOF
sh ${PKG_PREFIX}/share/wine/patch-nvidia.sh
sh ${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.