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