| www.delorie.com/archives/browse.cgi | search | 
| X-Recipient: | archive-cygwin AT delorie DOT com | 
| X-SWARE-Spam-Status: | No, hits=-1.7 required=5.0 tests=AWL,BAYES_20 | 
| X-Spam-Check-By: | sourceware.org | 
| Message-ID: | <4B813977.1010805@x-ray.at> | 
| Date: | Sun, 21 Feb 2010 14:47:35 +0100 | 
| From: | Reini Urban <rurban AT x-ray DOT at> | 
| User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.1.8) Gecko/20100205 SeaMonkey/2.0.3 | 
| MIME-Version: | 1.0 | 
| To: | Cygwin List <cygwin AT cygwin DOT com> | 
| Subject: | perlrebase.sh fast rebasing of perl dll's | 
| X-IsSubscribed: | yes | 
| 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 | 
--------------080003040202040602040703
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
For cygwin perl powerusers like me the attached script perlrebase.sh 
might come handy.
perlrebase.sh 5.11.4
searches for the perl5.11.4 executable in /usr/local/bin and /usr/bin 
then rebases all corresponding dll's.
default is 5.10.1
-- 
Reini Urban
--------------080003040202040602040703
Content-Type: text/plain;
 name="perlrebase.sh.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="perlrebase.sh.txt"
#!/bin/sh
suff=$1
suff=${suff:=5.10.1}
baseaddr=0x5200000
perl=/usr/local/bin/perl$suff.exe
if [ ! -f $perl ]; then
  perl=/usr/bin/perl$suff.exe
  if [ ! -f $perl ]; then
    echo "$perl and /usr/local/bin/perl$suff.exe not found"
    echo "usage: perlrebase.sh [5.11.4d-nt]"
    exit
  fi
fi
dll=$(ldd $perl | perl -anle 'print $F[2] if /cygperl/')
arch=$($perl -MConfig -MFile::Basename -e'print basename($Config{archlib})')
ver=$($perl -MConfig -MFile::Basename -e'print basename(dirname $Config{archlib})')
echo $perl > rebase$suff.lst
if [ ! -d /usr/lib/perl5/$ver/$arch/auto ]; then
  echo "no archlib found for $perl"
  exit
fi
if [ ! -e /usr/bin/rebase.exe ]; then
  echo "/usr/bin/rebase.exe not found. Install the rebase package"
  exit
fi
# pushd /usr/lib/perl5
echo $dll >> rebase$suff.lst
find /usr/lib/perl5/{,site_perl/,vendor_perl/}$ver/$arch/auto/ -name \*.dll >> rebase$suff.lst 
cat rebase$suff.lst | xargs chmod u+w 
rebase -v -b $baseaddr -T rebase$suff.lst
cat rebase$suff.lst | xargs chmod u-w
# popd
--------------080003040202040602040703
Content-Type: text/plain; charset=us-ascii
--
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
--------------080003040202040602040703--
| webmaster | delorie software privacy | 
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |