Permalink
Browse files

Solve libGL.so and libglx.so conflict situation between libGL, xorg-s…

…erver and

the nvidia-driver. Install the libraries in port specific directories.
Use pkg-install and pkg-deinstall scripts to update the hardlinks to the
default locations of these files.

While here clean up some @dirrmtry lines in xorg-server plist for directories
that aren.t created by xorg-server.

Motivator:	pkgng
Inspiration:	irc, freebsd-x11@ mailinglist discussion (sorry can't find it
		anymore to give credit the people)
Reviewed by:	danfe@ (for nvidia parts), bapt@
Approved by:	danfe@ (for nvidia parts)
With hat:	x11@
  • Loading branch information...
1 parent 2db20fb commit 5fb75889ff78049c1801014ae2d2eb32fb4d68cb @kwm81 kwm81 committed Aug 31, 2012
View
@@ -7,6 +7,7 @@
PORTNAME= libGL
PORTVERSION= ${MESAVERSION}
+PORTREVISION= 1
CATEGORIES= graphics
COMMENT= OpenGL library that renders using GLX or DRI
@@ -16,10 +17,15 @@ LIB_DEPENDS+= drm:${PORTSDIR}/graphics/libdrm \
USE_XORG= glproto x11 xext xxf86vm xdamage xfixes dri2proto:both
+SUB_FILES= pkg-install pkg-deinstall
+
do-install:
${RM} -f ${WRKSRC}/include/GL/glu*.h
cd ${WRKSRC}/src/mesa; ${GMAKE} install-libgl
+post-install:
+ @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+
.include "${.CURDIR}/bsd.mesalib.mk"
.include <bsd.port.pre.mk>
@@ -0,0 +1,15 @@
+--- src/mesa/Makefile.orig 2012-04-22 18:34:50.000000000 +0200
++++ src/mesa/Makefile 2012-04-22 18:35:00.000000000 +0200
+@@ -183,10 +183,10 @@
+ $(DESTDIR)$(INSTALL_INC_DIR)/GL
+
+ install-libgl: default gl.pc install-headers
+- $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
++ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/.libGL
+ $(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
+ $(MINSTALL) $(TOP)/$(LIB_DIR)/$(GL_LIB_GLOB) \
+- $(DESTDIR)$(INSTALL_LIB_DIR)
++ $(DESTDIR)$(INSTALL_LIB_DIR)/.libGL
+ $(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
+
+ install-osmesa: default osmesa.pc
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+DEINSTALL)
+ /bin/rm -f ${PREFIX}/lib/libGL.so*
+ ;;
+esac
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+POST-INSTALL)
+ if [ -f ${PREFIX}/lib/.nvidia/libGL.so.1 ]; then
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ else
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ fi
+ ;;
+esac
View
@@ -14,7 +14,8 @@ include/GL/osmesa.h
include/GL/vms_x_fix.h
include/GL/wglext.h
include/GL/wmesa.h
-lib/libGL.so
-lib/libGL.so.1
+lib/.libGL/libGL.so
+lib/.libGL/libGL.so.1
libdata/pkgconfig/gl.pc
+@dirrm lib/.libGL
@dirrmtry include/GL
@@ -22,16 +22,17 @@ RUN_DEPENDS= ${LOCALBASE}/share/X11/xkb/rules/base.xml:${PORTSDIR}/x11/xkeyboard
xkbcomp:${PORTSDIR}/x11/xkbcomp
XORG_CAT= xserver
+SLAVE_PORT?= no
.if defined(WITH_NEW_XORG)
XORG_VERSION= 1.10.6
-XORG_REVISION= 0
+XORG_REVISION= 1
PLIST_SUB+= OLD="@comment " NEW=""
EXTRA_PATCHES+= ${FILESDIR}/extra-hw_dmx_glxProxy_compsize.h \
${FILESDIR}/extra-hw_dmx_glxProxy_glxcmds.h
.else
XORG_VERSION= 1.7.7
-XORG_REVISION= 5
+XORG_REVISION= 6
PLIST_SUB+= OLD="" NEW="@comment "
EXTRA_PATCHES+= ${FILESDIR}/extra-dix_events.c
EXTRA_PATCHES+= ${FILESDIR}/extra-include_eventstr.h
@@ -56,7 +57,8 @@ CONFIGURE_ARGS?=--disable-dmx --disable-xvfb --disable-xnest \
--localstatedir=/var --without-dtrace --disable-xephyr \
--enable-record=yes
-.if !defined(SLAVE_PORT)
+.if ${SLAVE_PORT} == "no"
+SUB_FILES= pkg-install pkg-deinstall
MAN1= Xorg.1 \
Xserver.1 \
cvt.1 \
@@ -151,10 +153,22 @@ pre-everything::
post-patch:
@${REINPLACE_CMD} 's/test.*-traditional.*;/true;/' \
${WRKSRC}/configure
+# build libglx.so but don't install it yet. which is done in pre-install.
+ @${REINPLACE_CMD} -e 's|@GLX_TRUE@GLXMODS =|@GLX_BOGUS@GLXMODS =|g' \
+ -e 's|^LTLIBRARIES = |LTLIBRARIES = libglx.la |g' \
+ ${WRKSRC}/hw/xfree86/dixmods/Makefile.in
+
+.if ${SLAVE_PORT} == "no"
+pre-su-install:
+ ${MKDIR} ${PREFIX}/lib/xorg/modules/extensions/.xorg
+ ${INSTALL_LIB} ${WRKSRC}/hw/xfree86/dixmods/.libs/libglx.so \
+ ${PREFIX}/lib/xorg/modules/extensions/.xorg/
-.if defined(WITH_NEW_XORG)
post-install:
+.if defined(WITH_NEW_XORG)
@${MKDIR} ${PREFIX}/share/X11/xorg.conf.d
.endif
+ @PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
.include <bsd.port.post.mk>
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+DEINSTALL)
+ /bin/rm -rf ${PREFIX}/lib/xorg/modules/extensions/libglx.so*
+ ;;
+esac
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+POST-INSTALL)
+ if [ -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 ]; then
+ /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 \
+ ${PREFIX}/lib/xorg/modules/extensions/libglx.so
+ /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 \
+ ${PREFIX}/lib/xorg/modules/extensions/libglx.so.1
+ else
+ /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.xorg/libglx.so \
+ ${PREFIX}/lib/xorg/modules/extensions/libglx.so
+ fi
+ ;;
+esac
@@ -180,10 +180,9 @@ lib/xorg/modules/extensions/libdri2.la
lib/xorg/modules/extensions/libdri2.so
lib/xorg/modules/extensions/libextmod.la
lib/xorg/modules/extensions/libextmod.so
-lib/xorg/modules/extensions/libglx.la
-lib/xorg/modules/extensions/libglx.so
lib/xorg/modules/extensions/librecord.la
lib/xorg/modules/extensions/librecord.so
+lib/xorg/modules/extensions/.xorg/libglx.so
lib/xorg/modules/libexa.la
lib/xorg/modules/libexa.so
lib/xorg/modules/libfb.la
@@ -228,18 +227,11 @@ share/aclocal/xorg-server.m4
%%NEW%%@exec /bin/mkdir -p %D/share/X11/xorg.conf.d
%%NEW%%@dirrm share/doc/xorg-server
@dirrm include/xorg
+@dirrm lib/xorg/modules/extensions/.xorg
@dirrm lib/xorg/modules/extensions
@dirrm lib/xorg/modules/multimedia
%%OLD%%@dirrm lib/xorg/modules/linux
@dirrm lib/xorg/modules
@dirrm lib/xorg
-@dirrmtry include/X11/bitmaps
-@dirrmtry include/X11/pixmaps
-@dirrmtry lib/X11/doc
-@dirrmtry lib/X11/etc
-@dirrmtry lib/X11/xserver
-@dirrmtry lib/xorg/modules
-@dirrmtry lib/xorg
%%NEW%%@dirrmtry share/X11/xorg.conf.d
-@dirrmtry share/X11/app-defaults
@dirrmtry share/X11
@@ -6,7 +6,7 @@
#
DISTVERSION= 173.14.31
-PORTREVISION= 1
+PORTREVISION= 2
MASTERDIR= ${.CURDIR}/../nvidia-driver
NO_LATEST_LINK= yes
@@ -6,6 +6,7 @@
#
DISTVERSION= 71.86.15
+PORTREVISION= 1
MASTERDIR= ${.CURDIR}/../nvidia-driver
NO_LATEST_LINK= yes
@@ -6,6 +6,7 @@
#
DISTVERSION= 96.43.20
+PORTREVISION= 1
MASTERDIR= ${.CURDIR}/../nvidia-driver
NO_LATEST_LINK= yes
View
@@ -7,7 +7,7 @@
PORTNAME= nvidia-driver
DISTVERSION?= 295.71
-PORTREVISION?= 0 # As a reminder it can be overridden
+PORTREVISION?= 1 # As a reminder it can be overridden
CATEGORIES= x11 kld
MASTER_SITES= ${MASTER_SITE_NVIDIA}
# MASTER_SITE_SUBDIR has to be set later because it depends on NVVERSION
@@ -33,7 +33,7 @@ USE_LDCONFIG= yes
# hack below to universally set NVIDIA_ROOT. Also provide X11BASE value
# since it is going away from `Mk/bsd.port.mk' as deprecated.
MAKE_ENV= NVIDIA_ROOT=${WRKSRC} X11BASE=${LOCALBASE}
-SUB_FILES= pkg-message
+SUB_FILES= pkg-deinstall pkg-install pkg-message
DOCSDIR= ${PREFIX}/share/doc/NVIDIA_GLX-1.0
MODULESDIR= lib/xorg/modules
PORTDOCS= *
@@ -72,11 +72,7 @@ OPTIONS+= WBINVD "Enable heavy-weight cache-flush logic" off
.include <bsd.port.pre.mk>
-XSERVVERSION!= ${PKG_INFO} -qO x11-servers/xorg-server 2>/dev/null || true
-LIBGLVERSION!= ${PKG_INFO} -qO graphics/libGL 2>/dev/null || true
-
-PLIST_SUB+= XSERVVERSION=${XSERVVERSION} LIBGLVERSION=${LIBGLVERSION} \
- LINUXBASE=${LINUXBASE} SHLIB_VERSION=${PORTVERSION} \
+PLIST_SUB+= LINUXBASE=${LINUXBASE} SHLIB_VERSION=${PORTVERSION} \
MODULESDIR=${MODULESDIR}
.if !defined(WITHOUT_LINUX)
@@ -148,8 +144,16 @@ post-patch: .SILENT
.if defined(NOPORTDOCS)
${REINPLACE_CMD} -E 's/(x11).*/\1/ ; /doc/d' ${WRKSRC}/Makefile
.endif
+# Adjust installation paths of some conflicting files (shared also between
+# libGL and xorg-server) to ease package manager work, esp. with pkgng
+ ${REINPLACE_CMD} -e '/LIBDIR/s:xorg/modules/extensions:&/.nvidia:' \
+ ${WRKSRC}/x11/extension/Makefile
+ ${REINPLACE_CMD} -e '/LIBDIR/s:lib:&/.nvidia:' \
+ ${WRKSRC}/lib/libGL/Makefile
# Do not execute afterinstall target (prevent automatic module registration)
${REINPLACE_CMD} -e 's/afterinstall/dontexecute/' ${WRKSRC}/Makefile
+ ${REINPLACE_CMD} -e 's/beforeinstall/dontexecute/' \
+ ${WRKSRC}/lib/Makefile ${WRKSRC}/src/Makefile
pre-su-install:
# While this port silently assumes PREFIX == LOCALBASE, at least try to
@@ -184,6 +188,7 @@ post-install: .SILENT
${REINPLACE_CMD} -e '26,27d' ${PKGMESSAGE}
. endif
.endif
+ PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
${ECHO_MSG}
${CAT} ${PKGMESSAGE}
${ECHO_MSG}
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+DEINSTALL)
+ /bin/rm -f ${PREFIX}/lib/libGL.so*
+ /bin/rm -f ${PREFIX}/lib/xorg/modules/extensions/libglx.so*
+
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.libGL/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.xorg/libglx.so \
+ ${PREFIX}/lib/xorg/modules/extensions/libglx.so
+ ;;
+esac
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+PREFIX="${PKG_PREFIX-/usr/local}"
+
+case $2 in
+POST-INSTALL)
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so
+ /bin/ln -f ${PREFIX}/lib/.nvidia/libGL.so.1 ${PREFIX}/lib/libGL.so.1
+ /bin/ln -f ${PREFIX}/lib/xorg/modules/extensions/.nvidia/libglx.so.1 \
+ ${PREFIX}/lib/xorg/modules/extensions/libglx.so
+ ;;
+esac
@@ -1,11 +1,6 @@
-@exec mv -f %D/%%MODULESDIR%%/extensions/libglx.la %D/%%MODULESDIR%%/extensions/XXX-libglx.la.%%%%.%%XSERVVERSION%%
-@unexec mv -f %D/%%MODULESDIR%%/extensions/XXX-libglx.la.%%%%.%%XSERVVERSION%% %D/%%MODULESDIR%%/extensions/libglx.la
-@exec mv -f %D/%%MODULESDIR%%/extensions/libglx.so %D/%%MODULESDIR%%/extensions/XXX-libglx.so.%%%%.%%XSERVVERSION%%
-%%MODULESDIR%%/extensions/libglx.so
-@unexec mv -f %D/%%MODULESDIR%%/extensions/XXX-libglx.so.%%%%.%%XSERVVERSION%% %D/%%MODULESDIR%%/extensions/libglx.so
-@exec mv -f %D/lib/libGL.so.1 %D/lib/XXX-libGL.so.1.%%%%.%%LIBGLVERSION%%
-lib/libGL.so.1
-@unexec mv -f %D/lib/XXX-libGL.so.1.%%%%.%%LIBGLVERSION%% %D/lib/libGL.so.1
+lib/.nvidia/libGL.so
+lib/.nvidia/libGL.so.1
+@dirrm lib/.nvidia
lib/libnvidia-tls.so.1
lib/libnvidia-tls.so
lib/libnvidia-cfg.so.1
@@ -21,8 +16,9 @@ lib/libXvMCNVIDIA_dynamic.so.1
@dirrmtry lib/vdpau
%%MODULESDIR%%/libnvidia-wfb.so.1
%%MODULESDIR%%/drivers/nvidia_drv.so
-%%MODULESDIR%%/extensions/libglx.so.1
-@exec ln -sf libglx.so.1 %D/%%MODULESDIR%%/extensions/libglx.so
+%%MODULESDIR%%/extensions/.nvidia/libglx.so
+%%MODULESDIR%%/extensions/.nvidia/libglx.so.1
+@dirrm %%MODULESDIR%%/extensions/.nvidia
@dirrmtry %%MODULESDIR%%/drivers
@cwd /boot/modules
nvidia.ko

0 comments on commit 5fb7588

Please sign in to comment.