tools: sync gyp code base with node-gyp repo
This syncs the gyp code base so that it is identical to the one in nodejs/node-gyp.
This was done by removing the code in nodejs/node-gyp, copying from nodejs/node and then manually reviewing and adapting the diff.