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

#
# spec file for package xorg-x11-driver-video-unichrome (Version 20091020)
#
# Copyright (c) 2009 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-unichrome
%if 0%{?fedora_version} >= 6
BuildRequires:  libdrm-devel xorg-x11-proto-devel xorg-x11-server-sdk
%if 0%{?fedora_version} < 7
BuildRequires:  pkgconfig
%endif
%endif
%if 0%{?mandriva_version} > 2006
BuildRequires:  libx11_6-devel x11-proto-devel x11-server-devel
%if 0%{?mandriva_version} > 2007
BuildRequires:  libdrm-devel
%else
BuildRequires:  libdrm2-devel
%endif
%endif
%if 0%{?suse_version}
BuildRequires:  Mesa-devel popt xorg-x11-sdk
%if 0%{?suse_version} < 1020
BuildRequires:  Mesa-devel xorg-x11-devel
%if 0%{?suse_version} > 1000
BuildRequires:  libdrm-devel
%endif
%endif
%endif
Url:            unichrome.sf.net
License:        MIT License (or similar)
Group:          System/X11/Servers/XF86_4
%if 0%{?suse_version}
Supplements:    modalias(pci:v00001106d00003122sv*sd*bc*sc*i*)
Supplements:    modalias(pci:v00001106d00007205sv*sd*bc*sc*i*)
Supplements:    modalias(pci:v00001106d00003108sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003118sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003344sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003157sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003230sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003343sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00003371sv*sd*bc*sc*i*)
#Supplements:    modalias(pci:v00001106d00001122sv*sd*bc*sc*i*)
%endif
AutoReqProv:    on
Version:        20091020
Release:        1.<RELEASE1>
Summary:        The Unichrome Project
PreReq:         coreutils
Requires:       xorg-x11-server
Provides:       xorg-x11-driver-video:%{_libdir}/xorg/modules/drivers/unichrome_drv.so
Source:         xf86-video-unichrome-4ce10d4.tar.bz2
Source1:        pci_ids
Patch1:         mandriva2007.diff
Patch2:         commit-18bcba7.diff
ExclusiveArch:  %ix86 ia64 ppc ppc64 x86_64
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The Unichrome Project. The Unichrome Project provides Free and Open
Source support for the S3 Unichrome family of integrated graphics
devices, as found on all recent VIA Technologies Northbridges.



Authors:
--------
    Luc Verhaegen
    The Unichrome Project
    VIA Technologies, Inc.
    S3 Graphics, Inc.

%prep
%setup -n xf86-video-unichrome
%if 0%{?mandriva_version} > 2006
%patch1
%endif
%if 0%{?suse_version}
%patch2 -p1 -R
%endif

%build
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
autoreconf -fi
%configure CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
make
%else
xmkmf -a
make CDEBUGFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -I/usr/X11R6/%{_lib}/Server/include -I/usr/X11R6/%{_lib}/Server/include/extensions -I/usr/include/drm" PREPROCESSMANPAGES="true"
%endif

%install
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
make install DESTDIR=$RPM_BUILD_ROOT
%if 0%{?suse_version} > 1020 && 0%{?suse_version} < 1100
mkdir -p $RPM_BUILD_ROOT/usr/%{_lib}/xorg/modules/updates/drivers/
mv $RPM_BUILD_ROOT/usr/%{_lib}/xorg/modules/drivers/* \
   $RPM_BUILD_ROOT/usr/%{_lib}/xorg/modules/updates/drivers/
rmdir $RPM_BUILD_ROOT/usr/%{_lib}/xorg/modules/drivers
%endif
%if 0%{?mandriva_version} > 2006
mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man4
mv $RPM_BUILD_ROOT/*.4 $RPM_BUILD_ROOT/%{_mandir}/man4
%endif
%else
make install DESTDIR=$RPM_BUILD_ROOT
make install.man DESTDIR=$RPM_BUILD_ROOT
%endif
%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.%name
> $RPM_BUILD_ROOT/var/lib/hardware/ids/%name
NAME=VIA
SERVER=unichrome
PROFILE=
cat $RPM_SOURCE_DIR/pci_ids support | \
while read line; do
  VID=$(echo "$line"|cut -d "#" -f 1)
  DID=$(echo "$line"|cut -d "#" -f 2)
  DEVICE=$(echo "$line"|cut -d "#" -f 3)
  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=&RAW=&PROFILE=${PROFILE}&SCRIPT3D=&PACKAGE3D=&FLAG=DEFAULT
EOF
  cat >> $RPM_BUILD_ROOT/usr/share/sax/api/data/cdb/Cards.%name << EOF
${NAME}:${DEVICE} {
 Driver    = ${SERVER}
}
EOF
  cat >> $RPM_BUILD_ROOT/var/lib/hardware/ids/%name << EOF
 vendor.id              pci ${VID}
&device.id              pci ${DID}
+device.name            ${DEVICE}
+driver.xfree           4|${SERVER}
EOF
  echo >> $RPM_BUILD_ROOT/var/lib/hardware/ids/%name
done
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%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
%if 0%{?suse_version} > 1010 || 0%{?fedora_version} >= 6 || 0%{?mandriva_version} > 2006
%if 0%{?suse_version} > 1020 && 0%{?suse_version} < 1100
%dir %{_libdir}/xorg/modules/updates/drivers
%{_libdir}/xorg/modules/updates/drivers/*_drv.la
%{_libdir}/xorg/modules/updates/drivers/*_drv.so
%else
%dir %{_libdir}/xorg/modules/drivers
%{_libdir}/xorg/modules/drivers/*_drv.la
%{_libdir}/xorg/modules/drivers/*_drv.so
%endif
%{_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.%{name}
/usr/share/sax/sysp/maps/update/Identity.map.20.%{name}
/var/lib/hardware/ids/%{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