gnu: MariaDB: Fix 'mariadb_config' output to refer to correct directories.
authorMarius Bakke <marius@gnu.org>
Sun, 20 Dec 2020 15:12:50 +0000 (16:12 +0100)
committerMarius Bakke <marius@gnu.org>
Sun, 20 Dec 2020 15:12:50 +0000 (16:12 +0100)
This fixes a regression introduced in ce29031a23104928155b498d552fc4140cc03030
where 'mariadb_config' would return libdir and plugindir relative to the
location of the 'mariadb_config' program (which lives in a separate output).

While at it, fix a couple other wrong references, and a another regression
related to test installation.

* gnu/packages/databases.scm (mariadb)[arguments]: Patch "mariadb_config.c.in"
so that it falls back to old behavior.  Patch 'mariadb.pc.in' and
'mariadb_connector_c.cmake' to cope with absolute directory names. In
 #:configure-flags, don't set INSTALL_MYSQLTESTDIR, but delete the installed
tests with a phase.

gnu/packages/databases.scm

index 733c8c4..fa5dbfa 100644 (file)
@@ -957,8 +957,7 @@ Language.")
          "-DMYSQL_DATADIR=/var/lib/mysql"
          "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
 
-         ;; Do not install the tests or benchmark suite.
-         "-DINSTALL_MYSQLTESTDIR=false"
+         ;; Do not install the benchmark suite.
          "-DINSTALL_SQLBENCHDIR=false"
 
          (string-append "-DCMAKE_INSTALL_PREFIX=" (assoc-ref %outputs "lib"))
@@ -990,14 +989,26 @@ Language.")
              ;; to other variables such as $INSTALL_INCLUDEDIR, which does
              ;; not work when the latter uses an absolute file name.
              (substitute* "libmariadb/mariadb_config/mariadb_config.c.in"
-               (("@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDEDIR@")
-                "@INSTALL_INCLUDEDIR@"))
+               (("%s/@INSTALL_INCLUDEDIR@")
+                (string-append "@INSTALL_INCLUDEDIR@"))
+               ;; As of 10.5.8, the mariadb_config program tries to be
+               ;; clever and computes the installation directory relative
+               ;; to /proc/self/exe when running on Linux.  Make it fall
+               ;; back to the old behaviour.
+               (("defined\\(__linux__\\)")
+                "0"))
              (substitute* "libmariadb/mariadb_config/libmariadb.pc.in"
                (("\\$\\{prefix\\}/@INSTALL_INCLUDEDIR@")
                 "@INSTALL_INCLUDEDIR@"))
+             (substitute* "support-files/mariadb.pc.in"
+               (("^(include|bin|script|doc|man)dir=\\$\\{prefix\\}/" _ dir)
+                (string-append dir "dir=")))
              (substitute* "include/CMakeLists.txt"
                (("\\\\\\$\\{CMAKE_INSTALL_PREFIX\\}/\\$\\{INSTALL_INCLUDEDIR\\}")
                 "${INSTALL_INCLUDEDIR}"))
+             (substitute* "cmake/mariadb_connector_c.cmake"
+               (("\\\\\\$\\{CMAKE_INSTALL_PREFIX\\}/\\$\\{INSTALL_BINDIR\\}")
+                "${INSTALL_BINDIR}"))
              #t))
          (add-after 'unpack 'adjust-tests
            (lambda _
@@ -1090,11 +1101,8 @@ Language.")
                  (string-append lib "/share/mysql")))
 
               (with-directory-excursion lib
-                ;; FIXME: Something creates an empty gnu/store/xxx-mariadb/bin
-                ;; directory at the root of the lib output.  It's not present
-                ;; in the installation log.  This started occuring between
-                ;; 10.5.6 and 10.5.8.  How to prevent it?
-                (delete-file-recursively "gnu")
+                ;; Remove tests.
+                (delete-file-recursively "mysql-test")
                 ;; Remove static libraries.
                 (for-each delete-file (find-files "lib" "\\.a$")))