1 |
# Copyright 1999-2010 Gentoo Foundation |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# $Header: /var/cvsroot/gentoo-x86/dev-vcs/git/git-1.7.0.3.ebuild,v 1.5 2010/06/22 18:47:46 arfrever Exp $ |
4 |
|
5 |
EAPI=2 |
6 |
|
7 |
inherit toolchain-funcs eutils elisp-common perl-module bash-completion |
8 |
[ "$PV" == "9999" ] && inherit git |
9 |
|
10 |
MY_PV="${PV/_rc/.rc}" |
11 |
MY_P="${PN}-${MY_PV}" |
12 |
|
13 |
DOC_VER=${MY_PV} |
14 |
|
15 |
DESCRIPTION="GIT - the stupid content tracker, the revision control system heavily used by the Linux kernel team" |
16 |
HOMEPAGE="http://www.git-scm.com/" |
17 |
if [ "$PV" != "9999" ]; then |
18 |
SRC_URI="mirror://kernel/software/scm/git/${MY_P}.tar.bz2 |
19 |
mirror://kernel/software/scm/git/${PN}-manpages-${DOC_VER}.tar.bz2 |
20 |
doc? ( mirror://kernel/software/scm/git/${PN}-htmldocs-${DOC_VER}.tar.bz2 )" |
21 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd" |
22 |
else |
23 |
SRC_URI="" |
24 |
EGIT_BRANCH="master" |
25 |
EGIT_REPO_URI="git://git.kernel.org/pub/scm/git/git.git" |
26 |
# EGIT_REPO_URI="http://www.kernel.org/pub/scm/git/git.git" |
27 |
KEYWORDS="" |
28 |
fi |
29 |
|
30 |
LICENSE="GPL-2" |
31 |
SLOT="0" |
32 |
IUSE="+blksha1 +curl cgi doc emacs gtk iconv +perl ppcsha1 tk +threads +webdav xinetd cvs subversion" |
33 |
|
34 |
# Common to both DEPEND and RDEPEND |
35 |
CDEPEND=" |
36 |
!blksha1? ( dev-libs/openssl ) |
37 |
sys-libs/zlib |
38 |
perl? ( dev-lang/perl ) |
39 |
tk? ( dev-lang/tk ) |
40 |
curl? ( |
41 |
net-misc/curl |
42 |
webdav? ( dev-libs/expat ) |
43 |
) |
44 |
emacs? ( virtual/emacs )" |
45 |
|
46 |
RDEPEND="${CDEPEND} |
47 |
perl? ( dev-perl/Error |
48 |
dev-perl/Net-SMTP-SSL |
49 |
dev-perl/Authen-SASL |
50 |
cgi? ( virtual/perl-CGI ) |
51 |
cvs? ( >=dev-vcs/cvsps-2.1 dev-perl/DBI dev-perl/DBD-SQLite ) |
52 |
subversion? ( dev-vcs/subversion[-dso,perl] dev-perl/libwww-perl dev-perl/TermReadKey ) |
53 |
) |
54 |
gtk? |
55 |
( |
56 |
>=dev-python/pygtk-2.8 |
57 |
|| ( dev-python/pygtksourceview:2 dev-python/gtksourceview-python ) |
58 |
)" |
59 |
|
60 |
# This is how info docs are created with Git: |
61 |
# .txt/asciidoc --(asciidoc)---------> .xml/docbook |
62 |
# .xml/docbook --(docbook2texi.pl)--> .texi |
63 |
# .texi --(makeinfo)---------> .info |
64 |
DEPEND="${CDEPEND} |
65 |
app-arch/cpio |
66 |
doc? ( |
67 |
app-text/asciidoc |
68 |
app-text/docbook2X |
69 |
sys-apps/texinfo |
70 |
)" |
71 |
|
72 |
# Live ebuild builds HTML docs, additionally |
73 |
if [ "$PV" == "9999" ]; then |
74 |
DEPEND="${DEPEND} |
75 |
doc? ( |
76 |
app-text/xmlto |
77 |
)" |
78 |
fi |
79 |
|
80 |
SITEFILE=50${PN}-gentoo.el |
81 |
S="${WORKDIR}/${MY_P}" |
82 |
|
83 |
pkg_setup() { |
84 |
if ! use perl ; then |
85 |
use cgi && ewarn "gitweb needs USE=perl, ignoring USE=cgi" |
86 |
use cvs && ewarn "CVS integration needs USE=perl, ignoring USE=cvs" |
87 |
use subversion && ewarn "git-svn needs USE=perl, it won't work" |
88 |
fi |
89 |
if use webdav && ! use curl ; then |
90 |
ewarn "USE=webdav needs USE=curl. Ignoring" |
91 |
fi |
92 |
if use subversion && has_version dev-vcs/subversion && built_with_use --missing false dev-vcs/subversion dso ; then |
93 |
ewarn "Per Gentoo bugs #223747, #238586, when subversion is built" |
94 |
ewarn "with USE=dso, there may be weird crashes in git-svn. You" |
95 |
ewarn "have been warned." |
96 |
fi |
97 |
} |
98 |
|
99 |
# This is needed because for some obscure reasons future calls to make don't |
100 |
# pick up these exports if we export them in src_unpack() |
101 |
exportmakeopts() { |
102 |
local myopts |
103 |
|
104 |
if use blksha1 ; then |
105 |
myopts="${myopts} BLK_SHA1=YesPlease" |
106 |
elif use ppcsha1 ; then |
107 |
myopts="${myopts} PPC_SHA1=YesPlease" |
108 |
fi |
109 |
|
110 |
if use curl ; then |
111 |
use webdav || myopts="${myopts} NO_EXPAT=YesPlease" |
112 |
else |
113 |
myopts="${myopts} NO_CURL=YesPlease" |
114 |
fi |
115 |
|
116 |
use iconv \ |
117 |
|| myopts="${myopts} NO_ICONV=YesPlease" |
118 |
use tk \ |
119 |
|| myopts="${myopts} NO_TCLTK=YesPlease" |
120 |
use perl \ |
121 |
&& myopts="${myopts} INSTALLDIRS=vendor" \ |
122 |
|| myopts="${myopts} NO_PERL=YesPlease" |
123 |
use threads \ |
124 |
&& myopts="${myopts} THREADED_DELTA_SEARCH=YesPlease" |
125 |
use subversion \ |
126 |
|| myopts="${myopts} NO_SVN_TESTS=YesPlease" |
127 |
|
128 |
has_version '>=app-text/asciidoc-8.0' \ |
129 |
&& myopts="${myopts} ASCIIDOC8=YesPlease" |
130 |
myopts="${myopts} ASCIIDOC_NO_ROFF=YesPlease" |
131 |
|
132 |
# Bug 290465: |
133 |
# builtin-fetch-pack.c:816: error: 'struct stat' has no member named 'st_mtim' |
134 |
[[ "${CHOST}" == *-uclibc* ]] && \ |
135 |
myopts="${myopts} NO_NSEC=YesPlease" |
136 |
|
137 |
export MY_MAKEOPTS="${myopts}" |
138 |
} |
139 |
|
140 |
src_unpack() { |
141 |
if [ "${PV}" != "9999" ]; then |
142 |
unpack ${MY_P}.tar.bz2 |
143 |
cd "${S}" |
144 |
unpack ${PN}-manpages-${DOC_VER}.tar.bz2 |
145 |
use doc && \ |
146 |
cd "${S}"/Documentation && \ |
147 |
unpack ${PN}-htmldocs-${DOC_VER}.tar.bz2 |
148 |
cd "${S}" |
149 |
else |
150 |
git_src_unpack |
151 |
cd "${S}" |
152 |
#cp "${FILESDIR}"/GIT-VERSION-GEN . |
153 |
fi |
154 |
|
155 |
} |
156 |
|
157 |
src_prepare() { |
158 |
# Noperl is being merged to upstream as of 2009/04/05 |
159 |
#epatch "${FILESDIR}"/20090305-git-1.6.2-noperl.patch |
160 |
|
161 |
# GetOpt-Long v2.38 is strict |
162 |
# Merged in 1.6.3 final 2009/05/07 |
163 |
#epatch "${FILESDIR}"/20090505-git-1.6.2.5-getopt-fixes.patch |
164 |
|
165 |
# JS install fixup |
166 |
epatch "${FILESDIR}"/git-1.7.0-always-install-js.patch |
167 |
|
168 |
sed -i \ |
169 |
-e 's:^\(CFLAGS =\).*$:\1 $(OPTCFLAGS) -Wall:' \ |
170 |
-e 's:^\(LDFLAGS =\).*$:\1 $(OPTLDFLAGS):' \ |
171 |
-e 's:^\(CC = \).*$:\1$(OPTCC):' \ |
172 |
-e 's:^\(AR = \).*$:\1$(OPTAR):' \ |
173 |
Makefile || die "sed failed" |
174 |
|
175 |
# Never install the private copy of Error.pm (bug #296310) |
176 |
sed -i \ |
177 |
-e '/private-Error.pm/s,^,#,' \ |
178 |
perl/Makefile.PL |
179 |
|
180 |
# Fix docbook2texi command |
181 |
sed -i 's/DOCBOOK2X_TEXI=docbook2x-texi/DOCBOOK2X_TEXI=docbook2texi.pl/' \ |
182 |
Documentation/Makefile || die "sed failed" |
183 |
|
184 |
} |
185 |
|
186 |
git_emake() { |
187 |
emake ${MY_MAKEOPTS} \ |
188 |
DESTDIR="${D}" \ |
189 |
OPTCFLAGS="${CFLAGS}" \ |
190 |
OPTLDFLAGS="${LDFLAGS}" \ |
191 |
OPTCC="$(tc-getCC)" \ |
192 |
OPTAR="$(tc-getAR)" \ |
193 |
prefix=/usr \ |
194 |
htmldir=/usr/share/doc/${PF}/html \ |
195 |
"$@" |
196 |
} |
197 |
|
198 |
src_configure() { |
199 |
exportmakeopts |
200 |
} |
201 |
|
202 |
src_compile() { |
203 |
git_emake || die "emake failed" |
204 |
|
205 |
if use emacs ; then |
206 |
elisp-compile contrib/emacs/git{,-blame}.el \ |
207 |
|| die "emacs modules failed" |
208 |
fi |
209 |
|
210 |
if use perl && use cgi ; then |
211 |
git_emake \ |
212 |
gitweb/gitweb.cgi \ |
213 |
|| die "emake gitweb/gitweb.cgi failed" |
214 |
fi |
215 |
|
216 |
cd "${S}"/Documentation |
217 |
if [[ "$PV" == "9999" ]] ; then |
218 |
git_emake man \ |
219 |
|| die "emake man failed" |
220 |
if use doc ; then |
221 |
git_emake info html \ |
222 |
|| die "emake info html failed" |
223 |
fi |
224 |
else |
225 |
if use doc ; then |
226 |
git_emake info \ |
227 |
|| die "emake info html failed" |
228 |
fi |
229 |
fi |
230 |
} |
231 |
|
232 |
src_install() { |
233 |
git_emake \ |
234 |
install || \ |
235 |
die "make install failed" |
236 |
|
237 |
doman man?/*.[157] Documentation/*.[157] |
238 |
|
239 |
dodoc README Documentation/{SubmittingPatches,CodingGuidelines} |
240 |
use doc && dodir /usr/share/doc/${PF}/html |
241 |
for d in / /howto/ /technical/ ; do |
242 |
docinto ${d} |
243 |
dodoc Documentation${d}*.txt |
244 |
use doc && dohtml -p ${d} Documentation${d}*.html |
245 |
done |
246 |
docinto / |
247 |
# Upstream does not ship this pre-built :-( |
248 |
use doc && doinfo Documentation/{git,gitman}.info |
249 |
|
250 |
dobashcompletion contrib/completion/git-completion.bash ${PN} |
251 |
|
252 |
if use emacs ; then |
253 |
elisp-install ${PN} contrib/emacs/git.{el,elc} || die |
254 |
elisp-install ${PN} contrib/emacs/git-blame.{el,elc} || die |
255 |
#elisp-install ${PN}/compat contrib/emacs/vc-git.{el,elc} || die |
256 |
# don't add automatically to the load-path, so the sitefile |
257 |
# can do a conditional loading |
258 |
touch "${D}${SITELISP}/${PN}/compat/.nosearch" |
259 |
elisp-site-file-install "${FILESDIR}"/${SITEFILE} || die |
260 |
fi |
261 |
|
262 |
if use gtk ; then |
263 |
dobin "${S}"/contrib/gitview/gitview |
264 |
dodoc "${S}"/contrib/gitview/gitview.txt |
265 |
fi |
266 |
|
267 |
dobin contrib/fast-import/git-p4 |
268 |
dodoc contrib/fast-import/git-p4.txt |
269 |
newbin contrib/fast-import/import-tars.perl import-tars |
270 |
|
271 |
dodir /usr/share/${PN}/contrib |
272 |
# The following are excluded: |
273 |
# svnimport - use git-svn |
274 |
# p4import - excluded because fast-import has a better one |
275 |
# examples - these are stuff that is not used in Git anymore actually |
276 |
# patches - stuff the Git guys made to go upstream to other places |
277 |
for i in continuous fast-import hg-to-git \ |
278 |
hooks remotes2config.sh stats \ |
279 |
workdir convert-objects blameview ; do |
280 |
cp -rf \ |
281 |
"${S}"/contrib/${i} \ |
282 |
"${D}"/usr/share/${PN}/contrib \ |
283 |
|| die "Failed contrib ${i}" |
284 |
done |
285 |
|
286 |
if use perl && use cgi ; then |
287 |
dodir /usr/share/${PN}/gitweb |
288 |
insinto /usr/share/${PN}/gitweb |
289 |
doins "${S}"/gitweb/gitweb.cgi |
290 |
doins "${S}"/gitweb/gitweb.css |
291 |
js=gitweb.js |
292 |
[ -f "${S}"/gitweb/gitweb.min.js ] && js=gitweb.min.js |
293 |
doins "${S}"/gitweb/${js} |
294 |
doins "${S}"/gitweb/git-{favicon,logo}.png |
295 |
|
296 |
# Make sure it can run |
297 |
fperms 0755 /usr/share/${PN}/gitweb/gitweb.cgi |
298 |
|
299 |
# INSTALL discusses configuration issues, not just installation |
300 |
docinto / |
301 |
newdoc "${S}"/gitweb/INSTALL INSTALL.gitweb |
302 |
newdoc "${S}"/gitweb/README README.gitweb |
303 |
|
304 |
find "${D}"/usr/lib64/perl5/ \ |
305 |
-name .packlist \ |
306 |
-exec rm \{\} \; |
307 |
fi |
308 |
if ! use subversion ; then |
309 |
rm -f "${D}"/usr/libexec/git-core/git-svn \ |
310 |
"${D}"/usr/share/man/man1/git-svn.1* |
311 |
fi |
312 |
|
313 |
if use xinetd ; then |
314 |
insinto /etc/xinetd.d |
315 |
newins "${FILESDIR}"/git-daemon.xinetd git-daemon |
316 |
fi |
317 |
|
318 |
newinitd "${FILESDIR}"/git-daemon.initd git-daemon |
319 |
newconfd "${FILESDIR}"/git-daemon.confd git-daemon |
320 |
|
321 |
fixlocalpod |
322 |
} |
323 |
|
324 |
src_test() { |
325 |
local disabled="" |
326 |
local tests_cvs="t9200-git-cvsexportcommit.sh \ |
327 |
t9400-git-cvsserver-server.sh \ |
328 |
t9401-git-cvsserver-crlf.sh \ |
329 |
t9600-cvsimport.sh \ |
330 |
t9601-cvsimport-vendor-branch.sh \ |
331 |
t9602-cvsimport-branches-tags.sh \ |
332 |
t9603-cvsimport-patchsets.sh" |
333 |
local tests_perl="t5502-quickfetch.sh \ |
334 |
t5512-ls-remote.sh \ |
335 |
t5520-pull.sh" |
336 |
# Bug #225601 - t0004 is not suitable for root perm |
337 |
# Bug #219839 - t1004 is not suitable for root perm |
338 |
# t0001-init.sh - check for init notices EPERM* fails |
339 |
local tests_nonroot="t0001-init.sh \ |
340 |
t0004-unwritable.sh \ |
341 |
t1004-read-tree-m-u-wf.sh \ |
342 |
t3700-add.sh \ |
343 |
t7300-clean.sh" |
344 |
|
345 |
# Unzip is used only for the testcase code, not by any normal parts of Git. |
346 |
if ! has_version app-arch/unzip ; then |
347 |
einfo "Disabling tar-tree tests" |
348 |
disabled="${disabled} t5000-tar-tree.sh" |
349 |
fi |
350 |
|
351 |
cvs=0 |
352 |
use cvs && let cvs=$cvs+1 |
353 |
if [[ ${EUID} -eq 0 ]]; then |
354 |
if [[ $cvs -eq 1 ]]; then |
355 |
ewarn "Skipping CVS tests because CVS does not work as root!" |
356 |
ewarn "You should retest with FEATURES=userpriv!" |
357 |
disabled="${disabled} ${tests_cvs}" |
358 |
fi |
359 |
einfo "Skipping other tests that require being non-root" |
360 |
disabled="${disabled} ${tests_nonroot}" |
361 |
else |
362 |
[[ $cvs -gt 0 ]] && \ |
363 |
has_version dev-vcs/cvs && \ |
364 |
let cvs=$cvs+1 |
365 |
[[ $cvs -gt 1 ]] && \ |
366 |
built_with_use dev-vcs/cvs server && \ |
367 |
let cvs=$cvs+1 |
368 |
if [[ $cvs -lt 3 ]]; then |
369 |
einfo "Disabling CVS tests (needs dev-vcs/cvs[USE=server])" |
370 |
disabled="${disabled} ${tests_cvs}" |
371 |
fi |
372 |
fi |
373 |
|
374 |
if ! use perl ; then |
375 |
einfo "Disabling tests that need Perl" |
376 |
disabled="${disabled} ${tests_perl}" |
377 |
fi |
378 |
|
379 |
# Reset all previously disabled tests |
380 |
cd "${S}/t" |
381 |
for i in *.sh.DISABLED ; do |
382 |
[[ -f "${i}" ]] && mv -f "${i}" "${i%.DISABLED}" |
383 |
done |
384 |
einfo "Disabled tests:" |
385 |
for i in ${disabled} ; do |
386 |
[[ -f "${i}" ]] && mv -f "${i}" "${i}.DISABLED" && einfo "Disabled $i" |
387 |
done |
388 |
cd "${S}" |
389 |
# Now run the tests |
390 |
einfo "Start test run" |
391 |
git_emake \ |
392 |
test || die "tests failed" |
393 |
} |
394 |
|
395 |
showpkgdeps() { |
396 |
local pkg=$1 |
397 |
shift |
398 |
elog " $(printf "%-17s:" ${pkg}) ${@}" |
399 |
} |
400 |
|
401 |
pkg_postinst() { |
402 |
use emacs && elisp-site-regen |
403 |
if use subversion && has_version dev-vcs/subversion && ! built_with_use --missing false dev-vcs/subversion perl ; then |
404 |
ewarn "You must build dev-vcs/subversion with USE=perl" |
405 |
ewarn "to get the full functionality of git-svn!" |
406 |
fi |
407 |
elog "These additional scripts need some dependencies:" |
408 |
echo |
409 |
showpkgdeps git-quiltimport "dev-util/quilt" |
410 |
showpkgdeps git-instaweb \ |
411 |
"|| ( www-servers/lighttpd www-servers/apache )" |
412 |
echo |
413 |
} |
414 |
|
415 |
pkg_postrm() { |
416 |
use emacs && elisp-site-regen |
417 |
} |