Skip to content

Commit 946b66e

Browse files
committed
docs/prebuilt: Add an example of how to use a wrap file
When using a pre-built library
1 parent 48c9ec2 commit 946b66e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/markdown/Shipping-prebuilt-binaries-as-wraps.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,33 @@ compiler flags) might not be compatible. If you do this, then you are
4242
responsible for verifying that your libraries are compatible, Meson
4343
will not check things for you.
4444

45+
## Using a wrap file
46+
47+
To make this all work automatically, a project will need a
48+
[wrap file](Wrap-dependency-system-manual.md#wrap-format), as well as the
49+
meson.build definition from above. For this example our dependency is called
50+
`bob`.
51+
52+
The wrap ini (subprojects/bob.wrap):
53+
```ini
54+
[wrap-file]
55+
directory = libbob-1.0
56+
source_url = https://libbob.example.com/libbob-1.0.zip
57+
source_filename = libbob-1.0.zip
58+
source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663
59+
patch_directory = libbob
60+
61+
[provide]
62+
dependency_names = bob
63+
```
64+
65+
Then create `subprojects/packagefiles/libbob/`, and place the `meson.build` from
66+
above in that directory. With these in place a call to `dependency('bob')` will
67+
first try standard discovery methods for your system (such as pkg-config, cmake,
68+
and any built-in meson find methods), and then fall back to using the binary
69+
wrap if it cannot find the dependency on the system. Meson provides the
70+
`--force-fallback-for=bob` command line option to force the use of the fallback.
71+
4572
## Note for Linux libraries
4673

4774
A precompiled linux shared library (.so) requires a soname field to be properly installed. If the soname field is missing, binaries referencing the library will require a hard link to the location of the library at install time (`/path/to/your/project/subprojects/precompiledlibrary/lib.so` instead of `$INSTALL_PREFIX/lib/lib.so`) after installation.

0 commit comments

Comments
 (0)