From 2806d315b12eb34883ba01befba85cf26f147034 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 13 Aug 2009 20:07:26 +0000 Subject: new ebuild --- www-apps/cgit/cgit-9999.ebuild | 120 ++++++++++++++++++++++++++++------------- 1 file changed, 83 insertions(+), 37 deletions(-) diff --git a/www-apps/cgit/cgit-9999.ebuild b/www-apps/cgit/cgit-9999.ebuild index de33543..6291a8c 100644 --- a/www-apps/cgit/cgit-9999.ebuild +++ b/www-apps/cgit/cgit-9999.ebuild @@ -1,64 +1,110 @@ -# Copyright 1999-2008 Gentoo Foundation +# Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ -inherit git webapp +inherit eutils webapp -EGIT_REPO_URI="git://hjemli.net/pub/git/cgit" - -GIT_V="1.5.5.1" +use dataonly || GIT_V="$(git --version | cut -d ' ' -f 3)" DESCRIPTION="a fast web-interface for git repositories" HOMEPAGE="http://hjemli.net/git/cgit/about/" -SRC_URI="mirror://kernel/software/scm/git/git-${GIT_V}.tar.bz2" +SRC_URI="!dataonly? ( mirror://kernel/software/scm/git/git-${GIT_V}.tar.bz2 ) + http://hjemli.net/git/cgit/snapshot/${P}.tar.bz2" LICENSE="GPL-2" KEYWORDS="~amd64 ~x86" -IUSE="" -RDEPEND="dev-util/git - sys-libs/zlib - dev-libs/openssl" +IUSE="standalone dataonly" + +# This is remote installation, so we don't need any depends +use standalone || need_httpd_cgi + +RDEPEND="!dataonly? ( dev-util/git ) + sys-libs/zlib + dev-libs/openssl" + DEPEND="${RDEPEND}" -S=${WORKDIR} +S="${WORKDIR}/cgit-${PV}" -src_unpack() { - git_src_unpack +pkg_setup() { + if use standalone; then + use dataonly && die "standalone and dataonly are conflicting USE-flags" + use vhosts && ewarn "vhosts flag is useless with standalone installation" + + # We're into fast-cgi environment, so we need user to operate on + enewuser cgit + enewgroup cgit + else + webapp_pkg_setup + fi +} - # Extract the git release +src_unpack() { unpack ${A} + cd "${S}" - rmdir git - mv git-${GIT_V} git - cp ${FILESDIR}/cgitrc . - - sed -i \ - -e "s:#css=/cgit/cgit.css:css=/cgit/cgit.css:" \ - -e "s:#logo=/cgit/git-logo.png:logo=/cgit/cgit.png:" \ - -e "s:#cache-root=/var/cache/cgit:cache-root=/var/cache/cgit:" \ - cgitrc || die "patching cgitrc failed" + + if ! use dataonly; then + rmdir git + + mv "${WORKDIR}/git-${GIT_V}" git + fi +} + +src_compile() { + # Skip compilation if this is dataonly build + use dataonly && return 0 + + emake || die "emake failed" } src_install() { - webapp_src_preinst + if ! use dataonly; then + mv cgit cgit.cgi + + insinto /etc + doins "${FILESDIR}"/cgitrc + + local cache_dir=/var/cache/cgit + + dodir "${cache_dir}" + keepdir "${cache_dir}" + + use standalone && fowners cgit:cgit "${cache_dir}" - insinto ${MY_HTDOCSDIR} - mv cgit cgit.cgi - doins ${FILESDIR}/.htaccess cgit.cgi cgit.css cgit.png + dodoc cgitrc.5.txt + fi - insinto /etc - doins cgitrc + if use standalone; then + dobin cgit.cgi + else + webapp_src_preinst - dodir /var/cache/cgit - keepdir /var/cache/cgit + insinto "${MY_HTDOCSDIR}" + doins cgit.css cgit.png - # This is just plain wrong, how to do it correctly? (copied from bugzilla - # 3.0.4 ebuild) - chmod +x "${D}${MY_HTDOCSDIR}"/*.cgi + if ! use dataonly; then + exeinto "${MY_CGIBINDIR}" + doexe cgit.cgi - webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt - + insinto "${MY_APPDIR}"/conf + doins "${FILESDIR}"/cgitrc + webapp_configfile "${MY_APPDIR}"/conf/cgitrc + fi + + webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt + + webapp_src_install + fi +} + +pkg_postinst() { + # We don't want to use webapp if this is standalone setup + use standalone || webapp_pkg_postinst +} - webapp_src_install +pkg_prerm() { + # Same idea + use standalone || webapp_pkg_prerm } -- cgit v1.2.3