blob: 3622b9709d5a99b08c0890b7610a64524795ced7 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001SUMMARY = "Distributed version control system"
2HOMEPAGE = "http://git-scm.com"
3DESCRIPTION = "Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency."
4SECTION = "console/utils"
5LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later"
6DEPENDS = "openssl zlib"
7
8PROVIDES:append:class-native = " git-replacement-native"
9
10SRC_URI = "${KERNELORG_MIRROR}/software/scm/git/git-${PV}.tar.gz;name=tarball \
11 file://fixsort.patch \
12 file://0001-config.mak.uname-do-not-force-RHEL-7-specific-build-.patch \
13 "
14
15S = "${WORKDIR}/git-${PV}"
16
17LIC_FILES_CHKSUM = "\
18 file://COPYING;md5=7c0d7ef03a7eb04ce795b0f60e68e7e1 \
19 file://reftable/LICENSE;md5=1a6424cafc4c9c88c689848e165af33b \
20 file://sha1dc/LICENSE.txt;md5=9bbe4c990a9e98ea4b98ef5d3bcb8a7a \
21 file://compat/nedmalloc/License.txt;md5=e4224ccaecb14d942c71d31bef20d78c \
22 file://compat/inet_ntop.c;md5=76593c6f74e8ced5b24520175688d59b;endline=16 \
23 file://compat/obstack.h;md5=08ad25fee5428cd879ceef451ce3a22e;endline=18 \
24 file://compat/poll/poll.h;md5=9fc00170a53b8e3e52157c91ac688dd1;endline=19 \
25 file://compat/regex/regex.h;md5=30cc8af0e6f0f8a25acec6d8783bb763;beginline=4;endline=22 \
26"
27
28CVE_PRODUCT = "git-scm:git"
29
30# This is about a manpage not mentioning --mirror may "leak" information
31# in mirrored git repos. Most OE users wouldn't build the docs and
32# we don't see this as a major issue for our general users/usecases.
33CVE_CHECK_IGNORE += "CVE-2022-24975"
34
35PACKAGECONFIG ??= "expat curl"
36PACKAGECONFIG[cvsserver] = ""
37PACKAGECONFIG[svn] = ""
38PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native"
39PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl"
40PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat"
41
42EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \
43 --without-tcltk \
44 --without-iconv \
45"
46EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig "
47
48# Needs brokensep as this doesn't use automake
49inherit autotools-brokensep perlnative bash-completion manpages
50
51EXTRA_OEMAKE = "NO_PYTHON=1 CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
52EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'"
53EXTRA_OEMAKE += "COMPUTE_HEADER_DEPENDENCIES=no"
54EXTRA_OEMAKE:append:class-native = " NO_CROSS_DIRECTORY_HARDLINKS=1"
55
56do_compile:prepend () {
57 # Remove perl/perl.mak to fix the out-of-date perl.mak error
58 # during rebuild
59 rm -f perl/perl.mak
60
61 if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
62 oe_runmake man
63 fi
64}
65
66do_install () {
67 oe_runmake install DESTDIR="${D}" bindir=${bindir} \
68 template_dir=${datadir}/git-core/templates
69
70 install -d ${D}/${datadir}/bash-completion/completions/
71 install -m 644 ${S}/contrib/completion/git-completion.bash ${D}/${datadir}/bash-completion/completions/git
72
73 if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
74 # Needs to be serial with make 4.4 due to https://savannah.gnu.org/bugs/index.php?63362
75 make install-man DESTDIR="${D}"
76 fi
77}
78
79perl_native_fixup () {
80 sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \
81 -e 's#${libdir}/perl-native/#${libdir}/#' \
82 ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')}
83
84 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then
85 # Only install the git cvsserver command if explicitly requested
86 # as it requires the DBI Perl module, which does not exist in
87 # OE-Core.
88 rm ${D}${libexecdir}/git-core/git-cvsserver \
89 ${D}${bindir}/git-cvsserver
90 fi
91
92 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then
93 # Only install the git svn command and all Git::SVN Perl modules
94 # if explicitly requested as they require the SVN::Core Perl
95 # module, which does not exist in OE-Core.
96 rm -r ${D}${libexecdir}/git-core/git-svn \
97 ${D}${datadir}/perl5/Git/SVN*
98 fi
99}
100
101REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core"
102REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates"
103
104do_install:append:class-target () {
105 perl_native_fixup
106}
107
108do_install:append:class-native() {
109 create_wrapper ${D}${bindir}/git \
110 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
111 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
112}
113
114do_install:append:class-nativesdk() {
115 create_wrapper ${D}${bindir}/git \
116 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
117 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
118 perl_native_fixup
119}
120
121FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/"
122
123PERLTOOLS = " \
124 ${bindir}/git-cvsserver \
125 ${libexecdir}/git-core/git-add--interactive \
126 ${libexecdir}/git-core/git-archimport \
127 ${libexecdir}/git-core/git-cvsexportcommit \
128 ${libexecdir}/git-core/git-cvsimport \
129 ${libexecdir}/git-core/git-cvsserver \
130 ${libexecdir}/git-core/git-send-email \
131 ${libexecdir}/git-core/git-svn \
132 ${libexecdir}/git-core/git-instaweb \
133 ${datadir}/gitweb/gitweb.cgi \
134 ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
135 ${datadir}/git-core/templates/hooks/pre-rebase.sample \
136 ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
137"
138
139# Git tools requiring perl
140PACKAGES =+ "${PN}-perltools"
141FILES:${PN}-perltools += " \
142 ${PERLTOOLS} \
143 ${libdir}/perl \
144 ${datadir}/perl5 \
145"
146
147RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils"
148
149# git-tk package with gitk and git-gui
150PACKAGES =+ "${PN}-tk"
151#RDEPENDS:${PN}-tk = "${PN} tk tcl"
152#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh"
153FILES:${PN}-tk = " \
154 ${bindir}/gitk \
155 ${datadir}/gitk \
156"
157
158PACKAGES =+ "gitweb"
159FILES:gitweb = "${datadir}/gitweb/"
160RDEPENDS:gitweb = "perl"
161
162BBCLASSEXTEND = "native nativesdk"
163
164EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \
165 ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \
166 "
167EXTRA_OEMAKE += "NO_GETTEXT=1"
168
169SRC_URI[tarball.sha256sum] = "d929fe67cef7ac3ca709d2b56a9920f17112d5a524bf8112af37ec045a7a5109"