[libdvdnav-devel] [Git][videolan/libdvdread][master] 5 commits: meson: replace pkgconfig with pkg-config in cross files

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Mon Sep 8 06:08:46 UTC 2025



Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread


Commits:
87c0f49a by Steve Lhomme at 2025-09-05T14:23:22+02:00
meson: replace pkgconfig with pkg-config in cross files

Fixes this warning:
DEPRECATION: "pkgconfig" entry is deprecated and should be replaced by "pkg-config"

- - - - -
e20655cc by Steve Lhomme at 2025-09-05T14:23:22+02:00
meson: add cross files for Universal Windows Platform (UWP)

- - - - -
b399d11e by Steve Lhomme at 2025-09-08T07:49:00+02:00
dvd_input: use Windows DLL functions rather than a fake dlfcn

So we don't need to convert a constant string to wide char in UNICODE
mode.

- - - - -
06f50b01 by Steve Lhomme at 2025-09-08T07:49:18+02:00
dlfcn: use LoadPackagedLibrary() in UWP mode

We can open DLL's inside the packaged app with LoadPackagedLibrary().
libdvdcss-2.dll might be there.

- - - - -
05b6fe2a by Steve Lhomme at 2025-09-08T07:49:34+02:00
CI: add Universal Windows Platform (UWP) targets

- - - - -


12 changed files:

- .gitlab-ci.yml
- meson.build
- − msvc/contrib/dlfcn.c
- package/crossfiles/aarch64-w64-mingw32.meson
- + package/crossfiles/aarch64-w64-mingw32uwp.meson
- package/crossfiles/armv7-w64-mingw32.meson
- + package/crossfiles/armv7-w64-mingw32uwp.meson
- package/crossfiles/i686-w64-mingw32.meson
- + package/crossfiles/i686-w64-mingw32uwp.meson
- package/crossfiles/x86_64-w64-mingw32.meson
- + package/crossfiles/x86_64-w64-mingw32uwp.meson
- src/dvd_input.c


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -65,6 +65,19 @@ build-win-arm:
         matrix:
             - CROSSFILE: [armv7-w64-mingw32, aarch64-w64-mingw32]
 
+build-win-uwp:
+    image: registry.videolan.org/vlc-debian-llvm-ucrt:20250305204125
+    stage: build
+    tags:
+        - docker
+        - amd64
+    script:
+        - meson setup build --cross-file package/crossfiles/${CROSSFILE}.meson
+        - meson compile -C build
+    parallel:
+        matrix:
+            - CROSSFILE: [x86_64-w64-mingw32uwp, aarch64-w64-mingw32uwp, armv7-w64-mingw32uwp, i686-w64-mingw32uwp]
+
 build-wasm:
     image: registry.videolan.org/vlc-debian-wasm-emscripten:20250323132008
     stage: build


=====================================
meson.build
=====================================
@@ -92,18 +92,7 @@ libdvdcss_dependency = dependency('libdvdcss',
     version: '>= 1.2', method: 'pkg-config', required: get_option('libdvdcss'))
 if libdvdcss_dependency.found()
     cdata.set('HAVE_DVDCSS_DVDCSS_H', 1)
-elif host_machine.system() == 'windows'
-    if get_option('dlfcn') in ['external', 'auto']
-        # Using MinGW dlfcn wrapper
-        libdl_dependency = cc.find_library('dl', required: get_option('dlfcn') == 'external')
-        if libdl_dependency.found()
-            cdata.set('HAVE_DLFCN_H', 1)
-        endif
-    endif
-    if not cdata.has('HAVE_DLFCN')
-        cdata.set('USING_BUILTIN_DLFCN', 1)
-    endif
-else
+elif host_machine.system() != 'windows'
     # Using builtin dlfcn (may require linking to libdl depending on the system)
     if not cc.has_function('dlopen', prefix: '#include <dlfcn.h>', args: test_args)
         libdl_dependency = cc.find_library('dl')


=====================================
msvc/contrib/dlfcn.c deleted
=====================================
@@ -1,96 +0,0 @@
-/*
- * Adopted from Apache DSO code.
- * Portions copyright Apache Software Foundation
- *
- * Structures and types used to implement dlopen, dlsym, etc.
- * on Windows 95/NT.
- */
-#include <windows.h>
-#include <string.h>
-#include <stdio.h>
-
-#include "../include/dlfcn.h"
-#include "../include/os_types.h"
-
-void *dlopen(const char *module_name, int mode)
-{
-    UINT em;
-    HINSTANCE dsoh;
-    char path[MAX_PATH], *p;
-    (void)mode;
-    /* Load the module...
-     * per PR2555, the LoadLibraryEx function is very picky about slashes.
-     * Debugging on NT 4 SP 6a reveals First Chance Exception within NTDLL.
-     * LoadLibrary in the MS PSDK also reveals that it -explicitly- states
-     * that backslashes must be used.
-     *
-     * Transpose '\' for '/' in the filename.
-     */
-    (void)strncpy(path, module_name, MAX_PATH);
-    path[MAX_PATH - 1] = 0;
-    p = path;
-    while ((p = strchr(p, '/')))
-        *p = '\\';
-
-    /* First assume the dso/dll's required by -this- dso are sitting in the
-     * same path or can be found in the usual places.  Failing that, let's
-     * let that dso look in the apache root.
-     */
-    em = SetErrorMode(SEM_FAILCRITICALERRORS);
-    dsoh = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
-    if (!dsoh)
-    {
-        SetLastError(0); // clear the last error
-        dsoh = LoadLibraryEx(path, NULL, 0);
-    }
-    SetErrorMode(em);
-    SetLastError(0); // clear the last error
-    return (void *)dsoh;
-}
-
-char *dlerror(void)
-{
-    int len, nErrorCode;
-    static char errstr[120];
-    /* This is -not- threadsafe code, but it's about the best we can do.
-     * mostly a potential problem for isapi modules, since LoadModule
-     * errors are handled within a single config thread.
-     */
-
-    if((nErrorCode = GetLastError()) == 0)
-      return((char *)0);
-
-    SetLastError(0); // clear the last error
-    len = snprintf(errstr, sizeof(errstr), "(%d) ", nErrorCode);
-
-    len += FormatMessage(
-            FORMAT_MESSAGE_FROM_SYSTEM,
-            NULL,
-            nErrorCode,
-            MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-            (LPTSTR) errstr + len,
-            sizeof(errstr) - len,
-            NULL
-        );
-        /* FormatMessage may have appended a newline (\r\n). So remove it
-         * and use ": " instead like the Unix errors. The error may also
-         * end with a . before the return - if so, trash it.
-         */
-    if (len > 1 && errstr[len-2] == '\r' && errstr[len-1] == '\n') {
-        if (len > 2 && errstr[len-3] == '.')
-            len--;
-        errstr[len-2] = ':';
-        errstr[len-1] = ' ';
-    }
-    return errstr;
-}
-
-int dlclose(void *handle)
-{
-  return  FreeLibrary(handle);
-}
-
-void *dlsym(void *handle, const char *name)
-{
-  return GetProcAddress(handle, name);
-}


=====================================
package/crossfiles/aarch64-w64-mingw32.meson
=====================================
@@ -4,7 +4,7 @@ cpp = 'aarch64-w64-mingw32-clang++'
 ar = 'aarch64-w64-mingw32-ar'
 strip = 'aarch64-w64-mingw32-strip'
 windres = 'aarch64-w64-mingw32-windres'
-pkgconfig = 'pkg-config'
+pkg-config = 'pkg-config'
 
 [built-in options]
 c_link_args = ['-static-libgcc']


=====================================
package/crossfiles/aarch64-w64-mingw32uwp.meson
=====================================
@@ -0,0 +1,17 @@
+[binaries]
+c = 'aarch64-w64-mingw32uwp-clang'
+cpp = 'aarch64-w64-mingw32uwp-clang++'
+ar = 'aarch64-w64-mingw32uwp-ar'
+strip = 'aarch64-w64-mingw32uwp-strip'
+windres = 'aarch64-w64-mingw32uwp-windres'
+pkg-config = 'pkg-config'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-D__MSVCRT_VERSION__=0xE00', '-D_UCRT']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'aarch64'
+cpu = 'aarch64'
+endian = 'little'


=====================================
package/crossfiles/armv7-w64-mingw32.meson
=====================================
@@ -4,7 +4,7 @@ cpp = 'armv7-w64-mingw32-clang++'
 ar = 'armv7-w64-mingw32-ar'
 strip = 'armv7-w64-mingw32-strip'
 windres = 'armv7-w64-mingw32-windres'
-pkgconfig = 'pkg-config'
+pkg-config = 'pkg-config'
 
 [built-in options]
 c_link_args = ['-static-libgcc']


=====================================
package/crossfiles/armv7-w64-mingw32uwp.meson
=====================================
@@ -0,0 +1,17 @@
+[binaries]
+c = 'armv7-w64-mingw32uwp-clang'
+cpp = 'armv7-w64-mingw32uwp-clang++'
+ar = 'armv7-w64-mingw32uwp-ar'
+strip = 'armv7-w64-mingw32uwp-strip'
+windres = 'armv7-w64-mingw32uwp-windres'
+pkg-config = 'pkg-config'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-D__MSVCRT_VERSION__=0xE00', '-D_UCRT']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'arm'
+cpu = 'armv7'
+endian = 'little'


=====================================
package/crossfiles/i686-w64-mingw32.meson
=====================================
@@ -4,7 +4,7 @@ cpp = 'i686-w64-mingw32-g++'
 ar = 'i686-w64-mingw32-ar'
 strip = 'i686-w64-mingw32-strip'
 windres = 'i686-w64-mingw32-windres'
-pkgconfig = 'i686-w64-mingw32-pkg-config'
+pkg-config = 'i686-w64-mingw32-pkg-config'
 exe_wrapper = 'wine'
 
 [built-in options]


=====================================
package/crossfiles/i686-w64-mingw32uwp.meson
=====================================
@@ -0,0 +1,18 @@
+[binaries]
+c = 'i686-w64-mingw32uwp-gcc'
+cpp = 'i686-w64-mingw32uwp-g++'
+ar = 'i686-w64-mingw32uwp-ar'
+strip = 'i686-w64-mingw32uwp-strip'
+windres = 'i686-w64-mingw32uwp-windres'
+pkg-config = 'i686-w64-mingw32uwp-pkg-config'
+exe_wrapper = 'wine'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-D__MSVCRT_VERSION__=0xE00', '-D_UCRT']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'


=====================================
package/crossfiles/x86_64-w64-mingw32.meson
=====================================
@@ -4,7 +4,7 @@ cpp = 'x86_64-w64-mingw32-g++'
 ar = 'x86_64-w64-mingw32-ar'
 strip = 'x86_64-w64-mingw32-strip'
 windres = 'x86_64-w64-mingw32-windres'
-pkgconfig = 'x86_64-w64-mingw32-pkg-config'
+pkg-config = 'x86_64-w64-mingw32-pkg-config'
 exe_wrapper = 'wine'
 
 [built-in options]


=====================================
package/crossfiles/x86_64-w64-mingw32uwp.meson
=====================================
@@ -0,0 +1,18 @@
+[binaries]
+c = 'x86_64-w64-mingw32-gcc'
+cpp = 'x86_64-w64-mingw32-g++'
+ar = 'x86_64-w64-mingw32-ar'
+strip = 'x86_64-w64-mingw32-strip'
+windres = 'x86_64-w64-mingw32-windres'
+pkg-config = 'x86_64-w64-mingw32-pkg-config'
+exe_wrapper = 'wine'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+c_args = ['-DWINAPI_FAMILY=WINAPI_FAMILY_APP', '-D__MSVCRT_VERSION__=0xE00', '-D_UCRT']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'


=====================================
src/dvd_input.c
=====================================
@@ -28,6 +28,16 @@
 #include <errno.h>
 #include <assert.h>
 
+#if defined(_WIN32)
+# include <winapifamily.h>
+# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#  if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x602
+#   undef _WIN32_WINNT
+#   define _WIN32_WINNT 0x602 /* LoadPackagedLibrary is Win8 APP Family */
+#  endif
+# endif
+#endif
+
 #ifdef _WIN32
 #include <windows.h>
 #include "../msvc/contrib/win32_cs.h"
@@ -71,12 +81,12 @@ int         (*dvdinput_init)  (dvd_input_t, uint8_t* mkb);
 #else
 
 /* dlopening libdvdcss */
-# if defined(HAVE_DLFCN_H) && !defined(USING_BUILTIN_DLFCN)
+# if defined(HAVE_DLFCN_H)
 #  include <dlfcn.h>
 # else
 #   if defined(_WIN32)
-/* Only needed on MINGW at the moment */
-#    include "../msvc/contrib/dlfcn.c"
+#    define dlsym(h, name)  (void*)GetProcAddress(h, name)
+#    define dlclose(h)      FreeLibrary(h)
 #   endif
 # endif
 
@@ -478,7 +488,32 @@ int dvdinput_setup(void *priv, dvd_logger_cb *logcb, dvd_type_t dvda_flag)
 #else
   #define CSS_LIB "libdvdcss.so.2"
 #endif
+
+#define WIDEN_(x) L ## x
+#define WIDEN(x) WIDEN_(x)
+
+#if defined(_WIN32)
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+    UINT em;
+    /* First assume the dso/dll's required by -this- dso are sitting in the
+     * same path or can be found in the usual places.  Failing that, let's
+     * let that dso look in the apache root.
+     */
+    em = SetErrorMode(SEM_FAILCRITICALERRORS);
+    dvdcss_library = LoadLibraryExA(CSS_LIB, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+    if (!dvdcss_library)
+    {
+        SetLastError(0); // clear the last error
+        dvdcss_library = LoadLibraryExA(CSS_LIB, NULL, 0);
+    }
+    SetErrorMode(em);
+    SetLastError(0); // clear the last error
+# else /* WINAPI_PARTITION_DESKTOP */
+    dvdcss_library = LoadPackagedLibrary(WIDEN(CSS_LIB), 0);
+# endif /* WINAPI_PARTITION_DESKTOP */
+#else
   dvdcss_library = dlopen(CSS_LIB, RTLD_LAZY);
+#endif
 
   if(dvdcss_library != NULL) {
 #ifdef __OS2__



View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/ce66ed6f988a20ca4e9e37c6004390c7bbda5b2d...05b6fe2a16038c9e9910ace571963a68487fa945

-- 
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/ce66ed6f988a20ca4e9e37c6004390c7bbda5b2d...05b6fe2a16038c9e9910ace571963a68487fa945
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libdvdnav-devel mailing list