forked from cms-sw/cmsdist
-
Notifications
You must be signed in to change notification settings - Fork 0
/
castor.spec
103 lines (85 loc) · 3.42 KB
/
castor.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
### RPM external castor 2.1.13.9
# Override default realversion since they have a "-" in the realversion
%define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac)
%define realversion 2.1.13-6
%define downloadv v%(echo %realversion | tr - _ | tr . _)
%define baseVersion %(echo %realversion | cut -d- -f1)
%define patchLevel %(echo %realversion | cut -d- -f2)
%define isamd64 %(case %{cmsplatf} in (*amd64*) echo 1 ;; (*) echo 0 ;; esac)
%define isonline %(case %{cmsplatf} in (*onl_*_*) echo 1 ;; (*) echo 0 ;; esac)
%define isdarwin %(case %{cmsos} in (osx*) echo 1 ;; (*) echo 0 ;; esac)
%if %isamd64
%define libsuffix ()(64bit)
%else
%define libsuffix %nil
%endif
Source: http://castorold.web.cern.ch/castorold/DIST/CERN/savannah/CASTOR.pkg/%{baseVersion}-*/%{realversion}/castor-%{realversion}.tar.gz
Patch0: castor-2.1.13.6-fix-pthreads-darwin
Patch1: castor-2.1.13.6-fix-memset-in-showqueues
Patch2: castor-2.1.13.9-fix-arm-m32-option
Patch3: castor-2.1.13.9-fix-arm-type-limits
Patch4: castor-2.1.13.9-fix-link-libuuid
%if %isonline
Requires: onlinesystemtools
%else
Requires: libuuid
%endif
# Ugly kludge : forces libshift.x.y to be in the provides (rpm only puts libshift.so.x)
# root rpm require .x.y
Provides: libshift.so.%(echo %realversion |cut -d. -f1,2)%{libsuffix}
%if "%{?cms_cxxflags:set}" != "set"
%define cms_cxxflags -std=c++0x
%endif
%prep
%setup -n castor-%{baseVersion}
%if %isdarwin
%patch0 -p1
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
case %cmsplatf in
*_gcc4[012345]*) ;;
*)
perl -pi -e "s|-Werror|-Werror -Wno-error=unused-but-set-variable|" config/Imake.tmpl
perl -pi -e "s|--no-undefined||" config/Imake.rules
# perl -pi -e 's|^(\s+)(\$\(MAKE\) depend)|$1#$2|' Makefile.ini
;;
esac
# Add CMS CXXFLAGS
#sed -ibak "s/\(^CXX.*=.*\)/\1 %cms_cxxflags/g" config/Imake.tmpl
%build
# make sure the version gets properly set up as otherwise it's "unknown" to the server
# to check: " %i/bin/castor -v " should give back the version
perl -pi -e "s/\ \ __MAJORVERSION__/%(echo %realversion | cut -d. -f1)/" h/patchlevel.h
perl -pi -e "s/\ \ __MINORVERSION__/%(echo %realversion | cut -d. -f2)/" h/patchlevel.h
perl -pi -e "s/\ \ __MAJORRELEASE__/%(echo %realversion | cut -d. -f3 | cut -d- -f 1 )/" h/patchlevel.h
perl -pi -e "s/\ \ __MINORRELEASE__/%(echo %realversion | cut -d- -f2)/" h/patchlevel.h
perl -p -i -e "s!__PATCHLEVEL__!%patchLevel!;s!__BASEVERSION__!\"%baseVersion\"!;s!__TIMESTAMP__!%(date +%%s)!" h/patchlevel.h
mkdir -p %i/bin %i/lib %i/etc/sysconfig
find . -type f -exec touch {} \;
CASTOR_NOSTK=yes; export CASTOR_NOSTK
./configure
LDFLAGS="-L${LIBUUID_ROOT}/lib64" CXXFLAGS="-I${LIBUUID_ROOT}/include" make %{makeprocesses} client
%install
make installclient \
MAJOR_CASTOR_VERSION=%(echo %realversion | cut -d. -f1-2) \
MINOR_CASTOR_VERSION=%(echo %realversion | cut -d. -f3-4 | tr '-' '.' ) \
EXPORTLIB=/ \
DESTDIR=%i \
PREFIX= \
CONFIGDIR=etc \
FILMANDIR=usr/share/man/man4 \
LIBMANDIR=usr/share/man/man3 \
MANDIR=usr/share/man/man1 \
LIBDIR=lib \
BINDIR=bin \
LIB=lib \
BIN=bin \
DESTDIRCASTOR=include/shift \
TOPINCLUDE=include
rm -rf %i/bin
mv %i/usr/bin %i/bin
# Strip libraries, we are not going to debug them.
%define strip_files %i/lib