Name:          b43-firmware
Version:       @SRPMVERSION@
Release:       @SRPMRELEASE@
Epoch:         1
Summary:       Broadcom firmware files for the b43 and b43legacy drivers
Group:         System/Kernel and Hardware
Vendor:        @vendor@
Distribution:  @distribution@
Packager:      Silvan Calarco <silvan.calarco@mambasoft.it>
URL:           http://macromedia.rediris.es/
Source:        LICENSE
License:       Non Distributable
BuildPrereq:   /usr/bin/b43-fwcutter
BuildPrereq:   /usr/bin/tempfile
# NOTE: requires the backward compatible version of the libstdc++ library
BuildRoot:     %{_tmppath}/%{name}-%{version}-root

%description
Broadcom firmware files for the b43 and b43legacy drivers.

%prep
%setup -c -n %{name}-%{version} -T

[ -r /etc/sysconfig/@sysconfigfile@ ] || exit 1
declare -A SRPMVERSION SRPMRELEASE
. /etc/sysconfig/@sysconfigfile@

[ "${B43_FIRMWARE_PCK}" ] || exit 1
[ "${B43_FIRMWARE_URL}" ] || exit 1

tmpdir=$(mktemp -q -d -t flashplugin.XXXXXXXX)
[ $? -eq 0 ] || exit 1

[ -f ${tmpdir}/${B43_FIRMWARE_PCK} ] ||
   wget -nv --timeout=10 --tries=2 \
      ${B43_FIRMWARE_URL}${B43_FIRMWARE_PCK} -O ${tmpdir}/${B43_FIRMWARE_PCK}
[ -f ${tmpdir}/${B43_FIRMWARE_PCK} ] || exit 1
ls
mkdir b43
cd b43
if [ `echo ${B43_FIRMWARE_PCK} | grep "tar.bz2$"` ]; then   
   tar xjf ${tmpdir}/${B43_FIRMWARE_PCK} --strip-components=1
else
   tar xzf ${tmpdir}/${B43_FIRMWARE_PCK} --strip-components=1
fi
cd ..

%build -q

%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}

install -d %{buildroot}/lib/firmware/
b43-fwcutter -w %{buildroot}/lib/firmware/ b43/driver/wl_apsta_mimo.o

#cd b43
#
#install -D libflashplayer.so \
#    %{buildroot}%{_libdir}/mozilla/plugins/libflashplayer.so

cp %{S:0} LICENSE

rm -fr ${tmpdir}

%clean
[ "%{buildroot}" != / ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
/lib/firmware/b43/*.fw
%doc LICENSE

%changelog
* Tue Mar 31 2009 Silvan Calarco <silvan.calarco@mambasoft.it> 1-1mamba
- specfile created
