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
Release: 2025-01-29 08:12:17
Original
779 people have browsed it

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>
Copy after login
. Then, add

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

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

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>
Copy after login

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

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

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>
Copy after login

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 of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template