Commit b2d289f3 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

extend configure-like perl wrapper for INSTALL_FOODIR variables

parent d6f8da6e
...@@ -8,6 +8,35 @@ my $cmakeargs = ""; ...@@ -8,6 +8,35 @@ my $cmakeargs = "";
# Find source root directory # Find source root directory
# Assume this script is in <srcroot>/cmake # Assume this script is in <srcroot>/cmake
my $srcdir = dirname(dirname(abs_path($0))); my $srcdir = dirname(dirname(abs_path($0)));
my $cmake_install_prefix="";
# Sets installation directory, bindir, libdir, libexecdir etc
# the equivalent CMake variables are given without prefix
# e.g if --prefix is /usr and --bindir is /usr/bin
# then cmake variable (INSTALL_BINDIR) must be just "bin"
sub set_installdir
{
my($path, $varname) = @_;
my $prefix_length = length($cmake_install_prefix);
if (($prefix_length > 0) && (index($path,$cmake_install_prefix) == 0))
{
# path is under the prefix, so remove the prefix and maybe following "/"
$path = substr($path, $prefix_length);
if(length($path) > 0)
{
my $char = substr($path, 0, 1);
if($char eq "/")
{
$path= substr($path, 1);
}
}
if(length($path) > 0)
{
$cmakeargs = $cmakeargs." -D".$varname."=".$path;
}
}
}
foreach my $option (@ARGV) foreach my $option (@ARGV)
{ {
...@@ -68,10 +97,30 @@ foreach my $option (@ARGV) ...@@ -68,10 +97,30 @@ foreach my $option (@ARGV)
} }
if($option =~ /prefix=/) if($option =~ /prefix=/)
{ {
my $cmake_install_prefix= substr($option, 7); $cmake_install_prefix= substr($option, 7);
$cmakeargs = $cmakeargs." -DCMAKE_INSTALL_PREFIX=".$cmake_install_prefix; $cmakeargs = $cmakeargs." -DCMAKE_INSTALL_PREFIX=".$cmake_install_prefix;
next; next;
} }
if($option =~/bindir=/)
{
set_installdir(substr($option,7), "INSTALL_BINDIR");
next;
}
if($option =~/libdir=/)
{
set_installdir(substr($option,7), "INSTALL_LIBDIR");
next;
}
if($option =~/libexecdir=/)
{
set_installdir(substr($option,11), "INSTALL_SBINDIR");
next;
}
if($option =~/includedir=/)
{
set_installdir(substr($option,11), "INSTALL_INCLUDEDIR");
next;
}
if ($option =~ /extra-charsets=all/) if ($option =~ /extra-charsets=all/)
{ {
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=all"; $cmakeargs = $cmakeargs." -DWITH_CHARSETS=all";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment