Radix cross Linux Build System

Cross-platform build system is designed to build distributions of different operating systems for a set of target devices

39 Commits   2 Branches   2 Tags
     5         kx #!/bin/env 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 ( @clean_dirs, @clean_dirs_all );
     5         kx my ( $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 
     5         kx     _kxLab::system( "make -C $d local_clean" );
     5         kx 
     5         kx     # remove requires and .makefile:
     5         kx     unlink "$d/.makefile";
     5         kx     unlink <$d/.*_requires*>;
     5         kx     # remove lists of files installed into $top_dir/dist/products and $top_dir/dist/rootfs:
     5         kx     unlink <$d/.*.rootfs>;
     5         kx     unlink <$d/.*.dist*>;
     5         kx   }
     5         kx }
     5         kx 
     5         kx 
     5         kx sub find_directories
     5         kx {
     5         kx   # find all directories which has Makefile and hiden build results
     5         kx   my $shell_output = <<`SHELL`;
     5         kx   dirs=`find $top_dir -name ".[a-zA-Z0-9_-+.]*"       \\
     5         kx 	! -path "$top_dir/doc/*"                      \\
     5         kx 	! -path "$top_dir/dist/*"                     \\
     5         kx 	! -path "$top_dir/sources/*"                  \\
     5         kx 	! -path "$top_dir/build-system/3pp/sources/*" \\
     5         kx 	-prune -exec dirname {} \\; | sort -u`
     5         kx 
     5         kx   for dir in \$dirs ; do
     5         kx     if [ -f "\$dir/Makefile" ] ; then
     5         kx       echo "\$dir"
     5         kx     fi
     5         kx   done
     5         kx SHELL
     5         kx 
     5         kx   @clean_dirs = split /\n/, $shell_output;
     5         kx   @clean_dirs = grep { $_ ne $top_dir } @clean_dirs;
     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 
     5         kx find_directories();
     5         kx 
     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 build tree =======\n\n" if ( $verbose );
     5         kx     $header_printed = 1;
     5         kx   }
     5         kx 
     5         kx   do_clean();
     5         kx 
     5         kx   # remove DEST_DIR_ABS
     5         kx   _kxLab::system( "rm -rf $top_dir/dist" );
     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 }