summaryrefslogtreecommitdiff
path: root/cmake/configure.pl
diff options
context:
space:
mode:
authorVladislav Vaintroub <vvaintroub@mysql.com>2010-02-20 14:17:55 +0100
committerVladislav Vaintroub <vvaintroub@mysql.com>2010-02-20 14:17:55 +0100
commit5f833a39ed92acaf482d56c3de871ff0115ffcbd (patch)
tree6a6345ac29217705127a1e5cd2883d5bb1178c3b /cmake/configure.pl
parent0fd18913d92a3d4ebc24c5c474dfb61eb8adb723 (diff)
downloadmariadb-git-5f833a39ed92acaf482d56c3de871ff0115ffcbd.tar.gz
extend configure-like perl wrapper for INSTALL_FOODIR variables
Diffstat (limited to 'cmake/configure.pl')
-rw-r--r--cmake/configure.pl51
1 files changed, 50 insertions, 1 deletions
diff --git a/cmake/configure.pl b/cmake/configure.pl
index f52435e2cde..52c57011ce0 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -8,6 +8,35 @@ my $cmakeargs = "";
# Find source root directory
# Assume this script is in <srcroot>/cmake
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)
{
@@ -68,10 +97,30 @@ foreach my $option (@ARGV)
}
if($option =~ /prefix=/)
{
- my $cmake_install_prefix= substr($option, 7);
+ $cmake_install_prefix= substr($option, 7);
$cmakeargs = $cmakeargs." -DCMAKE_INSTALL_PREFIX=".$cmake_install_prefix;
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/)
{
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=all";