you know builder-cc is a gcc/g++ wrapper, which utilize some bash env variable to optimize/tune/etc compilation, using -mtune -ftracer and so on...
in builder-cc (and builder-c++) only 2 variables are used, that is
DEBIAN_BUILDARCH (to specify architecture as pentium3,prescott,k7,k8,core2 and so on...) and DEBIAN_BUILDGCCVER (just the gcc version: 4.2, 4.3, ...)
however, i love extreme situations, and these 2 variables are not enough for me.. i want use also -ftrace -fomit-frame-pointer -mSOMEsse etc...
so, just another variable: EXTREME_COMPILING (what wonderful name, isn't ;D ?)
with "EXTREME_COMPILING=yes" we could have:
-pipe -O2 -msse4 -ftracer -mcx16 -msahf -fomit-frame-pointer -momit-leaf-frame-pointer -other-options-we-like
and NOW, 'cause most people have multicore processore (core2duo,quad,etc), it would be smart use make "-j" option; -j = jobs -> it specifies the number of simultaneously jobs (i.e. compiling). So i use -j9 'cause i have a i7 (ht-quad = 8cores) [or you can using -j`echo $((`getconf _NPROCESSORS_ONLN`+1))` ]
For this last i wrote "builder-make", which use SMP_MAKE=9 <- -j9
To be more simpler, i used same prefix in variable names:
BUILDER_ARCH
BUILDER_GCCVER
BUILDER_EXTREME_COMPILING
BUILDER_SMP_MAKE
ACHTUNG!
in order to use builder-cc, builder-c++ and (last) builder-make, we must:
1) use this links structure:
[k0smik0@widgy bin]$ pwd /usr/bin [k0smik0@widgy bin]$ ls -l g++* gcc* make* lrwxrwxrwx 1 root root 11 19 mag 17:51 g++ -> builder-c++* -rwxr-xr-x 1 root root 253104 26 feb 06:56 g++-4.4* lrwxrwxrwx 1 root root 10 19 mag 17:51 gcc -> builder-cc* -rwxr-xr-x 1 root root 239080 17 feb 11:53 gcc-4.3* -rwxr-xr-x 1 root root 251440 26 feb 06:57 gcc-4.4* lrwxrwxrwx 1 root root 7 7 mar 12:18 gcc.real -> gcc-4.4* lrwxrwxrwx 1 root root 7 7 mar 12:23 g++.real -> g++-4.4* lrwxrwxrwx 1 root root 12 7 mar 12:24 make -> builder-make* -rwxr-xr-x 1 root root 31070 16 feb 06:04 make-kpkg* -rwxr-xr-x 1 root root 166448 2 nov 2009 make.real*
2) declare above variables with "declare -x" or "export" before launch gcc/g++/make, or declare in /etc/bash.bashrc or ~/.bashrc or... or.
ok, here the scripts: links:
builder-cc
builder-c++
builder-make
or code below:
## builder-cc #!/usr/bin/perl if ($ENV{BUILDER_GCCVER} eq undef && $ENV{BUILDER_ARCH} eq undef && $ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("gcc.real", @ARGV); } elsif ($ENV{BUILDER_ARCH} eq undef && $ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("gcc-" . $ENV{BUILDER_GCCVER}); } elsif ($ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("gcc-" . $ENV{BUILDER_GCCVER}, "-mtune=$ENV{BUILDER_ARCH}", "-march=$ENV{BUILDER_ARCH}", @ARGV); } else { # these options are _VERY_ personal, and architecture dependant - you risk to fail compile - careful with that axe, eugene! @flags = ("-pipe","-O2","-msse4","-ftracer","-mcx16","-msahf","-fomit-frame-pointer","-momit-leaf-frame-pointer"); @target = ("gcc-" . $ENV{BUILDER_GCCVER}, "-mtune=$ENV{BUILDER_ARCH}", "-march=$ENV{BUILDER_ARCH}", @flags, @ARGV); } exec @target or die "Unable to exec @target[0]: $!\n";
## builder-c++ #!/usr/bin/perl if ($ENV{BUILDER_GCCVER} eq undef && $ENV{BUILDER_ARCH} eq undef && $ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("g++.real", @ARGV); } elsif ($ENV{BUILDER_ARCH} eq undef && $ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("g++-" . $ENV{BUILDER_GCCVER}); } elsif ($ENV{BUILDER_EXTREME_COMPILING} eq undef) { @target = ("g++-" . $ENV{BUILDER_GCCVER}, "-mtune=$ENV{BUILDER_ARCH}", "-march=$ENV{BUILDER_ARCH}", @ARGV); } else { # these options are _VERY_ personal, and architecture dependant - you risk to fail compile - careful with that axe, eugene! @flags = ("-pipe","-O2","-msse4","-ftracer","-mcx16","-msahf","-fomit-frame-pointer","-momit-leaf-frame-pointer"); @target = ("g++-" . $ENV{BUILDER_GCCVER}, "-mtune=$ENV{BUILDER_ARCH}", "-march=$ENV{BUILDER_ARCH}", @flags, @ARGV); } exec @target or die "Unable to exec @target[0]: $!\n";
## builder-make #!/usr/bin/perl if ($ENV{BUILDER_SMP_MAKE} eq undef) { @target = ("make.real", @ARGV); } else { @target = ("make.real", "-j$ENV{SMP_MAKE}", @ARGV); } exec @target or die "Unable to exec @target[0]: $!\n";
No comments :
Post a Comment