News for hackers. Stuff that matters.
Re:Meson 1.0 Build System by oldgradstudent on Friday December 23, 2022 @07:00PM (#34112178)
I'm sure I can use any number of ugly workarounds.

In many large projects, the build system is necessarily large and complicated. It should be treated like any other code, and would massively benefit from the most basic tool for writing clean, readable code - user-defined functions.

Sadly, as much as Meson is tempting in other respects, without user-defined functions, it is unfit for human consumption.

The excuse Meson uses, that user-defined functions would make it Turing-complete and therefore not statically analyzable is totally false.

Adding user-defined functions without recursion does not make the language Turing-complete. On the contrary, as long as there is no recursion, you can inline the functions and create an equivalent code without functions.

Re:Meson 1.0 Build System by tristan957 on Friday December 23, 2022 @07:28PM (#34112383)
> it is unfit for human consumption.

Surely this is hyperbole since some of the largest open source projects consider it a viable build system. Systemd, Mesa, GStreamer, GNOME, Postgres.

Would I be correct in assuming that you are coming at this conversation having never tried Meson?

Re:Meson 1.0 Build System by oldgradstudent on Friday December 23, 2022 @07:59PM (#34112602)
> Would I be correct in assuming that you are coming at this conversation having never tried Meson?

I tried to port the project I've previously mentioned here from CMake to Meson build, but could not find a way of doing it with Meson build in a satisfactory way.

The lack of user-defined functions is a show stopper because I have a complicated multis-stage build process. It is also very different between platform. Having to repeat parts of this process is disqualifying.

A programming language, and a build language is a programming language, without user-defined functions is unfit for human consumption.

Re:Meson 1.0 Build System by sfpotter on Friday December 23, 2022 @10:00PM (#34113444)
Can you use a script written in another programming language to generate your intermediate targets?
Re:Meson 1.0 Build System by oldgradstudent on Saturday December 24, 2022 @05:28AM (#34115613)
Sure, I can write a script to do that.

The script can examine the dependencies, see if any of them changed and then rebuild only if needed.

It's like Greenspun's tenth law[1]:

> Any sufficiently complicated build script contains an ad hoc, informally-specified, bug-ridden, slow implementation of make.

But then, what do I need Meson for?

[1] https://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule

Re:Meson 1.0 Build System by sfpotter on Saturday December 24, 2022 @01:23PM (#34119542)
That's not what I meant. Of course, if you wanted to roll your own build system, you could do that. But hopefully you're aware that's not what I'm suggesting.

Meson provides custom targets, so Meson itself would examine the dependencies and rebuild if needed:

https://mesonbuild.com/Custom-build-targets.html

Obviously this might not do what you need specifically, but it does deal with some of the use cases for user-defined functions.

Re:Meson 1.0 Build System by oldgradstudent on Saturday December 24, 2022 @04:24PM (#34121208)
Of course I have custom build scripts that build a target from its dependencies. The point is that there are several such targets as part of building a single plugin. It is the build system that decides whether to run such build script and in what order in order to build the final result, depending on which sources and intermediate targets were updated.

The entire point of having functions is to capture a "recipe" for building one type of target, and then be able to reuse it again and again.

Re:Meson 1.0 Build System by sfpotter on Saturday December 24, 2022 @06:24PM (#34122268)
Sounds like Meson isn't a very good match for your use case. That's too bad. Good thing there are other tools like CMake which are a better fit for you. It seems like you have also lost some time attempting to port your build over to Meson and failed, which was probably really frustrating. As a result, you really dislike Meson, going so far as to call it "unfit for human consumption".

Many other people like Meson, and many large projects have gone so far as to switch to using Meson. It's great that it worked for them, and it's OK that it didn't work for you.

Re:Meson 1.0 Build System by oldgradstudent on Sunday December 25, 2022 @10:06AM (#34127811)
> Sounds like Meson isn't a very good match for your use case.

That's exactly what I've been saying.

> As a result, you really dislike Meson, going so far as to call it "unfit for human consumption".

Meson got so many things right, but this one point makes it unusable for many projects, and prevents it from being industry standard.

Let me say it again, a programming language for writing large scale programs (11,000 lines is a large scale program) without functions/subroutines is unfit for human consumption.

It is made worse by giving a blatantly wrong rationale for not having user-defined function.

The only reason I even bothered spending so much time in responding is the hope that they will reverse this idiotic position.

Re:Meson 1.0 Build System by sfpotter on Sunday December 25, 2022 @01:53PM (#34129932)
I guess it wouldn’t help for me to recapitulate all of the arguments made by bonzini, who actually was involved in the 11,000 lines (down from 15,000 thanks to switching to Meson). He made his arguments very cogently and you apparently either don’t understand them or don’t care to listen.

Clearly there are people who think the position isn’t idiotic, and there are large projects which decided that Meson was a great choice and chose to migrate to it. This means that Meson is fit for human consumption.

Re:Meson 1.0 Build System by bonzini on Saturday December 24, 2022 @02:20AM (#34114773)
QEMU also has a complicated multi stage build process, and using foreach was not a workaround. Each directory sets up what it wants to build in a dictionary, and then the main meson.build does all the steps.
Re:Meson 1.0 Build System by oldgradstudent on Saturday December 24, 2022 @12:55PM (#34119216)
So it's like having ad hoc, informally-specified, bug-ridden functions calls, just without argument checking, type checking, localized error reporting, etc?
Re:Meson 1.0 Build System by bonzini on Saturday December 24, 2022 @04:31PM (#34121261)
No, not really. It's just a different, data flow based approach.

The only thing I would use user-defined functions for is to structure the meson.build file in top-down manner, but each function would be called just once.

Re:Meson 1.0 Build System by camgunz on Saturday December 24, 2022 @05:16PM (#34121671)
Honestly, and I'm saying this with kindness, you are super hung up on Meson not having user-defined functions and their use of "Turing complete". Others have pointed out there are perfectly reasonable workarounds (external scripts and foreach loops aren't really that ugly), but you're just so miffed you refuse to consider them.

A lot of build systems won't support what you're asking here. Most don't do multi-stage builds, most don't have the concept of functions, many rely on external tools (autotools, pkg-config, etc). They're not "unfit for human consumption", which is pretty offensive to the people who chose Meson for their projects as well as Meson developers.

I get that you're offended by the situation. I might even agree with you in principle. But you're all over a Meson release thread, their 1.0 release thread even, shitting all over them, on Christmas Eve! Lighten up!