

export FR_NAME="FreeSOLID"
export FR_VERSION="2.1.1"
export FR_RELEASE="11.fc16"
export FR_GROUP="System Environment/Libraries"
export FR_LICENSE="LGPLv2+"
export FR_URL="http://sourceforge.net/projects/freesolid/"

export Source0="http://sourceforge.net/projects/freesolid/files/FreeSOLID/FreeSOLID-2.1.1.zip/FreeSOLID-2.1.1.zip"

export Patch8="FreeSOLID-2.1.1-Makefile.am-update.patch"
Patch0="FreeSOLID-2.1.1-src.patch"
Patch1="FreeSOLID-2.1.1-headers.patch"
Patch2="FreeSOLID-2.1.1-endpoint.patch"
Patch3="FreeSOLID-2.1.1-autotools.patch"
Patch4="FreeSOLID-2.1.1-fsf-fix.patch"
Patch5="FreeSOLID-2.1.1-pkgconfig.patch"
Patch6="FreeSOLID-2.1.1-configure.patch"
Patch7="FreeSOLID-2.1.1-freesolid-config.patch"


export FR_PREP='%setup -q -n FreeSOLID-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
mkdir m4
rm acinclude.m4 aclocal.m4
rm ltmain.sh missing depcomp install-sh config.*
chmod 755 configure
'
export FR_BUILD='autoreconf -i
%configure --disable-static
make %{?_smp_mflags}
'
export FR_INSTALL='make install DESTDIR=%{buildroot}
rm $( find %{buildroot} -name '*.la' ) %{buildroot}%{_infodir}/dir
rm -rf sample/*.o sample/.libs $(find sample -type f -a -executable)
'
export FR_PRE=
export FR_POST=
export FR_PREUN=
export FR_POSTUN=
export FR_POSTTRANS=

declare -A FR_FILES
FR_FILES[%files devel]='%doc sample
%{_infodir}/*
%{_bindir}/freesolid-config
%{_libdir}/*.so
%{_libdir}/pkgconfig/FreeSOLID.pc
%{_includedir}/*
'
FR_FILES[%files]='%doc README COPYING COPYING.LIB TODO
%{_libdir}/*.so.*
'

declare -A FR_DESCRIPTION
FR_DESCRIPTION[%description    devel]='Libraries and header files for developing applications that use %{name}.
'
FR_DESCRIPTION[%description]='FreeSOLID is a library for collision detection of three-dimensional
objects undergoing rigid motion and deformation. FreeSOLID is designed
to be used in interactive 3D graphics applications.
'

declare -A FR_PACKAGE
FR_PACKAGE[%package        devel]='Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       pkgconfig
'


export FR_FILES FR_DESCRIPTION FR_PACKAGE

export FR_PASS=80
export FR_FAIL=81
export FR_PENDING=82
export FR_NOT_APPLICABLE=83

function unpack_rpms()
# Unpack all non-src rpms in results into rpms-unpacked, one dir per rpm.
{
    [ -d rpms-unpacked ] && return
    mkdir rpms-unpacked
    cd rpms-unpacked
    for rpm_path in ../results/*.rpm; do
        if [[ "$rpm_path" == *.src.rpm ]];then
           continue
        fi
        rpm=$( basename $rpm_path)
        mkdir $rpm
        cd $rpm
        rpm2cpio ../$rpm_path | cpio -id &>/dev/null
        cd ..
    done
    cd ..
}

export -f unpack_rpms

