http://www.perlmonks.org?node_id=671549


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 .)