Radix cross Linux Toolchains

Toolchains for all supported by Radix cross Linux devices

65 Commits   2 Branches   12 Tags
     5         kx #!/usr/bin/perl
     5         kx 
     5         kx use FindBin;
     5         kx use lib $FindBin::Bin;
     5         kx 
     5         kx use strict;
     5         kx use warnings FATAL => 'all';
     5         kx 
     5         kx use File::Find;
     5         kx use _kxLab;
     5         kx 
     5         kx 
     5         kx # Global variables
     5         kx my $header_printed = 0;
     5         kx 
     5         kx my $top_dir;
     5         kx my @targets;
     5         kx my $verbose = $ENV{VERBOSE};
     5         kx 
     5         kx my %seen;
     5         kx my ( @dist_clean_dirs, @clean_dirs, @dist_clean_dirs_all, @clean_dirs_all );
     5         kx my ( $dist_clean_count, $clean_count );
     5         kx 
     5         kx sub do_clean
     5         kx {
     5         kx   unlink "$top_dir/.makefile";
     5         kx 
     5         kx   foreach my $d ( @clean_dirs )
     5         kx   {
     5         kx     my $printed_d;
     5         kx 
     5         kx     $printed_d = $d;
     5         kx     $printed_d =~ s/^$top_dir\///;
     5         kx 
     5         kx     print "\n=======\n" if ( $verbose );
     5         kx     print "======= Cleaning in $printed_d...\n" if ( $verbose );
     5         kx     print "=======\n" if ( $verbose );
     5         kx     _kxLab::system( "make -C $d download_clean" );
     5         kx     unlink "$d/.makefile";
     5         kx     unlink <$d/.*_requires*>;
     5         kx   }
     5         kx }
     5         kx 
     5         kx sub do_clean_list
     5         kx {
     5         kx   my $dir = shift;
     5         kx   my $cwd = `pwd`;
     5         kx 
     5         kx   chomp $cwd;
     5         kx 
     5         kx   # skip not our directories where we create patches
     5         kx   return if( $cwd =~ m/.*create\-.*\-patch.*/ );
     5         kx 
     5         kx   return if( ! -f "$cwd/Makefile" );
     5         kx 
     5         kx   # needs clean:
     5         kx   push @clean_dirs_all, $cwd;
     5         kx }
     5         kx 
     5         kx sub process_clean
     5         kx {
     5         kx   return if( ! $File::Find::dir =~ m/$top_dir\/sources/ );
     5         kx 
     5         kx   # add directory which contains 'Makefile' too.
     5         kx   if( $_ eq "Makefile" ) { do_clean_list( $File::Find::dir ); }
     5         kx 
     5         kx   return if( ! -d $_ );
     5         kx 
     5         kx   foreach my $d ( @targets )
     5         kx   {
     5         kx     if( $d eq $_ ) { do_clean_list( $File::Find::dir ); }
     5         kx   }
     5         kx }
     5         kx 
     5         kx 
     5         kx foreach ( @ARGV )
     5         kx {
     5         kx   push @targets, $_;
     5         kx }
     5         kx $top_dir = pop @targets;
     5         kx 
     5         kx if( ! -d $top_dir )
     5         kx {
     5         kx   die "\nTop: $top_dir: is not a directory\n\n";
     5         kx }
     5         kx if( ! $top_dir =~ m/^\// )
     5         kx {
     5         kx   die "\nTop: $top_dir: is not absolute path\n\n";
     5         kx }
     5         kx 
     5         kx find( \&process_clean, "$top_dir" );
     5         kx 
     5         kx # get unique names:
     5         kx %seen = ();
     5         kx @clean_dirs = grep { ! $seen{ $_ }++ } @clean_dirs_all;
     5         kx @clean_dirs = reverse( keys %seen );
     5         kx 
     5         kx $clean_count = @clean_dirs;
     5         kx 
     5         kx if( $clean_count != 0 )
     5         kx {
     5         kx   if( !$header_printed )
     5         kx   {
     5         kx     print "\n======= Cleaning downloads tree =======\n\n" if ( $verbose );
     5         kx     $header_printed = 1;
     5         kx   }
     5         kx 
     5         kx   do_clean();
     5         kx 
     5         kx   print "\n";
     5         kx }
     5         kx else
     5         kx {
     5         kx   print "\nCleaning...   (nothing to be done).\n\n";
     5         kx }
     5         kx