######################################################################
#
# Package building section 
#
# Prepare sources - make package output dir (e.g. ../i686)
%prep
%setup -n %{name}

#---------------------------------------------------------------------
# The actual build
#
# Configure the ROOT source tree. You may want to disable some
# features here, though it is STRONGLY DEPRECIATED. 
#
# Note that there is a problem with Redhats standard installation
# directories. They do not conform to standard Linux directory
# structure, so we use our own. 
#
# For reference, this are the translations. 
#
#   SPEC file macro       This package      Rpm default
#   ---------------------------------------------------
#   %{_prefix}            @prefix@              @prefix@
#   %{_defaultdocdir}     @prefix@/share/doc    @prefix@/doc
#   %{_mandir}            @prefix@/share/man    @prefix@/man
#   %{_datadir}           @prefix@/share        @prefix@/share
#
# In the future, we might add support for other directories. 
#
%build
./configure linux					\
	--prefix=%_prefix 				\
	--etcdir=%_sysconfdir/root  			\
	--docdir=%_defaultdocdir/root-doc-%ver          \
	--cintincdir=%_prefix/lib/root/cint		\
        --enable-table  				\
        --enable-thread 				\
        --enable-shared 				\
        --enable-soversion 				\
	--disable-rpath                                 \
        --disable-afs 					\
        --disable-srp 					\
        --with-sys-iconpath=%_datadir/pixmaps 		\
        --fontdir=%_datadir/root/fonts/truetype
make 

#---------------------------------------------------------------------
# The installation 
#
# We install in `pwd`/build/package/rpm so that we do not disturb
# the system, and so that non-priviliged user may build the packages. 
#
%install
make install DESTDIR=${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/%_defaultdocdir/root-daemon-%ver
mv ${RPM_BUILD_ROOT}/%_defaultdocdir/root-doc-%ver/README.PROOF \
	${RPM_BUILD_ROOT}/%_defaultdocdir/root-daemon-%ver/README 
find ${RPM_BUILD_ROOT} -name "CVS" | xargs rm -fr 
@libdir@/makerpmfiles.sh ${RPM_BUILD_ROOT} \
	@cmndir@ @tgtdir@ %_prefix %_sysconfdir/root \
	%_defaultdocdir/root-doc-%ver @pkglist@ 
echo "%doc %_defaultdocdir/root-daemon-%ver/README" >> @tgtdir@/root-daemon.files

######################################################################
#
# End Of Spec File for ROOT
#
