forked from mesonbuild/meson
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allows installing symlinks directly from meson, which can become useful in multiple scenarios. Current main use is to help moving forward mesonbuild#9557
- Loading branch information
1 parent
bb5a09d
commit 4f882ff
Showing
14 changed files
with
180 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## install_symlink function | ||
|
||
It is now possible to request for symbolic links to be installed during | ||
installation. The `install_symlink` function takes a positional argument to | ||
the link name, and installs a symbolic link pointing to `pointing_to` target. | ||
The link will be created under `install_dir` directory and cannot contain path | ||
separators. | ||
|
||
```meson | ||
install_symlink('target', pointing_to: '../bin/target', install_dir: '/usr/sbin') | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: install_symlink | ||
returns: void | ||
since: 0.61.0 | ||
description: | | ||
Installs a symbolic link to `pointing_to` target under install_dir. | ||
posargs: | ||
link_name: | ||
type: str | ||
description: | | ||
Name of the created link under `install_dir`. | ||
It cannot contain path separators. Those should go in `install_dir`. | ||
kwargs: | ||
pointing_to: | ||
type: str | ||
required: true | ||
description: | | ||
Target to point the link to. | ||
Can be absolute or relative and that will be respected when creating the link. | ||
install_dir: | ||
type: str | ||
required: true | ||
description: | | ||
The absolute or relative path to the installation directory for the links. | ||
If this is a relative path, it is assumed to be relative to the prefix. | ||
install_tag: | ||
type: str | ||
description: | | ||
A string used by the `meson install --tags` command | ||
to install only a subset of the files. By default these files have no install | ||
tag which means they are not being installed when `--tags` argument is specified. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
this is a data file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
project('install_emptydir') | ||
|
||
if build_machine.system() == 'windows' and meson.backend() == 'ninja' | ||
error('MESON_SKIP_TEST windows does not support symlinks unless root or in development mode') | ||
endif | ||
|
||
install_data('datafile.dat', install_dir: 'share/progname/C') | ||
install_symlink('datafile.dat', pointing_to: '../C/datafile.dat', install_dir: 'share/progname/es') | ||
install_symlink('rename_datafile.dat', pointing_to: '../C/datafile.dat', install_dir: 'share/progname/fr') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"installed": [ | ||
{"type": "file", "file": "usr/share/progname/C/datafile.dat"}, | ||
{"type": "file", "file": "usr/share/progname/es/datafile.dat"}, | ||
{"type": "file", "file": "usr/share/progname/fr/rename_datafile.dat"} | ||
] | ||
} |
3 changes: 3 additions & 0 deletions
3
test cases/failing/118 pathsep in install_symlink/meson.build
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
project('symlink_pathsep') | ||
|
||
install_symlink('foo/bar', pointing_to: '/usr/baz/bar', install_dir: '/usr') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"stdout": [ | ||
{ | ||
"line": "test cases/failing/118 pathsep in install_symlink/meson.build:3:0: ERROR: Link name is \"foo/bar\", but link names cannot contain path separators. The dir part should be in install_dir." | ||
} | ||
] | ||
} |