blob: 222e545f6095141401b0fb185f024868e095f556 [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"
Patrick Williams864cc432023-02-09 14:54:44 -060034# This is specific to Git-for-Windows
35CVE_CHECK_IGNORE += "CVE-2022-41953"
Andrew Geissler517393d2023-01-13 08:55:19 -060036
37PACKAGECONFIG ??= "expat curl"
38PACKAGECONFIG[cvsserver] = ""
39PACKAGECONFIG[svn] = ""
40PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native"
41PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl"
42PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat"
43
44EXTRA_OECONF = "--with-perl=${STAGING_BINDIR_NATIVE}/perl-native/perl \
45 --without-tcltk \
46 --without-iconv \
47"
48EXTRA_OECONF:append:class-nativesdk = " --with-gitconfig=/etc/gitconfig "
49
50# Needs brokensep as this doesn't use automake
51inherit autotools-brokensep perlnative bash-completion manpages
52
53EXTRA_OEMAKE = "NO_PYTHON=1 CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
54EXTRA_OEMAKE += "'PERL_PATH=/usr/bin/env perl'"
55EXTRA_OEMAKE += "COMPUTE_HEADER_DEPENDENCIES=no"
56EXTRA_OEMAKE:append:class-native = " NO_CROSS_DIRECTORY_HARDLINKS=1"
57
58do_compile:prepend () {
59 # Remove perl/perl.mak to fix the out-of-date perl.mak error
60 # during rebuild
61 rm -f perl/perl.mak
62
63 if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
64 oe_runmake man
65 fi
66}
67
68do_install () {
69 oe_runmake install DESTDIR="${D}" bindir=${bindir} \
70 template_dir=${datadir}/git-core/templates
71
72 install -d ${D}/${datadir}/bash-completion/completions/
73 install -m 644 ${S}/contrib/completion/git-completion.bash ${D}/${datadir}/bash-completion/completions/git
74
75 if [ "${@bb.utils.filter('PACKAGECONFIG', 'manpages', d)}" ]; then
76 # Needs to be serial with make 4.4 due to https://savannah.gnu.org/bugs/index.php?63362
77 make install-man DESTDIR="${D}"
78 fi
79}
80
81perl_native_fixup () {
82 sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \
83 -e 's#${libdir}/perl-native/#${libdir}/#' \
84 ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')}
85
86 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then
87 # Only install the git cvsserver command if explicitly requested
88 # as it requires the DBI Perl module, which does not exist in
89 # OE-Core.
90 rm ${D}${libexecdir}/git-core/git-cvsserver \
91 ${D}${bindir}/git-cvsserver
92 fi
93
94 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then
95 # Only install the git svn command and all Git::SVN Perl modules
96 # if explicitly requested as they require the SVN::Core Perl
97 # module, which does not exist in OE-Core.
98 rm -r ${D}${libexecdir}/git-core/git-svn \
99 ${D}${datadir}/perl5/Git/SVN*
100 fi
101}
102
103REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core"
104REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates"
105
106do_install:append:class-target () {
107 perl_native_fixup
108}
109
110do_install:append:class-native() {
111 create_wrapper ${D}${bindir}/git \
112 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
113 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
114}
115
116do_install:append:class-nativesdk() {
117 create_wrapper ${D}${bindir}/git \
118 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
119 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
120 perl_native_fixup
121}
122
123FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/"
124
125PERLTOOLS = " \
126 ${bindir}/git-cvsserver \
127 ${libexecdir}/git-core/git-add--interactive \
128 ${libexecdir}/git-core/git-archimport \
129 ${libexecdir}/git-core/git-cvsexportcommit \
130 ${libexecdir}/git-core/git-cvsimport \
131 ${libexecdir}/git-core/git-cvsserver \
132 ${libexecdir}/git-core/git-send-email \
133 ${libexecdir}/git-core/git-svn \
134 ${libexecdir}/git-core/git-instaweb \
135 ${datadir}/gitweb/gitweb.cgi \
136 ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
137 ${datadir}/git-core/templates/hooks/pre-rebase.sample \
138 ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
139"
140
141# Git tools requiring perl
142PACKAGES =+ "${PN}-perltools"
143FILES:${PN}-perltools += " \
144 ${PERLTOOLS} \
145 ${libdir}/perl \
146 ${datadir}/perl5 \
147"
148
149RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils"
150
151# git-tk package with gitk and git-gui
152PACKAGES =+ "${PN}-tk"
153#RDEPENDS:${PN}-tk = "${PN} tk tcl"
154#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh"
155FILES:${PN}-tk = " \
156 ${bindir}/gitk \
157 ${datadir}/gitk \
158"
159
160PACKAGES =+ "gitweb"
161FILES:gitweb = "${datadir}/gitweb/"
162RDEPENDS:gitweb = "perl"
163
164BBCLASSEXTEND = "native nativesdk"
165
166EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \
167 ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \
168 "
169EXTRA_OEMAKE += "NO_GETTEXT=1"
170
Andrew Geissler6aa7eec2023-03-03 12:41:14 -0600171SRC_URI[tarball.sha256sum] = "fb6807d1eb4094bb2349ab97d203fe1e6c3eb28af73ea391decfbd3a03c02e85"