Use PreReq for schemas, add root back to file ownership
[shibboleth/cpp-sp.git] / shibboleth.spec.in
1 Name:           @PACKAGE_NAME@
2 Version:        @PACKAGE_VERSION@
3 Release:        1
4 Summary:        Open source system for attribute-based Web SSO
5 Group:          Productivity/Networking/Security
6 Vendor:         Internet2
7 License:        Apache 2.0
8 URL:            http://shibboleth.internet2.edu/
9 Source:         %{name}-sp-%{version}.tar.gz
10 BuildRoot:      %{_tmppath}/%{name}-%{version}-root
11 Requires:       openssl
12 PreReq:         xmltooling-schemas, opensaml-schemas
13 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
14 PreReq:         %{insserv_prereq}
15 BuildRequires:  libXerces-c-devel >= 2.8.0
16 %else
17 BuildRequires:  libxerces-c-devel >= 2.8.0
18 %endif
19 BuildRequires:  libxml-security-c-devel >= 1.4.0
20 BuildRequires:  libxmltooling-devel >= 1.4
21 BuildRequires:  libsaml-devel >= 2.4
22 %{?_with_log4cpp:BuildRequires: liblog4cpp-devel >= 1.0}
23 %{!?_with_log4cpp:BuildRequires: liblog4shib-devel}
24 %if 0%{?rhel} >= 6
25 Requires: libcurl-openssl >= 7.21.7
26 BuildRequires: chrpath
27 %endif
28 BuildRequires:  gcc-c++, zlib-devel
29 %{!?_without_doxygen:BuildRequires: doxygen}
30 %{!?_without_odbc:BuildRequires:unixODBC-devel}
31 %{?_with_fastcgi:BuildRequires: fcgi-devel}
32 %if "%{_vendor}" == "redhat"
33 %{!?_without_builtinapache:BuildRequires: httpd-devel}
34 BuildRequires: redhat-rpm-config
35 %endif
36 %if "%{_vendor}" == "suse"
37 %{!?_without_builtinapache:BuildRequires: apache2-devel}
38 %endif
39
40 %if "%{_vendor}" == "suse"
41 %define pkgdocdir %{_docdir}/%{name}
42 %else
43 %define pkgdocdir %{_docdir}/%{name}-%{version}
44 %endif
45
46 %description
47 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
48 that supports multiple protocols, federated identity, and the extensible
49 exchange of rich attributes subject to privacy controls.
50
51 This package contains the Shibboleth Service Provider runtime libraries
52 and Apache module(s).
53
54 %package devel
55 Summary:        Shibboleth development Headers
56 Group:          Development/Libraries/C and C++
57 Requires:       %{name} = %{version}-%{release}
58 %if 0%{?suse_version} > 1030 && 0%{?suse_version} < 1130
59 Requires:       libXerces-c-devel >= 2.8.0
60 %else
61 Requires:       libxerces-c-devel >= 2.8.0
62 %endif
63 Requires:       libxml-security-c-devel >= 1.4.0
64 Requires:       libxmltooling-devel >= 1.4
65 Requires:       libsaml-devel >= 2.4
66 %{?_with_log4cpp:Requires: liblog4cpp-devel >= 1.0}
67 %{!?_with_log4cpp:Requires: liblog4shib-devel}
68
69 %description devel
70 Shibboleth is a Web Single Sign-On implementations based on OpenSAML
71 that supports multiple protocols, federated identity, and the extensible
72 exchange of rich attributes subject to privacy controls.
73
74 This package includes files needed for development with Shibboleth.
75
76 %prep
77 %setup -q
78
79 %build
80 %configure %{?_without_odbc:--disable-odbc} %{?_without_adfs:--disable-adfs} %{?_with_fastcgi} %{?_with_memcached} %{?shib_options}
81 %{__make} pkgdocdir=%{pkgdocdir}
82
83 %install
84 %{__make} install NOKEYGEN=1 DESTDIR=$RPM_BUILD_ROOT pkgdocdir=%{pkgdocdir}
85
86 %if "%{_vendor}" == "suse"
87         %{__sed} -i "s/\/var\/log\/httpd/\/var\/log\/apache2/g" \
88                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/native.logger
89 %endif
90 %if 0%{?rhel} >= 6
91         %{__sed} -i "s/#_RHEL6_//g" \
92                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-redhat
93         %{__sed} -i "s/\/opt\/shibboleth\/lib/\/opt\/shibboleth\/%{_lib}/g" \
94                 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-redhat
95         chrpath -d $RPM_BUILD_ROOT%{_sbindir}/shibd
96         chrpath -d $RPM_BUILD_ROOT%{_bindir}/mdquery
97         chrpath -d $RPM_BUILD_ROOT%{_bindir}/resolvertest
98 %endif
99
100 # Plug the SP into the built-in Apache on a recognized system.
101 touch rpm.filelist
102 APACHE_CONFIG="no"
103 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_13.so ] ; then
104     APACHE_CONFIG="apache.config"
105 fi
106 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_20.so ] ; then
107     APACHE_CONFIG="apache2.config"
108 fi
109 if [ -f $RPM_BUILD_ROOT%{_libdir}/%{name}/mod_shib_22.so ] ; then
110     APACHE_CONFIG="apache22.config"
111 fi
112 %{?_without_builtinapache:APACHE_CONFIG="no"}
113 if [ "$APACHE_CONFIG" != "no" ] ; then
114     APACHE_CONFD="no"
115     if [ -d %{_sysconfdir}/httpd/conf.d ] ; then
116             APACHE_CONFD="%{_sysconfdir}/httpd/conf.d"
117     fi
118     if [ -d %{_sysconfdir}/apache2/conf.d ] ; then
119             APACHE_CONFD="%{_sysconfdir}/apache2/conf.d"
120     fi
121     if [ "$APACHE_CONFD" != "no" ] ; then
122         %{__mkdir} -p $RPM_BUILD_ROOT$APACHE_CONFD
123         %{__cp} -p $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/$APACHE_CONFIG $RPM_BUILD_ROOT$APACHE_CONFD/shib.conf 
124         echo "%config $APACHE_CONFD/shib.conf" > rpm.filelist
125     fi
126 fi
127
128 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
129         # %{_initddir} not yet in RHEL5, use deprecated %{_initrddir}
130         install -d -m 0755 $RPM_BUILD_ROOT%{_initrddir}
131         install -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/shibd-%{_vendor} $RPM_BUILD_ROOT%{_initrddir}/shibd
132 %if "%{_vendor}" == "suse"
133         install -d -m 0755 $RPM_BUILD_ROOT/%{_sbindir}
134         %{__ln_s} -f %{_initrddir}/shibd $RPM_BUILD_ROOT%{_sbindir}/rcshibd
135 %endif
136 %endif
137
138 %check
139 %{__make} check
140
141 %clean
142 [ "$RPM_BUILD_ROOT" != "/" ] && %{__rm} -rf $RPM_BUILD_ROOT
143
144 %post
145 %ifnos solaris2.8 solaris2.9 solaris2.10
146 /sbin/ldconfig
147 %endif
148
149 # Key generation
150 cd %{_sysconfdir}/%{name}
151 sh ./keygen.sh -b
152
153 %if "%{_vendor}" == "redhat"
154         # This adds the proper /etc/rc*.d links for the script
155         /sbin/chkconfig --add shibd
156         # On upgrade, restart components if they're already running.
157     if [ "$1" -gt "1" ] ; then
158         /etc/init.d/shibd status 1>/dev/null && /etc/init.d/shibd restart 1>/dev/null
159         %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
160         exit 0
161     fi
162 %endif
163 %if "%{_vendor}" == "suse"
164     # This adds the proper /etc/rc*.d links for the script
165     cd /
166     %insserv_force_if_yast shibd
167 %endif
168
169 %preun
170 %if "%{_vendor}" == "redhat"
171         if [ "$1" = 0 ] ; then
172                 /sbin/service shibd stop >/dev/null 2>&1
173                 /sbin/chkconfig --del shibd
174         %{!?_without_builtinapache:/etc/init.d/httpd status 1>/dev/null && /etc/init.d/httpd restart 1>/dev/null}
175         fi
176 %endif
177 %if "%{_vendor}" == "suse"
178     %stop_on_removal shibd
179     if [ "$1" = 0 ] ; then
180         %{!?_without_builtinapache:/etc/init.d/apache2 status 1>/dev/null && /etc/init.d/apache2 restart 1>/dev/null}
181     fi
182 %endif
183 exit 0
184
185 %postun
186 %ifnos solaris2.8 solaris2.9 solaris2.10
187 /sbin/ldconfig
188 %endif
189 %if "%{_vendor}" == "suse"
190 cd /
191 %restart_on_update shibd
192 %{!?_without_builtinapache:%restart_on_update apache2}
193 %{insserv_cleanup}
194 %endif
195
196 %posttrans
197 # ugly hack if init script got removed during %postun by upgraded (buggy/2.1) package
198 %if "%{_vendor}" == "redhat"
199     if [ ! -f %{_initrddir}/shibd ] ; then
200         if [ -f %{_sysconfdir}/%{name}/shibd-%{_vendor} ] ; then
201             %{__cp} -p %{_sysconfdir}/%{name}/shibd-%{_vendor} %{_initrddir}/shibd
202             %{__chmod} 755 %{_initrddir}/shibd
203             /sbin/chkconfig --add shibd
204         fi
205     fi
206 %endif
207
208 %files -f rpm.filelist
209 %defattr(-,root,root,-)
210 %{_sbindir}/shibd
211 %{_bindir}/mdquery
212 %{_bindir}/resolvertest
213 %{_libdir}/libshibsp.so.*
214 %{_libdir}/libshibsp-lite.so.*
215 %dir %{_libdir}/%{name}
216 %{_libdir}/%{name}/*
217 %exclude %{_libdir}/%{name}/*.la
218 %attr(0750,root,root) %dir %{_localstatedir}/log/%{name}
219 %dir %{_localstatedir}/run/%{name}
220 %dir %{_datadir}/xml/%{name}
221 %{_datadir}/xml/%{name}/*
222 %dir %{_sysconfdir}/%{name}
223 %config(noreplace) %{_sysconfdir}/%{name}/*.xml
224 %config(noreplace) %{_sysconfdir}/%{name}/*.html
225 %config(noreplace) %{_sysconfdir}/%{name}/*.logger
226 %if "%{_vendor}" == "redhat" || "%{_vendor}" == "suse"
227 %config %{_initrddir}/shibd
228 %endif
229 %if "%{_vendor}" == "suse"
230 %{_sbindir}/rcshibd
231 %endif
232 %{_sysconfdir}/%{name}/*.dist
233 %{_sysconfdir}/%{name}/apache*.config
234 %{_sysconfdir}/%{name}/shibd-*
235 %attr(0755,root,root) %{_sysconfdir}/%{name}/keygen.sh
236 %attr(0755,root,root) %{_sysconfdir}/%{name}/metagen.sh
237 %{_sysconfdir}/%{name}/*.xsl
238 %doc %{pkgdocdir}
239 %exclude %{pkgdocdir}/api
240
241 %files devel
242 %defattr(-,root,root,-)
243 %{_includedir}/*
244 %{_libdir}/libshibsp.so
245 %{_libdir}/libshibsp-lite.so
246 %doc %{pkgdocdir}/api
247
248 %changelog
249 * Sun Jun 26 2011  Scott Cantor  <cantor.2@osu.edu>  - 2.4.3-1
250 - Log files shouldn't be world readable.
251 - Explicit requirement for libcurl-openssl on RHEL6
252 - Uncomment LD_LIBRARY_PATH in init script for RHEL6 
253 - Remove rpath from binaries for RHEL6
254
255 * Fri Dec 25 2009  Scott Cantor  <cantor.2@osu.edu>  - 2.4-1
256 - Update dependencies.
257
258 * Mon Nov 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.3.1-1
259 - Reset revision for 2.3.1 release
260
261 * Wed Aug 19 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-2
262 - SuSE init script changes
263 - Restart Apache on removal, not just upgrade
264 - Fix scriptlet exit values when Apache is stopped
265
266 * Mon Aug 10 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
267 - Doc handling changes
268 - SuSE init script
269
270 * Tue Aug 4 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2.1-1
271 - Initial version for 2.2.1, with shibd/httpd restart on upgrade
272
273 * Thu Jun 25 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-3
274 - Add additional cleanup to posttrans fix
275
276 * Tue Jun 23 2009 Scott Cantor  <cantor.2@osu.edu>  - 2.2-2
277 - Reverse without_builtinapache macro test
278 - Fix init script handling on Red Hat to handle upgrades
279
280 * Wed Dec 3 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.2-1
281 - Bump minor version.
282 - Make keygen.sh executable.
283 - Fixing SUSE Xerces dependency name.
284 - Optionally package shib.conf.
285
286 * Tue Jun 10 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.1-1
287 - Change shib.conf handling to treat as config file.
288
289 * Mon Mar 17 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-6
290 - Official release.
291
292 * Fri Jan 18 2008  Scott Cantor  <cantor.2@osu.edu>  - 2.0-5
293 - Release candidate 1.
294
295 * Sun Oct 21 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-4
296 - libexec -> lib/shibboleth changes
297 - Added doc subpackage
298
299 * Thu Aug 16 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-3
300 - First public beta.
301
302 * Fri Jul 13 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-2
303 - Second alpha release.
304
305 * Sun Jun 10 2007 Scott Cantor  <cantor.2@osu.edu>  - 2.0-1
306 - First alpha release.
307
308 * Mon Oct 2 2006 Scott Cantor   <cantor.2@osu.edu>  - 1.3-11
309 - Applied fix for secadv 20061002
310 - Fix for metadata loader loop
311
312 * Wed Jun 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-10
313 - Applied fix for sec 20060615
314
315 * Fri Apr 15 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-9
316 - Misc. patches, SuSE, Apache 2.2, gcc 4.1, and 64-bit support
317
318 * Mon Jan 9 2006 Scott Cantor  <cantor.2@osu.edu>  - 1.3-8
319 - Applied new fix for secadv 20060109
320
321 * Tue Nov 8 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-7
322 - Applied new fix for secadv 20050901 plus rollup
323
324 * Fri Sep 23 2005 Scott Cantor  <cantor.2@osu.edu>  - 1.3-6
325 - Minor patches and default config changes
326 - pidfile patch
327 - Fix shib.conf creation
328 - Integrated init.d script
329 - Prevent replacement of config files
330
331 * Thu Sep 1 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-5
332 - Applied fix for secadv 20050901 plus rollup of NSAPI fixes
333
334 * Sun Apr 24 2005  Scott Cantor  <cantor.2@osu.edu>  - 1.3-1
335 - Updated test programs and location of schemas.
336 - move siterefresh to to sbindir
337
338 * Fri Apr  1 2005  Derek Atkins  <derek@ihtfp.com>  - 1.3-1
339 - Add selinux-targeted-policy package
340 - move shar to sbindir
341
342 * Tue Oct 19 2004  Derek Atkins  <derek@ihtfp.com>  - 1.2-1
343 - Create SPEC file based on various versions in existence.