mirror of https://github.com/djcb/mu.git
build: use date.py instead of date
MacOS (and others) "date" command don't support all the options that GNU date has. So don't depend on that, add a small python program for this.
This commit is contained in:
parent
967b724e75
commit
d8c224ae8e
|
@ -105,7 +105,6 @@ configure.lineno
|
||||||
/lib/doxyfile
|
/lib/doxyfile
|
||||||
/version.texi
|
/version.texi
|
||||||
/compile
|
/compile
|
||||||
build-aux/
|
|
||||||
/TAGS
|
/TAGS
|
||||||
parse
|
parse
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/env python
|
||||||
|
#The MacOS 'date' is not quite up to GNU standards
|
||||||
|
import sys
|
||||||
|
from datetime import datetime
|
||||||
|
date=datetime.strptime(sys.argv[1],'%Y-%m-%d')
|
||||||
|
print(date.strftime(sys.argv[2]))
|
||||||
|
#
|
||||||
|
# ./date.py 2023-10-14 "The year-month is %y %m"
|
||||||
|
#
|
16
meson.build
16
meson.build
|
@ -99,21 +99,22 @@ endforeach
|
||||||
cxx.check_header('charconv', required:true)
|
cxx.check_header('charconv', required:true)
|
||||||
|
|
||||||
|
|
||||||
|
build_aux = join_paths(meson.current_source_dir(), 'build-aux')
|
||||||
################################################################################
|
################################################################################
|
||||||
# derived date values (based on 'mu-date'); used in docs
|
# derived date values (based on 'mu-date'); used in docs
|
||||||
date=find_program('date', required:true)
|
# we can't use the 'date' because MacOS 'date' is incompatible with GNU's.
|
||||||
|
pdate=join_paths(build_aux, 'date.py')
|
||||||
env = environment()
|
env = environment()
|
||||||
env.set('LANG', 'C')
|
env.set('LANG', 'C')
|
||||||
mu_day_month_year = run_command(date, '-u', '+%d %B %Y', '--date', mu_date,
|
mu_day_month_year = run_command(pdate, mu_date, '%d %B %Y',
|
||||||
check:true, capture:true,
|
check:true, capture:true,
|
||||||
env: env).stdout().strip()
|
env: env).stdout().strip()
|
||||||
mu_month_year = run_command(date, '-u', '+%B %Y', '--date', mu_date,
|
mu_month_year = run_command(pdate, mu_date, '%B %Y',
|
||||||
check:true, capture:true,
|
check:true, capture:true,
|
||||||
env: env).stdout().strip()
|
env: env).stdout().strip()
|
||||||
mu_year = run_command(date, '-u', '+%Y', '--date', mu_date,
|
mu_year = run_command(pdate, mu_date, '%Y',
|
||||||
check:true, capture:true, env: env).stdout().strip()
|
check:true, capture:true, env: env).stdout().strip()
|
||||||
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# config.h setup
|
# config.h setup
|
||||||
#
|
#
|
||||||
|
@ -239,8 +240,7 @@ else
|
||||||
if not install_info.found()
|
if not install_info.found()
|
||||||
message('install-info not found')
|
message('install-info not found')
|
||||||
else
|
else
|
||||||
install_info_script=join_paths(meson.current_source_dir(), 'build-aux',
|
install_info_script=join_paths(build_aux, 'meson-install-info.sh')
|
||||||
'meson-install-info.sh')
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ version_texi_data.set('UPDATED', mu_day_month_year)
|
||||||
version_texi_data.set('UPDATEDMONTH', mu_month_year)
|
version_texi_data.set('UPDATEDMONTH', mu_month_year)
|
||||||
version_texi_data.set('UPDATEDYEAR', mu_year)
|
version_texi_data.set('UPDATEDYEAR', mu_year)
|
||||||
|
|
||||||
configure_file(input: join_paths('build-aux', 'version.texi.in'),
|
configure_file(input: join_paths(build_aux, 'version.texi.in'),
|
||||||
output: 'version.texi',
|
output: 'version.texi',
|
||||||
configuration: version_texi_data)
|
configuration: version_texi_data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue