#!/usr/bin/perl ## $Id: run47,v 1.37 2014/01/13 13:39:37 pdc Exp $ $pwd=`pwd`; chomp($pwd); $quiet=$ENV{QUIET}+0; $forcexx=$ENV{FORCEXX}+0; $GCCFLAGS=$ENV{GCCFLAGS}; $GPPFLAGS=$ENV{GPPFLAGS}; $GCCERR=$ENV{GCCERR}; $warn=''; our $ERR=\*STDERR; my $noLTO=$ENV{NO_LTO}=~/1|yes/i; if(defined $GCCERR) { open ERR,">>", $GCCERR || die "cant create error output: $!\n"; $ERR=\*ERR; } if($ARGV[0] eq '') { $h=" COMPILER_TYPE=gcc CC=run47 CXX=run47++ FC=run47f"; print $ERR "env PATH=/tmp/run47:\$PATH GCCFLAGS='-fPIC ' make $h all deinstall reinstall \n"; print $ERR "env PATH=/tmp/run47:\$PATH make $h CFLAGS+=-fPIC all deinstall reinstall \n"; print $ERR "env PATH=/tmp/run47:\$PATH make $h all deinstall reinstall \n"; print $ERR "make $h all deinstall reinstall \n"; print $ERR "make $h CFLAGS+=-fPIC all deinstall reinstall \n"; print $ERR "make $h GCCFLAGS=-lintl all deinstall reinstall \n"; print $ERR "make $h DEBUG_FLAGS=-g3 WITH_DEBUG=yes all deinstall reinstall \n"; print $ERR "make $h \n"; print $ERR "make $h NO_LTO=1\n"; print $ERR "make1 $h\n"; print $ERR "env $h make \n"; print $ERR "env GCCFLAGS='-fPIC -I/usr/local/include/glib12 -I/usr/local/include/libIDL-1.0' make1 $h\n"; #print $ERR " CFLAGS+=-fPIC FORCEXX=1 QUIET=1 env GCCFLAGS=-lstdc++\n"; print $ERR " $h CPP=run47cpp \n"; print $ERR " CFLAGS+=-fPIC FORCEXX=1 QUIET=1 GCCFLAGS=-lstdc++ GCCFLAGS='-lstdc++ -g3'\n"; print $ERR " DEBUG_FLAGS=-g3 WITH_DEBUG=yes GCCERR=`tty` \n"; print $ERR "$0 install\n"; exit 64; } elsif($ARGV[0] eq 'install') { system qq% mkdir /tmp/run47 ln -sf "$0" /tmp/run47/cc ln -sf "$0" /tmp/run47/gcc ln -sf "$0" /tmp/run47/g++ ln -sf "$0" /tmp/run47/c++ ln -sf "$0" /tmp/run47/gcc47 ln -sf "$0" /tmp/run47/g++47 %; exit 0; } print $ERR "\n"; my $nolink=0; $args=join ' ',@ARGV; if($args=~/-x c\+\+-header|hpp$/) { $nolink=1; } @ARG=(); for $i (0..$#ARGV) { $a=$ARGV[$i]; if($a=~s/^-avoid-version$//) { $warn.="******.avoid-version.************ " }; if($a=~s/^-Qunused-arguments$//) { $warn.="******.Qunused-arguments.************ " }; if($a=~s/^-Bsymbolic-functions$//) { $warn.="******.Bsymbolic-functions.************ " }; if($a=~s/(\s)-implicit-function-declaration$/$1/) { $warn.="******.implicit-function-declaration.************ " }; if($a=~s/^-fformat-extensions$//) { $warn.="******.fformat-extensions.************* " }; if($a=~s/^-fno-format-extensions$//) { $warn.="******.fno-format-extensions.************* " }; if($a=~s/^-fforce-mem$//) { $warn.="******.fforce-mem.************* " }; if($a=~s/^-fno-format-extensions$//) { $warn.+"*******.fno-format-extensions.********** " }; if($a=~s/^--shave-mode=(compile|link)$//) { $warn.="********.shave-mode=$1.********* " }; if($a=~s/^-Werror$//) { $warn.="********.Werror.********* " }; if($a=~s/^-Wl --warn-common$/-Wl,--warn-common/) { $warn.="********.warn-common.********* " }; if($a=~s/^-Wl$//) { $warn.="********.lone.Wl.********* " }; if($a=~s/^-module//) { $warn.="********.module.********* " }; if($a=~s/^-liconv/-lc/) { $warn.="********.-liconv.********* " }; # !!! 10-11? if($nolink && $a=~s/^-Wl,\S+//) { $warn.="********.NO-LINK-NOW.********* " }; if($noLTO && $a=~s/^-flto$//) { $warn.="********.flto.********* " }; push @ARG,$a if $a ne '' }; $_=$0; $run='gcc47'; $run='g++47' if /\+\+/ || $forcexx; $run='gfortran47' if /fortran|runf47/; if ( /run47cpp|cpp47/ ) { $run='cpp47'; $GCCFLAGS=''; # no need for CPP }; if ( /gcc47\+\+/ ) { push @ARG,split(/\s+/,$GPPFLAGS) if $GPPFLAGS ne ''; }; #push @ARG,"-D__FreeBSD_cc_version=400001"; push @ARG,split(/\s+/,$GCCFLAGS) if $GCCFLAGS ne ''; print $ERR "-->> $pwd **::** $warn$run ".join(" \t",@ARG)." <<-\n" if !$quiet; exec("/usr/local/libexec/ccache/$run", @ARG); exec("/usr/local/bin/$run", @ARG); __END__ CC=/root/bin/run47 CXX=/root/bin/run47++ FC=/root/bin/run47f CC=run47 CXX=run47++ FC=run47f darktable (cmake): env CC=run47 CXX=run47++ FC=runf47 ./build.sh /usr/test env CC=run47 CXX=run47++ FC=run47f GCCFLAGS='-lstdc++ -g3' ./build.sh /usr/test env LD_LIBRARY_PATH=/usr/test/lib/darktable /usr/test/bin/darktable ln -sf run47 run47cpp ln -sf run47 run47++ ln -sf run47 run47f libdarktable.so: undefined reference to `std::ctype::_M_widen_init() const@GLIBCXX_3.4.11' -lstdc++ /etc/libmap.conf [/usr/test/bin/darktable] libstdc++.so.6 gcc47/libstdc++.so.6 [/usr/local/lib/] libstdc++.so.6 gcc47/libstdc++.so.6