registry: Use plugin directory from the build system for relocateable Windows builds
authorSebastian Dröge <sebastian@centricular.com>
Thu, 8 Aug 2019 10:49:07 +0000 (13:49 +0300)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 9 Aug 2019 11:29:37 +0000 (12:29 +0100)
Instead of guessing something based on preprocessor defines and magic.

configure.ac
gst/gstregistry.c
meson.build

index 479a7a0..8474e34 100644 (file)
@@ -1069,6 +1069,23 @@ esac
 AC_DEFINE_UNQUOTED(GST_PLUGIN_SCANNER_SUBDIR,
     "$GST_PLUGIN_SCANNER_SUBDIR", [libexecdir path component, used to find plugin-scanner on relocatable builds on windows])
 
+case "${libdir}" in
+  *lib64)
+    GST_PLUGIN_SUBDIR="lib64";;
+  *lib32)
+    GST_PLUGIN_SUBDIR="lib32";;
+  *lib)
+    GST_PLUGIN_SUBDIR="lib";;
+  *)
+    GST_PLUGIN_SUBDIR=`basename ${libdir}`;
+    if test -z "$GST_PLUGIN_SUBDIR"; then
+      AC_MSG_WARN([Couldn't determined libdir suffix, using "lib"])
+      GST_PLUGIN_SUBDIR="lib";
+    fi
+    ;;
+esac
+AC_DEFINE_UNQUOTED(GST_PLUGIN_SUBDIR,
+    "$GST_PLUGIN_SUBDIR", [plugin directory path component, used to find plugins on relocatable builds on windows])
 
 dnl completion helper locations
 AS_AC_EXPAND(GST_COMPLETION_HELPER_INSTALLED,${libexecdir}/gstreamer-$GST_API_VERSION/gst-completion-helper)
index 32153ff..a8b2f51 100644 (file)
@@ -1643,11 +1643,8 @@ scan_and_update_registry (GstRegistry * default_registry,
           g_win32_get_package_installation_directory_of_module
           (_priv_gst_dll_handle);
 
-      dir = g_build_filename (base_dir,
-#ifdef _DEBUG
-          "debug"
-#endif
-          "lib", "gstreamer-" GST_API_VERSION, NULL);
+      dir = g_build_filename (base_dir, GST_PLUGIN_SUBDIR,
+          "gstreamer-" GST_API_VERSION, NULL);
       GST_DEBUG ("scanning DLL dir %s", dir);
 
       changed |= gst_registry_scan_path_internal (&context, dir);
index e738c55..ca2fdef 100644 (file)
@@ -114,6 +114,8 @@ cdata.set_quoted('PLUGINDIR', join_paths(get_option('prefix'), get_option('libdi
 cdata.set_quoted('VERSION', gst_version)
 cdata.set_quoted('GST_PLUGIN_SCANNER_INSTALLED', join_paths(prefix, helpers_install_dir, 'gst-plugin-scanner'))
 cdata.set_quoted('GST_PTP_HELPER_INSTALLED', join_paths(prefix, helpers_install_dir, 'gst-ptp-helper'))
+cdata.set_quoted('GST_PLUGIN_SUBDIR', get_option('libdir'),
+  description: 'plugin directory path component, used to find plugins on relocatable builds on windows')
 cdata.set_quoted('GST_PLUGIN_SCANNER_SUBDIR', libexecdir,
   description: 'libexecdir path component, used to find plugin-scanner on relocatable builds on windows')
 cdata.set('GST_DISABLE_OPTION_PARSING', not get_option('option-parsing'))