added -d option to util/install and also made the -m option optional. fixed compatibility issue on Solaris with lua-cjson: there is no isinf on Solaris 11.

This commit is contained in:
agentzh (章亦春) 2011-08-10 14:59:16 +08:00
parent 32ef993e05
commit 3aedf4d8e5
2 changed files with 15 additions and 12 deletions

2
util/configure vendored
View File

@ -553,7 +553,7 @@ _EOC_
"LUA_LIB_DIR=$lualib_prefix"; "LUA_LIB_DIR=$lualib_prefix";
if ($on_solaris) { if ($on_solaris) {
$extra_opts .= " INSTALL=$root_dir/build/install"; $extra_opts .= " INSTALL=$root_dir/build/install CFLAGS=\"-g -O3 -Wall -pedantic -D'isinf(x)=0'\"";
} }
if ($platform eq 'macosx') { if ($platform eq 'macosx') {

View File

@ -6,16 +6,15 @@ use warnings;
use Getopt::Std qw(getopts); use Getopt::Std qw(getopts);
my %opts; my %opts;
getopts("m:", \%opts) or usage(); getopts("dm:", \%opts) or usage();
my $mode = $opts{m}; my $mode = $opts{m};
if (!defined $mode) { if ($opts{d}) {
die "No -m option specified.\n"; shell("mkdir -p @ARGV");
exit;
} }
my $mod = $opts{m};
if (@ARGV < 2) { if (@ARGV < 2) {
usage(); usage();
} }
@ -46,8 +45,10 @@ if (!-d $target_dir) {
shell("cp @src $dst"); shell("cp @src $dst");
if (-f $dst) { if (-f $dst) {
if (defined $mode) {
chmod oct($mode), $dst or chmod oct($mode), $dst or
die "failed to change mode of $dst to $mode.\n"; die "failed to change mode of $dst to $mode.\n";
}
exit; exit;
} }
@ -62,13 +63,15 @@ for my $src (@src) {
$name = $src; $name = $src;
} }
if (defined $mode) {
my $target = "$target_dir/$name"; my $target = "$target_dir/$name";
chmod oct($mode), $target or chmod oct($mode), $target or
die "failed to change mode of $target to $mode.\n"; die "failed to change mode of $target to $mode.\n";
} }
}
sub usage { sub usage {
die "Usage: install -m <attrs> <src>... <dst>\n"; die "Usage: install [-d] [-m <attrs>] <src>... <dst>\n";
} }
sub shell { sub shell {