davical/davical.spec

Wed, 08 Feb 2012 20:07:00 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 08 Feb 2012 20:07:00 +0200
changeset 588
300d43423c2e
parent 396
610cba0674b9
child 703
6e3df34ead39
permissions
-rw-r--r--

Update version, adapt patch, correct PID writing, correct build on newer
FreeBSD releases, and most importantly introduce new patch to try to
avoid segfault caused by multiple network interfaces with the same (or
no) address. This is common when configuring bridges and tunnels.

     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    1.1.1
    26 %define       V_davical 1.1.1
    27 %define       V_awl     0.53
    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:      20120800
    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 BuildPreReq:  OpenPKG, openpkg >= 20100101
    56 PreReq:       OpenPKG, openpkg >= 20100101
    57 PreReq:       pcre, pcre::with_utf8
    58 PreReq:       apache, apg
    59 %if "%{with_ssl}" == "yes"
    60 PreReq:       apache::with_mod_ssl = yes, x509
    61 %endif
    62 PreReq:       apache-php
    63 PreReq:       apache-php::with_pgsql = yes
    64 PreReq:       apache-php::with_gettext = yes
    65 PreReq:       apache-php::with_iconv = yes
    66 PreReq:       yaml, yaml::with_perl = yes
    67 PreReq:       perl-dbi
    68 PreReq:       perl-dbi::with_pgsql = yes
    69 PreReq:       postgresql
    71 %description
    72     The DAViCal CalDAV Server is a repository for calendar, schedule,
    73     todo, and journal entries. Its design allows for trivial storage of
    74     CalDAV calendars from clients such as Evolution, Sunbird/Lightning,
    75     Mulberry, iCal, iPhone, or SOHO Organizer. Calendar data is stored
    76     in a central location providing shared calendars, free/busy
    77     publication and a basic administration interface.
    79 %track
    80     prog davical:davical = {
    81         version   = %{V_davical}
    82         url       = http://debian.mcmillan.net.nz/packages/davical/
    83         regex     = davical-(__VER__)\.tar\.gz
    84     }
    85     prog davical:awl = {
    86         version   = %{V_awl}
    87         url       = http://debian.mcmillan.net.nz/packages/awl/
    88         regex     = awl-(__VER__)\.tar\.gz
    89     }
    91 %prep
    92     %setup -q -c
    93     %setup -q -T -D -a 1
    94     %patch -p0
    95     %{l_shtool} subst \
    96         -e 's;../awl/VERSION;../awl-%{V_awl}/VERSION;' \
    97         davical-%{V_davical}/scripts/build-always.sh
    99 %build
   100     ln -s awl-%{V_awl} awl
   101     ( cd davical-%{V_davical}
   102       %{l_shtool} subst %{l_value -s -a} \
   103           inc/always.php.in \
   104           htdocs/always.php
   105       %{l_make} %{l_mflags} htdocs/always.php
   106     ) || exit $?
   108 %install
   109     #   create installation hierarchy
   110     %{l_shtool} mkdir -f -p -m 755 \
   111         $RPM_BUILD_ROOT%{l_prefix}/sbin \
   112         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
   113         $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
   114         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
   115         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
   116         $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
   117         $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
   118         $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
   120     #   install program components
   121     find . -name "*.orig" -print | xargs rm -f
   122 # MSvB: Needed?
   123 #    %{l_shtool} subst %{l_value -s -a} \
   124 #        davical-%{V_davical}/htdocs/always.php
   125     cp -r \
   126         awl-%{V_awl}/dba \
   127         awl-%{V_awl}/inc \
   128         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
   129     cp -r \
   130         davical-%{V_davical}/dba \
   131         davical-%{V_davical}/inc \
   132         davical-%{V_davical}/htdocs \
   133         $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
   135     #   install DAViCal application configuration file
   136     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   137         %{SOURCE davical-config.php} \
   138         $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   140     #   install DAViCal Apache configuration file
   141     l_hostname=`%{l_shtool} echo -e %h`
   142     l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
   143     %{l_shtool} install -c -m 644 %{l_value -s -a} \
   144         -e "s;@l_hostname@;$l_hostname;g" \
   145         -e "s;@l_domainname@;$l_domainname;g" \
   146         %{SOURCE davical-apache.conf} \
   147         $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
   149     #   install runcommand script
   150 %if "%{with_ssl}" == "yes"
   151     with_ssl="-DSSL"
   152 %else
   153     with_ssl=""
   154 %endif
   155     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   156         -e "s;@with_ssl@;$with_ssl;" \
   157         %{SOURCE rc.davical} \
   158         $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   160     #   install RDBMS setup script
   161     %{l_shtool} install -c -m 755 %{l_value -s -a} \
   162         %{SOURCE davical-setup.sh} \
   163         $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
   165     #   remove intermediate headers and other unused files
   166     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/inc/*.in
   167     rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/inc/*.in
   169     #   determine installation files
   170     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   171         %{l_files_std} \
   172         '%config %attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/etc/davical/*' \
   173         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/lib/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}/var/davical' \
   179         '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
   181 %files -f files
   183 %clean
   185 %post
   186     if [ $1 -eq 1 ]; then
   187         #   display final hints on initial installation
   188         ( echo "1. To complete this installation of DAViCal please start"
   189           echo "   PostgreSQL and initialize the DAViCal database like this:"
   190           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
   191           echo "     \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
   192           echo ""
   193 %if "%{with_ssl}" == "yes"
   194           echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
   195           echo "   under 127.0.0.1, TCP port 8443. Please change this by editing"
   196           echo "   the \"Listen 127.0.0.1:8443\" directive in:"
   197 %else
   198           echo "2. By default, DAViCal runs its own Apache server"
   199           echo "   under 127.0.0.1, TCP port 8080. Please change this by editing"
   200           echo "   the \"Listen 127.0.0.1:8080\" directive in:"
   201 %endif
   202           echo "     $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
   203           echo ""
   204           echo "3. Now start DAViCal by running the command"
   205           echo "     \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
   206           echo "   and connect with a browser to the URL"
   207 %if "%{with_ssl}" == "yes"
   208           echo "     https://127.0.0.1:8443/"
   209 %else
   210           echo "     https://127.0.0.1:8080/"
   211 %endif
   212           echo "   and create user accounts."
   213           echo ""
   214           echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
   215           echo "   calendar with a CalDAV client through the URL"
   216 %if "%{with_ssl}" == "yes"
   217           echo "     https://127.0.0.1:8443/caldav/example/home"
   218 %else
   219           echo "     http://127.0.0.1:8080/caldav/example/home"
   220 %endif
   221         ) | %{l_rpmtool} msg -b -t notice
   222     fi
   223     if [ $1 -eq 2 ]; then
   224         #   after upgrade, restart service
   225         eval `%{l_rc} davical status 2>/dev/null`
   226         [ ".$davical_active" = .yes ] && %{l_rc} davical restart
   227     fi
   228     exit 0
   230 %preun
   231     if [ $1 -eq 0 ]; then
   232         #   before erase, stop service and remove log files
   233         %{l_rc} davical stop 2>/dev/null
   234         $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
   235         rm -f $RPM_INSTALL_PREFIX/var/davical/log/*   >/dev/null 2>&1 || true
   236         rm -f $RPM_INSTALL_PREFIX/var/davical/run/*   >/dev/null 2>&1 || true
   237         rm -f $RPM_INSTALL_PREFIX/var/davical/db/*    >/dev/null 2>&1 || true
   238     fi
   239     exit 0

mercurial