summaryrefslogtreecommitdiff
blob: e97644e6370ed5170b2cc7073b3767fe58571d9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/dev-util/subversion/subversion-0.10_pre1.ebuild,v 1.4 2002/08/16 04:04:42 murphy Exp $

S=${WORKDIR}/svn
S_APACHE=${WORKDIR}/httpd-2.0
S_APR=${WORKDIR}/apr
S_APRUTIL=${WORKDIR}/apr-util
S_AUTOCONF=${WORKDIR}/autoconf-2.52
S_BDB=${WORKDIR}/db-4.0.14/build_unix
I_APACHE=${WORKDIR}/tmpinstall_httpd
I_AUTOCONF=${WORKDIR}/tmpinstall_autoconf-2.52
I_BDB=${WORKDIR}/tmpinstall_db-4.0.14
I_SVN=${WORKDIR}/tmpinstall_svn

DESCRIPTION="A compelling replacement for CVS"
SRC_URI="http://www.sleepycat.com/update/4.0.14/db-4.0.14.tar.gz
	ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.52.tar.bz2
	http://www.gbevin.com/gentoo/apr-subversion-200202261456.tar.bz2
	http://www.gbevin.com/gentoo/apr-util-subversion-200202261456.tar.bz2
	http://www.gbevin.com/gentoo/httpd-subversion-200202261456.tar.bz2
	http://www.gbevin.com/gentoo/svn-200202261456.tar.bz2"
HOMEPAGE="http://subversion.tigris.org/"

SLOT="0"
LICENSE="Apache-1.1"
KEYWORDS="x86 sparc sparc64"

DEPEND=">=dev-lang/python-2.0
	>=sys-apps/diffutils-2.7.7
	>=sys-devel/libtool-1.4.1-r1
	>=sys-devel/bison-1.28-r3
	>=sys-devel/m4-1.4o-r2
	>=net-misc/neon-0.19.2"
RDEPEND=">=dev-lang/python-2.0
	>=sys-apps/diffutils-2.7.7
	>=sys-devel/m4-1.4o-r2
	>=net-misc/neon-0.19.2"
	
src_bootstrap() {
	cd ${WORKDIR}
	
	# bootstrap subversion from version 0.9.0
	unpack ${DISTDIR}/subversion-r1302.tar.gz
	cd ${WORKDIR}/subversion-r1302
	./configure \
		--with-berkeley-db=${I_BDB} \
		--enable-maintainer-mode \
		--disable-shared
	emake || die "make of subversion bootstrap failed"

	# get latest subversion version from cvs
	cd ${WORKDIR}
	subversion-r1302/subversion/clients/cmdline/svn checkout http://svn.collab.net/repos/svn/trunk -d svn
}

src_compile_bdb() {
	# configure berkeley db
	cd ${S_BDB}
	../dist/configure \
		--prefix=/usr/svn \
	    --mandir=/usr/svn/share/man \
	    --infodir=/usr/svn/share/info \
	    --datadir=/usr/svn/share \
	    --localstatedir=/var/lib \
		--host=${CHOST} || die "../dist/configure of berkeley db failed"
	# build berkeley db
	emake || die "make of berkeley db failed"
	# install temporary version of berkeley db
	make prefix=${I_BDB} install || die "temporary installation of berkeley db failed"
}

src_compile_apache() {
	# copy the apr and apr-util dirs
	rm -rf ${S_APACHE}/srclib/apr ${S_APACHE}/srclib/apr-util
	cp -a ${S_APR} ${S_APACHE}/srclib/apr
	cp -a ${S_APRUTIL} ${S_APACHE}/srclib/apr-util

	# configure apache
	cd ${S_APACHE}
	./buildconf
	./configure \
		--prefix=/usr/svn \
	    --mandir=/usr/svn/share/man \
	    --infodir=/usr/svn/share/info \
	    --datadir=/usr/svn/share \
	    --localstatedir=/var/lib \
		--host=${CHOST} \
		--enable-so \
		--enable-dav \
		--with-dbm=db4 \
		--with-berkeley-db=${I_BDB} \
		--enable-maintainer-mode || die "./configure of apache failed"
	make depend
	# fix the apache sources to correctly work with LD_LIBRARY_PATH
	mv srclib/pcre/Makefile srclib/pcre/Makefile_orig
	sed -e "s#./dftables#LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH}\" ./dftables#" \
		srclib/pcre/Makefile_orig > srclib/pcre/Makefile
	mv server/Makefile server/Makefile_orig
	sed -e "s#./gen_test_char#LD_LIBRARY_PATH=\"${LD_LIBRARY_PATH}\" ./gen_test_char#" \
		server/Makefile_orig > server/Makefile
	# build apache
	emake || die "make of apache failed"
	# install temporary version of apache
	make prefix=${I_APACHE} install || die "temporary installation of apache failed"
	# change the paths in apxs to point to the temporarly installed version of apache
	# this will make subversions dav module install there
	mv ${I_APACHE}/bin/apxs ${I_APACHE}/bin/apxs_orig
	sed -e "s#/usr/svn#${I_APACHE}#" \
		${I_APACHE}/bin/apxs_orig > ${I_APACHE}/bin/apxs
	chmod +x ${I_APACHE}/bin/apxs
}

src_compile_autoconf() {
	# configure autoconf
	cd ${S_AUTOCONF}
	./configure \
		--prefix=${I_AUTOCONF} \
		--infodir=${I_AUTOCONF}/share/info \
		--mandir=${I_AUTOCONF}/share/man \
		--target=${CHOST} || die "./configure of autoconf failed"
	# build autoconf
	emake || die "make of autoconf failed"
	# install temporary version of autoconf
	make install || die "temporary installation of autoconf failed"
}

src_compile_svn() {
	cd ${S}
	# create a copy of the most recent apr and apr-utils sources
	rm -rf apr apr-util
	cp -a ${S_APR} apr
	cp -a ${S_APRUTIL} apr-util
	# generate the configure scripts
	sh ./autogen.sh || die "autoconf of subversion failed"
	# configure subversion
	# have to install in temporary location first and can't sue DESTDIR
	# with make install since otherwise the libraries are wrongly installed
	./configure \
		--prefix=${I_SVN} \
		--with-berkeley-db=${I_BDB} \
		--with-neon=/usr \
		--with-apxs=${I_APACHE}/bin/apxs \
		--enable-maintainer-mode || die "./configure of subversion failed"
	# build subversion
	emake LD_LIBRARY_PATH="${I_BDB}/lib" || die "make of subversion failed"
	# install temporary version of subversion
	export LD_LIBRARY_PATH="${I_SVN}/lib:$LD_LIBRARY_PATH"
	make LD_LIBRARY_PATH="${I_BDB}/lib:${I_APACHE}/lib:${I_SVN}/lib" install || die "temporary installation of subversion failed"
}

src_compile() {
	src_compile_bdb
	# make the system pick up the installed berkeley db libs before others
	export LD_LIBRARY_PATH="${I_BDB}/lib"
	
	src_compile_apache
	# make the system have access to the cvs head libraries of apache 2.0
	export LD_LIBRARY_PATH="${I_APACHE}/lib:$LD_LIBRARY_PATH"
	
	src_compile_autoconf
	# set the correct paths so that this new version of autoconf will be picked up instead
	# of the old version that gentoo uses by default
	export PATH="$I_AUTOCONF/bin:$PATH"

	src_compile_svn
}

src_install () {
	# copy the prior temporary installs to the image dir
	mkdir -p ${D}/usr/svn
	mkdir -p ${D}/usr/svn/lib
	cp -av ${I_BDB}/lib/* ${D}/usr/svn/lib || die "installation of berkeley db failed"
	cp -av ${I_APACHE}/* ${D}/usr/svn || die "installation of apache failed"
	cp -av ${I_SVN}/* ${D}/usr/svn || die "installation of subversion failed"
	
	# install documentation
	dodoc BUGS COMMITTERS COPYING HACKING IDEAS INSTALL PORTING README
	cd notes
	for f in *.txt
	do
		dodoc ${f}
	done
	
	# remove portage /var/tmp paths from files
	cd ${D}/usr/svn
	for x in bin/apxs \
		bin/apu-config \
		bin/apr-config \
		build/config_vars.mk \
		conf/highperformance-std.conf \
		conf/highperformance.conf \
		conf/httpd-std.conf \
		conf/httpd.conf \
		conf/ssl-std.conf \
		conf/ssl.conf \
		conf/httpd.conf.bak \
		lib/libsvn_delta.la \
		lib/libsvn_ra_dav.la \
		lib/libexpat.la \
		lib/libsvn_subr.la \
		lib/libaprutil.la \
		lib/libsvn_ra_local.la \
		lib/libsvn_repos.la \
		lib/libapr.la \
		lib/libsvn_client.la \
		lib/libsvn_fs.la \
		lib/libsvn_ra.la \
		lib/libsvn_wc.la
	do
		mv ${x} ${x}_orig
		sed -e "s#/var/tmp/portage/${P}/work/tmpinstall_svn#/usr/svn#g" \
			-e "s#/var/tmp/portage/${P}/work/tmpinstall_httpd#/usr/svn#g" \
			-e "s#/var/tmp/portage/${P}/work/tmpinstall_db-4.0.14#/usr/svn#g" \
			${x}_orig > ${x}
			rm ${x}_orig
	done

	# add the subversion path to the apache config
	cat << ENDL >> ${D}/usr/svn/conf/httpd.conf
<Location /svn/repos>
	DAV svn
	SVNPath /var/lib/svn
</Location>
ENDL

	# setup gentoo to make using subversion easier
	mkdir -p ${D}/var/lib/svn
	mkdir -p ${D}/usr/svn/logs
	touch ${D}/usr/svn/logs/.keep
	insinto /usr/bin
	dosym /usr/svn/bin/svn /usr/bin/svn
	dosym /usr/svn/bin/svnadmin /usr/bin/svnadmin
	dosym /usr/svn/bin/svnlook /usr/bin/svnlook
	insinto /etc/env.d
	echo "LDPATH=/usr/svn/lib" > ${D}/etc/env.d/10subversion
}

pkg_config() {
	einfo ">>> Initializing the database ..."
	if [ -f /var/lib/svn/db ] ; then
        echo "A subversion repository already exists and I will not overwrite it."
		echo "Delete /var/lib/svn first if you're sure you want to have a clean version."
	else
		einfo ">>> Populating repository directory ..."
		# create initial repository
		LD_LIBRARY_PATH="/usr/svn/lib:$LD_LIBRARY_PATH" /usr/svn/bin/svnadmin create /var/lib/svn

		einfo ">>> Setting repository permissions ..."
		chown -Rf nobody.nobody /var/lib/svn
		chmod -Rf 755 /var/lib/svn
	fi
}