delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/08/07/03:38:12

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)" <yselkowitz AT users DOT sourceforge DOT net>
To: cygwin AT cygwin DOT com
Date: Tue, 07 Aug 2012 02:37:50 -0500
Mime-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019