summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Goldstein <cardoe@gentoo.org>2008-02-22 05:28:38 +0000
committerDoug Goldstein <cardoe@gentoo.org>2008-02-22 05:28:38 +0000
commitb055dd3d9da85ef753870a4f4250ac99974b7e1d (patch)
treeb212fd98ae6b2bd3d4e2ef6dc8438957a6666e26 /app-admin/eselect-xvmc
parentprune unused version (diff)
downloadgentoo-2-b055dd3d9da85ef753870a4f4250ac99974b7e1d.tar.gz
gentoo-2-b055dd3d9da85ef753870a4f4250ac99974b7e1d.tar.bz2
gentoo-2-b055dd3d9da85ef753870a4f4250ac99974b7e1d.zip
Decided to write an eselect module for XvMCWrapper. First version.
(Portage version: 2.1.4.4)
Diffstat (limited to 'app-admin/eselect-xvmc')
-rw-r--r--app-admin/eselect-xvmc/ChangeLog10
-rw-r--r--app-admin/eselect-xvmc/Manifest4
-rw-r--r--app-admin/eselect-xvmc/eselect-xvmc-0.1.ebuild20
-rw-r--r--app-admin/eselect-xvmc/files/xvmc-0.1.eselect181
-rw-r--r--app-admin/eselect-xvmc/metadata.xml8
5 files changed, 223 insertions, 0 deletions
diff --git a/app-admin/eselect-xvmc/ChangeLog b/app-admin/eselect-xvmc/ChangeLog
new file mode 100644
index 000000000000..43e280ff4c62
--- /dev/null
+++ b/app-admin/eselect-xvmc/ChangeLog
@@ -0,0 +1,10 @@
+# ChangeLog for app-admin/eselect-xvmc
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-xvmc/ChangeLog,v 1.1 2008/02/22 05:28:37 cardoe Exp $
+
+*eselect-xvmc-0.1 (22 Feb 2008)
+
+ 22 Feb 2008; Doug Klima <cardoe@gentoo.org> +files/xvmc-0.1.eselect,
+ +metadata.xml, +eselect-xvmc-0.1.ebuild:
+ Decided to write an eselect module for XvMCWrapper. First version.
+
diff --git a/app-admin/eselect-xvmc/Manifest b/app-admin/eselect-xvmc/Manifest
new file mode 100644
index 000000000000..bf81c6e9dc70
--- /dev/null
+++ b/app-admin/eselect-xvmc/Manifest
@@ -0,0 +1,4 @@
+AUX xvmc-0.1.eselect 3753 RMD160 10b2bdb863a3d21b335952081b06e64ffbcc913f SHA1 aeb0ead526c82f2d056d6cf4052b2ae684bd11bd SHA256 71e344cba2941582770fd47703dc44ac5e8bc2c7e39ed6ab24bf6beb982e5a02
+EBUILD eselect-xvmc-0.1.ebuild 521 RMD160 0dca6396102339ac395f13a6a44070d97a05911c SHA1 3c3714a62c512b3fabddb22620a30901af9652d8 SHA256 2ed2193f2a86211841631befd54eea9e5d4e0631fcd523864dda107956dd3a20
+MISC ChangeLog 340 RMD160 3fa56384c4e132ad5a135544d8fe40705a202434 SHA1 184d578ed2152889aee0562965baba5fb824eb65 SHA256 1ccc345f18497edae20ea0d740eae602e6e78731e2b23ec18adfefa1ee9b8409
+MISC metadata.xml 222 RMD160 d1a3fdf35754f259a53541e6f3fdf4685c621b4c SHA1 2669a0aa4051cb9d7eca5b8e5719f5039bf850b9 SHA256 2744b911fd4a893fc26fd4fbfcf4bad6189fbbd14a6b525c84c95d012e8c06da
diff --git a/app-admin/eselect-xvmc/eselect-xvmc-0.1.ebuild b/app-admin/eselect-xvmc/eselect-xvmc-0.1.ebuild
new file mode 100644
index 000000000000..ad187aa84e38
--- /dev/null
+++ b/app-admin/eselect-xvmc/eselect-xvmc-0.1.ebuild
@@ -0,0 +1,20 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/app-admin/eselect-xvmc/eselect-xvmc-0.1.ebuild,v 1.1 2008/02/22 05:28:37 cardoe Exp $
+
+DESCRIPTION="Manages XvMC implementations"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND=""
+RDEPEND=">=app-admin/eselect-1.0.10"
+
+src_install() {
+ insinto /usr/share/eselect/modules
+ newins "${FILESDIR}"/${P}.eselect xvmc.eselect || die "newins failed"
+}
diff --git a/app-admin/eselect-xvmc/files/xvmc-0.1.eselect b/app-admin/eselect-xvmc/files/xvmc-0.1.eselect
new file mode 100644
index 000000000000..3ea738d7affb
--- /dev/null
+++ b/app-admin/eselect-xvmc/files/xvmc-0.1.eselect
@@ -0,0 +1,181 @@
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id: xvmc-0.1.eselect,v 1.1 2008/02/22 05:28:38 cardoe Exp $
+
+DESCRIPTION="Manage the XvMC implementation used by your system"
+MAINTAINER="cardoe@gentoo.org"
+SVN_DATE='$Date: 2008/02/22 05:28:38 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+XVMCLIBS=(
+"libXvMCNVIDIA_dynamic.so.1"
+"libXvMC.so.1"
+"libviaXvMC.so.1"
+"libchromeXvMC.so.1"
+"libviaXvMCPro.so.1"
+"libchromeXvMCPro.so.1"
+"libI810XvMC.so.1" )
+XVMCPRETTY=(
+"nvidia"
+"xorg-x11"
+"via"
+"openchrome"
+"via-pro"
+"openchrome-pro"
+"intel" )
+
+get_implementation_indices() {
+ local ret n
+ for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do
+ [[ -e "${ROOT}/usr/lib/${XVMCLIBS[n]}" ]] && ret+=($n)
+ done
+
+ echo ${ret[@]}
+}
+
+get_current_implementation_index() {
+ local n
+ if [[ -f "${ROOT}/etc/X11/XvMCConfig" ]]; then
+ local current=$(< "${ROOT}/etc/X11/XvMCConfig")
+ for (( n = 0; n < ${#XVMCLIBS[@]}; ++n )); do
+ if [[ "${XVMCLIBS[n]}" = "${current}" ]]; then
+ echo "${n}"
+ return
+ fi
+ done
+ fi
+
+ echo "-1"
+}
+
+set_new_implementation() {
+ echo -n "Switching to ${XVMCPRETTY[$1]} XvMC implementation..."
+ touch "${ROOT}/etc/X11/XvMCConfig" 2&>1 > /dev/null
+ if [[ $? -eq 0 ]]; then
+ echo "${XVMCLIBS[$1]}" > "${ROOT}/etc/X11/XvMCConfig"
+ chmod 644 "${ROOT}/etc/X11/XvMCConfig"
+ chown 0:0 "${ROOT}/etc/X11/XvMCConfig"
+ echo " done"
+ else
+ echo " failed!"
+ echo "Insufficient privileges"
+ fi
+}
+
+### list action
+
+## {{{ list stuff
+describe_list() {
+ echo "List Available XvMC implementations"
+}
+
+do_list() {
+ local output n
+ local avail=( $(get_implementation_indices) )
+ local current=$(get_current_implementation_index)
+ write_list_start "Available XvMC implementations ( $(highlight '*') is current ):"
+
+ if (( ${#avail[@]} )) ; then
+ for n in "${avail[@]}" ; do
+ output[n]="${XVMCPRETTY[n]}"
+ [[ ${current} -eq ${n} ]] && \
+ output[n]+=" $(highlight '*')"
+ done
+ write_numbered_list "${output[@]}"
+ else
+ write_kv_list_entry "(none found)" ""
+ fi
+
+ return 0
+}
+## }}}
+
+### show action
+
+## {{{ show stuff
+describe_show() {
+ echo "Print the current XvMC implementation."
+}
+
+do_show() {
+ local current=$(get_current_implementation_index)
+ write_list_start "Current XvMC implementation:"
+
+ if [[ ${current} -ne -1 ]]; then
+ echo "${XVMCPRETTY[current]}"
+ return 0
+ else
+ echo "(none)"
+ return 2
+ fi
+}
+## }}}
+
+### set action
+
+## {{{ set stuff
+describe_set() {
+ echo "Select the XvMC implementation"
+}
+
+describe_set_parameters() {
+ echo "<target>"
+}
+
+describe_set_options() {
+ echo "<target> : XvMC implementation to activate"
+ echo "--use-old : If an implementation is already set, use that one instead"
+}
+
+do_set() {
+ local current=$(get_current_implementation_index)
+ local avail=( $(get_implementation_indices) )
+ local n new action
+
+ while [[ ${#@} -gt 0 ]]; do
+ local opt=${1}
+ shift
+ case ${opt} in
+ --use-old)
+ if [[ ${current} -gt -1 ]]; then
+ (( ${current} < ${#XVMCPRETTY[@]} )) && action="old-implementation"
+ fi
+ ;;
+ *)
+ [[ -z ${action} ]] && action="set-implementation"
+
+ if is_number ${opt} ; then
+ new=${avail[opt - 1]}
+ if [[ -z ${new} ]]; then
+ die -q "Unrecognized option: ${opt}"
+ fi
+ elif has ${opt} ${XVMCPRETTY[@]}; then
+ for (( n = 0; n < ${#XVMCPRETTY[@]}; ++n )); do
+ [[ "${XVMCPRETTY[n]}" = "${opt}" ]] && new=${n}
+ done
+ else
+ die -q "Unrecognized option: ${opt}"
+ fi
+ ;;
+ esac
+ done
+
+ case ${action} in
+ old-implementation)
+ set_new_implementation ${current}
+ return $?
+ ;;
+ set-implementation)
+ if [[ -n ${new} ]]; then
+ set_new_implementation ${new}
+ return $?
+ else
+ die -q "Please specify an implementation to set"
+ fi
+ ;;
+ *)
+ die -q "Invalid usage of set action."
+ esac
+}
+
+# vim: ts=4 sw=4 noet fdm=marker
diff --git a/app-admin/eselect-xvmc/metadata.xml b/app-admin/eselect-xvmc/metadata.xml
new file mode 100644
index 000000000000..f99e49fb0002
--- /dev/null
+++ b/app-admin/eselect-xvmc/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>no-herd</herd>
+<maintainer>
+ <email>cardoe@gentoo.org</email>
+</maintainer>
+</pkgmetadata>