]> mj.ucw.cz Git - libucw.git/commitdiff
Build: Attempt to fix problems with access rights to custom INSTALL_LIB_DIR.
authorPavel Charvat <pchar@ucw.cz>
Thu, 15 Jan 2015 19:44:24 +0000 (19:44 +0000)
committerPavel Charvat <pchar@ucw.cz>
Thu, 15 Jan 2015 19:44:24 +0000 (19:44 +0000)
ucw/perl/UCW/Configure/C.pm

index 537955f8e8516c5b544d7731b0745f74b9df8834..95644b4504e0f00f36037aeecdb7e1d7cffc2874 100644 (file)
@@ -120,16 +120,19 @@ Set("LIBS" => "");
 # Extra flags for compiling and linking shared libraries
 Set("CSHARED" => '-fPIC');
 Append("LOPT" => "-Wl,--rpath-link,run/lib -Lrun/lib");
-if (Get("INSTALL_LIB_DIR") eq "/usr/lib") {
+if (!IsSet("CONFIG_LOCAL")) {
+       # Beware that in non-local builds the INSTALL_LIB_DIR must exist in
+       # standard search paths for shared libraries.
        Set("SO_LINK_PATH" => '');
 }
 else {
+       # In local builds, we need to link binaries with custom --rpath.
+       # GCC seems to fail when this directory does not exist.
        Set("SO_LINK_PATH" => "-Wl,--rpath," . Get("INSTALL_LIB_DIR"));
        AtWrite {
-               # FIXME: This is a hack. GCC would otherwise fail to link binaries.
                my $libdir = Get("INSTALL_LIB_DIR");
-               if (IsSet("CONFIG_SHARED") && !(-d $libdir)) {
-                       `install -d -m 755 $libdir`; Fail("Cannot create $libdir") if $?;
+               if (IsSet("CONFIG_SHARED")) {
+                       `mkdir -p $libdir`; Fail("Cannot create $libdir") if $?;
                }
        };
 }