diff options
author | Bryan Stine <battousai@gentoo.org> | 2004-08-29 08:11:06 +0000 |
---|---|---|
committer | Bryan Stine <battousai@gentoo.org> | 2004-08-29 08:11:06 +0000 |
commit | ba5066ff9b4b3f1b13fbee2e6085b16b5e232f0d (patch) | |
tree | de099981264c6e6fe57dc26f8583d8035d1b002d /x11-base/x11-drm | |
parent | digest fix (Manifest recommit) (diff) | |
download | gentoo-2-ba5066ff9b4b3f1b13fbee2e6085b16b5e232f0d.tar.gz gentoo-2-ba5066ff9b4b3f1b13fbee2e6085b16b5e232f0d.tar.bz2 gentoo-2-ba5066ff9b4b3f1b13fbee2e6085b16b5e232f0d.zip |
Add x11-drm. This is where xfree-drm is being moved to.
Diffstat (limited to 'x11-base/x11-drm')
-rw-r--r-- | x11-base/x11-drm/ChangeLog | 14 | ||||
-rw-r--r-- | x11-base/x11-drm/Manifest | 5 | ||||
-rw-r--r-- | x11-base/x11-drm/files/digest-x11-drm-20040827 | 3 | ||||
-rw-r--r-- | x11-base/x11-drm/files/digest-x11-drm-4.3.0-r6 | 2 | ||||
-rw-r--r-- | x11-base/x11-drm/files/digest-x11-drm-4.3.0-r7 | 4 | ||||
-rw-r--r-- | x11-base/x11-drm/files/modules.d-x11-drm | 3 | ||||
-rw-r--r-- | x11-base/x11-drm/metadata.xml | 10 | ||||
-rw-r--r-- | x11-base/x11-drm/x11-drm-20040827.ebuild | 222 | ||||
-rw-r--r-- | x11-base/x11-drm/x11-drm-4.3.0-r6.ebuild | 203 | ||||
-rw-r--r-- | x11-base/x11-drm/x11-drm-4.3.0-r7.ebuild | 255 |
10 files changed, 721 insertions, 0 deletions
diff --git a/x11-base/x11-drm/ChangeLog b/x11-base/x11-drm/ChangeLog new file mode 100644 index 000000000000..9671f49ba5c5 --- /dev/null +++ b/x11-base/x11-drm/ChangeLog @@ -0,0 +1,14 @@ +# ChangeLog for x11-base/x11-drm +# Copyright 1999-2004 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/x11-base/x11-drm/ChangeLog,v 1.1 2004/08/29 08:11:06 battousai Exp $ + +*x11-drm-4.3.0-r6 (29 Aug 2004) + + 29 Aug 2004; Bryan Stine <battousai@gentoo.org>; +metadata.xml, + +files/modules.d-x11-drm, +x11-drm-20040827.ebuild, + +x11-drm-4.3.0-r6.ebuild, +x11-drm-4.3.0-r7.ebuild: + Moved xfree-drm ebuilds to x11-drm. No notable changes have been made to them. + Snapshot 20040827 has been added, which begins the new versioning, since this + is based on dri.sf.net drm snapshots. Improvements in the new snapshot include + 2.6 support for 2.6.6+ kernels and koutput, along with many upstream changes. + diff --git a/x11-base/x11-drm/Manifest b/x11-base/x11-drm/Manifest new file mode 100644 index 000000000000..e767c9a0c6ef --- /dev/null +++ b/x11-base/x11-drm/Manifest @@ -0,0 +1,5 @@ +MD5 b22f33c1d80979a5dccf7e3d344d077a x11-drm-20040827.ebuild 5344 +MD5 b67cc82ec3e8786dbc0f8f5e7e37bcfc metadata.xml 360 +MD5 0da633cdf84a7960139bb6bb5847e2ac ChangeLog 546 +MD5 f7de985da1c53156a63bc43dea3b71ea files/digest-x11-drm-20040827 252 +MD5 88b8c90e440b3db246a7d06cf53640ae files/modules.d-x11-drm 40 diff --git a/x11-base/x11-drm/files/digest-x11-drm-20040827 b/x11-base/x11-drm/files/digest-x11-drm-20040827 new file mode 100644 index 000000000000..29da1b173349 --- /dev/null +++ b/x11-base/x11-drm/files/digest-x11-drm-20040827 @@ -0,0 +1,3 @@ +MD5 92e823db1bd1f5567af7791bf3185396 x11-drm-20040827-gentoo-0.1.tar.bz2 7710 +MD5 aa602f867e00717c50921718980f43c2 linux-drm-20040827-kernelsource.tar.bz2 249379 +MD5 72e856bdfcbf181a4d99ff278462f47d linux-drm-gatos-20031202-kernelsource.tar.bz2 154677 diff --git a/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r6 b/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r6 new file mode 100644 index 000000000000..47da13b6e139 --- /dev/null +++ b/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r6 @@ -0,0 +1,2 @@ +MD5 26820c1cf12ba2b2b71b4a3806875e9c linux-drm-4.3.0-kernelsource-20030714.tar.gz 329112 +MD5 7c6e58d1dc5c5d5f768937c832c08236 xfree-drm-4.3.0-r6-gentoo-0.4.tar.bz2 9280 diff --git a/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r7 b/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r7 new file mode 100644 index 000000000000..ed4848460aca --- /dev/null +++ b/x11-base/x11-drm/files/digest-x11-drm-4.3.0-r7 @@ -0,0 +1,4 @@ +MD5 eb8793b69f526cabc87e99537b28753d xfree-drm-4.3.0-r7-gentoo-0.4.tar.bz2 8143 +MD5 b1cc5fb755df16855915eb38747982eb linux-drm-4.3.0-kernelsource-20031202.tar.bz2 440304 +MD5 698a248d4192967eb41d9577bed8d75a linux-drm-gatos-4.3.0-kernelsource-20031202.tar.bz2 154684 +MD5 ccd16a915cd22f707ac3aac743b1398d linux-drm-mach64-4.3.0-kernelsource-20031202.tar.bz2 429549 diff --git a/x11-base/x11-drm/files/modules.d-x11-drm b/x11-base/x11-drm/files/modules.d-x11-drm new file mode 100644 index 000000000000..aa6e850dded4 --- /dev/null +++ b/x11-base/x11-drm/files/modules.d-x11-drm @@ -0,0 +1,3 @@ +keep +path[%PN%]=/lib/modules/%KV%/%PN% + diff --git a/x11-base/x11-drm/metadata.xml b/x11-base/x11-drm/metadata.xml new file mode 100644 index 000000000000..4c843cbdc63e --- /dev/null +++ b/x11-base/x11-drm/metadata.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>x11</herd> +<maintainer> + <email>battousai@gentoo.org</email> + <name>Bryan Stine</name> +</maintainer> +<longdescription>Kernel modules which provide the Direct Rendering Manager component for X11.</longdescription> +</pkgmetadata> diff --git a/x11-base/x11-drm/x11-drm-20040827.ebuild b/x11-base/x11-drm/x11-drm-20040827.ebuild new file mode 100644 index 000000000000..3f3c492c9d43 --- /dev/null +++ b/x11-base/x11-drm/x11-drm-20040827.ebuild @@ -0,0 +1,222 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-base/x11-drm/x11-drm-20040827.ebuild,v 1.1 2004/08/29 08:11:06 battousai Exp $ + +inherit eutils xfree kmod + +IUSE="gatos" +IUSE_VIDEO_CARDS="3dfx ffb i810 i830 i915 mach64 matrox rage128 radeon savage sis via" + +# Make sure Portage does _NOT_ strip symbols. We will do it later and make sure +# that only we only strip stuff that are safe to strip ... +RESTRICT="nostrip" + +GATOSSNAP="20031202" +PATCHVER="0.1" +PATCHDIR="${WORKDIR}/patch" +EXCLUDED="${WORKDIR}/excluded" +S="${WORKDIR}/drm" +DESCRIPTION="DRM Kernel Modules for X11" +HOMEPAGE="http://dri.sf.net" +SRC_URI="mirror://gentoo/${PF}-gentoo-${PATCHVER}.tar.bz2 + mirror://gentoo/linux-drm-${PV}-kernelsource.tar.bz2 + gatos? ( mirror://gentoo/linux-drm-gatos-${GATOSSNAP}-kernelsource.tar.bz2 )" + +SLOT="${KV}" +LICENSE="X11" +KEYWORDS="~x86 ~alpha ~ia64 ~ppc" + +DEPEND="virtual/x11 + virtual/linux-sources + >=sys-apps/portage-2.0.49-r13" + +PROVIDE="virtual/drm" + +pkg_setup() { + get_kernel_info + + # Require at least one video card + if [ -z "${VIDEO_CARDS}" ] + then + die "Please set at least one video card in VIDEO_CARDS in make.conf or the environment. Possible VIDEO_CARDS values are: ${IUSE_VIDEO_CARDS}." + fi + +# if [ "`is_kernel 2 6`" -a ! "`is_koutput`" -a "${KV_PATCH}" -lt 6 ] +# then +# eerror "Building DRM against 2.6 kernels without proper build systems is unsupported." +# die "Non-koutput and non-M 2.6 kernel tree" +# fi + + if [ "${ARCH}" != "sparc" -a "`use video_cards_ffb`" ] + then + die "The ffb driver is for sparc-specific hardware. Please remove it from your VIDEO_CARDS." + fi + + # GATOS only works with radeon, rage128. mach64 is provided by drm trunk. + if use gatos + then + if [ ! "`use video_cards_radeon`" -a ! "`use video_cards_rage128`" ] + then + die "Remove gatos from your USE flags. It does not work with cards other than radeon and rage128." + fi + is_kernel 2 6 && die "GATOS does not work with 2.6 kernels. Only 2.4 is supported at this time." + fi + + # Set video cards to build for. + set_vidcards + + return 0 +} + +src_unpack() { + if use gatos + then + unpack linux-drm-gatos-${GATOSSNAP}-kernelsource.tar.bz2 + else + unpack linux-drm-${PV}-kernelsource.tar.bz2 + fi + unpack ${PF}-gentoo-${PATCHVER}.tar.bz2 + + cd ${S} + cp ${PATCHDIR}/Makefile ${S} + + patch_prepare + + # Apply patches + EPATCH_SUFFIX="patch" epatch ${PATCHDIR} + + # Substitute new directory under /lib/modules/${KV} + sed -ie "s:/kernel/drivers/char/drm:/${PN}:g" Makefile +} + +src_compile() { + einfo "Building DRM..." + + # This now uses a kmod-driven build system. Makefile does most of the work. + unset ARCH + make M="${S}" \ + LINUXDIR="${ROOT}/usr/src/linux" \ + LINUXOUTPUT="${KV_OUTPUT}" \ + DRM_MODULES="${VIDCARDS}" \ + DRMSRCDIR="${S}" \ + modules || die_error + + # dristat in GATOS seems busted. + if ! use gatos + then + make dristat || die "Building dristat failed." + fi +} + +src_install() { + einfo "Installing DRM..." + + unset ARCH + make KV="${KV}" \ + LINUXDIR="${ROOT}/usr/src/linux" \ + LINUXOUTPUT="${KV_OUTPUT}" \ + DRM_MODULES="${VIDCARDS}" \ + DESTDIR="${D}" \ + install || die "Install failed." + + dodoc README* + + if ! use gatos + then + exeinto /usr/X11R6/bin + doexe dristat + + # Strip binaries, leaving /lib/modules untouched (bug #24415) + strip_bins \/lib\/modules + fi + + # Yoinked from the sys-apps/touchpad ebuild. Thanks to whoever made this. + keepdir /etc/modules.d + sed 's:%PN%:'${PN}':g' ${FILESDIR}/modules.d-${PN} > ${D}/etc/modules.d/${PN} + sed -i 's:%KV%:'${KV}':g' ${D}/etc/modules.d/${PN} +} + +pkg_postinst() { + if [ "${ROOT}" = "/" ] + then + /sbin/modules-update + fi + + if use video_cards_sis + then + einfo "SiS direct rendering only works on 300 series chipsets." + einfo "SiS framebuffer also needs to be enabled in the kernel." + fi + + if use video_cards_mach64 + then + einfo "The Mach64 DRI driver is insecure." + einfo "Malicious clients can write to system memory." + einfo "For more information, see:" + einfo "http://dri.sourceforge.net/cgi-bin/moin.cgi/ATIMach64?value=CategoryHardwareChipset." + fi +} + +# Functions used above are defined below: + +set_vidcards() { + # To get the kernel module extension +# get_kernel_info + + VIDCARDS="" + + use video_cards_matrox && \ + VIDCARDS="${VIDCARDS} mga.${KV_OBJ}" + use video_cards_3dfx && \ + VIDCARDS="${VIDCARDS} tdfx.${KV_OBJ}" + use video_cards_rage128 && \ + VIDCARDS="${VIDCARDS} r128.${KV_OBJ}" + use video_cards_radeon && \ + VIDCARDS="${VIDCARDS} radeon.${KV_OBJ}" + use video_cards_i810 && \ + VIDCARDS="${VIDCARDS} i810.${KV_OBJ}" + use video_cards_i830 && \ + VIDCARDS="${VIDCARDS} i830.${KV_OBJ}" + use video_cards_i915 && \ + VIDCARDS="${VIDCARDS} i915.${KV_OBJ}" +# use video_cards_gamma && \ +# VIDCARDS="${VIDCARDS} gamma.${KV_OBJ}" + use video_cards_mach64 && \ + VIDCARDS="${VIDCARDS} mach64.${KV_OBJ}" + use video_cards_savage && \ + VIDCARDS="${VIDCARDS} savage.${KV_OBJ}" + use video_cards_sis && \ + VIDCARDS="${VIDCARDS} sis.${KV_OBJ}" + use video_cards_via && \ + VIDCARDS="${VIDCARDS} via.${KV_OBJ}" + use video_cards_ffb && \ + VIDCARDS="${VIDCARDS} ffb.${KV_OBJ}" +} + +patch_prepare() { + # Handle exclusions based on the following... + # GATOS (2xx*) vs. Standard trees (1xx*) + # 2.4 vs. 2.6 kernels + + is_kernel 2 4 && mv -f ${PATCHDIR}/*kernel-2.6* ${EXCLUDED} + is_kernel 2 6 && mv -f ${PATCHDIR}/*kernel-2.4* ${EXCLUDED} + + if use gatos + then + einfo "Updating for GATOS build..." + mv -f ${PATCHDIR}/1* ${EXCLUDED} + # Don't bother with dristat, it's broken + mv -f ${PATCHDIR}/*dristat* ${EXCLUDED} + else + einfo "Updating for standard build..." + mv -f ${PATCHDIR}/2* ${EXCLUDED} + fi +} + +die_error() { + eerror "Portage could not build the DRM modules. If you see an ACCESS DENIED error," + eerror "this could mean that you were using an unsupported kernel build system. All" + eerror "2.4 kernels are supported, but only 2.6 kernels with koutput enabled or" + eerror "kernels 2.6.6 and above are supported." + die "Unable to build DRM modules." +} diff --git a/x11-base/x11-drm/x11-drm-4.3.0-r6.ebuild b/x11-base/x11-drm/x11-drm-4.3.0-r6.ebuild new file mode 100644 index 000000000000..c20c008f9a9d --- /dev/null +++ b/x11-base/x11-drm/x11-drm-4.3.0-r6.ebuild @@ -0,0 +1,203 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-base/x11-drm/x11-drm-4.3.0-r6.ebuild,v 1.1 2004/08/29 08:11:06 battousai Exp $ + +# Small note: we should prob consider using a DRM only tarball, as it will ease +# some of the overhead on older systems, and will enable us to +# update DRM if there are fixes not already in XFree86 tarballs ... + +# Removing USE as soon as VIDEO_CARDS shows up in make.conf +IUSE="3dfx gamma i8x0 matrox rage128 radeon sis" +IUSE_VIDEO_CARDS="3dfx gamma i810 i830 matrox rage128 radeon sis" + +inherit eutils xfree + +# Make sure Portage does _NOT_ strip symbols. We will do it later and make sure +# that only we only strip stuff that are safe to strip ... +RESTRICT="nostrip" + +SNAPSHOT="20030714" +PATCHVER="0.4" + +MY_PF=${PF/x11/xfree} +S="${WORKDIR}/drm" +DESCRIPTION="Xfree86 Kernel DRM modules" +HOMEPAGE="http://dri.sf.net" +SRC_URI="mirror://gentoo/linux-drm-${PV}-kernelsource-${SNAPSHOT}.tar.gz + mirror://gentoo/${MY_PF}-gentoo-${PATCHVER}.tar.bz2" + +# These sources come from one of these places: +# +# http://www.xfree86.org/~alanh/ -- DRM snapshots, outdated +# http://people.debian.org/~daenzer/ -- full tree, often patched but +# somewhat outdated +# http://dri.sourceforge.net/snapshots/ -- daily CVS snapshots, lacking +# gamma and sis +# http://dri.sourceforge.net CVS -- full tree +# http://cvs.sourceforge.net/cvstarballs/dri-cvsroot.tar.gz -- backup +# rsync -avz --delete rsync://mefriss1.swan.ac.uk/dri/ -- temporary +# +# We throw all necessary files into one folder and turn that into our tarball. + +SLOT="${KV}" +LICENSE="X11" +KEYWORDS="x86 alpha ppc ia64" + +# Need new portage for USE_EXPAND +DEPEND="virtual/x11 + virtual/linux-sources + >=sys-apps/portage-2.0.49-r13" + +PROVIDE="virtual/drm" + +pkg_setup() { + VIDCARDS="" + + if useq matrox || useq video_cards_matrox + then + VIDCARDS="${VIDCARDS} mga.o" + fi + if useq 3dfx || useq video_cards_3dfx + then + VIDCARDS="${VIDCARDS} tdfx.o" + fi + if useq rage128 || useq video_cards_rage128 + then + VIDCARDS="${VIDCARDS} r128.o" + fi + if useq radeon || useq video_cards_radeon + then + VIDCARDS="${VIDCARDS} radeon.o" + fi + if useq sis || useq video_cards_sis + then + VIDCARDS="${VIDCARDS} sis.o" + fi + if useq i8x0 + then + VIDCARDS="${VIDCARDS} i810.o i830.o" + fi + if useq gamma || useq video_cards_gamma + then + VIDCARDS="${VIDCARDS} gamma.o" + fi + + useq video_cards_i810 && VIDCARDS="${VIDCARDS} i810.o" + useq video_cards_i830 && VIDCARDS="${VIDCARDS} i830.o" +} + +src_unpack() { + # 2.6 kernels are broken for now + is_kernel "2" "6" && \ + die "Please link ${ROOT}/usr/src/linux to 2.4 kernel sources. x11-drm is not yet working with 2.6 kernels, use the DRM in the kernel." + + # Is this necessary with the fixed Makefile? + if [ ! -f ${ROOT}/usr/src/linux/include/config/MARKER ] ; then + die "Please compile kernel sources with \"make bzImage.\"" + fi + + # Require at least one video card. + if [ -z "${VIDCARDS}" ] ; then + die "Please set at least one video card in VIDEO_CARDS in make.conf or the environment. USE is deprecated. Possible VIDEO_CARDS values are matrox, 3dfx, rage128, radeon, sis, i810, i830, and gamma." + fi + + unpack ${A} + cd ${S} + + local PATCHDIR=${WORKDIR}/patch + + epatch ${PATCHDIR}/${MY_PF}-gentoo-Makefile-fixup.patch + epatch ${PATCHDIR}/${MY_PF}-dristat.patch + # For kernels that lack a vmap() implementation taking four arguments, which + #the DRM requires for using agpgart with AGP bridges that don't provide + #direct CPU access to the AGP aperture. + [ "${ARCH}" = "ppc" ] && \ + epatch ${PATCHDIR}/${MY_PF}-drm-ioremap.patch + + # Fix for bug #25598 + [ "${ARCH}" = "ppc" ] && \ + epatch ${PATCHDIR}/${MY_PF}-rage128-timeout.patch + +# Pfeifer said this patch is ok for any kernel >= 2.4 <spyderous> +# if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 4 ] && \ + if [ -r ${ROOT}/usr/src/linux/mm/rmap.c ] + then + einfo "Detected rmap enabled kernel." + EPATCH_SINGLE_MSG="Applying rmap patch..." \ + epatch ${PATCHDIR}/${MY_PF}-pte_offset.diff + fi + +# Fix for 2.5 kernels +# if [ "${KV_major}" -eq 2 -a "${KV_minor}" -eq 5 ] +# then +# EPATCH_SINGLE_MSG="Applying patch for kernel 2.5..." \ +# epatch ${PATCHDIR}/${MY_PF}-drm_2.5.diff +# fi + +} + +src_compile() { + check_KV + ln -sf Makefile.linux Makefile + einfo "Building DRM..." + make ${VIDCARDS} \ + TREE="${ROOT}/usr/src/linux/include" KV="${KV}" + make dristat || die +} + +src_install() { + + einfo "installing DRM..." + make \ + TREE="${ROOT}/usr/src/linux/include" \ + KV="${KV}" \ + DESTDIR="${D}" \ + MODS="${VIDCARDS}" \ + install || die + dodoc README* + exeinto /usr/X11R6/bin + doexe dristat + + einfo "Stripping binaries..." + # This bit I got from Redhat ... strip binaries and drivers .. + # NOTE: We do NOT want to strip the drivers, modules or DRI modules! + for x in $(find ${D}/ -type f -perm +0111 -exec file {} \; | \ + grep -v ' shared object,' | \ + sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p') + do + if [ -f ${x} ] + then + # Dont do the modules ... + if [ "${x/\/lib\/modules}" = "${x}" ] + then + echo "`echo ${x} | sed -e "s|${D}||"`" + strip ${x} || : + fi + fi + done + +} + +pkg_postinst() { + + if [ "${ROOT}" = "/" ] + then + /sbin/modules-update + fi + if [ -z "VIDEO_CARDS" ] + then + einfo "USE is deprecated. Please set your video cards using VIDEO_CARDS." + einfo "Possible VIDEO_CARDS values are: ${IUSE_VIDEO_CARDS}." + echo + fi + + if use video_cards_sis + then + einfo "SiS direct rendering only works on 300/305, 540, 630/S/ST, 730/S chipsets." + einfo "SiS framebuffer also needs to be enabled in the kernel." + echo + fi + + ewarn "If you used genkernel to compile your kernel, you must change" + ewarn "your processor type to something greater than 386." +} diff --git a/x11-base/x11-drm/x11-drm-4.3.0-r7.ebuild b/x11-base/x11-drm/x11-drm-4.3.0-r7.ebuild new file mode 100644 index 000000000000..3e19a84eeadc --- /dev/null +++ b/x11-base/x11-drm/x11-drm-4.3.0-r7.ebuild @@ -0,0 +1,255 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/x11-base/x11-drm/x11-drm-4.3.0-r7.ebuild,v 1.1 2004/08/29 08:11:06 battousai Exp $ + +IUSE="gatos" +IUSE_VIDEO_CARDS="3dfx gamma i810 i830 matrox rage128 radeon sis mach64" + +inherit eutils xfree + +# Make sure Portage does _NOT_ strip symbols. We will do it later and make sure +# that only we only strip stuff that are safe to strip ... +RESTRICT="nostrip" + +MY_PF=${PF/x11/xfree} +SNAPSHOT="20031202" +# Should probably renumber 010 to 100 and 040 to 140 for next patchset +PATCHVER="0.4" +PATCHDIR="${WORKDIR}/patch" +EXCLUDED="${PATCHDIR}/excluded" +S="${WORKDIR}/drm" +DESCRIPTION="XFree86 Kernel DRM modules" +HOMEPAGE="http://dri.sf.net" +# Use the same patchset for all of them; exclude patches as necessary +SRC_URI="mirror://gentoo/${MY_PF}-gentoo-${PATCHVER}.tar.bz2 + mirror://gentoo/linux-drm-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 + gatos? ( mirror://gentoo/linux-drm-gatos-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 ) + video_cards_mach64? ( mirror://gentoo/linux-drm-mach64-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 )" + +# These sources come from one of these places: +# +# http://www.xfree86.org/~alanh/ -- Makefile.linux from DRM snapshots +# http://people.debian.org/~daenzer/ -- drm-ioremap patch +# http://dri.sourceforge.net CVS -- xc/xc/programs/Xserver/hw/os-support +# -- the CVS is at freedesktop.org now, but webpage is still sourceforge +# +# We throw all necessary files into one folder and turn that into our tarball. +# find os-support/ -name *.[ch] -exec cp {} drm/ \; +# find os-support/linux/drm/kernel/ -maxdepth 1 -type f -exec cp {} drm/ \; + +SLOT="${KV}" +LICENSE="X11" +KEYWORDS="x86 alpha ia64 ~ppc" + +# Need new portage for USE_EXPAND +DEPEND="virtual/x11 + virtual/linux-sources + >=sys-apps/portage-2.0.49-r13" + +PROVIDE="virtual/drm" + +pkg_setup() { + # mach64 is exclusive of other modules + check_exclusive mach64 + + # Require at least one video card + if [ -z "${VIDEO_CARDS}" ] + then + die "Please set at least one video card in VIDEO_CARDS in make.conf or the environment. Possible VIDEO_CARDS values are: ${IUSE_VIDEO_CARDS}." + fi + + # gatos doesn't build on anything but radeon + if use gatos + then + if ! use video_cards_radeon && ! use video_cards_rage128 + then + die "Remove gatos from your USE flags. It does not build for cards other than radeon and rage128." + fi + fi + + # 2.6 kernels are broken for now + is_kernel 2 6 && \ + die "Please link ${ROOT}/usr/src/linux to 2.4 kernel sources. x11-drm does not yet work with 2.6 kernels, use the DRM in the kernel." + + # Force at least make dep (this checks for bzImage, actually) (bug #22853) + if [ ! -f ${ROOT}/usr/src/linux/include/config/MARKER ] + then + die "Please compile kernel sources with \"make bzImage\"." + fi + + # Set video cards to build for + set_vidcards + + return 0 +} + +src_unpack() { + if use gatos + then + unpack linux-drm-gatos-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 + elif use video_cards_mach64 + then + unpack linux-drm-mach64-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 + else # standard case + unpack linux-drm-${PV}-kernelsource-${SNAPSHOT}.tar.bz2 + fi + + unpack ${MY_PF}-gentoo-${PATCHVER}.tar.bz2 + + cd ${S} + + # Move AGP checker and alanh's Makefile over + cp ${PATCHDIR}/picker.c ${S} + cp ${PATCHDIR}/Makefile.linux ${S} + + patch_prepare + + # Apply patches + EPATCH_SUFFIX="patch" epatch ${PATCHDIR} + + # Change the install location for the modules.d stuff + sed -ie "s:/kernel/drivers/char/drm:/${PN}:g" Makefile.linux +} + +src_compile() { + ln -sf Makefile.linux Makefile + einfo "Building DRM..." + make ${VIDCARDS} \ + TREE="${ROOT}/usr/src/linux/include" KV="${KV}" + # Build dristat utility (bug #18799) + # But, don't do it if the GATOS drivers are being built, since it won't work + if ! use gatos + then + make dristat || die + fi +} + +src_install() { + einfo "installing DRM..." + make \ + TREE="${ROOT}/usr/src/linux/include" \ + KV="${KV}" \ + DESTDIR="${D}" \ + MODS="${VIDCARDS}" \ + install || die + dodoc README* + if ! use gatos + then + exeinto /usr/X11R6/bin + doexe dristat + + # Strip binaries, leaving /lib/modules untouched (bug #24415) + strip_bins \/lib\/modules + fi + + # Shamelessly stolen from the sys-apps/thinkpad ebuild. Thanks! + keepdir /etc/modules.d + sed 's:%PN%:'${PN}':g' ${FILESDIR}/modules.d-${PN} > ${D}/etc/modules.d/${PN} + sed -i 's:%KV%:'${KV}':g' ${D}/etc/modules.d/${PN} +} + +pkg_postinst() { + if [ "${ROOT}" = "/" ] + then + /sbin/modules-update + fi + + if use video_cards_sis + then + einfo "SiS direct rendering only works on 300 series chipsets." + einfo "SiS framebuffer also needs to be enabled in the kernel." + fi + + if use video_cards_mach64 + then + ewarn "The Mach64 DRI driver is insecure." + ewarn "Malicious clients can write to system memory." + ewarn "For more information, see:" + ewarn "http://dri.sourceforge.net/cgi-bin/moin.cgi/ATIMach64?value=CategoryHardwareChipset." + fi +} + + +# Functions used earlier are defined below. + +check_exclusive() { + # If a certain module is being built, don't allow any others. + # Most useful for mach64, since it must be built exclusively + # since the two directories are both named drm to make ${S} easier + + local x + local c="0" + if use video_cards_${1} + then + for x in ${IUSE_VIDEO_CARDS} + do + if use video_cards_${x} + then + c="`expr ${c} + 1`" + if [ "${c}" -ge "2" ] + then + die "You cannot build for ${1} and any other card at the same time." + fi + fi + done + fi +} + +set_vidcards() { + VIDCARDS="" + + use video_cards_matrox && \ + VIDCARDS="${VIDCARDS} mga.o" + use video_cards_3dfx && \ + VIDCARDS="${VIDCARDS} tdfx.o" + use video_cards_rage128 && \ + VIDCARDS="${VIDCARDS} r128.o" + use video_cards_radeon && \ + VIDCARDS="${VIDCARDS} radeon.o" + use video_cards_sis && \ + VIDCARDS="${VIDCARDS} sis.o" + use video_cards_i810 && \ + VIDCARDS="${VIDCARDS} i810.o" + use video_cards_i830 && \ + VIDCARDS="${VIDCARDS} i830.o" + use video_cards_gamma && \ + VIDCARDS="${VIDCARDS} gamma.o" + use video_cards_mach64 && \ + VIDCARDS="${VIDCARDS} mach64.o" +} + +patch_prepare() { + # Do patch excluding based on standard, mach64 or gatos here. + # 001-099: Patches used in multiple sources + # 100-199: Standard-only patches + # 200-299: Mach64 patches + # 300-399: Gatos patches + # Convention for excluding is to use the full patch number, or * for groups + + # if [ ! "`is_kernel 2 6`" ] + # then + # mv -f ${PATCHDIR}/*2.6* ${EXCLUDED} + # fi + + if use video_cards_mach64 + then + einfo "Updating for mach64 build..." + # Exclude all non-mach64 patches + einfo "Excluding patches..." + patch_exclude 040 1* 3* + einfo "Done excluding patches" + elif use gatos + then + einfo "Updating for gatos build..." + # Exclude all non-gatos patches + einfo "Excluding patches..." + patch_exclude 010 040 1* 2* + einfo "Done excluding patches" + else # standard case + einfo "Updating for standard build..." + # Exclude all gatos or mach64 patches + einfo "Excluding patches..." + patch_exclude 2* 3* + einfo "Done excluding patches" + fi +} |