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