mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'kn/meson-hdr-check'
Add an equivalent to "make hdr-check" target to meson based builds. * kn/meson-hdr-check: makefile/meson: add 'check-headers' as alias for 'hdr-check' meson: add support for 'hdr-check' meson: rename 'third_party_sources' to 'third_party_excludes' meson: move headers definition from 'contrib/coccinelle' coccinelle: meson: rename variables to be more specific ci/github: install git before checking out the repository
This commit is contained in:
14
.github/workflows/main.yml
vendored
14
.github/workflows/main.yml
vendored
@@ -415,6 +415,20 @@ jobs:
|
|||||||
- name: prepare libc6 for actions
|
- name: prepare libc6 for actions
|
||||||
if: matrix.vector.jobname == 'linux32'
|
if: matrix.vector.jobname == 'linux32'
|
||||||
run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6
|
run: apt -q update && apt -q -y install libc6-amd64 lib64stdc++6
|
||||||
|
- name: install git in container
|
||||||
|
run: |
|
||||||
|
if command -v git
|
||||||
|
then
|
||||||
|
: # nothing to do
|
||||||
|
elif command -v apk
|
||||||
|
then
|
||||||
|
apk add --update git
|
||||||
|
elif command -v dnf
|
||||||
|
then
|
||||||
|
dnf -yq update && dnf -yq install git
|
||||||
|
else
|
||||||
|
apt-get -q update && apt-get -q -y install git
|
||||||
|
fi
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- run: ci/install-dependencies.sh
|
- run: ci/install-dependencies.sh
|
||||||
- run: useradd builder --create-home
|
- run: useradd builder --create-home
|
||||||
|
|||||||
4
Makefile
4
Makefile
@@ -3334,8 +3334,10 @@ HCC = $(HCO:hco=hcc)
|
|||||||
$(HCO): %.hco: %.hcc $(GENERATED_H) FORCE
|
$(HCO): %.hco: %.hcc $(GENERATED_H) FORCE
|
||||||
$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
|
$(QUIET_HDR)$(CC) $(ALL_CFLAGS) -o /dev/null -c -xc $<
|
||||||
|
|
||||||
.PHONY: hdr-check $(HCO)
|
# TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+
|
||||||
|
.PHONY: hdr-check check-headers $(HCO)
|
||||||
hdr-check: $(HCO)
|
hdr-check: $(HCO)
|
||||||
|
check-headers: hdr-check
|
||||||
|
|
||||||
.PHONY: style
|
.PHONY: style
|
||||||
style:
|
style:
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make hdr-check ||
|
make check-headers ||
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
make check-pot
|
make check-pot
|
||||||
|
|||||||
@@ -8,21 +8,6 @@ if not spatch.found()
|
|||||||
subdir_done()
|
subdir_done()
|
||||||
endif
|
endif
|
||||||
|
|
||||||
third_party_sources = [
|
|
||||||
':!contrib',
|
|
||||||
':!compat/inet_ntop.c',
|
|
||||||
':!compat/inet_pton.c',
|
|
||||||
':!compat/nedmalloc',
|
|
||||||
':!compat/obstack.*',
|
|
||||||
':!compat/poll',
|
|
||||||
':!compat/regex',
|
|
||||||
':!sha1collisiondetection',
|
|
||||||
':!sha1dc',
|
|
||||||
':!t/unit-tests/clar',
|
|
||||||
':!t/unit-tests/clar',
|
|
||||||
':!t/t[0-9][0-9][0-9][0-9]*',
|
|
||||||
]
|
|
||||||
|
|
||||||
rules = [
|
rules = [
|
||||||
'array.cocci',
|
'array.cocci',
|
||||||
'commit.cocci',
|
'commit.cocci',
|
||||||
@@ -55,18 +40,18 @@ concatenated_rules = custom_target(
|
|||||||
capture: true,
|
capture: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
sources = [ ]
|
coccinelle_sources = []
|
||||||
foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_sources, check: true).stdout().split()
|
foreach source : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.c', third_party_excludes, check: true).stdout().split()
|
||||||
sources += source
|
coccinelle_sources += source
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
headers = [ ]
|
coccinelle_headers = []
|
||||||
foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_sources, check: true).stdout().split()
|
foreach header : headers_to_check
|
||||||
headers += meson.project_source_root() / header
|
coccinelle_headers += meson.project_source_root() / header
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
patches = [ ]
|
patches = [ ]
|
||||||
foreach source : sources
|
foreach source : coccinelle_sources
|
||||||
patches += custom_target(
|
patches += custom_target(
|
||||||
command: [
|
command: [
|
||||||
spatch,
|
spatch,
|
||||||
@@ -78,7 +63,7 @@ foreach source : sources
|
|||||||
input: meson.project_source_root() / source,
|
input: meson.project_source_root() / source,
|
||||||
output: source.underscorify() + '.patch',
|
output: source.underscorify() + '.patch',
|
||||||
capture: true,
|
capture: true,
|
||||||
depend_files: headers,
|
depend_files: coccinelle_headers,
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
|||||||
86
meson.build
86
meson.build
@@ -675,6 +675,28 @@ builtin_sources = [
|
|||||||
'builtin/write-tree.c',
|
'builtin/write-tree.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
third_party_excludes = [
|
||||||
|
':!contrib',
|
||||||
|
':!compat/inet_ntop.c',
|
||||||
|
':!compat/inet_pton.c',
|
||||||
|
':!compat/nedmalloc',
|
||||||
|
':!compat/obstack.*',
|
||||||
|
':!compat/poll',
|
||||||
|
':!compat/regex',
|
||||||
|
':!sha1collisiondetection',
|
||||||
|
':!sha1dc',
|
||||||
|
':!t/unit-tests/clar',
|
||||||
|
':!t/t[0-9][0-9][0-9][0-9]*',
|
||||||
|
':!xdiff',
|
||||||
|
]
|
||||||
|
|
||||||
|
headers_to_check = []
|
||||||
|
if git.found() and fs.exists(meson.project_source_root() / '.git')
|
||||||
|
foreach header : run_command(git, '-C', meson.project_source_root(), 'ls-files', '--deduplicate', '*.h', third_party_excludes, check: true).stdout().split()
|
||||||
|
headers_to_check += header
|
||||||
|
endforeach
|
||||||
|
endif
|
||||||
|
|
||||||
if not get_option('breaking_changes')
|
if not get_option('breaking_changes')
|
||||||
builtin_sources += 'builtin/pack-redundant.c'
|
builtin_sources += 'builtin/pack-redundant.c'
|
||||||
endif
|
endif
|
||||||
@@ -2019,6 +2041,70 @@ endif
|
|||||||
|
|
||||||
subdir('contrib')
|
subdir('contrib')
|
||||||
|
|
||||||
|
exclude_from_check_headers = [
|
||||||
|
'compat/',
|
||||||
|
'unicode-width.h',
|
||||||
|
]
|
||||||
|
|
||||||
|
if sha1_backend != 'openssl'
|
||||||
|
exclude_from_check_headers += 'sha1/openssl.h'
|
||||||
|
endif
|
||||||
|
if sha256_backend != 'openssl'
|
||||||
|
exclude_from_check_headers += 'sha256/openssl.h'
|
||||||
|
endif
|
||||||
|
if sha256_backend != 'nettle'
|
||||||
|
exclude_from_check_headers += 'sha256/nettle.h'
|
||||||
|
endif
|
||||||
|
if sha256_backend != 'gcrypt'
|
||||||
|
exclude_from_check_headers += 'sha256/gcrypt.h'
|
||||||
|
endif
|
||||||
|
|
||||||
|
if headers_to_check.length() != 0 and compiler.get_argument_syntax() == 'gcc'
|
||||||
|
hco_targets = []
|
||||||
|
foreach h : headers_to_check
|
||||||
|
skip_header = false
|
||||||
|
foreach exclude : exclude_from_check_headers
|
||||||
|
if h.startswith(exclude)
|
||||||
|
skip_header = true
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
if skip_header
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
hcc = custom_target(
|
||||||
|
input: h,
|
||||||
|
output: h.underscorify() + 'cc',
|
||||||
|
command: [
|
||||||
|
shell,
|
||||||
|
'-c',
|
||||||
|
'echo \'#include "git-compat-util.h"\' > @OUTPUT@ && echo \'#include "' + h + '"\' >> @OUTPUT@'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
hco = custom_target(
|
||||||
|
input: hcc,
|
||||||
|
output: fs.replace_suffix(h.underscorify(), '.hco'),
|
||||||
|
command: [
|
||||||
|
compiler.cmd_array(),
|
||||||
|
libgit_c_args,
|
||||||
|
'-I', meson.project_source_root(),
|
||||||
|
'-I', meson.project_source_root() / 't/unit-tests',
|
||||||
|
'-o', '/dev/null',
|
||||||
|
'-c', '-xc',
|
||||||
|
'@INPUT@'
|
||||||
|
]
|
||||||
|
)
|
||||||
|
hco_targets += hco
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
# TODO: deprecate 'hdr-check' in lieu of 'check-headers' in Git 2.51+
|
||||||
|
hdr_check = alias_target('hdr-check', hco_targets)
|
||||||
|
alias_target('check-headers', hdr_check)
|
||||||
|
endif
|
||||||
|
|
||||||
foreach key, value : {
|
foreach key, value : {
|
||||||
'DIFF': diff.full_path(),
|
'DIFF': diff.full_path(),
|
||||||
'GIT_SOURCE_DIR': meson.project_source_root(),
|
'GIT_SOURCE_DIR': meson.project_source_root(),
|
||||||
|
|||||||
Reference in New Issue
Block a user