[RFC 3/3] Add gles-alternative-tegra

Heiko Stübner heiko at sntech.de
Thu Jul 21 06:47:14 UTC 2011


Add an alternative for NVidia-Tegra libraries from
package tegra-libraries by Julian Andres Klode.

Signed-off-by: Heiko Stuebner <mmind at debian.org>

---
 debian/control                         |   20 ++++++++
 debian/gles-alternative-tegra.postinst |   82 ++++++++++++++++++++++++++++++++
 debian/gles-alternative-tegra.prerm    |   14 +++++
 debian/gles-alternative-tegra.triggers |    1 +
 4 files changed, 117 insertions(+), 0 deletions(-)

diff --git a/debian/control b/debian/control
index 37a3798..cd7e6a1 100644
--- a/debian/control
+++ b/debian/control
@@ -178,3 +178,23 @@ Description: allows the selection of MESA as OpenGL ES provider
  This package does not depend on the corresponding MESA libraries.
  In order to install the MESA libraries, install the libgles1-mesa, libgles2-mesa
  and libegl1-mesa packages instead.
+
+Package: gles-alternative-tegra
+Architecture: armel amd64
+Multi-Arch: foreign
+Depends:
+ gles-diversions (= ${binary:Version}),
+ gles-alternative-mesa,
+ ${misc:Depends}
+Suggests:
+ tegra-libraries
+Description: allows the selection of TEGRA as OpenGL ES provider
+ In setups with several OpenGL ES providers (e.g. the free MESA implementation and
+ proprietary graphics hardware vendor implementations) this metapackage
+ allows one to switch to the non-free TEGRA driver and libraries.
+ .
+ Use 'update-alternatives --config gles' to select an implementation.
+ .
+ This package does not depend on the corresponding TEGRA libraries.
+ In order to install the TEGRA driver and libraries, install the tegra-libraries
+ package instead.
diff --git a/debian/gles-alternative-tegra.postinst b/debian/gles-alternative-tegra.postinst
new file mode 100644
index 0000000..466c38f
--- /dev/null
+++ b/debian/gles-alternative-tegra.postinst
@@ -0,0 +1,82 @@
+#!/bin/sh
+set -e
+
+
+TRIPLETS="/ /arm-linux-gnueabi/"
+
+add_slave()
+{
+	local target_link name source_path prefix
+	target_link="$1"
+	name="$2"
+	source_path="$3"
+	prefix="gles--"
+
+	if [ -f "${source_path}" ] && [ -d "$(dirname "${target_link}")" ]; then
+		echo --slave "${target_link}" "${prefix}${name}" "${source_path}"
+	fi
+}
+
+add_multiarch_slave()
+{
+	local target_dir target_sub_dir file source_dir source_sub_dir prefix suffix triplet
+	target_dir="$1"
+	target_sub_dir="$2"
+	file="$3"
+	source_dir="$4"
+	source_sub_dir="$5"
+	prefix="$6"
+
+	for triplet in $TRIPLETS ; do
+		# s|/$||; s|^/|-|;
+		suffix="${triplet%/}"
+		suffix="${suffix:+-${suffix#/}}"
+		add_slave \
+			"${target_dir}${triplet}${target_sub_dir}${file}" \
+			"${prefix}${file}${suffix}" \
+			"${source_dir}${triplet}${source_sub_dir}${file}"
+	done
+}
+
+# A trigger that handles the alternatives for
+# * /usr/lib[/<triplet>]/libGL.so.1
+# * /usr/lib/xorg/modules/extensions/libglx.so
+# * /usr/lib/xorg/modules/drivers/nvidia_drv.so 
+# * several more NVIDIA libraries etc.
+if [ "$1" = "triggered" ]; then
+
+	slaves="
+		$(add_multiarch_slave /usr/lib "" libEGL.so.1 /usr/lib tegra/)
+		$(add_multiarch_slave /usr/lib "" libGLESv1_CM.so.1 /usr/lib tegra/)
+		$(add_multiarch_slave /usr/lib "" libGLESv2.so.2 /usr/lib tegra/)
+"
+#	minor_slaves="
+#		$(add_multiarch_slave /usr/lib "" libGLcore.so.1 /usr/lib nvidia/)
+#		$(add_multiarch_slave /usr/lib "" libnvidia-cfg.so.1 /usr/lib nvidia/)
+#		$(add_multiarch_slave /usr/lib "" libnvidia-tls.so.1 /usr/lib nvidia/)
+#		$(add_multiarch_slave /usr/lib tls/ libnvidia-tls.so.1 /usr/lib nvidia/tls/ tls-)
+#		$(add_multiarch_slave /usr/lib "" libXvMCNVIDIA.so.1 /usr/lib nvidia/)
+#		$(add_multiarch_slave /usr/lib "" libXvMCNVIDIA_dynamic.so.1 /usr/lib nvidia/)
+#		$(add_slave /usr/bin/nvidia-bug-report.sh nvidia-bug-report.sh /usr/lib/nvidia/nvidia-bug-report.sh)
+#"
+
+	if echo "$slaves" | grep -q "slave" ; then
+		update-alternatives --install /usr/lib/gles gles /usr/lib/arm-linux-gnueabi/tegra 100 $slaves $minor_slaves
+	else
+		update-alternatives --remove gles /usr/lib/arm-linux-gnueabi/tegra
+	fi
+
+fi
+
+
+if [ "$1" = "configure" ]; then
+
+	# activate our trigger
+	dpkg-trigger register-gles-alternative-tegra
+
+fi
+
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/gles-alternative-tegra.prerm b/debian/gles-alternative-tegra.prerm
new file mode 100644
index 0000000..5880bed
--- /dev/null
+++ b/debian/gles-alternative-tegra.prerm
@@ -0,0 +1,14 @@
+#!/bin/sh
+set -e
+
+
+if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then
+
+	update-alternatives --remove gles /usr/lib/tegra
+
+fi
+
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/gles-alternative-tegra.triggers b/debian/gles-alternative-tegra.triggers
new file mode 100644
index 0000000..cbe626a
--- /dev/null
+++ b/debian/gles-alternative-tegra.triggers
@@ -0,0 +1 @@
+interest register-gles-alternative-tegra
-- 
tg: (e39b2bc..) topic/gles-alternative-tegra (depends on: master topic/gles-alternative-mesa)



More information about the pkg-nvidia-devel mailing list