Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add meson option for a static build #46

Merged
merged 1 commit into from
Nov 30, 2023
Merged

Conversation

iwoloschin
Copy link
Contributor

I have a use case for a "run anywhere" build of culvert so I wanted to build a statically linked binary. I've added a meson option to support this and left the default as dynamically linked.

To test, delete your build directory and run:
meson setup build -Dstatic=true && meson compile -C build

An important note, to set up meson.options required bumping the meson_version to >= 1.1. I also fixed one new warning that came up after that change. I assume this is fine (it can easily be installed via pip3), but if it is not I can refactor this PR to use meson_options.txt.

Copy link
Owner

@amboar amboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So a commit message comment:

Can you add a mention of e.g. pipx install meson or pipx upgrade meson in the commit message for Bump meson_version to 1.1 to support meson.options? Just trying to help people out who might not realise that they're not constrained to their distro meson.

Copy link
Owner

@amboar amboar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you update the commit message for Add meson option for a static build to describe why this was necessary? What problems did you see and why did the resolve them?

meson.options Outdated Show resolved Hide resolved
meson.build Outdated Show resolved Hide resolved
src/meson.build Show resolved Hide resolved
meson.build Show resolved Hide resolved
@amboar
Copy link
Owner

amboar commented Nov 30, 2023

Ah, so I did just find this:

https://mesonbuild.com/Release-notes-for-0-63-0.html#new-prefer_static-builtin-option

Looks like we can drop the change to the libfdt dependency() declaration. Also, we do need to bump the minimum meson version, but just to to v0.63.0. Let me just fix all this up locally and merge it.

@amboar amboar force-pushed the static-build branch 2 times, most recently from 605255a to c3d4eb7 Compare November 30, 2023 23:04
Static builds of the culvert binary allow it to run anywhere without
having to worry about packaging up libraries. This is useful if sending
the binary to 3rd parties to run or when trying to support multiple
Linux distributions that may have very old system libraries.

Signed-off-by: Ian Woloschin <[email protected]>
[AJ: Drop static kwarg for libfdt dependency, fix actions]
Signed-off-by: Andrew Jeffery <[email protected]>
@amboar amboar merged commit 0de2280 into amboar:main Nov 30, 2023
1 check passed
@iwoloschin iwoloschin deleted the static-build branch November 30, 2023 23:36
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