meson: replace bashism is POSIX shell compliant code (#463)

This commit is contained in:
Baptiste Daroussin 2021-11-25 08:54:38 +01:00 committed by GitHub
parent 8fc0f6e531
commit 262327a795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -222,15 +222,15 @@ install_subdir(
# because configure_file strips the backslash in e.g. \@display, # because configure_file strips the backslash in e.g. \@display,
# resulting in @display, breaking our Perl code: # resulting in @display, breaking our Perl code:
# https://github.com/mesonbuild/meson/issues/7165 # https://github.com/mesonbuild/meson/issues/7165
bash = find_program('bash') sh = find_program('sh')
replace_dirs = [ replace_dirs = [
bash, '-c', # Use bash to capture output and mark as executable sh, '-c', # Use bash to capture output and mark as executable
'sed -e \'s,@abs_top_builddir@,' 'sed -e \'s,@abs_top_builddir@,'
+ meson.current_build_dir() + meson.current_build_dir()
+ ',g;s,@abs_top_srcdir@,' + ',g;s,@abs_top_srcdir@,'
+ meson.current_source_dir()+',g\'' + meson.current_source_dir()+',g\''
# Only mark files ending in .pl as executables # Only mark files ending in .pl as executables
+ ' "$0" > "$1" && { [[ "${1##*.}" == pl ]] && chmod +x "$1" || true; }', + ' "$0" > "$1" && { [ "${1##*.}" = pl ] && chmod +x "$1" || true; }',
'@INPUT0@', # $0 '@INPUT0@', # $0
'@OUTPUT0@', # $1 '@OUTPUT0@', # $1
] ]