summaryrefslogtreecommitdiff
blob: 24050cd6b8bac3c694f7da2ccb542b0908c246e6 (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
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-ruby/mod_ruby/mod_ruby-1.2.4.ebuild,v 1.6 2005/04/24 10:56:46 blubb Exp $

DESCRIPTION="Embeds the Ruby interpreter into Apache"
HOMEPAGE="http://modruby.net/"
SRC_URI="http://modruby.net/archive/${P}.tar.gz"
LICENSE="BSD"
SLOT="0"
# 1.2.X -> stable branch; 1.3.Y -> development branch
KEYWORDS="alpha ~sparc x86 ppc amd64 ppc64"
IUSE="apache2 doc"
DEPEND=">=net-www/apache-1.3.3
	virtual/ruby
	doc? ( dev-ruby/rdtool )"

apache2-detect() {
	use apache2 || ! has_version '=net-www/apache-1*'
}

src_compile() {

	local two
	if apache2-detect ; then
		two="2"
	else	# apache1
		ewarn "apache 1.3.x support is UNTESTED"
		two=""
	fi

	./configure.rb --with-apxs=/usr/sbin/apxs${two}

	sed -i -e "s:\(^APACHE_LIBEXECDIR = \$(DESTDIR)/usr/lib/apache${two}\)/modules:\1-extramodules:" Makefile

	emake || die

	if use doc; then
		cd doc
		emake
	fi
}

src_install() {

	make DESTDIR=${D} install || die

	if apache2-detect ; then
		insinto /etc/apache2/conf/modules.d
		doins ${FILESDIR}/20_mod_ruby.conf
	else	# apache1
		insinto /etc/apache/conf/addon-modules
		doins ${FILESDIR}/mod_ruby.conf
	fi

	dodoc ChangeLog COPYING README.*

	if use doc; then
		dohtml doc/*.css doc/*.html
	fi

}

pkg_postinst() {
	if apache2-detect ; then
		einfo "To enable mod_ruby, edit /etc/conf.d/apache2 and add \"-D RUBY\""
		einfo "You may also wish to edit /etc/apache2/conf/modules.d/20_mod_ruby.conf"
	else	# apache1
		einfo "To enable mod_ruby:"
		einfo "1. Run \"ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config\""
		einfo "2. Edit /etc/conf.d/apache and add \"-D RUBY\""
	fi
	einfo "You must restart apache for changes to take effect"
}

pkg_config() {
	if ! apache2-detect ; then
		echo -e "<IfDefine RUBY>\n Include conf/addon-modules/mod_ruby.conf\n</IfDefine>" \
		>> ${ROOT}/etc/apache/conf/apache.conf
	fi
}