Update of /cvsroot/fink/fink/perlmod/Fink In directory vz-cvs-3.sog:/tmp/cvs-serv13755/perlmod/Fink
Modified Files: ChangeLog PkgVersion.pm Log Message: On 10.7 only support 64-bit, and use path-prefix-clang to send gcc/g++ calls to clang/clang++ (thanks jhowarth!) Index: PkgVersion.pm =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/PkgVersion.pm,v retrieving revision 1.661 retrieving revision 1.662 diff -u -d -r1.661 -r1.662 --- PkgVersion.pm 25 May 2011 00:20:44 -0000 1.661 +++ PkgVersion.pm 10 Jun 2011 15:30:22 -0000 1.662 @@ -4825,11 +4825,65 @@ Fink::PkgVersion->dpkg_changed; } + +=item ensure_clang_prefix + + my $prefix_path = ensure_clang_prefix; + +Ensures that a path-prefix directory exists to use clang compilers +Returns the path to the resulting directory. + +=cut + +sub ensure_clang_prefix { + my $dir = "$basepath/var/lib/fink/path-prefix-clang"; + unless (-d $dir) { + mkdir_p $dir or die "Path-prefix dir $dir cannot be created!\n"; + } + + my $gpp = "$dir/compiler_wrapper"; + unless (-x $gpp) { + open GPP, ">$gpp" or die "Path-prefix file $gpp cannot be created!\n"; + print GPP <<EOF; +#!/bin/sh +compiler=\${0##*/} +save_IFS="\$IFS" +IFS=: +newpath= +for dir in \$PATH ; do + case \$dir in + *var/lib/fink/path-prefix*) ;; + *) newpath="\${newpath:+\${newpath}:}\$dir" ;; + esac +done +IFS="\$save_IFS" +export PATH="\$newpath" +if [ "\$compiler" = "cc" -o "\$compiler" = "gcc" ]; then + compiler="clang" +fi +if [ "\$compiler" = "c++" -o "\$compiler" = "g++" ]; then + compiler="clang++" +fi +exec \$compiler "\$@" +EOF + close GPP; + chmod 0755, $gpp or die "Path-prefix file $gpp cannot be made executable!\n"; + } + + foreach my $cpp ("$dir/cc", "$dir/c++", "$dir/gcc", "$dir/g++") { + unless (-l $cpp) { + symlink 'compiler_wrapper', $cpp or die "Path-prefix link $cpp cannot be created!\n"; + } + } + + return $dir; +} + =item ensure_gpp106_prefix - my $prefix_path = ensure_gpp106_prefix; + my $prefix_path = ensure_gpp106_prefix $arch; -Ensures that a path-prefix directory exists for mac osx 10.6 +Ensures that a path-prefix directory exists to make compilers single-arch Returns the path to the resulting directory. =cut @@ -5106,11 +5160,13 @@ } } - # Enforce g++-3.3 or g++-4.0 even for uncooperative packages, by making - # it the first g++ in the path unless ($self->has_param('NoSetPATH')) { + # use path-prefix-* to give magic to 'gcc' and related commands my $pathprefix; if ($config->param("Distribution") lt "10.6") { + # Enforce g++-3.3 or g++-4.0 even for uncooperative + # packages, by making it the first 'g++' in the path + # (symbol-munging binary compatibility) my $vers; if (($config->param("Distribution") lt "10.4") or ($config->param("Distribution") eq "10.4-transitional")) { $vers = '3.3'; @@ -5118,14 +5174,17 @@ $vers = '4.0'; } $pathprefix = ensure_gpp_prefix($vers); - # and for modern distributions, use architecture-based compiler-wrapper - } else { - $pathprefix = ensure_gpp106_prefix($config->param("Architecture")); } - # also use the architecture-based compiler-wrapper on x86_64 architecture - if ($config->param("Architecture") eq "x86_64") { + if ($config->param("Distribution") eq "10.6" || $config->param("Architecture") eq "x86_64") { + # Use single-architecture compiler-wrapper on 10.6. Also + # override on older 10.x (gcc3.3 & 10.4T not supported) $pathprefix = ensure_gpp106_prefix($config->param("Architecture")); } + if ($config->param("Distribution") gt "10.6") { + # Use clang for gcc/g++ on darwin11 and later. Only + # x86_64 supported so can override single-arch wrappers. + $pathprefix = ensure_clang_prefix(); + } $script_env{'PATH'} = "$pathprefix:" . $script_env{'PATH'}; } Index: ChangeLog =================================================================== RCS file: /cvsroot/fink/fink/perlmod/Fink/ChangeLog,v retrieving revision 1.1711 retrieving revision 1.1712 diff -u -d -r1.1711 -r1.1712 --- ChangeLog 26 May 2011 19:24:43 -0000 1.1711 +++ ChangeLog 10 Jun 2011 15:30:22 -0000 1.1712 @@ -1,3 +1,9 @@ +2011-06-11 Daniel Macks <dma...@netspace.org> + + * PkgVersion.pm: import jhowarth's ensure_clang_prefix: create + path-prefix-clang/gcc and friends as wrapper around clang etc. + Use it on dist:10.7. + 2011-05-26 Daniel Macks <dma...@netspace.org> * Validation.pm: packages may have buried include/ headers dir ------------------------------------------------------------------------------ EditLive Enterprise is the world's most technically advanced content authoring tool. Experience the power of Track Changes, Inline Image Editing and ensure content is compliant with Accessibility Checking. http://p.sf.net/sfu/ephox-dev2dev _______________________________________________ Fink-commits mailing list Fink-commits@lists.sourceforge.net http://news.gmane.org/gmane.os.apple.fink.cvs