Martin Schlemmer
2005-Mar-09 15:40 UTC
[klibc] makeklcc.pl passes '' to ld if LDFLAGS empty among things
Hi, If say ppc where LDFLAGS=, you get the problem that klcc is generated like: ----- @LDFLAGS = ( '' ) ----- which then causes '' to get passed to ld, which gives: ----- /usr/bin/ld: : No such file: No such file or directory ----- One of two ways (I tried over here at least) to fix it, namely the quick hack: ----- --- 1/makeklcc.pl 2005-03-10 00:22:03.000000000 +0200 +++ 2/makeklcc.pl 2005-03-10 00:50:32.000000000 +0200 @@ -13,7 +13,11 @@ my($s) = @_; $s =~ s/\s+/\',\'/g; - return "(\'".$s."\')"; + if ( $s ne "" ) { + return "(\'".$s."\')"; + } else { + return "()"; + } } print "#!${perlpath}\n"; ----- Or the more extreme: ----- --- 1/makeklcc.pl 2005-03-10 00:22:03.000000000 +0200 +++ 2/makeklcc.pl 2005-03-10 01:26:51.000000000 +0200 @@ -7,24 +7,14 @@ ($klccin, $klibcconf, $perlpath) = @ARGV; -# This should probably handle quotes and escapes... -sub string2list($) -{ - my($s) = @_; - - $s =~ s/\s+/\',\'/g; - return "(\'".$s."\')"; -} - print "#!${perlpath}\n"; open(KLIBCCONF, '<', $klibcconf) or die "$0: cannot open $klibcconf: $!\n"; while ( defined($l = <KLIBCCONF>) ) { - chomp $l; - if ( $l =~ /^([^=]+)\=(.*)$/ ) { + if ( $l =~ /^([^=]+)=(.*)$/ ) { $n = $1; $s = $2; print "\$$n = \"\Q$s\E\";\n"; - print "\@$n = ", string2list($s), ";\n"; + print "\@$n = qw( $s );\n"; print "\$conf{\'\L$n\E\'} = \\\$$n;\n"; } } ----- (Credits for last goes to Aron Griffis) Regards, -- Martin Schlemmer -- ---------------------[ Ciphire Signature ]---------------------- From: azarah@nosferatu.za.org signed email body (1173 characters) Date: on 09 March 2005 at 23:39:42 UTC To: klibc@zytor.com ---------------------------------------------------------------- : Ciphire has secured this email against identity theft. : Free download at www.ciphire.com. The garbled lines : below are the sender's verifiable digital signature. ---------------------------------------------------------------- 00fAAAAAEAAAA+iS9ClQQAAE4CAAIAAgACACAjYe/qeWoHRrdDE3mOifT0WPgp92 kbkclxgX1lQsV9VwEAJOQiG+Djg3e7Ai63e8AMF0Hl/gle8q4Ud88Lecx5fcXNtl 3DAZVZcFq04+rPD6tpTtLgraiMSUDYV3YWoTTHKg=------------------[ End Ciphire Signed Message ]----------------