base: propagate environments through export argcheck wrappers.

* lib/std/base.lua (debug): Rename from this...
(debug_init): ...to this.
(_ARGCHECK, _DEBUG): Adjust accordingly.
(getfenv, setfenv): Compatibility functions for Lua 5.2.
(export): When returning argchecking wrapper function, propagate
the wrapper's function environment to the inner function.
* specs/base_spec.yaml (export): Adjust mkmagic not to rely on
out-of-scope MAGIC table.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>