1
0
Fork 0
forked from len0rd/rockbox

Added the symlinkinstall make target. See #11825

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28915 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Stummvoll 2010-12-28 10:30:46 +00:00
parent 3c43503283
commit 1f06ca41e8
2 changed files with 50 additions and 30 deletions

View file

@ -13,6 +13,7 @@ use strict;
use File::Copy; # For move() and copy()
use File::Find; # For find()
use File::Path qw(mkpath rmtree); # For rmtree()
use Cwd;
use Cwd 'abs_path';
use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
@ -29,6 +30,7 @@ my $incfonts;
my $target_id; # passed in, not currently used
my $rbdir; # can be non-.rockbox for special builds
my $app;
my $mklinks;
sub glob_mkdir {
my ($dir) = @_;
@ -81,13 +83,19 @@ sub find_copyfile {
print "find_copyfile: $pattern -> $destination\n" if $verbose;
return sub {
my $path = $_;
my $source = getcwd();
if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /$rbdir/)) {
copy($path, $destination);
if($mklinks) {
print "link $path $destination\n" if $verbose;
symlink($source.'/'.$path, $destination.'/'.$path);
} else {
print "cp $path $destination\n" if $verbose;
copy($path, $destination);
chmod(0755, $destination.'/'.$path);
}
}
}
}
sub find_installfile {
my ($pattern, $destination) = @_;
@ -205,6 +213,7 @@ GetOptions ( 'r|root=s' => \$ROOT,
'v|verbose' => \$verbose,
'install=s' => \$install, # install destination
'rbdir:s' => \$rbdir, # If we want to put in a different directory
'l|link' => \$mklinks, # If we want to create links instead of copying files
);
# GetOptions() doesn't remove the params from @ARGV if their value was ""
@ -695,10 +704,16 @@ sub runone {
}
if($install) {
if($mklinks) {
my $cwd = getcwd();
symlink("$cwd/.rockbox", "$install/.rockbox");
print "link .rockbox $install\n" if $verbose;
} else {
make_install(".rockbox", $install) or die "MKDIRFAILED\n";
rmtree(".rockbox");
print "rm .rockbox\n" if $verbose;
}
}
else {
unless (".rockbox" eq $rbdir) {
mkpath($rbdir);

View file

@ -307,6 +307,10 @@ fullinstall:
@echo "Installing a full setup in your '$(RBPREFIX)' dir"
$(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -m "$(MODELNAME)" -i "$(TARGET_ID)" $(INSTALL) -z "zip -r0" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 $(TARGET) $(BINARY)
symlinkinstall:
@echo "Installing a full setup with links in your '$(RBPREFIX)' dir"
$(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -m "$(MODELNAME)" -i "$(TARGET_ID)" $(INSTALL) -z "zip -r0" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 $(TARGET) $(BINARY) -l
help:
@echo "A few helpful make targets"
@echo ""
@ -333,6 +337,7 @@ help:
@echo "voicetools - builds the voice tools only"
@echo "install - installs your build (at PREFIX, defaults to simdisk/ for simulators (no fonts))"
@echo "fullinstall - installs your build (like install, but with fonts)"
@echo "symlinkinstall - like fullinstall, but with links instead of copying files. (Good for developing on simulator)"
@echo "reconf - rerun configure with the same selection"
### general compile rules: