Home >Backend Development >C++ >Meson: Using a Git project without Meson.Build as dependence

Meson: Using a Git project without Meson.Build as dependence

Mary-Kate Olsen
Mary-Kate OlsenOriginal
2025-01-29 08:12:17804browse

The MESON project that depends lack of dependencies

Have you ever encountered such a situation: an excellent project has no meson.build file, and the defender will not accept your pull request (PR), or even accept it? Alternatively, your project needs to add a license document every time you build, but the defender refuses to do this?

Don't worry! You can solve this problem by adding a git patch to . subprojects/*.wrap

For example, in my project ONUR, I prefer to use Hoyt's HT tools instead of the huge Gnome Glib library, but the HT project does not have

files. meson.build

For this project without labels, a simple

configuration, using the main branch (wrap-git) as shown below: master

./subprojects/ht.wrap

First, download the Meson sub -project:
<code>[wrap-git]
directory=ht
url=https://github.com/benhoyt/ht
revision=master
depth=1</code>
. Then, add

File: meson subprojects download meson.build ./subprojects/ht

Next, create a patch file:
<code># 创建一个空的 meson.build 文件 (如果需要,可以添加内容)
touch ./subprojects/ht/meson.build </code>

Then, specify the patch file in file:
<code class="language-bash">mkdir -pv subprojects/{packagecache,packagefiles}
git -C ./subprojects/ht add meson.build
git -C ./subprojects/ht diff --cached > ./subprojects/packagefiles/ht-meson.patch</code>

ht.wrap Finally, apply patch and compile the project:

<code class="language-bash">echo "diff_files = ht-meson.patch" >> ./subprojects/ht.wrap</code>

executable files will appear in the

directory as expected.
<code class="language-bash">meson subprojects purge --confirm
meson subprojects download
CC=gcc meson setup ./build --wipe -D b_sanitize=none -D buildtype=release
meson compile -C ./build</code>

Related resources: ./build

Meson subprojects

    GCC
  • GNU
  • System Information:
  • GCC 14.2.0 meson 1.7.0
ninja 1.12.1

GNU EMACS 30
  • Debian Sid/GNU Guix/Swaywm/Waybar/Firefox
  • LanguageTool
  • dev.to/easbarba
  • gitlab

The above is the detailed content of Meson: Using a Git project without Meson.Build as dependence. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn