Skip to content

Commit 8960f32

Browse files
committed
Subprojects can use meson.add_dist_script() if meson.version() >= 0.58.0
* meson.build: * MSVC_NMake/meson.build: * docs/docs/manual/meson.build: * docs/docs/reference/meson.build: Call add_dist_script() in a subproject, if meson.version() >= 0.58.0. * tools/handle-built-files.py: * tools/tutorial-custom-cmd.py: Use MESON_PROJECT_DIST_ROOT if it exists, else MESON_DIST_ROOT. It exists if meson.version() >= 0.58.0.
1 parent de48a71 commit 8960f32

File tree

6 files changed

+26
-19
lines changed

6 files changed

+26
-19
lines changed

MSVC_NMake/meson.build

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# MSVC_NMake
22

3-
# Input: pkg_conf_data, sigcxxconfig_h, project_build_root, python3
3+
# Input: pkg_conf_data, sigcxxconfig_h, project_build_root, python3,
4+
# can_add_dist_script
45
# Output: sigc_rc
56

67
sigc_rc = configure_file(
@@ -19,10 +20,8 @@ configure_file(
1920
untracked_msvc_nmake = 'untracked' / 'MSVC_NMake'
2021
handle_built_files = project_source_root / 'tools' / 'handle-built-files.py'
2122

22-
if not meson.is_subproject()
23+
if can_add_dist_script
2324
# Distribute built files.
24-
# (add_dist_script() is not allowed in a subproject)
25-
2625
meson.add_dist_script(
2726
python3.path(), handle_built_files, 'dist_gen_msvc_files',
2827
meson.current_build_dir(),

docs/docs/manual/meson.build

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# docs/docs/manual
22

33
# input: install_datadir, sigcxx_pcname, tutorial_custom_cmd, python3,
4-
# build_documentation, book_name
4+
# build_documentation, book_name, can_add_dist_script
55
# output: can_parse_and_validate, build_pdf_by_default, can_build_pdf,
66
# install_tutorialdir
77

@@ -77,9 +77,8 @@ if can_build_pdf
7777
)
7878
endif
7979

80-
if not meson.is_subproject()
80+
if can_add_dist_script
8181
# Distribute built files.
82-
# (add_dist_script() is not allowed in a subproject)
8382
meson.add_dist_script(
8483
python3.path(), tutorial_custom_cmd, 'dist_doc',
8584
doc_dist_dir,

docs/docs/reference/meson.build

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
# Input: project_build_root, project_source_root, sigcxx_pcname,
44
# sigcxx_api_version, build_documentation, source_h_files,
5-
# hg_ccg_basenames, install_datadir, python3, doc_reference
5+
# hg_ccg_basenames, install_datadir, python3, doc_reference,
6+
# can_add_dist_script
67
# Output: install_docdir, install_devhelpdir, book_name, tag_file
78

89
# There are no built source files in libsigc++-3.0.
@@ -121,9 +122,8 @@ meson.add_install_script(
121122
docinstall_flags
122123
)
123124

124-
if not meson.is_subproject()
125+
if can_add_dist_script
125126
# Distribute built files and files copied by mm-common-get.
126-
# (add_dist_script() is not allowed in a subproject)
127127
meson.add_dist_script(
128128
python3.path(), doc_reference, 'dist_doc',
129129
doctool_dir,

meson.build

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ sigcxxconfig_h = configure_file(
220220
install_dir: install_includeconfigdir,
221221
)
222222

223+
# add_dist_script() is not allowed in a subproject if meson.version() < 0.58.0.
224+
can_add_dist_script = not meson.is_subproject() or meson.version().version_compare('>= 0.58.0')
225+
223226
#subdir('cmake')
224227
subdir('MSVC_NMake')
225228
subdir('sigc++')
@@ -228,22 +231,22 @@ subdir('tests')
228231
subdir('docs/docs/reference')
229232
subdir('docs/docs/manual')
230233

231-
if not meson.is_subproject()
234+
if can_add_dist_script
232235
# Add a ChangeLog file to the distribution directory.
233-
# (add_dist_script() is not allowed in a subproject)
234236
meson.add_dist_script(
235237
python3.path(), dist_changelog,
236238
project_source_root,
237239
)
238240
# Add build scripts to the distribution directory, and delete .gitignore
239-
# files and an empty $MESON_DIST_ROOT/build/ directory.
241+
# files and an empty $MESON_PROJECT_DIST_ROOT/build/ directory.
240242
meson.add_dist_script(
241243
python3.path(), dist_build_scripts,
242244
project_source_root,
243245
'untracked' / 'build_scripts',
244246
)
245-
else
246-
# This is a subproject.
247+
endif
248+
249+
if meson.is_subproject()
247250
sigcxx_dep = declare_dependency(
248251
dependencies: sigcxx_own_dep,
249252
variables: {

tools/handle-built-files.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,12 @@ def dist_built_files(is_msvc_files=False):
2020
# <built_h_cc_dir> <dist_dir> <built_files>...
2121

2222
# <built_h_cc_dir> is an absolute path in the build directory or source directory.
23-
# <dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
23+
# <dist_dir> is a distribution directory, relative to MESON_PROJECT_DIST_ROOT.
24+
25+
# MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
26+
project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
2427
built_h_cc_dir = sys.argv[2]
25-
dist_dir_root = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[3])
28+
dist_dir_root = os.path.join(project_dist_root, sys.argv[3])
2629
dist_dir = dist_dir_root
2730

2831
# Distribute .h and .cc files built from .m4 files, or generated MSVC files.

tools/tutorial-custom-cmd.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,14 @@ def dist_doc():
132132
# argv[2] argv[3] argv[4] argv[5]
133133
# <doc_dist_dir> <doc_build_dir> <xml_file> <pdf_file>
134134

135-
# <doc_dist_dir> is a distribution directory, relative to MESON_DIST_ROOT.
135+
# <doc_dist_dir> is a distribution directory, relative to MESON_PROJECT_DIST_ROOT.
136136
# <doc_build_dir> is a relative or absolute path in the build directory.
137137
# <xml_file> is a relative or absolute path in the source directory.
138138
# <pdf_file> is a relative or absolute path in the build directory.
139-
doc_dist_dir = os.path.join(os.getenv('MESON_DIST_ROOT'), sys.argv[2])
139+
140+
# MESON_PROJECT_DIST_ROOT is set only if meson.version() >= 0.58.0.
141+
project_dist_root = os.getenv('MESON_PROJECT_DIST_ROOT', os.getenv('MESON_DIST_ROOT'))
142+
doc_dist_dir = os.path.join(project_dist_root, sys.argv[2])
140143
doc_build_dir = sys.argv[3]
141144
xml_file = sys.argv[4]
142145
pdf_file = sys.argv[5]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy