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