File xorg-x11-driver-video-radeonhd.spec of Package xorg-x11-driver-video-radeonhd

#
# spec file for package xorg-x11-driver-video-radeonhd (Version 1.3.0_20100216_79a0ab2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           xorg-x11-driver-video-radeonhd
BuildRequires:  pciutils-devel
%if 0%{?fedora_version} >= 6
BuildRequires:  libdrm-devel mesa-libGL-devel xorg-x11-proto-devel xorg-x11-server-sdk
%if 0%{?fedora_version} < 7
BuildRequires:  pkgconfig
%endif
%endif
%if 0%{?mandriva_version} > 2006
BuildRequires:  libdrm-devel libmesagl1-devel libx11_6-devel x11-proto-devel x11-server-devel x11-util-macros
%endif
%if 0%{?suse_version}
BuildRequires:  Mesa-devel xorg-x11-sdk
%if 0%{?suse_version} < 1020
BuildRequires:  Mesa-devel xorg-x11-devel
%endif
%endif
Url:            http://wiki.x.org/wiki/radeonhd
License:        MIT
%if 0%{?fedora_version} >= 6
Group:          System/X11/Servers/XF86_4
%else
Group:          System/X11/Servers/XF86_4
%endif
AutoReqProv:    on
%define vers	1.3.0
Version:        %{vers}_20100216_79a0ab2
Release:        0.<RELEASE1>
Summary:        Driver for AMD GPG (ATI) r5xx/r6xx Chipsets
%if 0%{?suse_version}
Requires:       xorg-x11-server
Supplements:    xorg-x11-server
%endif
# ATOM BIOS is not endian clean
ExclusiveArch:  %ix86 x86_64
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         /bin/rm /bin/cat
Source:         xf86-video-radeonhd-%{version}.tar.bz2
Patch1:         R6XX-disable-acceleration.patch

%description
radeonhd is the X.org X11 driver for AMD GPG (ATI) r5xx/r6xx chipsets.
Main development is driven by Novell, in close relationship to AMD
which provides free documentation for the chipsets.



Authors:
--------
    Luc Verhaegen
    Egbert Eich
    Matthias Hopf
    Advanced Micro Devices, Inc.

%prep
%setup -n xf86-video-radeonhd-%vers
%patch1 -p1

%build
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
autoreconf -fi
%configure CFLAGS="$RPM_OPT_FLAGS"
make
%else
xmkmf -a
make CDEBUGFLAGS="$RPM_OPT_FLAGS"
%endif
make -C utils/conntest
cp utils/conntest/README README_conntest

%install
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
make install DESTDIR=$RPM_BUILD_ROOT
rm -r utils/conntest/{.deps,.libs}
%else
make install DESTDIR=$RPM_BUILD_ROOT
make install.man DESTDIR=$RPM_BUILD_ROOT
%endif
mkdir -p $RPM_BUILD_ROOT/usr/bin
install -m 755 utils/conntest/rhd_conntest $RPM_BUILD_ROOT/usr/bin
%if 0%{?suse_version} > 1000
###
### generate SaX2/hwinfo data
###
mkdir -p $RPM_BUILD_ROOT/usr/share/sax/sysp/maps/update/ \
         $RPM_BUILD_ROOT/usr/share/sax/api/data/cdb/ \
         $RPM_BUILD_ROOT/var/lib/hardware/ids
> $RPM_BUILD_ROOT/usr/share/sax/sysp/maps/update/Identity.map.20.%name
> $RPM_BUILD_ROOT/usr/share/sax/api/data/cdb/Cards.20.%name
> $RPM_BUILD_ROOT/var/lib/hardware/ids/20.%name
if [ ! -r src/rhd_id.c ]; then
  echo "src/rhd_ic.c does not exist"
  exit 1
fi
###   supported devices are in PCI_ID_LIST (rhd_id.c)
###   Example: RHD_DEVICE_MATCH(  0x7100, RHD_R520  ), /* Radeon X1800 */
VID=0x1002
NAME=ATI
SERVER=radeonhd
PROFILE=
egrep -A1000 "^[ \t]*const[ \t]*PCI_ID_LIST[ \t]*=[ \t]*{" src/rhd_id.c | \
  grep "RHD_DEVICE_MATCH" | \
while read line; do
  DEVICE=$(echo "$line"|cut -d "*" -f 2|sed -e 's/ *$//' -e 's/^ *//')
  if [ "$(echo $DEVICE|sed -e 's/ //g')" == "" ]; then
     DEVICE=$(echo "$line"|cut -d "(" -f 2|cut -d "," -f 1|sed -e 's/ //g')
  fi 
  DID=$(echo "$line"|cut -d "," -f 1|cut -d "(" -f 2|sed 's/ //g')
  # enable DRI for RS690 (cyberorg), FireGL V5200 (bnc #434019),
  # Macbook Pro (ro)
  case "$DID" in
    0x791E|0x791F|0x71C4|0x71C5)
      OPTION="DRI"
      ;;
    *)
      OPTION=""
      ;;
  esac
  cat >> $RPM_BUILD_ROOT/usr/share/sax/sysp/maps/update/Identity.map.20.%name << EOF
NAME=${NAME}&DEVICE=${DEVICE}&VID=${VID}&DID=${DID}&SERVER=${SERVER}&EXT=&OPT=${OPTION}&RAW=&PROFILE=${PROFILE}&SCRIPT3D=&PACKAGE3D=&FLAG=DEFAULT
EOF
  cat >> $RPM_BUILD_ROOT/usr/share/sax/api/data/cdb/Cards.20.%name << EOF
${NAME}:${DEVICE} {
 Driver    = radeonhd
}
EOF
  cat >> $RPM_BUILD_ROOT/var/lib/hardware/ids/20.%name << EOF
 vendor.id              pci ${VID}
&device.id              pci ${DID}
+device.name            ${DEVICE}
+driver.xfree           4|${SERVER}
EOF
if [ "$OPTION" == "DRI" ]; then
  echo "+driver.xfree           4|${SERVER}|3d" >> $RPM_BUILD_ROOT/var/lib/hardware/ids/20.%name
fi
  echo >> $RPM_BUILD_ROOT/var/lib/hardware/ids/20.%name
done
%endif

%files
%defattr(-,root,root)
%doc COPYING README README_conntest
%if 0%{?suse_version} > 1000
%dir /usr/share/sax
%dir /usr/share/sax/api
%dir /usr/share/sax/api/data
%dir /usr/share/sax/api/data/cdb
%dir /usr/share/sax/sysp
%dir /usr/share/sax/sysp/maps
%dir /usr/share/sax/sysp/maps/update
%dir /var/lib/hardware
%dir /var/lib/hardware/ids
%endif
/usr/bin/rhd_conntest
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
%dir %{_libdir}/xorg/modules/drivers
%{_libdir}/xorg/modules/drivers/*_drv.la
%{_libdir}/xorg/modules/drivers/*_drv.so
%{_mandir}/man4/*
%else
%dir /usr/X11R6/%{_lib}/modules
%dir /usr/X11R6/%{_lib}/modules/drivers
/usr/X11R6/%{_lib}/modules/drivers/*_drv.*
/usr/X11R6/man/man4/*
%endif
%if 0%{?suse_version} > 1000
/usr/share/sax/api/data/cdb/Cards.20.%{name}
/usr/share/sax/sysp/maps/update/Identity.map.20.%{name}
/var/lib/hardware/ids/20.%{name}
%endif
%if 0%{?suse_version} > 1000

%post
if ls var/lib/hardware/ids/* &> /dev/null; then
  cat var/lib/hardware/ids/* > var/lib/hardware/hd.ids
else
  rm -f var/lib/hardware/hd.ids
fi
exit 0

%postun
if ls var/lib/hardware/ids/* &> /dev/null; then
  cat var/lib/hardware/ids/* > var/lib/hardware/hd.ids
else
  rm -f var/lib/hardware/hd.ids
fi
exit 0
%endif

%changelog
openSUSE Build Service is sponsored by