Skip to content

Conversation

@Nazarevsky
Copy link
Contributor

Problem

UNIFFI crates a dynamic lib file which is used for generating bindings for different languages. On different OS dynamic files have different extension: Linux - .os, Darwin - .dylib, Windows - .dll. For now, only a Linux case is handled (.os files are supported).

Solution

In order to use a dynamic library file for bindings generation on multiple OS, OS should be defined in .task.yaml via shell command. Moreover, bindings-... tasks scripts should be expanded to copy libglsdk.* file from the target directory into the glsdk directory.

The same should be done for pyproject.toml file which uses force-include option for checking whether libglsdk.* is included into glsdk directory. Since it is not possible to follow the same approach as it is introduced in .task.yaml, pyproject.toml should use a build hook with custom force inclusion Python script.

Using hooks for pyproject.toml file result some changes in uv sync command. Since uv sync builds hatch module only once, build hook is also called only once. Future uv sync calls will omit the hook, so adding --reinstall-package='gl-sdk' flag will reinstall gl-sdk package every time the command is executed and check for libglsdk.*. Also, I do not think that it is necessary to change uv sync command in Dockerfiles since gl-sdk should be rebuilt each time (assuming PR #639) resulting hook call.

Changes

  • add OS recognition via shell script to .task.yaml;
  • add libglsdk_force_include.py hook to handle force inclusion of libglsdk.* dynamic lib;
  • add --reinstall-package='gl-sdk' to libs/gl-client-py/Makefile uv sync command to handle force-inclusion hook.

@cdecker cdecker merged commit 2fd52c7 into Blockstream:main Dec 4, 2025
12 checks passed
@cdecker
Copy link
Collaborator

cdecker commented Dec 4, 2025

Great work, thanks for addressing the things I didn't quite get to. This works perfectly 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants