Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: RFC: Setting up a minGW compiling envronment for Perl 5.10

by Bloodrage (Monk)
on Mar 02, 2008 at 23:12 UTC ( #671549=note: print w/replies, xml ) Need Help??

in reply to Re^3: RFC: Setting up a minGW compiling envronment for Perl 5.10
in thread RFC: Setting up a minGW compiling envronment for Perl 5.10

Fantastic. I did not know to do this. A quick little script:

use strict; use warnings; # This script is intended to change the extension on compiler librarie +s from .lib (MSVC standard) to .a (GNU standard). # It does this by grabbing the environment variables U3_DEVICE_PATH an +d LIB. # U3_DEVICE_PATH is used to exclude paths to libraries that aren't on +the U3 Compiler-onna-stick # LIB is used to provide a list of paths to scan for the libraries to +be checked. my $debug = 0; my $u3_drive = $ENV{'U3_DEVICE_PATH'} or die "HALT: U3_DEVICE_PATH is +not set or null ($!)\n"; my @lib_paths = split ";", $ENV{'LIB'} or die "HALT: LIB not set or nu +ll ($!)\n"; if ($debug){ print "U3_DEVICE_PATH is $u3_drive\n"; print "$_ is a LIB path\n" for (@lib_paths); } for my $lib_dir (@lib_paths){ -d $lib_dir or die "HALT: $_ not found ($!)\n"; unless ($lib_dir =~ /^$u3_drive/){ print "$lib_dir is not on $u3_drive, skipped.\n" if $debug; next; } print "$lib_dir is on $u3_drive processing...\n" if $debug; opendir THEDIR, $lib_dir or die "HALT: Can't open $lib_dir ($!)\n" +; my @lib_files = readdir THEDIR or die "HALT: Can't read $lib_dir ( +$!)\n"; close THEDIR; for my $lib_file (@lib_files){ unless($lib_file =~ /\.lib$|\.dll\.a$/i){ print "$lib_file does not end with .lib or .dll.a, skippin +g.\n" if $debug; next; } my $old_file = $lib_dir."\\".$lib_file; my $new_file = $old_file; $new_file =~ s/\.lib$|\.dll\.lib$|\.dll\.a$/.a/i; print "Renaming $old_file to $new_file\n"; rename $old_file, $new_file or die "HALT: Could not rename $ne +w_file ($!)\n"; } }

...and that's done.

Update The code now handles files ending in .dll.lib and renames them to .a as well...(and files that have been misnamed .dll.a, oh and properly escapes the .)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://671549]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2017-04-28 21:58 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (529 votes). Check out past polls.