summaryrefslogtreecommitdiff
blob: 2bc87a082bfedeecce5c60412e77c05276c9fd3b (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/initng/initng-9999.ebuild,v 1.13 2009/02/08 19:35:58 vapier Exp $

if [[ ${PV} == "9999" ]] ; then
	ESVN_REPO_URI="http://svn.initng.org/initng/trunk"
	ESVN_PROJECT="initng"
	inherit subversion
	SRC_URI=""
else
	SRC_URI="http://download.initng.org/initng/v${PV:0:3}/${P}.tar.bz2"
	KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~s390 ~sparc ~x86"
fi
inherit eutils multilib

DESCRIPTION="A next generation init replacement"
HOMEPAGE="http://initng.org/"

LICENSE="GPL-2"
SLOT="0"
IUSE=""

RDEPEND=""
DEPEND="${RDEPEND}
	>=dev-util/cmake-2.1"
PDEPEND="sys-apps/initng-ifiles"

plugin_warning() {
	if [[ -z ${INITNG_PLUGINS} ]] ; then
		einfo "If you want to customize the list of initng plugins, please"
		einfo "set the INITNG_PLUGINS variable in your make.conf."
		einfo "See http://www.initng.org/wiki/Documents_Plugins for a list of"
		einfo "valid plugins for you to choose from."
	fi
}

pkg_setup() {
	plugin_warning
}

src_unpack() {
	if [[ ${PV} == "9999" ]] ; then
		subversion_src_unpack
	else
		unpack ${A}
	fi
	cd "${S}"
	sed -i -e 's:-Werror::' CMakeLists.txt #136992
}

src_compile() {
	local x default_opts valid_opts cmake_opts=""
	valid_opts=$(sed -n   '/^OPTION/        s:.*(\([[:alpha:]_]*\).*:\1:p' CMakeLists.txt)
	default_opts=$(sed -n '/^OPTION(.*ON)$/ s:.*(\([[:alpha:]_]*\).*:\1:p' CMakeLists.txt)
	INITNG_PLUGINS=$(echo ${INITNG_PLUGINS} | tr '[:lower:]' '[:upper:]')
	INITNG_PLUGINS=${INITNG_PLUGINS:-${default_opts}}
	for x in ${valid_opts} ; do
		if hasq ${x} ${INITNG_PLUGINS} || hasq ${x#BUILD_} ${INITNG_PLUGINS} ; then
			cmake_opts="${cmake_opts} -D${x}=ON"
		else
			cmake_opts="${cmake_opts} -D${x}=OFF"
		fi
	done
	cmake \
		-DCMAKE_INSTALL_PREFIX=/ \
		-DLIB_INSTALL_DIR=/$(get_libdir) \
		${cmake_opts} || die
	emake || die
}

src_install() {
	emake install DESTDIR="${D}" || die
	find "${D}" -name '*.a' -exec rm "{}" \;
	dodoc AUTHORS ChangeLog NEWS README TODO
}

pkg_postinst() {
	plugin_warning
	einfo "Remember to add init=/sbin/initng in your grub or lilo config"
	einfo " in order to use initng.  Happy testing!"
}