4
1
Fork
You've already forked libftdi
1

Add Meson build #1

Merged
amyspark merged 1 commit from v1.5-meson into meson 2024年03月03日 17:26:46 +01:00
amyspark commented 2024年03月03日 02:41:25 +01:00 (Migrated from github.com)
Copy link

Hi @dragonmux,

Hope you like this 🎁 . It's mostly a 1:1 port of the CMake toolchain, with the following exceptions:

  • I skipped the Python bindings as the logic is hidden behind a CMake module, and I was not sure if they were useful for you.
  • The examples component is gatekept so that it's skipped under Windows (they need unistd.h and termios.h).
  • I added a patch of mine from the GStreamer's libvpx Meson wrap, to make Doxygen's output directory compliant with Meson's subproject system.

Please note the latter, your libusb wrap needs the same script applied as currently it overwrites everything in meson.global_build_root() / 'api-1.0' (Doxygen builds relative to the pwd, which in this case is Ninja's working directory).

Hi @dragonmux, Hope you like this 🎁 . It's mostly a 1:1 port of the CMake toolchain, with the following exceptions: - I skipped the Python bindings as the logic is hidden behind a CMake module, and I was not sure if they were useful for you. - The `examples` component is gatekept so that it's skipped under Windows (they need `unistd.h` and `termios.h`). - I added a patch of mine from the GStreamer's libvpx Meson wrap, to make Doxygen's output directory compliant with Meson's subproject system. Please note the latter, your libusb wrap needs the same script applied as currently it overwrites everything in `meson.global_build_root() / 'api-1.0' ` (Doxygen builds relative to the `pwd`, which in this case is Ninja's working directory).
dragonmux left a comment
Copy link

This is looking fantastic. There's a couple of questions we've got and a few suggestions, but with them taken care of we'll merge.

We have one final query to add to the review notes below: how difficult/feasible do you think it would be to thread a way to disable installation of the installable targets into the build system so this can be used as a subproject without running the risk of installing, eg, the programs generated to the user's system? Noting that we intend to use this in a statically linked mode on fallback to it.

This is looking fantastic. There's a couple of questions we've got and a few suggestions, but with them taken care of we'll merge. We have one final query to add to the review notes below: how difficult/feasible do you think it would be to thread a way to disable installation of the installable targets into the build system so this can be used as a subproject without running the risk of installing, eg, the programs generated to the user's system? Noting that we intend to use this in a statically linked mode on fallback to it.
@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>

You can use f-strings here if you like - f'@eeprom_major_version@.@eeprom_minor_version@'.

You can use f-strings here if you like - `f'@eeprom_major_version@.@eeprom_minor_version@'`.
@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
# SPDX-License-Identifier: BSD-3-Clause
warning('''

This can be collapsed onto a single line if you like - looks a bit strange to us split over two.

This can be collapsed onto a single line if you like - looks a bit strange to us split over two.
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>

Given this uses SPDX syntax, is there any reason for it to be in array brackets?

Given this uses SPDX syntax, is there any reason for it to be in array brackets?

This doesn't mention a fallback: - so won't this fail if it can't find libusb-1.0 on the user's system?

This doesn't mention a `fallback:` - so won't this fail if it can't find `libusb-1.0` on the user's system?
@ -0,0 +1,60 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>

[ftdi1_sources, ftdi1_version]? This way looks a bit strange and we don't recall if it causes problems on older Meson's or not.

`[ftdi1_sources, ftdi1_version]`? This way looks a bit strange and we don't recall if it causes problems on older Meson's or not.
@ -0,0 +5,4 @@
snapshot_version='unknown'
git_describe=run_command(

Query: given this will only be re-run when ninja reconfigure or a reconfiguration of some kind is triggered, not any time a commit is made, is there a particular reason this is not done as a vcs_tag() instead so it will trigger every change?

Query: given this will only be re-run when `ninja reconfigure` or a reconfiguration of some kind is triggered, not any time a commit is made, is there a particular reason this is not done as a vcs_tag() instead so it will trigger every change?
amyspark (Migrated from github.com) reviewed 2024年03月03日 16:16:51 +01:00
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
amyspark (Migrated from github.com) commented 2024年03月03日 16:16:49 +01:00
Copy link

That's indeed correct. Do you have any I can provide here? Locally I copied your wrap.

That's indeed correct. Do you have any I can provide here? Locally I copied your wrap.
amyspark (Migrated from github.com) reviewed 2024年03月03日 16:18:16 +01:00
@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
# SPDX-License-Identifier: BSD-3-Clause
warning('''
amyspark (Migrated from github.com) commented 2024年03月03日 16:18:15 +01:00
Copy link

The purpose is to make the license stand out, as it's different from the main library's.

Configuring ftdi_version_i.h using configuration
ftdi_eeprom\meson.build:4: WARNING:
 The EEPROM programmer is licensed under GPL 2 (not any later)
Configuring ftdi_eeprom_version.h using configuration
The purpose is to make the license stand out, as it's different from the main library's. ``` Configuring ftdi_version_i.h using configuration ftdi_eeprom\meson.build:4: WARNING: The EEPROM programmer is licensed under GPL 2 (not any later) Configuring ftdi_eeprom_version.h using configuration ```
amyspark (Migrated from github.com) reviewed 2024年03月03日 16:22:14 +01:00
@ -0,0 +5,4 @@
snapshot_version='unknown'
git_describe=run_command(
amyspark (Migrated from github.com) commented 2024年03月03日 16:22:13 +01:00
Copy link

vcs_tag(), as per its docs, operates as a custom_target. However, libftdi sets the macro FTDI_SNAPSHOT_VERSION to the value of snapshot_version, and this maps to a configure_file, not a custom_target.

[`vcs_tag()`, as per its docs, operates as a `custom_target`](https://mesonbuild.com/Reference-manual_functions.html#vcs_tag). However, libftdi sets the macro `FTDI_SNAPSHOT_VERSION` to the value of `snapshot_version`, and this maps to a `configure_file`, not a `custom_target`.
amyspark (Migrated from github.com) reviewed 2024年03月03日 16:23:04 +01:00
@ -0,0 +1,60 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
amyspark (Migrated from github.com) commented 2024年03月03日 16:23:03 +01:00
Copy link

Good catch, it does alter the value of ftdi1_sources without telling anyone.

Good catch, it does alter the value of `ftdi1_sources` without telling anyone.
amyspark (Migrated from github.com) reviewed 2024年03月03日 16:25:18 +01:00
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
amyspark (Migrated from github.com) commented 2024年03月03日 16:25:17 +01:00
Copy link

Oh, I added your wrap here without noticing during rebasing 😅

Oh, I added your wrap here without noticing during rebasing :sweat_smile:
@ -0,0 +1,37 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
# SPDX-License-Identifier: BSD-3-Clause
warning('''

Ahh, gotcha - that works.

Ahh, gotcha - that works.
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>

As the wrap is in this PR, you can just fallback: 'libusb' to fix that if you want.

As the wrap is in this PR, you can just `fallback: 'libusb'` to fix that if you want.
amyspark (Migrated from github.com) reviewed 2024年03月03日 17:04:54 +01:00
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>
amyspark (Migrated from github.com) commented 2024年03月03日 17:04:54 +01:00
Copy link

Starting with 0.55, the presence of a wrap file with [provide] libusb-1.0 = <dep> is enough: https://mesonbuild.com/Reference-manual_functions.html#dependency_fallback

Starting with 0.55, the presence of a wrap file with `[provide] libusb-1.0 = <dep>` is enough: https://mesonbuild.com/Reference-manual_functions.html#dependency_fallback
@ -0,0 +1,98 @@
# SPDX-FileCopyrightText: 2024 L. E. Segovia <amy@amyspark.me>

Guessing you've tested that as well and it worked? The manual doesn't make it particularly clear what the default value of allow_fallback is which is if memory serves, why we've always gone to provide fallback: to ensure we get the behaviour we want. If that can be avoided, that'd be fantastic though.

Guessing you've tested that as well and it worked? The manual doesn't make it particularly clear what the default value of `allow_fallback` is which is if memory serves, why we've always gone to provide `fallback:` to ensure we get the behaviour we want. If that can be avoided, that'd be fantastic though.
@ -0,0 +5,4 @@
snapshot_version='unknown'
git_describe=run_command(

Ahhh, ok. If this makes things work the way the CMake build system would do them, we'll go with it even if it seems odd. No complaints there.

Ahhh, ok. If this makes things work the way the CMake build system would do them, we'll go with it even if it seems odd. No complaints there.
dragonmux left a comment
Copy link

Assuming that libusb-1.0 fallback point is ok, LGTM. Merging if nothing needs changing for that.

Assuming that libusb-1.0 fallback point is ok, LGTM. Merging if nothing needs changing for that.
Sign in to join this conversation.
No reviewers
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
blackmagic-debug/libftdi!1
Reference in a new issue
blackmagic-debug/libftdi
No description provided.
Delete branch "v1.5-meson"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?