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";
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') {

View File

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