summaryrefslogtreecommitdiff
path: root/www-apps/gitweb/gitweb-2.4.0.ebuild
blob: 06446b1fb401dd45ea079ab501b6071d42a0d355 (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5

GENTOO_DEPEND_ON_PERL=no

[[ ${PV} == *9999 ]] && SCM="git-2"
EGIT_REPO_URI="git://git.kernel.org/pub/scm/git/git.git"
EGIT_MASTER=pu

inherit toolchain-funcs eutils ${SCM}

MY_PV="${PV/_rc/.rc}"
MY_PV="${MY_PV/gitweb/git}"
MY_P="${PN}-${MY_PV}"
MY_P="${MY_P/gitweb/git}"

DESCRIPTION="A web interface to git"
HOMEPAGE="http://www.git-scm.com/"
if [[ "$PV" != *9999 ]]; then
	SRC_URI_SUFFIX="xz"
	SRC_URI_GOOG="http://git-core.googlecode.com/files"
	SRC_URI_KORG="mirror://kernel/software/scm/git"
	SRC_URI="${SRC_URI_GOOG}/${MY_P}.tar.${SRC_URI_SUFFIX}
			${SRC_URI_KORG}/${MY_P}.tar.${SRC_URI_SUFFIX}"
	KEYWORDS="~amd64 ~x86"
fi

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

# Common to both DEPEND and RDEPEND
CDEPEND="
	~dev-vcs/git-${PV}
	sys-libs/zlib
	dev-lang/perl:=[-build(-)]
	dev-libs/libpcre
	dev-lang/tk:="

RDEPEND="${CDEPEND}
	dev-vcs/git[-cgi]
	dev-perl/Error
	dev-perl/Net-SMTP-SSL
	dev-perl/Authen-SASL
	virtual/perl-CGI highlight? ( app-text/highlight )"

DEPEND="${CDEPEND}"

SITEFILE=50${PN}-gentoo.el
S="${WORKDIR}/${MY_P}"

src_unpack() {
	if [[ "${PV}" != *9999 ]]; then
		unpack ${MY_P}.tar.${SRC_URI_SUFFIX}
		cd "${S}"
	else
		git-2_src_unpack
		cd "${S}"
		#cp "${FILESDIR}"/GIT-VERSION-GEN .
	fi

}

src_prepare() {
	epatch_user

	sed -i \
		-e 's:^\(CFLAGS[[:space:]]*=\).*$:\1 $(OPTCFLAGS) -Wall:' \
		-e 's:^\(LDFLAGS[[:space:]]*=\).*$:\1 $(OPTLDFLAGS):' \
		-e 's:^\(CC[[:space:]]* =\).*$:\1$(OPTCC):' \
		-e 's:^\(AR[[:space:]]* =\).*$:\1$(OPTAR):' \
		-e "s:\(PYTHON_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
		-e "s:\(PERL_PATH[[:space:]]\+=[[:space:]]\+\)\(.*\)$:\1${EPREFIX}\2:" \
		Makefile || die "sed failed"

	# Never install the private copy of Error.pm (bug #296310)
	sed -i \
		-e '/private-Error.pm/s,^,#,' \
		perl/Makefile.PL
}

git_emake() {
	local MY_MAKEOPTS="INSTALLDIRS=vendor"
	emake ${MY_MAKEOPTS} \
		DESTDIR="${D}" \
		OPTCFLAGS="${CFLAGS}" \
		OPTLDFLAGS="${LDFLAGS}" \
		OPTCC="$(tc-getCC)" \
		OPTAR="$(tc-getAR)" \
		prefix="${EPREFIX}"/usr \
		htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
		sysconfdir="${EPREFIX}"/etc \
		PERL_PATH="${EPREFIX}/usr/bin/env perl" \
		PERL_MM_OPT="" \
		GIT_TEST_OPTS="--no-color" \
		V=1 \
		"$@"
}

src_configure() {
	einfo "Nothing to configure."
}

src_compile() {
	git_emake perl/PM.stamp || die "emake perl/PM.stamp failed"
	git_emake perl/perl.mak || die "emake perl/perl.mak failed"

	git_emake \
		gitweb \
		|| die "emake gitweb failed"
}

src_install() {
	#if use perl && use cgi ; then
	# dosym /usr/share/gitweb /usr/share/${PN}/gitweb

	# INSTALL discusses configuration issues, not just installation
	docinto /
	newdoc "${S}"/gitweb/INSTALL INSTALL.gitweb
	newdoc "${S}"/gitweb/README README.gitweb

	find "${ED}"/usr/lib64/perl5/ \
		-name .packlist \
		-exec rm \{\} \;
	#else
	#	rm -rf "${ED}"/usr/share/gitweb
	#fi

	exeinto /usr/share/gitweb/
	doexe "${S}"/gitweb/gitweb.cgi

	insinto /usr/share/gitweb/static
	doins "${S}"/gitweb/static/*.png
	doins "${S}"/gitweb/static/*.css
	doins "${S}"/gitweb/static/*.js

	# Maybe not needed, but it's created when non-split ebuild is used too.
	dosym /usr/share/gitweb /usr/share/git/gitweb

	# perl_delete_localpod from perl-module: not needed
}

showpkgdeps() {
	local pkg=$1
	shift
	elog "  $(printf "%-17s:" ${pkg}) ${@}"
}

pkg_postinst() {
	elog "These additional scripts need some dependencies:"
	echo
	showpkgdeps git-quiltimport "dev-util/quilt"
	showpkgdeps git-instaweb \
		"|| ( www-servers/lighttpd www-servers/apache www-servers/nginx )"
	echo
}