Tue, 29 Mar 2011 20:04:34 +0200
Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.
The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.
It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.
michael@144 | 1 | ## |
michael@144 | 2 | ## sasl.spec -- OpenPKG RPM Package Specification |
michael@144 | 3 | ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> |
michael@144 | 4 | ## |
michael@144 | 5 | ## Permission to use, copy, modify, and distribute this software for |
michael@144 | 6 | ## any purpose with or without fee is hereby granted, provided that |
michael@144 | 7 | ## the above copyright notice and this permission notice appear in all |
michael@144 | 8 | ## copies. |
michael@144 | 9 | ## |
michael@144 | 10 | ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED |
michael@144 | 11 | ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@144 | 12 | ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
michael@144 | 13 | ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR |
michael@144 | 14 | ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@144 | 15 | ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
michael@144 | 16 | ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
michael@144 | 17 | ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
michael@144 | 18 | ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
michael@144 | 19 | ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
michael@144 | 20 | ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
michael@144 | 21 | ## SUCH DAMAGE. |
michael@144 | 22 | ## |
michael@144 | 23 | |
michael@144 | 24 | # package information |
michael@144 | 25 | Name: sasl |
michael@144 | 26 | Summary: Simple Authentication and Security Layer (SASL) |
michael@144 | 27 | URL: http://asg.web.cmu.edu/sasl/ |
michael@144 | 28 | Vendor: Cyrus Project, CMU |
michael@144 | 29 | Packager: OpenPKG Foundation e.V. |
michael@144 | 30 | Distribution: OpenPKG Community |
michael@144 | 31 | Class: BASE |
michael@144 | 32 | Group: Cryptography |
michael@144 | 33 | License: BSD |
michael@144 | 34 | Version: 2.1.22 |
michael@145 | 35 | Release: 20090206 |
michael@144 | 36 | |
michael@144 | 37 | # package options |
michael@144 | 38 | %option with_fsl yes |
michael@144 | 39 | %option with_sasldb yes |
michael@144 | 40 | %option with_pam no |
michael@144 | 41 | %option with_login no |
michael@144 | 42 | %option with_ldap no |
michael@144 | 43 | %option with_mysql no |
michael@144 | 44 | %option with_pgsql no |
michael@144 | 45 | %option with_sqlite no |
michael@144 | 46 | %option with_ntlm no |
michael@144 | 47 | %option with_otp no |
michael@144 | 48 | %option with_srp no |
michael@144 | 49 | %option with_kerberos no |
michael@144 | 50 | |
michael@144 | 51 | # list of sources |
michael@144 | 52 | Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz |
michael@144 | 53 | Source1: rc.sasl |
michael@144 | 54 | Source2: fsl.sasl |
michael@144 | 55 | Source3: saslauthd.conf |
michael@144 | 56 | Source4: sasl.pc |
michael@144 | 57 | Patch0: sasl.patch |
michael@144 | 58 | |
michael@144 | 59 | # build information |
michael@144 | 60 | Prefix: %{l_prefix} |
michael@144 | 61 | BuildRoot: %{l_buildroot} |
michael@144 | 62 | BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, make, groff |
michael@144 | 63 | PreReq: OpenPKG, openpkg >= 20060823 |
michael@144 | 64 | BuildPreReq: db >= 4.1.24, openssl |
michael@144 | 65 | PreReq: db >= 4.1.24, openssl |
michael@144 | 66 | %if "%{with_fsl}" == "yes" |
michael@144 | 67 | BuildPreReq: fsl |
michael@144 | 68 | PreReq: fsl |
michael@144 | 69 | %endif |
michael@144 | 70 | %if "%{with_pam}" == "yes" |
michael@144 | 71 | BuildPreReq: PAM |
michael@144 | 72 | PreReq: PAM |
michael@144 | 73 | %endif |
michael@144 | 74 | %if "%{with_ldap}" == "yes" |
michael@144 | 75 | BuildPreReq: openldap |
michael@144 | 76 | PreReq: openldap |
michael@144 | 77 | %endif |
michael@144 | 78 | %if "%{with_mysql}" == "yes" |
michael@144 | 79 | BuildPreReq: mysql |
michael@144 | 80 | PreReq: mysql |
michael@144 | 81 | %endif |
michael@144 | 82 | %if "%{with_pgsql}" == "yes" |
michael@144 | 83 | BuildPreReq: postgresql |
michael@144 | 84 | PreReq: postgresql |
michael@144 | 85 | %endif |
michael@144 | 86 | %if "%{with_sqlite}" == "yes" |
michael@144 | 87 | BuildPreReq: sqlite |
michael@144 | 88 | PreReq: sqlite |
michael@144 | 89 | %endif |
michael@144 | 90 | %if "%{with_otp}" == "yes" |
michael@144 | 91 | BuildPreReq: opie |
michael@144 | 92 | PreReq: opie |
michael@144 | 93 | %endif |
michael@144 | 94 | %if "%{with_kerberos}" == "yes" |
michael@144 | 95 | BuildPreReq: KERBEROS |
michael@144 | 96 | PreReq: KERBEROS |
michael@144 | 97 | %endif |
michael@144 | 98 | AutoReq: no |
michael@144 | 99 | AutoReqProv: no |
michael@144 | 100 | |
michael@144 | 101 | %description |
michael@144 | 102 | SASL is the Simple Authentication and Security Layer, a method |
michael@144 | 103 | for adding authentication support to connection-based protocols. |
michael@144 | 104 | To use SASL, a protocol includes a command for identifying and |
michael@144 | 105 | authenticating a user to a server and for optionally negotiating |
michael@144 | 106 | protection of subsequent protocol interactions. If its use is |
michael@144 | 107 | negotiated, a security layer is inserted between the protocol and |
michael@144 | 108 | the connection. |
michael@144 | 109 | |
michael@144 | 110 | %track |
michael@144 | 111 | prog sasl = { |
michael@144 | 112 | version = %{version} |
michael@144 | 113 | url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ |
michael@144 | 114 | regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz |
michael@144 | 115 | } |
michael@144 | 116 | |
michael@144 | 117 | %prep |
michael@144 | 118 | %setup -q -n cyrus-sasl-%{version} |
michael@144 | 119 | %patch -p0 |
michael@145 | 120 | %{l_shtool} subst \ |
michael@145 | 121 | -e 's;u_int;uint;g' \ |
michael@145 | 122 | sasldb/db_berkeley.c |
michael@144 | 123 | |
michael@144 | 124 | %build |
michael@144 | 125 | # ensure the OpenPKG Berkeley-DB is picked up only |
michael@144 | 126 | %{l_shtool} subst \ |
michael@144 | 127 | -e 's;for dbname in db-.*db$;for dbname in db;' \ |
michael@144 | 128 | saslauthd/configure configure |
michael@144 | 129 | |
michael@144 | 130 | # disable some unwanted configure checks |
michael@144 | 131 | %{l_shtool} subst \ |
michael@144 | 132 | -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \ |
michael@144 | 133 | -e "s;javac;javac-xxx;g" \ |
michael@144 | 134 | -e "s;javah;javah-xxx;g" \ |
michael@144 | 135 | -e "s;javadoc;javadoc-xxx;g" \ |
michael@144 | 136 | configure |
michael@144 | 137 | |
michael@144 | 138 | # fix OpenLDAP support |
michael@144 | 139 | %if "%{with_ldap}" == "yes" |
michael@144 | 140 | echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache |
michael@144 | 141 | %{l_shtool} subst \ |
michael@144 | 142 | -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \ |
michael@144 | 143 | saslauthd/configure |
michael@144 | 144 | %endif |
michael@144 | 145 | |
michael@144 | 146 | # fix GSS/Kerberos support |
michael@144 | 147 | %if "%{with_kerberos}" == "yes" |
michael@144 | 148 | %{l_shtool} subst \ |
michael@144 | 149 | -e 's;\(-lk5crypto\);\1 -lkrb5support;' \ |
michael@144 | 150 | configure |
michael@144 | 151 | %endif |
michael@144 | 152 | |
michael@144 | 153 | # enforce disabled Kerberos 5 support in saslauthd |
michael@144 | 154 | echo 'ac_cv_header_krb5_h=no' >config.cache |
michael@144 | 155 | |
michael@144 | 156 | # configure path to sasl-server config files |
michael@144 | 157 | %{l_shtool} subst \ |
michael@144 | 158 | -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \ |
michael@144 | 159 | lib/server.c |
michael@144 | 160 | |
michael@144 | 161 | # determine build flags |
michael@144 | 162 | cflags="%{l_cflags -O} %{l_cppflags}" |
michael@144 | 163 | ldflags="%{l_ldflags} %{l_fsl_ldflags}" |
michael@144 | 164 | libs="-ldb %{l_fsl_libs}" |
michael@144 | 165 | %if "%{with_ldap}" == "yes" |
michael@144 | 166 | cflags="$cflags -DAUTH_LDAP" |
michael@144 | 167 | %endif |
michael@144 | 168 | %if "%{with_mysql}" == "yes" |
michael@144 | 169 | libs="$libs -lz -lm" |
michael@144 | 170 | %endif |
michael@144 | 171 | %if "%{with_pgsql}" == "yes" |
michael@144 | 172 | cflags="$cflags -I%{l_cppflags postgresql}" |
michael@144 | 173 | libs="$libs -lssl -lcrypto -lcrypt" |
michael@144 | 174 | %endif |
michael@144 | 175 | %if "%{with_kerberos}" == "yes" |
michael@144 | 176 | cflags="$cflags `krb5-config --cflags gssapi`" |
michael@144 | 177 | libs="$libs `krb5-config --libs gssapi`" |
michael@144 | 178 | %endif |
michael@144 | 179 | case "%{l_platform -t}" in |
michael@144 | 180 | *-sunos* ) libs="$libs -lrt" ;; |
michael@144 | 181 | esac |
michael@144 | 182 | |
michael@144 | 183 | # configure package |
michael@144 | 184 | CC="%{l_cc}" \ |
michael@144 | 185 | CFLAGS="$cflags" \ |
michael@144 | 186 | CPPFLAGS="%{l_cppflags}" \ |
michael@144 | 187 | LDFLAGS="$ldflags" \ |
michael@144 | 188 | LIBS="$libs" \ |
michael@144 | 189 | ./configure \ |
michael@144 | 190 | --cache-file=./config.cache \ |
michael@144 | 191 | --prefix=%{l_prefix} \ |
michael@144 | 192 | --sysconfdir=%{l_prefix}/etc/sasl \ |
michael@144 | 193 | --with-configdir=%{l_prefix}/etc/sasl/sasl.d \ |
michael@144 | 194 | --with-plugindir=%{l_prefix}/lib/sasl \ |
michael@144 | 195 | --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \ |
michael@144 | 196 | --enable-digest \ |
michael@144 | 197 | --enable-cram \ |
michael@144 | 198 | --enable-anon \ |
michael@144 | 199 | %if "%{with_sasldb}" == "yes" |
michael@144 | 200 | --enable-auth-sasldb \ |
michael@144 | 201 | --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \ |
michael@144 | 202 | --with-dblib=berkeley \ |
michael@144 | 203 | --with-bdb-incdir=%{l_prefix}/include \ |
michael@144 | 204 | --with-bdb-libdir=%{l_prefix}/lib \ |
michael@144 | 205 | %else |
michael@144 | 206 | --with-dblib=none \ |
michael@144 | 207 | %endif |
michael@144 | 208 | --with-openssl=%{l_prefix} \ |
michael@144 | 209 | %if "%{with_pam}" == "yes" |
michael@144 | 210 | --with-pam \ |
michael@144 | 211 | %else |
michael@144 | 212 | --without-pam \ |
michael@144 | 213 | %endif |
michael@144 | 214 | %if "%{with_login}" == "yes" |
michael@144 | 215 | --enable-login \ |
michael@144 | 216 | %else |
michael@144 | 217 | --disable-login \ |
michael@144 | 218 | %endif |
michael@144 | 219 | %if "%{with_ldap}" == "yes" |
michael@144 | 220 | --with-ldap=%{l_prefix} \ |
michael@144 | 221 | %else |
michael@144 | 222 | --without-ldap \ |
michael@144 | 223 | %endif |
michael@144 | 224 | %if "%{with_otp}" == "yes" |
michael@144 | 225 | --enable-otp \ |
michael@144 | 226 | --with-opie=%{l_prefix} \ |
michael@144 | 227 | %else |
michael@144 | 228 | --disable-otp \ |
michael@144 | 229 | --without-opie \ |
michael@144 | 230 | %endif |
michael@144 | 231 | %if "%{with_srp}" == "yes" |
michael@144 | 232 | --enable-srp \ |
michael@144 | 233 | %else |
michael@144 | 234 | --disable-srp \ |
michael@144 | 235 | %endif |
michael@144 | 236 | %if "%{with_kerberos}" == "yes" |
michael@144 | 237 | --enable-gssapi \ |
michael@144 | 238 | --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \ |
michael@144 | 239 | %else |
michael@144 | 240 | --disable-gssapi \ |
michael@144 | 241 | --without-gss_impl \ |
michael@144 | 242 | %endif |
michael@144 | 243 | %if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" |
michael@144 | 244 | --enable-sql \ |
michael@144 | 245 | %if "%{with_mysql}" == "yes" |
michael@144 | 246 | --with-mysql=%{l_prefix} \ |
michael@144 | 247 | %else |
michael@144 | 248 | --without-mysql \ |
michael@144 | 249 | %endif |
michael@144 | 250 | %if "%{with_pgsql}" == "yes" |
michael@144 | 251 | --with-pgsql=%{l_prefix} \ |
michael@144 | 252 | %else |
michael@144 | 253 | --without-pgsql \ |
michael@144 | 254 | %endif |
michael@144 | 255 | %if "%{with_sqlite}" == "yes" |
michael@144 | 256 | --with-sqlite=%{l_prefix} \ |
michael@144 | 257 | %else |
michael@144 | 258 | --without-sqlite \ |
michael@144 | 259 | %endif |
michael@144 | 260 | %endif |
michael@144 | 261 | %if "%{with_ntlm}" == "yes" |
michael@144 | 262 | --enable-ntlm \ |
michael@144 | 263 | %else |
michael@144 | 264 | --disable-ntlm \ |
michael@144 | 265 | %endif |
michael@144 | 266 | --enable-shared \ |
michael@144 | 267 | --enable-static \ |
michael@144 | 268 | --enable-staticdlopen \ |
michael@144 | 269 | --enable-sample \ |
michael@144 | 270 | --disable-java \ |
michael@144 | 271 | --disable-krb4 \ |
michael@144 | 272 | --without-des |
michael@144 | 273 | |
michael@144 | 274 | # post adjustment: trust me, libtool, I know what I am doing |
michael@144 | 275 | %{l_shtool} subst \ |
michael@144 | 276 | -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \ |
michael@144 | 277 | -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \ |
michael@144 | 278 | libtool |
michael@144 | 279 | |
michael@144 | 280 | # post adjustment: do not reference static plugins |
michael@144 | 281 | %{l_shtool} subst \ |
michael@144 | 282 | -e '58s;.*;#define PIC;' \ |
michael@144 | 283 | lib/dlopen.c |
michael@144 | 284 | |
michael@144 | 285 | # post adjustment: do not pull static plugins into static library |
michael@144 | 286 | %{l_shtool} subst \ |
michael@144 | 287 | -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \ |
michael@144 | 288 | lib/Makefile |
michael@144 | 289 | |
michael@144 | 290 | # post adjustment: build utils against static library |
michael@144 | 291 | %{l_shtool} subst \ |
michael@144 | 292 | -e 's;\(\$(CCLD)\);\1 -static;' \ |
michael@144 | 293 | -e 's;\(noinst.*=\) *dbconverter.*;\1;' \ |
michael@144 | 294 | utils/Makefile \ |
michael@144 | 295 | sample/Makefile |
michael@144 | 296 | |
michael@144 | 297 | # post adjustment: fix OpenLDAP support |
michael@144 | 298 | %if "%{with_ldap}" == "yes" |
michael@144 | 299 | %{l_shtool} subst \ |
michael@144 | 300 | -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \ |
michael@144 | 301 | saslauthd/Makefile |
michael@144 | 302 | %endif |
michael@144 | 303 | |
michael@144 | 304 | # build package |
michael@144 | 305 | %{l_make} %{l_mflags} |
michael@144 | 306 | ( cd saslauthd |
michael@144 | 307 | %{l_make} %{l_mflags} testsaslauthd |
michael@144 | 308 | ) || exit $? |
michael@144 | 309 | ( cd sample |
michael@144 | 310 | %{l_make} %{l_mflags} sample-client sample-server |
michael@144 | 311 | ) || exit $? |
michael@144 | 312 | |
michael@144 | 313 | %install |
michael@144 | 314 | rm -rf $RPM_BUILD_ROOT |
michael@144 | 315 | |
michael@144 | 316 | # install package |
michael@144 | 317 | %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" |
michael@144 | 318 | |
michael@144 | 319 | # remove libtool cruft |
michael@144 | 320 | rm -f \ |
michael@144 | 321 | $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \ |
michael@144 | 322 | $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \ |
michael@144 | 323 | $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \ |
michael@144 | 324 | $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a |
michael@144 | 325 | |
michael@144 | 326 | # post-adjust installation |
michael@144 | 327 | mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \ |
michael@144 | 328 | $RPM_BUILD_ROOT%{l_prefix}/lib/sasl |
michael@144 | 329 | mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \ |
michael@144 | 330 | $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test |
michael@144 | 331 | mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \ |
michael@144 | 332 | $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer |
michael@144 | 333 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \ |
michael@144 | 334 | $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8 |
michael@144 | 335 | mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \ |
michael@144 | 336 | $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd |
michael@144 | 337 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \ |
michael@144 | 338 | $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8 |
michael@144 | 339 | mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \ |
michael@144 | 340 | $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers |
michael@144 | 341 | mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \ |
michael@144 | 342 | $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8 |
michael@144 | 343 | rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2 |
michael@144 | 344 | strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true |
michael@144 | 345 | |
michael@144 | 346 | # install sample client/server programs |
michael@144 | 347 | %{l_shtool} install -c -m 755 \ |
michael@144 | 348 | sample/sample-client \ |
michael@144 | 349 | $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client |
michael@144 | 350 | %{l_shtool} install -c -m 755 \ |
michael@144 | 351 | sample/sample-server \ |
michael@144 | 352 | $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server |
michael@144 | 353 | |
michael@144 | 354 | # install saslauthd default configuration |
michael@144 | 355 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@144 | 356 | $RPM_BUILD_ROOT%{l_prefix}/etc/sasl |
michael@144 | 357 | %{l_shtool} install -c -m 755 \ |
michael@144 | 358 | %{SOURCE saslauthd.conf} \ |
michael@144 | 359 | $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/ |
michael@144 | 360 | |
michael@144 | 361 | # create necessary additional directories |
michael@144 | 362 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@144 | 363 | $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \ |
michael@144 | 364 | $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \ |
michael@144 | 365 | $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d |
michael@144 | 366 | |
michael@144 | 367 | # install run-command script |
michael@144 | 368 | %if "%{with_pam}" == "yes" |
michael@144 | 369 | l_authmech="pam" |
michael@144 | 370 | %else |
michael@144 | 371 | case "%{l_platform -t}" in |
michael@144 | 372 | *-linux* | *-sunos* ) l_authmech="shadow" ;; |
michael@144 | 373 | * ) l_authmech="getpwent" ;; |
michael@144 | 374 | esac |
michael@144 | 375 | %endif |
michael@144 | 376 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@144 | 377 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d |
michael@144 | 378 | %{l_shtool} install -c -m 755 \ |
michael@144 | 379 | -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \ |
michael@144 | 380 | %{SOURCE rc.sasl} \ |
michael@144 | 381 | $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ |
michael@144 | 382 | |
michael@144 | 383 | # install OSSP fsl configuration |
michael@144 | 384 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@144 | 385 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl |
michael@144 | 386 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@144 | 387 | %{SOURCE fsl.sasl} \ |
michael@144 | 388 | $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ |
michael@144 | 389 | |
michael@144 | 390 | # install pkg-config configuration |
michael@144 | 391 | libs="-lsasl2" |
michael@144 | 392 | case "%{l_platform -t}" in |
michael@144 | 393 | *-linux* ) libs="$libs -ldl" ;; |
michael@144 | 394 | esac |
michael@144 | 395 | %{l_shtool} mkdir -f -p -m 755 \ |
michael@144 | 396 | $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig |
michael@144 | 397 | %{l_shtool} install -c -m 644 %{l_value -s -a} \ |
michael@144 | 398 | -e "s;@version@;%{version};" \ |
michael@144 | 399 | -e "s;@libs@;$libs;" \ |
michael@144 | 400 | %{SOURCE sasl.pc} \ |
michael@144 | 401 | $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/ |
michael@144 | 402 | |
michael@144 | 403 | # determine installation files |
michael@144 | 404 | %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ |
michael@144 | 405 | %{l_files_std} \ |
michael@144 | 406 | '%config %{l_prefix}/etc/fsl/fsl.sasl' \ |
michael@144 | 407 | '%config %{l_prefix}/etc/sasl/saslauthd.conf' \ |
michael@144 | 408 | '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \ |
michael@144 | 409 | '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \ |
michael@144 | 410 | '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \ |
michael@144 | 411 | '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log' |
michael@144 | 412 | |
michael@144 | 413 | %files -f files |
michael@144 | 414 | |
michael@144 | 415 | %clean |
michael@144 | 416 | rm -rf $RPM_BUILD_ROOT |
michael@144 | 417 | |
michael@144 | 418 | %pre |
michael@144 | 419 | # before upgrade, save status and stop service |
michael@144 | 420 | [ $1 -eq 2 ] || exit 0 |
michael@144 | 421 | eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}` |
michael@144 | 422 | %{l_rc} sasl stop 2>/dev/null |
michael@144 | 423 | exit 0 |
michael@144 | 424 | |
michael@144 | 425 | %post |
michael@144 | 426 | %if "%{with_pam}" == "yes" |
michael@144 | 427 | if [ $1 -eq 1 ]; then |
michael@144 | 428 | # after install, add PAM configuration entry |
michael@144 | 429 | $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl |
michael@144 | 430 | fi |
michael@144 | 431 | %endif |
michael@144 | 432 | if [ $1 -eq 2 ]; then |
michael@144 | 433 | # after upgrade, restore status |
michael@144 | 434 | eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} |
michael@144 | 435 | [ ".$sasl_active" = .yes ] && %{l_rc} sasl start |
michael@144 | 436 | fi |
michael@144 | 437 | exit 0 |
michael@144 | 438 | |
michael@144 | 439 | %preun |
michael@144 | 440 | # before erase, stop service and remove log files |
michael@144 | 441 | [ $1 -eq 0 ] || exit 0 |
michael@144 | 442 | %{l_rc} sasl stop 2>/dev/null |
michael@144 | 443 | rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true |
michael@144 | 444 | %if "%{with_pam}" == "yes" |
michael@144 | 445 | # remove PAM configuration entry |
michael@144 | 446 | $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl |
michael@144 | 447 | %endif |
michael@144 | 448 | exit 0 |
michael@144 | 449 |