bash: loadable builtins

Yaakov (Cygwin/X)
Tue Aug 7 08:20:00 GMT 2012


As there was a question on this in IRC tonight, it is possible to make
bash loadable builtins work on Cygwin.

1) In src_compile(), add
LOCAL_LDFLAGS='-Wl,--export-all,--out-implib,lib$(@:.exe=.dll.a)' to the
final cygmake command.

2) In src_install(), add the following immediately after cyginstall:
  dolib libbash.dll.a
  cd ${S}
  includeinto bash
  doinclude [^y]*.h builtins/*.h include/*.h lib/{glob,tilde}/*.h

3) Builtins are compiled with `gcc -shared -I/usr/include/bash -o
foo.dll foo.c -lbash'

4) The builtin can then be loaded with enable -f foo.dll foo etc.

The only caveat is that this will only work with bash.exe, not sh.exe,
but as the latter should only be used with portable code, IMO that's a
reasonable restriction.



Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list