Wed, 08 Feb 2012 20:07:00 +0200
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 ## subversion.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2012 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_dist 1.7.5
26 %define V_opkg 1.7.5
27 %define V_book_html 20120518
28 %define V_book_pdf 20120518
30 # package information
31 Name: subversion
32 Summary: Subversion Source Revision Control System
33 URL: http://subversion.apache.org/
34 Vendor: Apache Software Foundation
35 Packager: OpenPKG Foundation e.V.
36 Distribution: OpenPKG Community
37 Class: BASE
38 Group: SCM
39 License: Apache/BSD
40 Version: %{V_opkg}
41 Release: 20120800
43 # package options
44 %option with_fsl yes
45 %option with_db no
46 %option with_sasl no
48 # list of sources
49 Source0: http://www.apache.org/dist/subversion/subversion-%{V_dist}.tar.bz2
50 Source1: http://download.openpkg.org/components/versioned/subversion/svn-book-%{V_book_html}.html
51 Source2: http://download.openpkg.org/components/versioned/subversion/svn-book-%{V_book_pdf}.pdf
52 Source3: subversion.config
53 Source4: subversion.servers
54 Source5: rc.subversion
55 Source6: fsl.subversion
56 Patch0: subversion.patch
58 # build information
59 BuildPreReq: OpenPKG, openpkg >= 20100101, make, libtool, sed, pkgconfig
60 PreReq: OpenPKG, openpkg >= 20100101
61 BuildPreReq: diffutils, openssl, zlib, libiconv, expat, serf, neon, apr, sqlite
62 PreReq: diffutils, openssl, zlib, libiconv, expat, serf, neon, apr, sqlite
63 %if "%{with_fsl}" == "yes"
64 BuildPreReq: fsl
65 PreReq: fsl
66 %endif
67 %if "%{with_db}" == "yes"
68 BuildPreReq: db
69 PreReq: db
70 %endif
71 %if "%{with_sasl}" == "yes"
72 BuildPreReq: sasl
73 PreReq: sasl
74 %endif
76 %description
77 Subversion is a modern Version Control System (VCS) providing most
78 current CVS features, versioned directories/renames/meta-data,
79 atomic commits, cheap branching and tagging, native client/server
80 architecture, and the choice of database or plain-file repository
81 implementations.
83 %track
84 prog subversion = {
85 version = %{V_dist}
86 url = http://subversion.apache.org/download/
87 regex = subversion-(\d+\.\d+.\d+)\.tar\.bz2
88 }
90 %prep
91 %setup -q
92 %patch -p0
94 # patch: correctly pass --disable-shared to sub-directories
95 %{l_shtool} subst \
96 -e 's;\(\$ac_abs_srcdir/configure \$ac_configure_args\);\1 --disable-shared;' \
97 configure
99 # patch: accommodate defective sqlite3_close(3) test from configure
100 %{l_shtool} subst \
101 -e 's;\(SVN_SQLITE_INCLUDES *= *\).*;\1`pkg-config --cflags-only-I sqlite3`;' \
102 -e 's;\(SVN_SQLITE_LIBS *= *\).*;\1`pkg-config --libs-only-l sqlite3`;' \
103 Makefile.in
105 # patch: adjust path to configuration directory
106 %{l_shtool} subst \
107 -e 's;/etc/subversion;%{l_prefix}/etc/subversion;g' \
108 subversion/libsvn_subr/config_impl.h \
109 subversion/libsvn_subr/config_file.c
111 %build
112 # configure package
113 CC="%{l_cc}" \
114 CFLAGS="%{l_cflags -O}" \
115 CPPFLAGS="%{l_cppflags libxml2 .} -DSQLITE_THREADSAFE=1" \
116 %if "%{with_sasl}" == "yes" && "%{with_db}" == "yes"
117 LDFLAGS="%{l_ldflags} `pkg-config db sasl --libs-only-L` %{l_fsl_ldflags}" \
118 LIBS="`pkg-config db sasl --libs-only-l` -lz %{l_fsl_libs}" \
119 %else
120 %if "%{with_sasl}" == "yes"
121 LDFLAGS="%{l_ldflags} `pkg-config sasl --libs-only-L` %{l_fsl_ldflags}" \
122 LIBS="`pkg-config sasl --libs-only-l` `pkg-config apr-util-1 --libs-only-l` -lz %{l_fsl_libs}" \
123 %else
124 LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}" \
125 LIBS="`pkg-config apr-util-1 --libs-only-l` -lz %{l_fsl_libs}" \
126 %endif
127 %endif
128 CONFIG_SHELL="%{l_bash}" \
129 ./configure \
130 --prefix=%{l_prefix} \
131 --mandir=%{l_prefix}/man \
132 %if "%{with_db}" == "yes"
133 --with-berkeley-db="db.h:%{l_prefix}/include:%{l_prefix}/lib:db" \
134 %else
135 --without-berkeley-db \
136 %endif
137 --with-sqlite=%{l_prefix} \
138 --with-ssl=openssl \
139 --with-zlib=%{l_prefix} \
140 --with-apr=%{l_prefix} \
141 --with-apr-util=%{l_prefix} \
142 --with-neon=%{l_prefix} \
143 --with-serf=%{l_prefix} \
144 %if "%{with_sasl}" == "yes"
145 --with-sasl \
146 %else
147 --without-sasl \
148 %endif
149 --without-gssapi \
150 --without-apxs \
151 --disable-nls \
152 --disable-shared \
153 --enable-static
155 # build package
156 %{l_make} %{l_mflags -O}
158 %install
159 # install package
160 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
162 # strip down installation
163 rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/*.exp
164 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/svn-revision.txt
165 rm -f $RPM_BUILD_ROOT%{l_prefix}/include/subversion-1/mod_dav_svn.h
166 rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/doc
167 rm -rf $RPM_BUILD_ROOT%{l_prefix}/build-1
168 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
170 # install Subversion default global configuration files
171 %{l_shtool} mkdir -f -p -m 755 \
172 $RPM_BUILD_ROOT%{l_prefix}/etc/subversion
173 %{l_shtool} install -c -m 644 %{l_value -s -a} \
174 %{SOURCE subversion.config} \
175 $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/config
176 %{l_shtool} install -c -m 644 \
177 %{SOURCE subversion.servers} \
178 $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/servers
180 # install Subversion Bash command completion
181 %{l_shtool} install -c -m 644 \
182 tools/client-side/bash_completion \
183 $RPM_BUILD_ROOT%{l_prefix}/etc/subversion/bashrc
185 # install Subversion book
186 %{l_shtool} mkdir -f -p -m 755 \
187 $RPM_BUILD_ROOT%{l_prefix}/share/subversion
188 %{l_shtool} install -c -m 644 \
189 %{SOURCE svn-book-%{V_book_pdf}.pdf} \
190 $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.pdf
191 %{l_shtool} install -c -m 644 \
192 %{SOURCE svn-book-%{V_book_html}.html} \
193 $RPM_BUILD_ROOT%{l_prefix}/share/subversion/svn-book.html
195 # install run-command script
196 %{l_shtool} mkdir -f -p -m 755 \
197 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
198 %{l_shtool} install -c -m 755 %{l_value -s -a} \
199 %{SOURCE rc.subversion} \
200 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
202 # install OSSP fsl configuration
203 %{l_shtool} mkdir -f -p -m 755 \
204 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
205 %{l_shtool} install -c -m 644 %{l_value -s -a} \
206 %{SOURCE fsl.subversion} \
207 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
209 # create directory for default repository and svnserve pidfile
210 %{l_shtool} mkdir -f -p -m 755 \
211 $RPM_BUILD_ROOT%{l_prefix}/var/subversion
213 # determine installation files
214 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
215 %{l_files_std} \
216 '%config %{l_prefix}/etc/subversion/*' \
217 '%config %{l_prefix}/etc/fsl/fsl.subversion' \
218 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/subversion' \
219 '%doc %{l_prefix}/share/subversion/svn-book.*'
221 %files -f files
223 %clean
225 %post
226 # create default repository
227 if [ ! -d $RPM_INSTALL_PREFIX/var/subversion/default ]; then
228 su - %{l_rusr} -c \
229 "$RPM_INSTALL_PREFIX/bin/svnadmin create \
230 $RPM_INSTALL_PREFIX/var/subversion/default"
231 fi
233 # after upgrade, restart service
234 [ $1 -eq 2 ] || exit 0
235 eval `%{l_rc} subversion status 2>/dev/null`
236 [ ".$subversion_active" = .yes ] && %{l_rc} subversion restart
237 exit 0
239 %preun
240 # before erase, stop service
241 [ $1 -eq 0 ] || exit 0
242 %{l_rc} subversion stop 2>/dev/null
243 exit 0