Should we change/adapt the build process?
(with the objective to make it easily maintainable and accessible to a greater number)
Small knowledgeable community
I know nobody amongst my fellow developers that has insight knowledge on the build process beyond bin/package make
, let alone to maintain it, but simply to customise it. Neither do I.
That said, they know how to maintain and tweak GNU Autotools and CMake toolchains.
Note: Do not jump to conclusions here, I am not trying to promote Autotools or CMake; quite the contrary. I simply want to emphasise the lack of openess of the build process' logic and toolchain.
Scarse documentation
Embedded usage documentation in any C or Korn shell script is a fantastic asset of the AST developments, and certainly immensely underused among users of AST packages.... except for the AST developers who have consistently added usage information to all their utilities.
Nonetheless that documentation does not suffice for a newbie to get his head round the build toolchain and gain sufficient insight information to act alone without calling out for help.
Today I am confronted with a failing build on a platform, which is certainly not exotic (MacOS), and I find myself spending hours trying to understand where the errors occur.
Unless told otherwise, I have no supporting information to help me get through my build failures. And calling out for help won't be of great help because ( I presume) only a few have invested significant time in understanding the guts of the toolchain. Questions will take time to be answered, if ever answered.
Build tool
When all goes well, the AST build toolchain seems to beat flat out the other tools mentioned above. It has (apparently) no dependencies, allows for all the GNU Autoconfigure probing without the M4 hell, and nicely lays out its build products.
Opinion: GNU Autotools are a fantastic suite. But they have a major inconvenience: M4. Opaque and to a certain extend clumsy. Probably a good compromise for portability 30 to 40 years ago. But no longer the ad hoc tool for today; pre-processing could be done the AST way :-)
Could the AST build toolchain be system agnostic and a possible replacement for GNU Autotools or CMake on other projects? A toolchain written in portable POSIX shell targeting any raw (POSIX) UNIX or Linux.
Whilst this was probably a driver in its conception, we see, going through the source files that it depend on bash
here, lynx
or wget
there, etc. So it is not agnostic and doesn't build on a raw system; it requires GNUish capabilities. Hence it targets UNIX/GNU or Linux/GNU platforms.
Note: for the reasoning let us ignore for now that we probably need gcc
to avoid proprietary compilers (where such compilers still exist).
Logically one can ask, why then maintain a distinct build toolchain? Why not use GNU Autotools or CMake?
Liminary thoughts
The breakup of the AST development team has (luckily) brought the AST developments to the open source community. But the community is small (and probably fragile).
If the AST packages and the Korn shell are here to stay, the community needs to be enlarged.
Enlarging the community means, making the build process accessible to many.
Migrating to GNU Autotools or CMake is an enormous effort which would require such time investment that it is almost guaranteed to stall.
Documentation and HOWTOs seems to be the only realistic approach. This also requires time, and reverse engineering.
Request for comments
In the 90s, shell portability was a big concern, and scripting had to focus on POSIX shells only (Korn shell wasn't a POSIX shell at the time, it now is).
Today, thanks to AT&T opening up the source code, a Korn shell exists on (almost) every platform. Not PDKSH or old versions, but a ksh93
executable (whatever its release).
Consequently, in 2017 onwards, we can assume that we have a Korn shell executable that supports the 93 syntax and features.
Converting the AST build toolchain scripts from universal shell syntax to Korn shell 93 syntax can:
a) greatly reduce the LOC (e.g. iffe
could be reduced by 50%)
b) allow for clean environments with the function
keywords, limiting globals
c) break down the code into smaller and more maintainable chunks using FPATH
d) usage information can be added to all functions
This doesn't require a full reverse engineering effort, nor does it require a full rewrite of the code.
At the same time this allows for a learning curve which can be populated in HOWTO's and central documentation.
By doing this we can (re)gain knowledge of the AST build toolchain, document it properly for the community to get involved, and lead the way for a ksh2023
rather than a ksh93+z2023
:-)