8000 meson build: simplify build script, increase usability by Kangie · Pull Request #71 · freeciv/freeciv · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

meson build: simplify build script, increase usability #71

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

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Kangie
Copy link
Contributor
@Kangie Kangie commented Apr 17, 2025

RM #1303

This will produce a summary of the build environment,
enabled features, and identified dependencies (with version where
possible).

To enable this work, many dependencies have been rewritten to directly
use the foo_dep = dependency('foo', required: false) syntax, enabling
us to take advantage of the 'not found' behaviour for many current
conditionals (see features below), significantly reducing boilerplate
requred. Meson cross build files should still enable resolution of
libraries in the cross build environment.

Targets of opportunity (combo with 'try', 'true', 'false', deps with
conditional logic) have been converted to the meson feature option
type, which has several advantages (including helpers) and reduces boilerplate.

Features that are disabled are treated as 'not found' for the purposes
of dependency resolution.

@Kangie Kangie marked this pull request as draft April 17, 2025 08:22
@Kangie
Copy link
Contributor Author
Kangie commented Apr 17, 2025

Still a WIP, submitted for early feedback.

I believe that meson should handle the dependencies for the cross use case, but have not yet tested.

Somewhere in there I found that Qt6 was being pulled in for ruledit when I didn't enable that client. Will debug later on, travelling this weekend.

This should build on native Linux (enable Qt or disable ruledit for now), further testing to come.

Summary output should look something like this, which I hope will make determining build configuration a lot more straightforward than parsing the string given to meson:

  Directories
    prefix                                     : /usr/local
    bindir                                     : bin
    datadir                                    : share
    libdir                                     : lib64
    localedir                                  : /usr/local/share/locale

  Environment
    AppImage Build                             : NO
    Emscripten Build                           : NO
    Build                                      : linux
    Build CPU Family                           : x86_64
    Host CPU Family                            : x86_64
    Cross-compiling                            : NO
    Build Endianness                           : little
    Host Endianness                            : little
    Target                                     : linux
    Version                                    : 3.3.90.1-dev

    Linker                                     : ld.bfd
    C Compiler                                 : gcc
    C Compiler Version                         : 14.2.1
    Python                                     : python3

  Clients
    GTK3                                       : NO
    GTK4                                       : YES 4.16.12
    GTK4x                                      : NO
    Qt                                         : NO
    SDL2                                       : NO
    SDL3                                       : NO
    Stub                                       : NO

  Modpack Installer
    CLI                                        : NO
    GTK3                                       : NO
    GTK4                                       : YES 4.16.12
    GTK4x                                      : NO
    Qt                                         : NO

  Features
    Audio                                      : sdl3
    Authentication                             : YES
    Custom followtag                           : NO
    Genpackets additional Arguments            : NO
    Git Revision Included                      : NO
    JSON Protocol Support                      : YES 2.14
    MagickWand                                 : NO
    Modpack Installer                          : gtk4
    Native Language Support                    : YES
    Readline                                   : NO
    Server                                     : enabled
    SVG Flag Support                           : NO
    System Lua                                 : NO
    Tools                                      : manual
    Use system `tolua` command for native build: NO
    Windows Minimum Version                    : NO

  Dependencies
    Bcrypt                                     : NO
    Bz2                                        : NO
    Charset                                    : NO
    cURL                                       : YES 8.13.0
    M                                          : YES
    Lua                                        : YES 5.4.6
    Network                                    : Not Required on this platform
    Readline                                   : YES 8.2
    SDL3                                       : YES
    SDL3_mixer                                 : YES

  User defined options
    audio                                      : sdl3
    tools                                      : manual
    

A bit of churn, unfortunately, as I've also run a code formatter over the build files.

Please let me know if you're interested in this work (or parts of it) and I can work on that, though the deps summary is really enabled (at least without much boilerplate) by having deps be a dependency or 'not found'.

Kangie added 3 commits April 17, 2025 18:47
This will produce a summary of the build environment,
enabled features, and identified dependencies (with version where
possible).

To enable this work, many dependencies have been rewritten to directly
use the `foo_dep = dependency('foo', required: false)` syntax, enabling
us to take advantage of the 'not found' behaviour for many current
conditionals (see features below), significantly reducing boilerplate
requred. Meson cross build files should still enable resolution of
libraries in the cross build environment.

Targets of opportunity (combo with 'try', 'true', 'false', deps with
conditional logic) have been converted to the meson `feature` option
type, which has several advantages (including helpers) and reduces boilerplate.

Features that are `disabled` are treated as 'not found' for the purposes
of dependency resolution.
@Kangie Kangie force-pushed the meson-summary-info branch from 64966c9 to 6224044 Compare April 17, 2025 08:47
@cazfi
Copy link
Member
cazfi commented Apr 17, 2025

Looks promising.
I would prefer atomic commits, so we could get simple steps tested one at the time, and right. Minor issues here and there, but I'll leave detailed review later.

I believe that meson should handle the dependencies for the cross use case, but have not yet tested.

Sometime in the past we went the other direction; dependency() -> compiler.find_xxx() for supporting crosser based builds via cross properties. That's not to say that the situation is necessary still the same (it's quite likely that we now could construct working cross file some other way)

@Kangie
Copy link
Contributor Author
Kangie commented Apr 23, 2025

I would prefer atomic commits, so we could get simple steps tested one at the time, and right.

Agree, I can split some things (e.g. meson feature option type) into their own PRs and will try and split the remainder of the work up into logical commits.

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

Successfully merging this pull request may close these issues.

2 participants
0