Skip to content

Commit 9420517

Browse files
committed
Merge branch 'rj/build-tweaks-part2' into seen
* 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 6b0ed5d + b608346 commit 9420517

File tree

4 files changed

+48
-11
lines changed

4 files changed

+48
-11
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: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ build_options_config.set('GIT_TEST_OPTS', '')
744744
build_options_config.set('GIT_TEST_PERL_FATAL_WARNINGS', '')
745745
build_options_config.set_quoted('GIT_TEST_UTF8_LOCALE', get_option('test_utf8_locale'))
746746
build_options_config.set_quoted('LOCALEDIR', fs.as_posix(get_option('prefix') / get_option('localedir')))
747-
build_options_config.set('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
747+
build_options_config.set_quoted('GITWEBDIR', fs.as_posix(get_option('prefix') / get_option('datadir') / 'gitweb'))
748748

749749
if get_option('sane_tool_path').length() != 0
750750
sane_tool_path = (host_machine.system() == 'windows' ? ';' : ':').join(get_option('sane_tool_path'))
@@ -762,8 +762,6 @@ endif
762762
libgit_c_args = [
763763
'-DBINDIR="' + get_option('bindir') + '"',
764764
'-DDEFAULT_GIT_TEMPLATE_DIR="' + get_option('datadir') / 'git-core/templates' + '"',
765-
'-DETC_GITATTRIBUTES="' + get_option('gitattributes') + '"',
766-
'-DETC_GITCONFIG="' + get_option('gitconfig') + '"',
767765
'-DFALLBACK_RUNTIME_PREFIX="' + get_option('prefix') + '"',
768766
'-DGIT_HOST_CPU="' + host_machine.cpu_family() + '"',
769767
'-DGIT_HTML_PATH="' + get_option('datadir') / 'doc/git-doc"',
@@ -774,6 +772,18 @@ libgit_c_args = [
774772
'-DSHELL_PATH="' + fs.as_posix(target_shell.full_path()) + '"',
775773
]
776774

775+
system_attributes = get_option('gitattributes')
776+
if system_attributes != ''
777+
libgit_c_args += '-DETC_GITATTRIBUTES="' + system_attributes + '"'
778+
else
779+
libgit_c_args += '-DETC_GITATTRIBUTES="' + get_option('sysconfdir') + '/gitattributes"'
780+
endif
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
777787
editor_opt = get_option('default_editor')
778788
if editor_opt != '' and editor_opt != 'vi'
779789
libgit_c_args += '-DDEFAULT_EDITOR="' + editor_opt + '"'
@@ -1585,10 +1595,19 @@ else
15851595
error('Unsupported CSPRNG backend: ' + csprng_backend)
15861596
endif
15871597

1598+
git_exec_path = 'libexec/git-core'
1599+
libexec = get_option('libexecdir')
1600+
if libexec != 'libexec' and libexec != '.'
1601+
git_exec_path = libexec
1602+
endif
1603+
15881604
if get_option('runtime_prefix')
15891605
libgit_c_args += '-DRUNTIME_PREFIX'
15901606
build_options_config.set('RUNTIME_PREFIX', 'true')
1591-
git_exec_path = get_option('libexecdir') / 'git-core'
1607+
1608+
if git_exec_path.startswith('/')
1609+
error('runtime_prefix requires a relative libexecdir not:', libexec)
1610+
endif
15921611

15931612
if compiler.has_header('mach-o/dyld.h')
15941613
libgit_c_args += '-DHAVE_NS_GET_EXECUTABLE_PATH'
@@ -1625,7 +1644,6 @@ if get_option('runtime_prefix')
16251644
endif
16261645
else
16271646
build_options_config.set('RUNTIME_PREFIX', 'false')
1628-
git_exec_path = get_option('prefix') / get_option('libexecdir') / 'git-core'
16291647
endif
16301648
libgit_c_args += '-DGIT_EXEC_PATH="' + git_exec_path + '"'
16311649

meson_options.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ 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',
10+
option('gitconfig', type: 'string',
1111
description: 'Path to the global git configuration file.')
12-
option('gitattributes', type: 'string', value: '/etc/gitattributes',
12+
option('gitattributes', type: 'string',
1313
description: 'Path to the global git attributes file.')
1414
option('pager_environment', type: 'string', value: 'LESS=FRX LV=-c',
1515
description: 'Environment used when spawning the pager')

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)