News for hackers. Stuff that matters.
Re:Make your own build system by RcouF1uZ4gsC on Wednesday March 07, 2018 @06:56PM (#16541110)
> Although it adds to the code that must be maintained as part of the project, I think that having a custom build infrastructure that can grow with the project is a good idea for medium-sized and larger projects.

Please don't do this for open source projects. Other people may want to use your code, but they generally don't want yet another build system. There are already a lot of build systems that are building very complicated projects. Surely, one of these existing, widely used build systems can be made to work for your project.

Re:Make your own build system by jstimpfle on Wednesday March 07, 2018 @08:29PM (#16541547)
TBH I don't have many fond memories of open-source build systems. Any widely used build system (that probably <10% of the developers know very well, anyway) is not going to help if the build realized with it is broken (too flexible, too confusing, too optimistic about others' environments). And frankly most uses of those build systems in the wild are "give up control and pray".

If it's about making it easy for uninitiated collaborators to add new source files, then the listed build description format is pretty self-explanatory to use. And the build script just needs to be run. It takes no arguments, so I don't think there is a problem with that.

Re:Make your own build system by Ace17 on Thursday March 08, 2018 @01:08AM (#16542656)
> If it's about making it easy for uninitiated collaborators to add new source files, then the listed build description format is pretty self-explanatory to use.

This misses the point IMHO. In practice, whatever complex the build system is, it's generally easy to add a new source file: simply grep for an existing source file name, find the build files that refers to it, and insert a similar line for your new file.

> And the build script just needs to be run. It takes no arguments, so I don't think there is a problem with that.

What about: cross compilation? ccache injection? verbose builds? parallelism control? installation prefix? Try being a package maintainer for a GNU/Linux distribution, where all of the above needs to be kept under control. You will despise custom build systems.

Established build systems (like GNU Autoconf (e.g gcc), and, to some extent, custom Autoconf (ffmpeg, libvpx)) handle all these cases pretty well, and provide fixed commande-line options (--prefix, --host) to control them. This means the project author doesn't get to decide how the option will be named and how it will work.

This make a huge difference if you're trying to packages for your distrib dozens of projects from dozens of various authors.

With a custom build system, the best case scenario is you have to re-learn all these options for each project. The worst case scenario is: one project doesn't support some use case (e.g cross-compiling), so you have to maintain a patch that hacks into the build files to add the behavior your need.

Re:Make your own build system by crdoconnor on Thursday March 08, 2018 @07:28AM (#16543916)
>With a custom build system, the best case scenario is you have to re-learn all these options for each project.

The best case scenario would be that it handles all of those scenarios in A) a highly readable way and B) has high quality documentation that demonstrates the use of all the necessary features in context.

Make's approach appears to be to use cryptic flags and settings and the best case documentation appears to be "have you tried stack overflow?". It is not the be all and end all of build systems.

Additionally, for many of the non-C++ workflows I want to accommodate, the 'make' approach appears to be hack around its deficiencies with bash scripting. Stringing together hacky bash scripts is not what I would describe as a best case scenario in any project.

I don't think of this guy's project is a meaningful competitor to make/cmake but equally, I can envisage other projects doing a better job than make on its home turf.

Re:Make your own build system by Ace17 on Thursday March 08, 2018 @02:05PM (#16546723)
> I can envisage other projects doing a better job than make on its home turf.

Of course it's possible, GNU make is far from being perfect ; it's a pity we can't slowly evolve the language for backward compatibility reasons. Autotools also are far from being perfect.

- As a project author, I like writing custom simple makefiles and hate anything related to editing "autoconf.ac".

- As a package manager, I love projects using autoconf (or exposing autoconf's options, such as --host): they're the easiest to build because they all have the same "build interface" (alas, by default, there's no equivalent to "./configure --host" for cmake). And I despise projects using "custom simple makefiles", because it means that I'm going to have to learn yet another parochialistic BS (for build system) and have yet another special case for this specific project.

Maybe one day we will have a build system that's loved by both sides? :-)

Re:Make your own build system by crdoconnor on Thursday March 08, 2018 @02:34PM (#16546956)
I think the ideal build tool would be a framework written in a decent, readable high level scripting language.
Re:Make your own build system by lolikoisuru on Thursday March 08, 2018 @08:57AM (#16544312)
> Make's approach appears to be to use cryptic flags and settings

You already memorize similiar syntax things for other languages. Why is it so hard to accept in this case? Comparatively there are a lot less of them to remember with make as well. Stop being lazy and read the manual.

> and the best case documentation appears to be "have you tried stack overflow?".

Make's documentation is fantastic. The manual is very comprehensive and well written. Just because you're too lazy to read a manual doesn't mean there isn't documentation.

Go read the documentation for make: https://gnu.org/s/make/manual/

Re:Make your own build system by crdoconnor on Thursday March 08, 2018 @09:39AM (#16544553)
>You already memorize similiar syntax things for other languages.

Yes, and cryptic configuration settings and syntax causes obscure, hard to track down bugs in other languages too. Welcome to programming. I am not saying it isn't a problem elsewhere. I'm saying that if a competing build system manages to do the same things in a less cryptic way then that's a strong point in its favor.

Essentially make is a fully fledged stringly typed programming language - it's got conditionals, loops, variables, etc. It just wasn't a fully fledged turing complete programming language that had a lot of thought put in to syntax, usability and readability. By contrast, there are many languages which actually did have a lot of thought put in to those things.

Btw, stringly typed is not commonly considered a 'good' thing.

>Stop being lazy and read the manual.

Did the fact that I commented on its quality make you think that I didn't look at it?

Try doing ctrl-F on the manual and searching for ccache and cross compilation - what the OP regarded as two of the most "necessary" features.

To be fair, I can find information about these things.... stack overflow has information on them.

Also, if you dig deep in to the docs the amount of context given is very thin. Look at section "the two flavors of variable" - it took about 300 words to explain something that could have been illustrated with two simple examples.

Re:Make your own build system by lolikoisuru on Thursday March 08, 2018 @05:01PM (#16548091)
>It just wasn't a fully fledged turing complete programming language

It is turing complete though.

Re:Make your own build system by lolikoisuru on Thursday March 08, 2018 @05:42AM (#16543568)
>What about: cross compilation? ccache injection? verbose builds? parallelism control? installation prefix? Try being a package maintainer for a GNU/Linux distribution, where all of the above needs to be kept under control. You will despise custom build systems.

None of those are features that developers care about. They are only of interest to package maintainers, systems administrators and other lunatics.

Re:Make your own build system by pleasecalllater on Thursday March 08, 2018 @05:56AM (#16543604)
Yea... how come that "I don't care" became a virtue.
Re:Make your own build system by oblio on Thursday March 08, 2018 @06:02AM (#16543631)
It's not a virtue, but it is what happens in real life, though.

And I'm one of those "lunatics".

Re:Make your own build system by rout39574 on Thursday March 08, 2018 @12:13AM (#16542435)
I think that your build would be much more readable as make. Building object code and libraries from C is.. kind of well traveled ground?

Making an idiosyncratic system is satisfying, but the usefulness of your work is decreased if it's decorated with locally invented barriers to comprehension.

Rock on; scratch your itches.

Re:Make your own build system by jstimpfle on Thursday March 08, 2018 @04:24AM (#16543311)
I don't entirely disagree. If you only compile C files this is not for you. This is about exploring what building blocks it takes to also support building all the custom things you need besides that in a larger project.
Re:Make your own build system by lolikoisuru on Thursday March 08, 2018 @06:57AM (#16543796)
>If it's about making it easy for uninitiated collaborators to add new source files, then the listed build description format is pretty self-explanatory to use.

If you write a generic makefile the uninitiated collaborator doesn't have to do anything to add new source files.

Re:Make your own build system by imtringued on Thursday March 08, 2018 @09:40AM (#16544561)
That's the problem with make and why there are so many build systems built on top of it. Make alone isn't enough. It actually doesn't handle this case at all unless you use a compiler (-MMD) or any other external tool to basically generate the makefile. Otherwise you have to manage the source files and header dependencies yourself.
Re:Make your own build system by lolikoisuru on Thursday March 08, 2018 @04:54PM (#16548020)
It's out of scope for any general purpose DAG runner. Sure you can make a tool that can do that for language X, but make is used with a lot more than that. Make should not implement parsing of source code to find out what they include.
Re:Make your own build system by jstimpfle on Thursday March 08, 2018 @07:34AM (#16543946)
You can setup any build that way (no need to use Make) but I don't think that's a good idea.
Re:Make your own build system by MereInterest on Thursday March 08, 2018 @08:49AM (#16544279)
I'd be interested to hear what you think that way. In my mind, if a file exists within the src directory but is not compiled as part of the project, its existence is lying to the developer. Keeping a separate list of files to be included makes it possible to lie to the developer. Therefore, wildcard builds should be used, so the list of files in the src directory and the list of files being compiled are one and the same.
Re:Make your own build system by jstimpfle on Thursday March 08, 2018 @10:15AM (#16544785)
I like to have an official place where the build rules and artifacts are clearly laid out. I don't think file system directories are a good place to put the truth. For one thing, parsing the information from the directory contents means relying on out-of-band data. For another, directories often contain files that "should not be there". Or maybe you accidentally delete an important file. The build couldn't detect the mistake.