Skip to content

Commit 496ef81

Browse files
committed
Merge branch 'rj/build-tweaks-part2' into seen
Updates to meson-based build procedure. * rj/build-tweaks-part2: configure.ac: upgrade to a compilation check for sysinfo meson.build: correct setting of GIT_EXEC_PATH meson: correct path to system config/attribute files meson: correct install location of YAML.pm meson.build: quote the GITWEBDIR build configuration
2 parents 2e7e4ad + 33c951f commit 496ef81

File tree

4 files changed

+52
-13
lines changed

4 files changed

+52
-13
lines changed

configure.ac

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,9 +1069,28 @@ GIT_CONF_SUBST([CHARSET_LIB])
10691069

10701070
#
10711071
# Define HAVE_SYSINFO=YesPlease if sysinfo is available.
1072-
GIT_CHECK_FUNC(sysinfo,
1073-
[HAVE_SYSINFO=YesPlease],
1074-
[HAVE_SYSINFO=])
1072+
#
1073+
AC_DEFUN([HAVE_SYSINFO_SRC], [
1074+
AC_LANG_PROGRAM([[
1075+
#include <stdint.h>
1076+
#include <sys/sysinfo.h>
1077+
]], [[
1078+
struct sysinfo si;
1079+
uint64_t t = 0;
1080+
if (!sysinfo(&si)) {
1081+
t = si.totalram;
1082+
if (si.mem_unit > 1)
1083+
t *= (uint64_t)si.mem_unit;
1084+
}
1085+
return t;
1086+
]])])
1087+
1088+
AC_MSG_CHECKING([for sysinfo])
1089+
AC_COMPILE_IFELSE([HAVE_SYSINFO_SRC],
1090+
[AC_MSG_RESULT([yes])
1091+
HAVE_SYSINFO=YesPlease],
1092+
[AC_MSG_RESULT([no])
1093+
HAVE_SYSINFO=])
10751094
GIT_CONF_SUBST([HAVE_SYSINFO])
10761095

10771096
#

meson.build

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ build_options_config.set('GIT_TEST_OPTS', '')
743743
build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
744744
build_options_config.set_quoted('GIT_TEST_UTF8_LOCALE', get_option('test_utf8_locale'))
745745
build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
746-
build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
746+
build_options_config.set_quoted('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
747747

748748
if get_option('sane_tool_path').length() != 0
749749
sane_tool_path = (host_machine.system() == 'windows' ? ';' : ':').join(get_option('sane_tool_path'))
@@ -761,8 +761,6 @@ endif
761761
libgit_c_args = [
762762
'-DBINDIR="' + get_option('bindir') + '"',
763763
'-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
764-
'-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
765-
'-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
766764
'-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
767765
'-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
768766
'-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
@@ -773,6 +771,20 @@ libgit_c_args = [
773771
'-DSHELL_PATH="' + fs.as_posix(target_shell.full_path()) + '"',
774772
]
775773

774+
system_attributes = get_option('gitattributes')
775+
if system_attributes != ''
776+
libgit_c_args += '-DETC_GITATTRIBUTES="' + system_attributes + '"'
777+
else
778+
libgit_c_args += '-DETC_GITATTRIBUTES="' + get_option('sysconfdir') / 'gitattributes"'
779+
endif
780+
781+
system_config = get_option('gitconfig')
782+
if system_config != ''
783+
libgit_c_args += '-DETC_GITCONFIG="' + system_config + '"'
784+
else
785+
libgit_c_args += '-DETC_GITCONFIG="' + get_option('sysconfdir') / 'gitconfig"'
786+
endif
787+
776788
editor_opt = get_option('default_editor')
777789
if editor_opt != '' and editor_opt != 'vi'
778790
libgit_c_args += '-DDEFAULT_EDITOR="' + editor_opt + '"'
@@ -1584,10 +1596,19 @@ else
15841596
error('Unsupported CSPRNG backend: ' + csprng_backend)
15851597
endif
15861598

1599+
git_exec_path = 'libexec/git-core'
1600+
libexec = get_option('libexecdir')
1601+
if libexec != 'libexec' and libexec != '.'
1602+
git_exec_path = libexec
1603+
endif
1604+
15871605
if get_option('runtime_prefix')
15881606
libgit_c_args += '-DRUNTIME_PREFIX'
15891607
build_options_config.set('RUNTIME_PREFIX', 'true')
1590-
git_exec_path = get_option('libexecdir') / 'git-core'
1608+
1609+
if git_exec_path.startswith('/')
1610+
error('runtime_prefix requires a relative libexecdir not:', libexec)
1611+
endif
15911612

15921613
if compiler.has_header('mach-o/dyld.h')
15931614
libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
@@ -1624,7 +1645,6 @@ if get_option('runtime_prefix')
16241645
endif
16251646
else
16261647
build_options_config.set('RUNTIME_PREFIX', 'false')
1627-
git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core'
16281648
endif
16291649
libgit_c_args += '-DGIT_EXEC_PATH="' + git_exec_path + '"'
16301650

meson_options.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ option('default_pager', type: 'string', value: 'less',
77
description: 'Fall-back pager.')
88
option('default_editor', type: 'string', value: 'vi',
99
description: 'Fall-back editor.')
10-
option('gitconfig', type: 'string', value: '/etc/gitconfig',
11-
description: 'Path to the global git configuration file.')
12-
option('gitattributes', type: 'string', value: '/etc/gitattributes',
13-
description: 'Path to the global git attributes file.')
10+
option('gitconfig', type: 'string', # default 'etc/gitconfig'
11+
description: 'Path to the global git configuration file. (default: etc/gitconfig)')
12+
option('gitattributes', type: 'string', # default 'etc/gitattributes'
13+
description: 'Path to the global git attributes file. (default: etc/gitattributes)')
1414
option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
1515
description: 'Environment used when spawning the pager')
1616
option('perl_cpan_fallback', type: 'boolean', value: true,

perl/Git/SVN/Memoize/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ test_dependencies += custom_target(
33
output: 'YAML.pm',
44
command: generate_perl_command,
55
install: true,
6-
install_dir: perllibdir / 'Git/SVN',
6+
install_dir: perllibdir / 'Git/SVN/Memoize',
77
depends: [git_version_file],
88
)

0 commit comments

Comments
 (0)