psmedley / node-os2

Other
1 stars 0 forks source link

gyp needs to be fixed to use response files #1

Closed psmedley closed 1 year ago

psmedley commented 1 year ago

Currently gyp generates make files which fail on OS/2 due to the command line exceeding 32k characters.

We need to adapt make.py to generate response files.

Steven suggests: `I suspect we may want to tweak gyp. At the moment I am little more than buzzword compliant in gpy so you may need to ignore me.

We have

tools\gyp\pylib\gyp\generator\make.py:139 LINK_COMMANDS_LINUX = """\ quiet_cmd_alink = AR($(TOOLSET)) $@ cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)

which appears to be what is generating the long-ish command lines.

This can be rewritten with make's file function to use response files. See 8.6 The 'file' Function in make.info

The example provided is:

program: $(OBJECTS) $(file >$@.in,$^) $(CMD) $(CMDFLAGS) @$@.in @rm $@.in

which does no filtering and is doing rm rather than ar and is multi-line. Assuming I have the syntax right, something like

rm -f $@ && $(file >$@.in,$(filter %.o,$^)) ; $(AR.$(TOOLSET)) crs $@ @$@.in

should work.

filter is documented in 8.2 Functions for String Substitution and Analysis

ar does response files, so given:

[d:\tmp]cat tmp.rsp foo

Running results in the expected

[d:\tmp]ar crs a.a @tmp.rsp |& less D:\USR\BIN\ar.exe: foo: No such file or directory

There actually two make.py's so both may need to be tweaked.

If the above works, it might be better to add our own LINK_COMMANDS_OS2 avoid conflicts going forward.

I may scan the gpy repo later to see if newer version support response files better. `

psmedley commented 1 year ago

Commits e0ccfc486876200f4e70038e32ada48bbcec7f16 4d5989c3941d51d453d7f1fc24223aa4b002ade8 & bf2158ccbe4b6c3ecf793a722a73e231d00d4aeb contain the initial attempts - for now only in the make.py in the tools directory.

psmedley commented 1 year ago

Fixed in 1c5b8544c2b5fea0a0df67c03ef1aee6b7d3f600