build: fix install from arbitrary directory for meson 0.55
PATCH 1/1 build: fix install from arbitrary directory for meson 0.55
Install command for meson >= 0.55.0 referenced the script by a plain string, assuming the build directory to be directly under the source tree root. This resulted in an error when the assumption did not hold:
c:\python\python.exe: can't open file
'../buildtools/symlink-drivers-solibs.py':
[Errno 2] No such file or directory
Use files() to make a valid script path for any build directory.
---
Note: this is not limited to Windows, it just happens that Windows requires newer meson and the error example is from Windows build.
config/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
config/meson.build +2 -1
@@ -61,7 +61,8 @@ if not is_windows get_option('libdir'), pmd_subdir_opt) elif meson.version().version_compare('>=0.55.0') # 0.55.0 is required to use external program with add_install_script - meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + meson.add_install_script(py3, + files('../buildtools/symlink-drivers-solibs.py'), get_option('libdir'), pmd_subdir_opt, get_option('bindir')) endif
Signature · 1 line
2.29.3
Quoted 27 lines · Dmitry Kozlyuk
Install command for meson >= 0.55.0 referenced the script by a plain string, assuming the build directory to be directly under the source tree root. This resulted in an error when the assumption did not hold:
c:\python\python.exe: can't open file
'../buildtools/symlink-drivers-solibs.py':
[Errno 2] No such file or directoryUse
files()to make a valid script path for any build directory.Fixes cd27047dbee1 ("build: support drivers symlink on Windows")Signed-off-by Dmitry Kozlyuk <[email protected]>---
Note: this is not limited to Windows, it just happens that Windows requires newer meson and the error example is from Windows build.config/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)config/meson.build +0
-0
config/meson.build if not is_windows · line 68
Quoted 9 lines
config/meson.build +2
-1@@ -61,7 +61,8 @@ if not is_windows get_option('libdir'), pmd_subdir_opt) elif meson.version().version_compare('>=0.55.0') # 0.55.0 is required to use external program with add_install_script - meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + meson.add_install_script(py3, + files('../buildtools/symlink-drivers-solibs.py'), get_option('libdir'), pmd_subdir_opt, get_option('bindir')) endif
Rather than using a relative path, we could also use "files()" in the buildtools directory and store it in a variable to re-use either. Most other python scripts in the buildtools directory, use that pattern to have a single (array) variable with the python and script calls together.
Either way as here, or with buildtools change:
2021-08-17 15:35 (UTC+0100), Bruce Richardson:
Quoted 34 lines · Dmitry Kozlyuk
Quoted 33 lines
Install command for meson >= 0.55.0 referenced the script by a plain string, assuming the build directory to be directly under the source tree root. This resulted in an error when the assumption did not hold:
c:\python\python.exe: can't open file
'../buildtools/symlink-drivers-solibs.py':
[Errno 2] No such file or directoryUse
files()to make a valid script path for any build directory.Fixes cd27047dbee1 ("build: support drivers symlink on Windows")Signed-off-by Dmitry Kozlyuk <[email protected]>---
Note: this is not limited to Windows, it just happens that Windows requires newer meson and the error example is from Windows build.config/meson.build | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)config/meson.build +2
-1@@ -61,7 +61,8 @@ if not is_windows get_option('libdir'), pmd_subdir_opt) elif meson.version().version_compare('>=0.55.0') # 0.55.0 is required to use external program with add_install_script - meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + meson.add_install_script(py3, + files('../buildtools/symlink-drivers-solibs.py'),
Quoted 8 lines
config/meson.build if not is_windows · line 68
Quoted 3 lines
config/meson.build +0
-0get_option('libdir'), pmd_subdir_opt, get_option('bindir')) endifRather than using a relative path, we could also use "
files()" in the buildtools directory and store it in a variable to re-use either. Most other python scripts in the buildtools directory, use that pattern to have a single (array) variable with the python and script calls together.
Thanks for the hint, but I don't think consistency is worth it. Now we have some non-trivial logic (otherwise it wouldn't need comments) in one place. With variable definition affected by the single use case in another file it will be harder to understand the reason.
Quoted 3 lines
Either way as here, or with buildtools change:
Acked-by Bruce Richardson <[email protected]>
17/08/2021 16:35, Bruce Richardson:
Quoted 11 lines · Dmitry Kozlyuk
Quoted 10 lines
Install command for meson >= 0.55.0 referenced the script by a plain string, assuming the build directory to be directly under the source tree root. This resulted in an error when the assumption did not hold:
c:\python\python.exe: can't open file
'../buildtools/symlink-drivers-solibs.py':
[Errno 2] No such file or directoryUse
files()to make a valid script path for any build directory.
Quoted 8 lines
Quoted 8 lines
Fixes cd27047dbee1 ("build: support drivers symlink on Windows")Signed-off-by Dmitry Kozlyuk <[email protected]>---
Note: this is not limited to Windows, it just happens that Windows requires newer meson and the error example is from Windows build.
It is used only for Windows.
Beginning of commit log is adjusted:
"Install command on Windows for Meson >= 0.55.0"
Quoted 5 lines
config/meson.build if not is_windows · line 65
Quoted 4 lines
# 0.55.0 is required to use external program with
add_install_scriptconfig/meson.build +2
-1- meson.add_install_script(py3, '../buildtools/symlink-drivers-solibs.py', + meson.add_install_script(py3, + files('../buildtools/symlink-drivers-solibs.py'),
Quoted 8 lines
Rather than using a relative path, we could also use "
files()" in the buildtools directory and store it in a variable to re-use either. Most other python scripts in the buildtools directory, use that pattern to have a single (array) variable with the python and script calls together.Either way as here, or with buildtools change:
Acked-by Bruce Richardson <[email protected]>
Applied as-is, thanks.
Good catch - thanks Dmitry.