Hi, I have just ported ninja over to z/OS and would like to contribute the changes to the master branch. Before I create a PR I thought we should talk about this since it is a little different than most changes.. I guess I'll start by giving an overview of the changes I had to make to get ninja working. The changes can be summarized as:
1) EBCDIC support. This is fair easier than you would expect. I built ninja with the compiler in "ASCII" mode and used few calls to fcntl() to convert characters from EBCDIC to ASCII while reading input by the file system. This should mean no one needs to worry about EBCDIC when making changes on other platforms. All I did was add one function call per important file descriptor to enable the conversion and the implementation of that function.
2) Using exec/fork for the subprocess management. z/OS doesn't have the same level of support for spawn as ninja is using. I had to implement the spawning using the traditional fork/exec sequence.
3) A few smaller places where z/OS has different interfaces to handle system interaction (eg. determining the number of processors).
4) Add support for the z/OS compiler
5) other misc things where the interfaces in system headers were slightly different than on other platforms.
I have not looked at re2c yet. So right now you can't modify the grammar on z/OS. I did find one curious bug in configure.py related to this that may occur on other platforms and may require a newer python level (or just someone with more python knowledge than I have). I found the code to run "re2c -V" would cause duplicate lines in the build.ninja file when it failed. Changing "stdout=subprocess.PIPE" to "stdout=subprocess.DEVNULL" solved the problem.
I do work for IBM. I have been working on compilers for many platforms for many years. You can reach me at perry at
ca.ibm.com as well as this email address.
Thanks