💾 Archived View for ew.srht.site › en › 2022 › 20221218-redo-0.gmi captured on 2023-11-14 at 07:54:23. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

➡️ Next capture (2024-06-16)

-=-=-=-=-=-=-

2022-12-18

Tools: redo (part 0) Intro

tags: software

Since October 2020 I'm fiddling with "redo", a build tool imagined by Daniel Bernstein. Writing about it will make me understand it better. And along the way, maybe others find it interesting, so here we go. This series will grow.

Content

Part 0: Intro

Part 1: Hello, world!

Part 2: Automatic Recording of Dependencies on Header Files

Part 3: CFLAGS and friends, config.sh, compile.do

Part 4: CFLAGS and friends, env/VAR, default.run.do

Part 5: Auto-update BUILDDATE in version.h

Part 6: The yacc/bison problem: one call produces two artifacts

Part 7: Test: Generator for N source files

My code featured in this series can be found at

https://git.sr.ht/~ew/ew.redo/

Part 0: Intro

For some reason I came across this interesting statement:

The only build system that might someday replace make...
...is djb redo.

https://apenwarr.ca/log/?m=201012#14

And a little later this more bold statement:

I think that djb redo will turn out to be the Git of build systems.

https://pozorvlak.livejournal.com/159126.html

I had heard about "redo" before, and now it sparked my interest. I did not find too much about this build system, and I did not understand it at first. So I will try to retrace, what I would need to read in order to find out for myself.

Detour: remarks about make and cons

Make was the first real tool I learned way back in maybe 1991 or so, when I got my first user account on a Unix system. A chapter of some book explained, what it can do for me, and how to make use of it. I immediately started building my software with it, and moreover I organized generating and formatting snippets of my thesis (written in LaTeX). Even then I did not understand, why not /everyone/ was using make. There were build shell skripts and other hacks in use.

Of course I had my share of problems (cursing included) and of course I had to read the fameous paper by Peter Miller, to understand

Recursive Make Considered Harmful

A colleage and I built a very nice single session make build for a fairly complex project back in 2005 or so.

I had a look into cons and scons as well. And while I could build something with it, I never understood enough OO-perl or python to actually create my own additions. However, the takeway from this experiment was that mtime timestamps just don't cut it and checksums go a much longer way. Their use can fix a broken file in some chain, without even rebuilding the rest of the chain, if it turns out, that the repaired file has the same content as before. That I found truely impressive.

https://www.gnu.org/software/cons/

https://scons.org/

However, the folks around me rather used qmake or cmake or something else entirely. Not my cup of tea.

redo by djb

djb is refering to Daniel J. Bernstein, a person with a big math brain. He apparently has described the build system, it is unclear whether he has fully implemented it.

https://cr.yp.to/djb.html

https://cr.yp.to/redo.html

https://en.wikipedia.org/wiki/Daniel_J._Bernstein

But others have picked it up. Jonathan de Boyne Pollard has a nice overview.

https://jdebp.uk/FGA/introduction-to-redo.html

Avery Pennarun has written an implementation in Python, and imho the best documentation.

https://github.com/apenwarr/redo

https://redo.readthedocs.io/en/latest/

In my experiments I have used an implementation in Go by Sergey Matveev found here:

http://www.goredo.cypherpunks.ru/

Download a tarball, verify it, unpack it and follow the INSTALL instructions. I placed the executable in $HOME/bin/ and called "goredo -symlinks", iirc. That creates all commands as symlinks:

shell$ goredo --version
goredo 1.27.1 built with go1.19.1
shell$ ls -l ./bin/*redo*
-rwxr-xr-x 1 ew ew 3368667 Sep 21 11:11 goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-affects -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-always -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-cleanup -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-depfix -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-dot -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-ifchange -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-ifcreate -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-log -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-ood -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-sources -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-stamp -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-targets -> ./goredo
lrwxrwxrwx 1 ew ew       8 Sep 21 11:11 redo-whichdo -> ./goredo

As mentioned, there are several implementations, they all differ to some extent, their recording of dependencies is different, and so on. But at this point nothing stood out as particularly important. At the end of Nils Dagsson Moskopp's description, there is a table with comments.

http://news.dieweltistgarnichtso.net./bin/redo-sh.html

Home