Skip to content

Get Noweb 3 to build on Windows#2

Open
dazitzel wants to merge 40 commits intonrnrnr:masterfrom
dazitzel:master
Open

Get Noweb 3 to build on Windows#2
dazitzel wants to merge 40 commits intonrnrnr:masterfrom
dazitzel:master

Conversation

@dazitzel
Copy link

This builds Noweb 3 on a Windows system, allows for generation of all 167 pages of documentation, and can successfully run a basic sanity check on it's behavior by using Noweb 3 to build Noweb 3.

Copy Makefile to Makefile.win and hack until it builds.
1) Copy Makefile to Makefile.win
2) Hack until it builds

This isn't completely fair, I did run some experiments over the summer so I was aware that I only need these two libraries.
I have taken advantage of that knowledge to not worry about the rest.
This is a direct copy of the C source files from Noweb2 (2.11b, I believe).
In this case we are building markup.exe and nt.exe.

We also need nocond and something to tie the input and a file together.
Unfortunately, for developers on Windows, nocond is a script and tie is not a standard command.

Nocond was built as a simple parser (and yes, I know that a massive switch statement is bad).
Tie was hacked together in even less time.
These are not designed to be general purpose tools, but one shot tools to enable the building of Noweb 3.

I imagine at some future point there will either be a better bootstrapping system or Noweb 3 will use the same trick Noweb 2 used --- that is distribute sources as well.
This change builds no.exe and nwmtime.exe.

xpipe.nw is the largest change.
This is addition of support for the Windows platform.
This code worked in my experiments over the summer, and with this commit I am assuming that it still will.
I will verify when I get the lua scripts building.

nwtime.nw has had non-Posix versions added.
This is something in the github version that was not in the .tar.gz from the Noweb website.

nwmtime.nw included unistd.h, but it is not be needed so I simply removed it.

The change to Makefile was because of the realization that I had broken the Linux build in my previous two commits.
nmake doesn't work very well if your local variable is $(BIN), so it was replaced with $(BINDIR).
The `Makefile's which were using the BIN macro have been updated to use the BINDIR macro instead.
1) Copy lua/Makefile to lua/Makefile.win
2) Hack it till it builds.
3) Try using Noweb 3 to tangle and weave one Noweb file.

The change to lua/tohtml.nw was required to get the scripts to execute.
An end of line comment in a snippet wil preventing correct parsing of post-snippet punctuation.

lua/Makefile.win was fairly mechanical to update once I had the first cfg file generated correctly.

Makefile.win now completes building `all' without error.
Updated almost all of the Makefile.win files to support a clean and clobber setting.
For these files I define clean as ``just the files I want are left'' and clobber as ``it's all gone''.
Probably the most controversial thing about this is that the root Makefile.win will ask for a clobber of some items when it is just being cleaned.
This fits with my definitions because even though a library may be clean by removing everything except the .lib files;
a system dependent on those .lib files isn't clean until the .lib files are clobbered.

I also added a large README.win to explain how to build, clean, and clobber everything on a Windows box.
Addition of the tex directory from Noweb 2 to generate the nwmac.tex for TeX and noweb.sty for LaTeX.

Addition to Makefile.win to generate doc.pdf.
This only works with Noweb 3 and weaves everything, so this servers as some level of sanity testing.

Both READMEs updated because of the added directory.
README.win updated with instructions for making doc.pdf as well as timing experiments.
Added the `careful' target to Makefile.win.
This builds Noweb 3 using the tools (basically Noweb 2).
Then it runs `clean' so everything needs to be regenerated.
Then it build Noweb 3 using the just built Noweb 3.
Finally, it weaves everything.

README.win updated to document this target.
@nrnrnr
Copy link
Owner

nrnrnr commented Sep 19, 2015

It's going to take me a while to digest this one.

I'm surprised CII did not already build on Windows. Dave Hanson is usually super careful about stuff like that. Did you look into any of that?

@dazitzel
Copy link
Author

I did try to make the commits in a progressive order so you should be able to digest one commit at a time.

I know that there are several added files. They will be much easier to digest when comparing them with existing files. For instance, the results of `diff Makefile Makefile.win' will be much easier to comprehend than just looking at Makefile.win in isolation. Similar for most of the tools directory and Noweb 2 sources.

I apologize for not making that obvious enough in the commit messages.

Regarding CII, yes CII does build on Windows and when I tried it over the summer it built on both my Windows box and my Linux box.

You aren't using CII, that is, you aren't using all of CII. The parts of CII that are in Noweb 3 do not compile because of missing source files.

At this point the four most obvious choices were:

  1. Adjust Makefile.nt until it builds.
  2. Copy Makefile.nt and adjust until it builds.
  3. Copy Makefile and adjust until it builds.
  4. Pull in all of CII.

I didn't try option 4 because it seemed the wrong choice.
I didn't try option 1 because I am hoping to adjust the DRY-ness of the make files.
I dare say that you would be hard pressed to tell if I went with option 2 or option 3.

@nrnrnr
Copy link
Owner

nrnrnr commented Sep 19, 2015

Thanks for those clarifications. Right now I am ill and I am behind at work, and so will touch nothing.

In the near future, I will have a closer look at the pull request and will probably merge everything.
I need to take a bit of care because Noweb 3 is on the critical path for my current project. But I hope after some deadlines are wrapped up I can take care of this. Maybe mid-October.

dazitzel and others added 17 commits September 21, 2015 08:14
Separate nwconfig into configurations rather than one massing file.
nwconfig replaced with instructions instead of an include.
Several macros added to nwconfig.*.
tools\Makefile.win renamed and adjusted.
Makfile and Makefile.win adjusted to be shared through the building of tools.
Reorganization of nwconfig.*

Update to tools/Makefile to account for nwconfig.* changes
No change execpt dos end of line to unix end of line.
Updates to Makefile (and match with updates to Makefile.win) until Linux builds cii as well.

Had to add a space after `ar rv' because if I place a space after $(AR) in the Makefile recipe, then Windows doesn't build.
The building of lua-2.5+nw is, admittedly, a kludge.

It didn't seem worthwhile to combine the lua makefiles when we have a goal of moving to lua 5.
We can combine the makefiles at that point.
Also add a couple of small sections to nwbuffer-lua.nw to regularize the generation of nwbuffer-lua.c.

Noticed and fixed an off by one error in tie.c.
One major change to linux builds here is that the primary scripts are renamed.
Instead of being called tangle.nws and weave.nws, they are now just tangle and weave.

Potentially I could have adjusted util.nw to automatically try adding the correct extension on a Win32 build;
but I decided I liked this solution better when I realized what the noweb scripts directory would look like.

With this change you will have .cfg files for configuration and shared functions,
.nws files for stages and internal filters,
and extensionless files for commands.

That seeems like a good thing.
Also put in a couple of minor fixes to clean/clobber which I had missed earlier.
In the case of lua-2.5+nw Makefiles, I have not unified them and I have only quieted the .win
versions.
A little bit of cleanup.

Updated READMEs to match new expectations.

Addition of another hacky tool to allow creation of todo.html.
Changes to Makefile to build on linux.

Merge of README.win into README and corrections to match the
new build system.

Update of limake to handing the BIN->BINDIR rename.

Re-merge of the updated nwconfig.unix and nwconfig.win to be closer
to the original.

Install used to have duplicate build information which varied slightly
from what was in README. It now points you to README and is more of an
installation/build list of troubleshooting pointers.
First step in moving up to using Lua 5 is removing the nw extensions
that were added to 2.5.

In order to provide a level of confidence of correctness I am adding
a new target called `tranfer' because we are transferring from 2.5+nw
to 2.5, and eventually up to 5. This target was initiall modelled on
careful.

The plan is to build a 2.5+nw and a 2.5 version with the programs in
tools. Then build them again using the 2.5+nw version. Then build them
one more time using the 2.5 version. If the 2.5+nw and 2.5 versions are
the same regardless of whether they were built with 2.5+nw or 2.5 then
both programs should be working the same and the conversion of the Lua
scripts was correct.

A quick look for echo commands will show how much of it works so far.
Lua version 2.5, without the Noweb extensions, added with a set of
Makefile.win files to get it to build on a Windows box.

nwconfig updated to support building both lua-2.5+nw and lua-2.5.

`echo' markers updated to the next build failure when building
the `transfer' target.
Removed the hardcoded LUA macro and added passed-in LUA and LUALIB
macros.

LUA is still used to determine the include directories, it's just
decided outside
of the makefile.

LUALIB is where to find the built libraries.
The prior version is generated by `nocond luanw' and the updated one
is generated by `nocond lua2'.

The root Makefile has a completed recipe for `trasfer' that builds
both versions of Noweb 3 with the Lua-2.5+nw library, and then builds
both versions of Noweb 3 with the Lua-2.5 library, and compares the
results.

With this commit, the comparison shows no differences so I believe
that the translation from `globmatch' and `case end' to `matchpattern'
and `if elseif end' is correct.
Changed the makefile so that Lua-2.5+nw is now
the exception I am testing for and Lua-2.5 is
the normally built version.
Now we are only using Lua 2.5 without any of the noweb extensions.
Small changes to lua-2.5 makefiles focusing on the parts we need.

Also cut down on the amount of kludge and removed it from nwconfig.
I was looking over the Lua2 branch and deciding
how similar or different the transition to Lua3
should be and noticed that the README was incorrect.

There are still several references to Lua-2.5+nw
in the xdoc folder. I have opted to leave those as
is for now because todo.nw already has a line item
acknowledging that all the text in xdoc needs a going
over.

I fully admit that this is not literate but have you
read the chunck of text that appears on page one of
the noweb weave?
No changes, just adding it.
Get Lua 3.0 to build, add a transfer target that will build
both versions, and run a full test by having each build itself
and the other and see what the differences are.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants