davical/davical.spec

Tue, 28 Aug 2012 18:28:35 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 28 Aug 2012 18:28:35 +0200
changeset 526
7ddfdb42afce
parent 361
45eaa38991fd
child 585
2dd48c9debd6
permissions
-rw-r--r--

Write a explicit dependency to pkgconfig file for getaddrinfo(3). The SVR4
dependencies libsocket and libnsl are needed by libgio and libglib at least,
and allow dependent software like gmime to build unmodified.

     1 ##
     2 ##  davical.spec -- OpenPKG RPM Package Specification
     3 ##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     4 ##
     5 ##  Permission to use, copy, modify, and distribute this software for
     6 ##  any purpose with or without fee is hereby granted, provided that
     7 ##  the above copyright notice and this permission notice appear in all
     8 ##  copies.
     9 ##
    10 ##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    11 ##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    12 ##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    13 ##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    14 ##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    15 ##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    16 ##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    17 ##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    18 ##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    19 ##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    20 ##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    21 ##  SUCH DAMAGE.
    22 ##
    24 #   package version
    25 %define       V_opkg    0.9.9.7
    26 %define       V_davical 0.9.9.7
    27 %define       V_awl     0.49
    29 #   package information
    30 Name:         davical
    31 Summary:      CalDAV Server
    32 URL:          http://rscds.sourceforge.net/
    33 Vendor:       Andrew McMillan
    34 Packager:     OpenPKG Foundation e.V.
    35 Distribution: OpenPKG Community
    36 Class:        EVAL
    37 Group:        Network
    38 License:      GPL
    39 Version:      %{V_opkg}
    40 Release:      20111130
    42 #   package options
    43 %define       with_ssl  no
    45 #   list of sources
    46 Source0:      http://debian.mcmillan.net.nz/packages/davical/davical-%{V_davical}.tar.gz
    47 Source1:      http://debian.mcmillan.net.nz/packages/awl/awl-%{V_awl}.tar.gz
    48 Source2:      davical-config.php
    49 Source3:      davical-apache.conf
    50 Source4:      davical-setup.sh
    51 Source5:      rc.davical
    52 Patch0:       davical.patch
    54 #   build information
    55 Prefix:       %{l_prefix}
    56 BuildRoot:    %{l_buildroot}
    57 BuildPreReq:  OpenPKG, openpkg >= 20060823
    58 PreReq:       OpenPKG, openpkg >= 20060823
    59 PreReq:       pcre, pcre::with_utf8
    60 PreReq:       apache
    61 %if "%{with_ssl}" == "yes"
    62 PreReq:       apache::with_mod_ssl = yes, x509
    63 %endif
    64 PreReq:       apache-php
    65 PreReq:       apache-php::with_pgsql = yes
    66 PreReq:       apache-php::with_gettext = yes
    67 PreReq:       apache-php::with_iconv = yes
    68 PreReq:       yaml, yaml::with_perl = yes
    69 PreReq:       perl-dbi
    70 PreReq:       postgresql
    71 PreReq:       apg
    72 AutoReq:      no
    73 AutoReqProv:  no
    75 %description
    76     The DAViCal CalDAV Server is a repository for calendar, schedule,
    77     todo and journal entries which may be accessed with CalDAV capable
    78     client software.
    80 %track
    81     prog davical:davical = {
    82         version   = %{V_davical}
    83         url       = http://debian.mcmillan.net.nz/packages/davical/
    84         regex     = davical-(__VER__)\.tar\.gz
    85     }
    86     prog davical:awl = {
    87         version   = %{V_awl}
    88         url       = http://debian.mcmillan.net.nz/packages/awl/
    89         regex     = awl-(__VER__)\.tar\.gz
    90     }
    92 %prep
    93     %setup -q -c
    94     %setup -q -T -D -a 1
    95     %patch -p0
    96     %{l_shtool} subst \
    97         -e 's;../awl/VERSION;../awl-%{V_awl}/VERSION;' \
    98         davical-%{V_davical}/scripts/build-always.sh
   100 %build
   101     ln -s awl-%{V_awl} awl
   102     ( cd davical-%{V_davical}
   103       %{l_shtool} subst %{l_value -s -a} inc/always.php.in
   104       %{l_make} %{l_mflags} htdocs/always.php
   105     ) || exit $?
   107 %install
   108     #   remove build cruft
   109     rm -rf $RPM_BUILD_ROOT
   111     #   create installation hierarchy
   112     %{l_shtool} mkdir -f -p -m 755 \
   113         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   114         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   115         $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
   116         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
   117         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
   118         $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
   119         $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
   120         $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
   122     #   install program components
   123     find . -name "*.orig" -print | xargs rm -f
   124     cp -r \
   125         awl-%{V_awl}/dba \
   126         awl-%{V_awl}/inc \
   127         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
   128     %{l_shtool} subst %{l_value -s -a} \
   129         davical-%{V_davical}/htdocs/always.php
   130     cp -r \
   131         davical-%{V_davical}/dba \
   132         davical-%{V_davical}/inc \
   133         davical-%{V_davical}/htdocs \
   134         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
   136     #   install DAViCal application configuration file
   137     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   138         %{SOURCE davical-config.php} \
   139         $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   141     #   install DAViCal Apache configuration file
   142     l_hostname=`%{l_shtool} echo -e %h`
   143     l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   144     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   145         -e "s;@l_hostname@;$l_hostname;g" \
   146         -e "s;@l_domainname@;$l_domainname;g" \
   147         %{SOURCE davical-apache.conf} \
   148         $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   150     #   install run-command script
   151 %if "%{with_ssl}" == "yes"
   152     with_ssl="-DSSL"
   153 %else
   154     with_ssl=""
   155 %endif
   156     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   157         -e "s;@with_ssl@;$with_ssl;" \
   158         %{SOURCE rc.davical} \
   159         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   161     #   install RDBMS setup script
   162     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   163         %{SOURCE davical-setup.sh} \
   164         $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
   166     #   remove intermediate headers and other unused files
   167     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/inc/*.in
   168     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/inc/*.in
   170     #   determine installation files
   171     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   172         %{l_files_std} \
   173         '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/davical/*' \
   174         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/davical/*' \
   175         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/davical/*/*' \
   176         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/davical/*/*/*' \
   177         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/davical/*/*/*/*' \
   178         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/davical/*/*/*/*/*' \
   179         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \
   180         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
   182 %files -f files
   184 %clean
   185     rm -rf $RPM_BUILD_ROOT
   187 %post
   188     if [ $1 -eq 1 ]; then
   189         #   display final hints on initial installation
   190         ( echo "1. To complete this installation of DAViCal please start"
   191           echo "   PostgreSQL and initialize the DAViCal database like this:"
   192           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   193           echo "     \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
   194           echo ""
   195 %if "%{with_ssl}" == "yes"
   196           echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
   197           echo "   under 127.0.0.1, TCP port 8443. Please change this by editing"
   198           echo "   the \"Listen 127.0.0.1:8443\" directive in:"
   199 %else
   200           echo "2. By default, DAViCal runs its own Apache server"
   201           echo "   under 127.0.0.1, TCP port 8080. Please change this by editing"
   202           echo "   the \"Listen 127.0.0.1:8080\" directive in:"
   203 %endif
   204           echo "     $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
   205           echo ""
   206           echo "3. Now start DAViCal by running the command"
   207           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
   208           echo "   and connect with a browser to the URL"
   209 %if "%{with_ssl}" == "yes"
   210           echo "     https://127.0.0.1:8443/"
   211 %else
   212           echo "     https://127.0.0.1:8080/"
   213 %endif
   214           echo "   and create user accounts."
   215           echo ""
   216           echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
   217           echo "   calendar with a CalDAV client through the URL"
   218 %if "%{with_ssl}" == "yes"
   219           echo "     https://127.0.0.1:8443/caldav/example/home"
   220 %else
   221           echo "     http://127.0.0.1:8080/caldav/example/home"
   222 %endif
   223         ) | %{l_rpmtool} msg -b -t notice
   224     fi
   225     if [ $1 -eq 2 ]; then
   226         #   after upgrade, restart service
   227         eval `%{l_rc} davical status 2>/dev/null`
   228         [ ".$davical_active" = .yes ] && %{l_rc} davical restart
   229     fi
   230     exit 0
   232 %preun
   233     if [ $1 -eq 0 ]; then
   234         #   before erase, stop service and remove log files
   235         %{l_rc} davical stop 2>/dev/null
   236         $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
   237         rm -f $RPM_INSTALL_PREFIX/var/davical/log/*   >/dev/null 2>&1 || true
   238         rm -f $RPM_INSTALL_PREFIX/var/davical/run/*   >/dev/null 2>&1 || true
   239         rm -f $RPM_INSTALL_PREFIX/var/davical/db/*    >/dev/null 2>&1 || true
   240     fi
   241     exit 0

mercurial