blob: d3bd0619af12bb0074c7ed3135fd4cd9e09d2bd3 [file] [log] [blame]
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00001SUMMARY = "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"
Patrick Williams03907ee2022-05-01 06:28:52 -05005LICENSE = "GPL-2.0-only & GPL-2.0-or-later & BSD-3-Clause & MIT & BSL-1.0 & LGPL-2.1-or-later"
Patrick Williams45852732022-04-02 08:58:32 -05006DEPENDS = "openssl zlib"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +00007
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
Patrick Williams03907ee2022-05-01 06:28:52 -050017LIC_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"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000027
28CVE_PRODUCT = "git-scm:git"
29
Patrick Williams03907ee2022-05-01 06:28:52 -050030# 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
Patrick Williams45852732022-04-02 08:58:32 -050035PACKAGECONFIG ??= "expat curl"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000036PACKAGECONFIG[cvsserver] = ""
37PACKAGECONFIG[svn] = ""
38PACKAGECONFIG[manpages] = ",,asciidoc-native xmlto-native"
Patrick Williams45852732022-04-02 08:58:32 -050039PACKAGECONFIG[curl] = "--with-curl,--without-curl,curl"
40PACKAGECONFIG[expat] = "--with-expat,--without-expat,expat"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +000041
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 oe_runmake install-man DESTDIR="${D}"
75 fi
76}
77
78perl_native_fixup () {
79 sed -i -e 's#${STAGING_BINDIR_NATIVE}/perl-native/#${bindir}/#' \
80 -e 's#${libdir}/perl-native/#${libdir}/#' \
81 ${@d.getVar("PERLTOOLS").replace(' /',d.getVar('D') + '/')}
82
83 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'cvsserver', d)}" ]; then
84 # Only install the git cvsserver command if explicitly requested
85 # as it requires the DBI Perl module, which does not exist in
86 # OE-Core.
87 rm ${D}${libexecdir}/git-core/git-cvsserver \
88 ${D}${bindir}/git-cvsserver
89 fi
90
91 if [ ! "${@bb.utils.filter('PACKAGECONFIG', 'svn', d)}" ]; then
92 # Only install the git svn command and all Git::SVN Perl modules
93 # if explicitly requested as they require the SVN::Core Perl
94 # module, which does not exist in OE-Core.
95 rm -r ${D}${libexecdir}/git-core/git-svn \
96 ${D}${datadir}/perl5/Git/SVN*
97 fi
98}
99
100REL_GIT_EXEC_PATH = "${@os.path.relpath(libexecdir, bindir)}/git-core"
101REL_GIT_TEMPLATE_DIR = "${@os.path.relpath(datadir, bindir)}/git-core/templates"
102
103do_install:append:class-target () {
104 perl_native_fixup
105}
106
107do_install:append:class-native() {
108 create_wrapper ${D}${bindir}/git \
109 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
110 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
111}
112
113do_install:append:class-nativesdk() {
114 create_wrapper ${D}${bindir}/git \
115 GIT_EXEC_PATH='`dirname $''realpath`'/${REL_GIT_EXEC_PATH} \
116 GIT_TEMPLATE_DIR='`dirname $''realpath`'/${REL_GIT_TEMPLATE_DIR}
117 perl_native_fixup
118}
119
120FILES:${PN} += "${datadir}/git-core ${libexecdir}/git-core/"
121
122PERLTOOLS = " \
123 ${bindir}/git-cvsserver \
124 ${libexecdir}/git-core/git-add--interactive \
125 ${libexecdir}/git-core/git-archimport \
126 ${libexecdir}/git-core/git-cvsexportcommit \
127 ${libexecdir}/git-core/git-cvsimport \
128 ${libexecdir}/git-core/git-cvsserver \
129 ${libexecdir}/git-core/git-send-email \
130 ${libexecdir}/git-core/git-svn \
131 ${libexecdir}/git-core/git-instaweb \
132 ${datadir}/gitweb/gitweb.cgi \
133 ${datadir}/git-core/templates/hooks/prepare-commit-msg.sample \
134 ${datadir}/git-core/templates/hooks/pre-rebase.sample \
135 ${datadir}/git-core/templates/hooks/fsmonitor-watchman.sample \
136"
137
138# Git tools requiring perl
139PACKAGES =+ "${PN}-perltools"
140FILES:${PN}-perltools += " \
141 ${PERLTOOLS} \
142 ${libdir}/perl \
143 ${datadir}/perl5 \
144"
145
146RDEPENDS:${PN}-perltools = "${PN} perl perl-module-file-path findutils"
147
148# git-tk package with gitk and git-gui
149PACKAGES =+ "${PN}-tk"
Andrew Geissler615f2f12022-07-15 14:00:58 -0500150#RDEPENDS:${PN}-tk = "${PN} tk tcl"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000151#EXTRA_OEMAKE = "TCL_PATH=${STAGING_BINDIR_CROSS}/tclsh"
152FILES:${PN}-tk = " \
153 ${bindir}/gitk \
154 ${datadir}/gitk \
155"
156
157PACKAGES =+ "gitweb"
158FILES:gitweb = "${datadir}/gitweb/"
159RDEPENDS:gitweb = "perl"
160
161BBCLASSEXTEND = "native nativesdk"
162
163EXTRA_OECONF += "ac_cv_snprintf_returns_bogus=no \
164 ac_cv_fread_reads_directories=${ac_cv_fread_reads_directories=yes} \
165 "
166EXTRA_OEMAKE += "NO_GETTEXT=1"
167
Andrew Geissler615f2f12022-07-15 14:00:58 -0500168SRC_URI[tarball.sha256sum] = "fc3ffe6c65c1f7c681a1ce6bb91703866e432c762731d4b57c566d696f6d62c3"