Add script to install files in the dist tarball.

Add a check inside Meson to detect if we're building from a git clone
or a dist tarball.
(in thie later, don't generated INSTALL.in and git-version.h)
This commit is contained in:
Félix Piédallu 2019-11-08 13:17:08 +01:00
parent 86c5720375
commit 9cd0584e90
2 changed files with 50 additions and 33 deletions

View file

@ -15,6 +15,11 @@ conf = configuration_data()
warnings = [] warnings = []
# git-version.h is already present and not generated if dist tarball
is_dist_tarball = run_command('python', '-c',
'import sys,os; sys.exit(0 if os.path.exists("git-version.h") else 1)'
).returncode() == 0
################################################################################ ################################################################################
# Project info # Project info
@ -919,20 +924,20 @@ else
if (not python_found) and (not always_install) if (not python_found) and (not always_install)
error(''' error('''
Python @0@ or PyGObject was not found. Python >=@0@ or PyGObject was not found.
Note that you may install the Python plug-ins even if you have no Python Note that you may install the Python plug-ins even if you have no Python
interpreter at build-time by passing the configure option -Dpython=always. interpreter at build-time by passing the configure option -Dpython=always.
Just make sure that a Python @0@ interpreter is available at run-time. Just make sure that a Python >=@0@ interpreter is available at run-time.
'''.format(python3_required_version)) '''.format(python3_minver))
endif endif
if (not python_found) and (always_install) if (not python_found) and (always_install)
python_warning = ''' python_warning = '''
Python @0@ or PyGObject was not found. Python >=@0@ or PyGObject was not found.
Python plug-ins will be installed anyway but you should make sure that Python plug-ins will be installed anyway but you should make sure that
a compatible Python interpreter is available at installation, otherwise a compatible Python interpreter is available at installation, otherwise
installed plug-ins won't be usable. installed plug-ins won't be usable.
'''.format(python3_required_version) '''.format(python3_minver)
warning(python_warning) warning(python_warning)
warnings += python_warning warnings += python_warning
endif endif
@ -1401,29 +1406,31 @@ endif
##### #### # # # # #### # # ###### ###### #### ##### #### # # # # #### # # ###### ###### ####
if is_dist_tarball
gitversion_h1 = vcs_tag( gitversion_h = files('git-version.h')
input : 'app/git-version.h.in', else
output: 'git-version.h.in.1', gitversion_h1 = vcs_tag(
command: [ 'git', 'describe', '--always', ], input : 'app/git-version.h.in',
replace_string: '@GIMP_GIT_VERSION@', output: 'git-version.h.in.1',
fallback: '', command: [ 'git', 'describe', '--always', ],
) replace_string: '@GIMP_GIT_VERSION@',
gitversion_h2 = vcs_tag( fallback: '',
input : gitversion_h1, )
output: 'git-version.h.in.2', gitversion_h2 = vcs_tag(
command: [ 'git', 'rev-parse', '--short', 'HEAD', ], input : gitversion_h1,
replace_string: '@GIMP_GIT_VERSION_ABBREV@', output: 'git-version.h.in.2',
fallback: '', command: [ 'git', 'rev-parse', '--short', 'HEAD', ],
) replace_string: '@GIMP_GIT_VERSION_ABBREV@',
gitversion_h = vcs_tag( fallback: '',
input : gitversion_h2, )
output: 'git-version.h', gitversion_h = vcs_tag(
command: [ 'git', 'log', '-n1', '--date=format:%Y', '--pretty=%cd', ], input : gitversion_h2,
replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@', output: 'git-version.h',
fallback: '', command: [ 'git', 'log', '-n1', '--date=format:%Y', '--pretty=%cd', ],
) replace_string: '@GIMP_GIT_LAST_COMMIT_YEAR@',
fallback: '',
)
endif
install_conf = configuration_data() install_conf = configuration_data()
install_conf.set('GIMP_APP_VERSION', gimp_app_version) install_conf.set('GIMP_APP_VERSION', gimp_app_version)
@ -1460,11 +1467,13 @@ install_conf.set('WEBP_REQUIRED_VERSION', webp_minver)
install_conf.set('WMF_REQUIRED_VERSION', wmf_minver) install_conf.set('WMF_REQUIRED_VERSION', wmf_minver)
install_conf.set('XGETTEXT_REQUIRED_VERSION', '0.19') install_conf.set('XGETTEXT_REQUIRED_VERSION', '0.19')
configure_file( if not is_dist_tarball
input : 'INSTALL.in', INSTALL = configure_file(
output: 'INSTALL', input : 'INSTALL.in',
configuration: install_conf output: 'INSTALL',
) configuration: install_conf
)
endif
configure_file( configure_file(
@ -1547,6 +1556,8 @@ custom_target('Changelog',
build_by_default: false, build_by_default: false,
) )
meson.add_dist_script('meson_dist_script.sh')
################################################################################ ################################################################################
# Subdirs # Subdirs

6
meson_dist_script.sh Executable file
View file

@ -0,0 +1,6 @@
#!/usr/bin/env bash
cp -f 'INSTALL' "${MESON_DIST_ROOT}"
# rm -f "${MESON_DIST_ROOT}/INSTALL.in"
cp 'git-version.h' "${MESON_DIST_ROOT}"