Meson: Use out-of-nothing GIT projects as dependencies
Meson project dependency processing: cleverly solves the problem of dependency on Git project without Meson.build files
Many excellent Git projects lack Meson.build files, which presents challenges for developers using Meson build systems. This article will introduce a way to solve this problem by creating a patch file and successfully add a Git project without the Meson.build file to your Meson project as a subproject.
Suppose you need to add benhoyt/ht
project (which does not have a Meson.build file) to your project as a subproject. You can use Meson's wrap
mechanism, but you need to add the Meson.build file manually.
First, create a ht.wrap
file and specify the Git repository information:
<code>[wrap-git] directory=ht url=https://github.com/benhoyt/ht revision=master depth=1</code>
Then, download the subproject:
<code class="language-bash">meson subprojects ht</code>
Next, create an empty meson.build
file in subprojects/ht
directory:
<code class="language-bash">touch ./subprojects/ht/meson.build</code>
Now, create a patch file containing the meson.build
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>
Finally, add the patch file to the ht.wrap
file:
<code class="language-bash">echo "diff_files = ht-meson.patch" >> ./subprojects/ht.wrap</code>
Now you can run the Meson build system:
<code class="language-bash">CC=gcc meson setup ./build --wipe -D b_sanitize=none -D buildtype=release meson compile -C ./build</code>
After the compilation is successful, the executable file will appear in the ./build
directory.
Summary: By creating the meson.build
file and the corresponding patch, you can easily add a Git project without the Meson.build file to your Meson project as a subproject. This approach avoids modifying the original project and maintains the integrity of the project.
Reference information:
- Meson Subprojects: https://www.php.cn/link/aaddcd13798c7609e4c6479d1a4f67c9
- GCC 14.2.0: https://www.php.cn/link/9a912f218d27a625d946ed56081d9123
- Meson 1.7.0
- Ninja 1.12.1
- GNU Emacs 30
- Debian Sid
- GNU Guix
(Note: This article assumes that you have installed necessary tools such as Meson, GCC and Ninja. The content of the meson.build
file needs to be written according to the actual situation of the ht
project.)
The above is the detailed content of Meson: Use out-of-nothing GIT projects as dependencies. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The library used for floating-point number operation in Go language introduces how to ensure the accuracy is...

Which libraries in Go are developed by large companies or well-known open source projects? When programming in Go, developers often encounter some common needs, ...

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

Under the BeegoORM framework, how to specify the database associated with the model? Many Beego projects require multiple databases to be operated simultaneously. When using Beego...

The problem of using RedisStream to implement message queues in Go language is using Go language and Redis...

In Go language development, properly introducing custom packages is a crucial step. This article will target "Golang...

Resource management in Go programming: Mysql and Redis connect and release in learning how to correctly manage resources, especially with databases and caches...

The H5 page needs to be maintained continuously, because of factors such as code vulnerabilities, browser compatibility, performance optimization, security updates and user experience improvements. Effective maintenance methods include establishing a complete testing system, using version control tools, regularly monitoring page performance, collecting user feedback and formulating maintenance plans.
