~kaniini/pkgconf

Windows: use slash and not backslash for better compatibility

Details
Message ID
<CAMq1ado72=qTQ+cNsO9jB3m8v0E=PYCiO6L5OBa14osLoN8m0g@mail.gmail.com>
DKIM signature
missing
Download raw message
patch below




commit f9fc855eff73401e762b356d0a9648016b9efbff
Author: Vincent Torri <vincent.torri@gmail.com>
Date:   Mon Jun 8 16:32:00 2020 +0200

    on Windows, with current release of pkgconf, pkgconf --cflags eina returns :

    -IC:\Documents\msys2\opt\efl_64/include/eina-1
-IC:\Documents\msys2\opt\efl_64/include/eina-1/eina -pthread
-DWINICONV_CONST= -IC:\Documents\msys2\opt\ewpi_64/include

    and using pkgconf in meson with ninja backend gives, in build.ninja :

    ARGS = "-Isrc/lib/91be6cf@@etui@sha" "-Isrc/lib" "-I../src/lib"
"-I." "-I.." "-IC:Documentsmsys2optefl_64/include/eina-1" etc...

    that is, all the backslashes are removed.

    with this patch, which replaces backslashes with slashes,
build.ninja is fixed :

    ARGS = "-Isrc/lib/91be6cf@@etui@sha" "-Isrc/lib" "-I../src/lib"
"-I." "-I.." "-IC:/Documents/msys2/opt/efl_64/include/eina-1" etc...

diff --git a/libpkgconf/path.c b/libpkgconf/path.c
index 3cc89f5..306cc40 100644
--- a/libpkgconf/path.c
+++ b/libpkgconf/path.c
@@ -355,6 +355,14 @@ pkgconf_path_relocate(char *buf, size_t buflen)

         pkgconf_strlcpy(buf, tmpbuf, buflen);
         free(tmpbuf);
+# ifdef _WIN32
+                /* rewrite any backslash arguments for best compatibility */
+                for (char *ti = buf; *ti != '\0'; ti++)
+        {
+            if (*ti == '\\')
+                *ti = '/';
+                }
+# endif
     }
 #endif
Reply to thread Export thread (mbox)