Skip to content
Snippets Groups Projects
castor.spec.in.head 2.70 KiB
# Generic macros
#---------------
%define name castor
%define castorVersion @CASTOR_VERSION@
%define castorRelease @CASTOR_RELEASE@

# Partial compilations
#---------------------
%ifnarch x86_64
# server side is only supported on x86_64 / SLC6
%define compile_server 0
%else
%if "%{?dist}" == ".slc6"
# rpmbuild --define "clientonly 1" ...
%if 0%{?clientonly:1} > 0 
%define compile_server 0
%else
%define compile_server @COMPILE_SERVER@
%endif
%else
%define compile_server 0
%endif
%endif

# Neutral packaging (for srpm)
#-----------------------------
%if 0%{?neutralpackage:1} > 0
%define mydist %{nil}
%else
%define mydist %{?dist}
%endif

# Skipping unit tests (for developpers)
#--------------------------------------
%define skip_unit_tests @SKIP_UNIT_TESTS@

# General settings
#-----------------
Summary: Cern Advanced mass STORage
Name: %{name}
Version: %{castorVersion}
Release: %{castorRelease}%{mydist}
Source: %{name}-%{castorVersion}-%{castorRelease}.tar.gz
URL: http://cern.ch/castor
License: http://cern.ch/castor/DIST/CONDITIONS
Group: Application/Castor
BuildRoot: %{_builddir}/%{name}-%{version}-root
BuildRequires: cmake >= 2.6 redhat-rpm-config
# only build debug info if you're building the whole code

%if %compile_server
%else
  %define debug_package %{nil}
%endif

%description
The CASTOR Project stands for CERN Advanced STORage Manager, and its goal is to handle LHC data in a fully distributed environment.

%prep
%setup -q -n %{name}-%{castorVersion}-%{castorRelease}

%build

%if 0%{?clientonly:1} > 0
# Suppress oracompile.py warnings in clientonly mode
export ORACOMPILE_OPTIONS="--quiet"
%endif

# define castor version (modified by maketar.sh to put the exact version)
MAJOR_CASTOR_VERSION=@MAJOR_CASTOR_VERSION@
MINOR_CASTOR_VERSION=@MINOR_CASTOR_VERSION@
export MAJOR_CASTOR_VERSION
export MINOR_CASTOR_VERSION
mkdir -p build
cd build
# The cmake step does the selection between client/server compilation or just client
MAJOR_CASTOR_VERSION=${MAJOR_CASTOR_VERSION} MINOR_CASTOR_VERSION=${MINOR_CASTOR_VERSION} cmake .. -DCOMPILE_PACKAGING:STRING=0 -DCOMPILE_SERVER:STRING=%{compile_server}
%{__make} -s %{_smp_mflags}

%install
# define castor version (modified by maketar.sh to put the exact version)
MAJOR_CASTOR_VERSION=@MAJOR_CASTOR_VERSION@
MINOR_CASTOR_VERSION=@MINOR_CASTOR_VERSION@
export MAJOR_CASTOR_VERSION
export MINOR_CASTOR_VERSION
%{__rm} -rf ${RPM_BUILD_ROOT}

cd build
%{__make} install DESTDIR=${RPM_BUILD_ROOT} EXPORTMAN=${RPM_BUILD_ROOT}/usr/share/man

%clean
%{__rm} -rf $RPM_BUILD_ROOT
%{__rm} -rf $RPM_BUILD_DIR/%{name}-%{version}


%check
%if 0%{compile_server} > 0
%if "%{skip_unit_tests}" == "0"
cd build
%{__make} test
%endif
%endif

# The following will be filled dynamically with the rule: makespec.py