X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Message-ID: <1344325070.9080.13.camel@YAAKOV04> Subject: bash: loadable builtins From: "Yaakov (Cygwin/X)" To: cygwin AT cygwin DOT com Date: Tue, 07 Aug 2012 02:37:50 -0500 Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Eric, 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 ${B}/[^y]*.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. HTH, Yaakov -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple