Add support for Meson as alternative/parallel build system
authorNirbheek Chauhan <nirbheek@centricular.com>
Fri, 12 Aug 2016 14:55:17 +0000 (20:25 +0530)
committerTim-Philipp Müller <tim@centricular.com>
Fri, 19 Aug 2016 20:26:14 +0000 (21:26 +0100)
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.

40 files changed:
.gitignore
config.h.meson [new file with mode: 0644]
docs/gst/meson.build [new file with mode: 0644]
docs/libs/meson.build [new file with mode: 0644]
docs/meson.build [new file with mode: 0644]
gst/build_mkenum.py [new file with mode: 0755]
gst/meson.build [new file with mode: 0644]
gst/parse/gen_grammar.py.in [new file with mode: 0755]
gst/parse/gen_lex.py.in [new file with mode: 0755]
gst/parse/meson.build [new file with mode: 0644]
gst/printf/meson.build [new file with mode: 0644]
libs/gst/base/meson.build [new file with mode: 0644]
libs/gst/check/libcheck/meson.build [new file with mode: 0644]
libs/gst/check/meson.build [new file with mode: 0644]
libs/gst/controller/meson.build [new file with mode: 0644]
libs/gst/helpers/meson.build [new file with mode: 0644]
libs/gst/meson.build [new file with mode: 0644]
libs/gst/net/meson.build [new file with mode: 0644]
libs/meson.build [new file with mode: 0644]
meson.build [new file with mode: 0644]
meson_options.txt [new file with mode: 0644]
pkgconfig/meson.build [new file with mode: 0644]
plugins/elements/meson.build [new file with mode: 0644]
plugins/meson.build [new file with mode: 0644]
po/meson.build [new file with mode: 0644]
tests/benchmarks/meson.build [new file with mode: 0644]
tests/check/meson.build [new file with mode: 0644]
tests/examples/adapter/meson.build [new file with mode: 0644]
tests/examples/controller/meson.build [new file with mode: 0644]
tests/examples/helloworld/meson.build [new file with mode: 0644]
tests/examples/memory/meson.build [new file with mode: 0644]
tests/examples/meson.build [new file with mode: 0644]
tests/examples/netclock/meson.build [new file with mode: 0644]
tests/examples/ptp/meson.build [new file with mode: 0644]
tests/examples/stepping/meson.build [new file with mode: 0644]
tests/examples/streamiddemux/meson.build [new file with mode: 0644]
tests/examples/streams/meson.build [new file with mode: 0644]
tests/meson.build [new file with mode: 0644]
tests/misc/meson.build [new file with mode: 0644]
tools/meson.build [new file with mode: 0644]

index 04e485a..04b5e7c 100644 (file)
@@ -58,3 +58,4 @@ Build
 *.swp
 
 /tests/misc/netclock-replay
+/build
diff --git a/config.h.meson b/config.h.meson
new file mode 100644 (file)
index 0000000..4a8a4dd
--- /dev/null
@@ -0,0 +1,441 @@
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#mesondefine AC_APPLE_UNIVERSAL_BUILD
+
+/* poll doesn't work on devices */
+#mesondefine BROKEN_POLL
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+#mesondefine ENABLE_NLS
+
+/* Subunit protocol result output */
+#mesondefine ENABLE_SUBUNIT
+
+/* gettext package name */
+#mesondefine GETTEXT_PACKAGE
+
+/* The GIO library directory. */
+#mesondefine GIO_LIBDIR
+
+/* The GIO modules directory. */
+#mesondefine GIO_MODULE_DIR
+
+/* GStreamer API Version */
+#mesondefine GST_API_VERSION
+
+/* data dir */
+#mesondefine GST_DATADIR
+
+/* Define if option parsing is disabled */
+#mesondefine GST_DISABLE_OPTION_PARSING
+
+/* Define if pipeline parsing code is disabled */
+#mesondefine GST_DISABLE_PARSE
+
+/* Extra platform specific plugin suffix */
+#mesondefine GST_EXTRA_MODULE_SUFFIX
+
+/* macro to use to show function name */
+#mesondefine GST_FUNCTION
+
+/* Defined if gcov is enabled to force a rebuild due to config.h changing */
+#mesondefine GST_GCOV_ENABLED
+
+/* Defined when registry scanning through fork is unsafe */
+#mesondefine GST_HAVE_UNSAFE_FORK
+
+/* Default errorlevel to use */
+#mesondefine GST_LEVEL_DEFAULT
+
+/* GStreamer license */
+#mesondefine GST_LICENSE
+
+/* package name in plugins */
+#mesondefine GST_PACKAGE_NAME
+
+/* package origin */
+#mesondefine GST_PACKAGE_ORIGIN
+
+/* GStreamer package release date/time for plugins as YYYY-MM-DD */
+#mesondefine GST_PACKAGE_RELEASE_DATETIME
+
+/* Define if static plugins should be built */
+#mesondefine GST_PLUGIN_BUILD_STATIC
+
+/* location of the installed gst-plugin-scanner */
+#mesondefine GST_PLUGIN_SCANNER_INSTALLED
+
+#mesondefine GST_PTP_HELPER_INSTALLED
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+#mesondefine HAVE_CFLOCALECOPYCURRENT
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+#mesondefine HAVE_CFPREFERENCESCOPYAPPVALUE
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#mesondefine HAVE_CLOCK_GETTIME
+
+/* Define if the target CPU is an Alpha */
+#mesondefine HAVE_CPU_ALPHA
+
+/* Define if the target CPU is an ARM */
+#mesondefine HAVE_CPU_ARM
+
+/* Define if the target CPU is a CRIS */
+#mesondefine HAVE_CPU_CRIS
+
+/* Define if the target CPU is a CRISv32 */
+#mesondefine HAVE_CPU_CRISV32
+
+/* Define if the target CPU is a HPPA */
+#mesondefine HAVE_CPU_HPPA
+
+/* Define if the target CPU is an x86 */
+#mesondefine HAVE_CPU_I386
+
+/* Define if the target CPU is a IA64 */
+#mesondefine HAVE_CPU_IA64
+
+/* Define if the target CPU is a M68K */
+#mesondefine HAVE_CPU_M68K
+
+/* Define if the target CPU is a MIPS */
+#mesondefine HAVE_CPU_MIPS
+
+/* Define if the target CPU is a PowerPC */
+#mesondefine HAVE_CPU_PPC
+
+/* Define if the target CPU is a 64 bit PowerPC */
+#mesondefine HAVE_CPU_PPC64
+
+/* Define if the target CPU is a S390 */
+#mesondefine HAVE_CPU_S390
+
+/* Define if the target CPU is a SPARC */
+#mesondefine HAVE_CPU_SPARC
+
+/* Define if the target CPU is a x86_64 */
+#mesondefine HAVE_CPU_X86_64
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+#mesondefine HAVE_DCGETTEXT
+
+/* Defined if we have dladdr () */
+#mesondefine HAVE_DLADDR
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#mesondefine HAVE_DLFCN_H
+
+/* Define to 1 if you have the `fgetpos' function. */
+#mesondefine HAVE_FGETPOS
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#mesondefine HAVE_FSEEKO
+
+/* Define to 1 if you have the `fsetpos' function. */
+#mesondefine HAVE_FSETPOS
+
+/* Define to 1 if you have the `ftello' function. */
+#mesondefine HAVE_FTELLO
+
+/* defined if the compiler implements __func__ */
+#mesondefine HAVE_FUNC
+
+/* defined if the compiler implements __FUNCTION__ */
+#mesondefine HAVE_FUNCTION
+
+/* Define to 1 if you have the `getpagesize' function. */
+#mesondefine HAVE_GETPAGESIZE
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+#mesondefine HAVE_GETTEXT
+
+/* Have GMP library */
+#mesondefine HAVE_GMP
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#mesondefine HAVE_GMTIME_R
+
+/* Have GSL library */
+#mesondefine HAVE_GSL
+
+/* Define if you have the iconv() function and it works. */
+#mesondefine HAVE_ICONV
+
+/* Define to 1 if the system has the type `intmax_t'. */
+#mesondefine HAVE_INTMAX_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#mesondefine HAVE_INTTYPES_H
+
+/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
+   declares uintmax_t. */
+#mesondefine HAVE_INTTYPES_H_WITH_UINTMAX
+
+/* Define to 1 if you have the `localtime_r' function. */
+#mesondefine HAVE_LOCALTIME_R
+
+/* Define to 1 if the system has the type long long */
+#mesondefine HAVE_LONG_LONG
+
+/* Define to 1 if the system has the type `long long int'. */
+#mesondefine HAVE_LONG_LONG_INT
+
+/* Define to 1 if you have the <memory.h> header file. */
+#mesondefine HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#mesondefine HAVE_MMAP
+
+/* Have a monotonic clock */
+#mesondefine HAVE_MONOTONIC_CLOCK
+
+/* Defined if compiling for OSX */
+#mesondefine HAVE_OSX
+
+/* Define to 1 if you have the `poll' function. */
+#mesondefine HAVE_POLL
+
+/* Define to 1 if you have the <poll.h> header file. */
+#mesondefine HAVE_POLL_H
+
+/* Define to 1 if you have the `posix_memalign' function. */
+#mesondefine HAVE_POSIX_MEMALIGN
+
+/* Have posix timers */
+#mesondefine HAVE_POSIX_TIMERS
+
+/* Define to 1 if you have the `ppoll' function. */
+#mesondefine HAVE_PPOLL
+
+/* defined if the compiler implements __PRETTY_FUNCTION__ */
+#mesondefine HAVE_PRETTY_FUNCTION
+
+/* Define to 1 if you have the <process.h> header file. */
+#mesondefine HAVE_PROCESS_H
+
+/* Define to 1 if you have the `pselect' function. */
+#mesondefine HAVE_PSELECT
+
+/* Define if you have POSIX threads libraries and header files. */
+#mesondefine HAVE_PTHREAD
+
+/* Have PTHREAD_PRIO_INHERIT. */
+#mesondefine HAVE_PTHREAD_PRIO_INHERIT
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#mesondefine HAVE_PTRDIFF_T
+
+/* Define if RDTSC is available */
+#mesondefine HAVE_RDTSC
+
+/* Define to 1 if you have the `sigaction' function. */
+#mesondefine HAVE_SIGACTION
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#mesondefine HAVE_STDINT_H
+
+/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
+   uintmax_t. */
+#mesondefine HAVE_STDINT_H_WITH_UINTMAX
+
+/* Define to 1 if you have the <stdio_ext.h> header file. */
+#mesondefine HAVE_STDIO_EXT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#mesondefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#mesondefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#mesondefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#mesondefine HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#mesondefine HAVE_SYS_POLL_H
+
+/* Define to 1 if you have the <sys/prctl.h> header file. */
+#mesondefine HAVE_SYS_PRCTL_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#mesondefine HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#mesondefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/times.h> header file. */
+#mesondefine HAVE_SYS_TIMES_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#mesondefine HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#mesondefine HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#mesondefine HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#mesondefine HAVE_SYS_WAIT_H
+
+/* Have tm_gmtoff field in struct tm */
+#mesondefine HAVE_TM_GMTOFF
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+#mesondefine HAVE_UCONTEXT_H
+
+/* Have __uint128_t type */
+#mesondefine HAVE_UINT128_T
+
+/* defined if unaligned memory access works correctly */
+#mesondefine HAVE_UNALIGNED_ACCESS
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#mesondefine HAVE_UNISTD_H
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#mesondefine HAVE_UNSIGNED_LONG_LONG_INT
+
+/* Define if valgrind should be used */
+#mesondefine HAVE_VALGRIND
+
+/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
+#mesondefine HAVE_VALGRIND_VALGRIND_H
+
+/* Defined if compiling for Windows */
+#mesondefine HAVE_WIN32
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+#mesondefine HAVE_WINSOCK2_H
+
+/* the host CPU */
+#mesondefine HOST_CPU
+
+/* library dir */
+#mesondefine LIBDIR
+
+/* gettext locale dir */
+#mesondefine LOCALEDIR
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#mesondefine LT_OBJDIR
+
+/* Memory alignment to use */
+#mesondefine MEMORY_ALIGNMENT
+
+/* Memory alignment by malloc default */
+#mesondefine MEMORY_ALIGNMENT_MALLOC
+
+/* Memory alignment by pagesize */
+#mesondefine MEMORY_ALIGNMENT_PAGESIZE
+
+/* Name of package */
+#mesondefine PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#mesondefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#mesondefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#mesondefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#mesondefine PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#mesondefine PACKAGE_URL
+
+/* Define to the version of this package. */
+#mesondefine PACKAGE_VERSION
+
+/* directory where plugins are located */
+#mesondefine PLUGINDIR
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+#mesondefine PTHREAD_CREATE_JOINABLE
+
+/* The size of `char', as computed by sizeof. */
+#mesondefine SIZEOF_CHAR
+
+/* The size of `int', as computed by sizeof. */
+#mesondefine SIZEOF_INT
+
+/* The size of `long', as computed by sizeof. */
+#mesondefine SIZEOF_LONG
+
+/* The size of `short', as computed by sizeof. */
+#mesondefine SIZEOF_SHORT
+
+/* The size of `void*', as computed by sizeof. */
+#mesondefine SIZEOF_VOIDP
+
+/* Define to 1 if you have the ANSI C header files. */
+#mesondefine STDC_HEADERS
+
+/* the target CPU */
+#mesondefine TARGET_CPU
+
+/* Define if we should poison deallocated memory */
+#mesondefine USE_POISONING
+
+/* Version number of package */
+#mesondefine VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#mesondefine _FILE_OFFSET_BITS
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#mesondefine _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#mesondefine _LARGE_FILES
+
+/* We need at least WinXP SP2 for __stat64 */
+#mesondefine __MSVCRT_VERSION__
+
+/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
+   not define. */
+#mesondefine intmax_t
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#mesondefine size_t
+
+#mesondefine HAVE_GETPID
+#mesondefine HAVE__GETPID
+#mesondefine HAVE_DECL_STRDUP
+#mesondefine HAVE__STRDUP
+#mesondefine HAVE_MKSTEMP
+#mesondefine HAVE_FORK
+#mesondefine HAVE_ALARM
+#mesondefine HAVE_DECL_LOCALTIME_R
+#mesondefine HAVE_DECL_STRSIGNAL
diff --git a/docs/gst/meson.build b/docs/gst/meson.build
new file mode 100644 (file)
index 0000000..c5a3516
--- /dev/null
@@ -0,0 +1,12 @@
+configure_file(input : 'gstreamer.types.in',
+  output : 'gstreamer.types',
+  configuration : configuration_data())
+
+gnome.gtkdoc('gstreamer',
+  main_sgml : 'gstreamer-docs.sgml',
+  src_dir : '@0@/gst'.format(meson.source_root()),
+  scan_args : ['--deprecated-guards=GST_DISABLE_DEPRECATED',
+            '--ignore-decorators=GST_EXPORT',
+            '--ignore-headers=gettext.h glib-compat-private.h glib-compat.h gst-i18n-app.h gst-i18n-lib.h gst_private.h gstelementdetails.h gstmacros.h grammar.tab.h grammar.tab.pre.h math-compat.h types.h'
+            ],
+  install : true)
diff --git a/docs/libs/meson.build b/docs/libs/meson.build
new file mode 100644 (file)
index 0000000..56706a3
--- /dev/null
@@ -0,0 +1,12 @@
+configure_file(input : 'gstreamer-libs.types',
+  output : 'gstreamer-libs.types',
+  configuration : configuration_data())
+
+gnome.gtkdoc('gstreamer-libs',
+  main_sgml : 'gstreamer-libs-docs.sgml',
+  src_dir : '@0@/libs/gst'.format(meson.source_root()),
+  scan_args : ['--deprecated-guards=GST_DISABLE_DEPRECATED',
+            '--ignore-decorators=GST_EXPORT',
+            '--ignore-headers=gettext.h glib-compat-private.h glib-compat.h gst-i18n-app.h gst-i18n-lib.h gst_private.h gstelementdetails.h gstmacros.h grammar.tab.h grammar.tab.pre.h math-compat.h types.h'
+            ],
+  install : true)
diff --git a/docs/meson.build b/docs/meson.build
new file mode 100644 (file)
index 0000000..d9ba333
--- /dev/null
@@ -0,0 +1,12 @@
+docconf = configuration_data()
+
+docconf.set('GST_API_VERSION', apiversion)
+docconf.set('PACKAGE_VERSION', gst_version)
+docconf.set('PLUGINDIR', '@0@/lib/gstreamer-1.0'.format(get_option('prefix')))
+
+configure_file(input : 'version.entities.in',
+  output : 'version.entities',
+  configuration : docconf)
+
+subdir('gst')
+subdir('libs')
diff --git a/gst/build_mkenum.py b/gst/build_mkenum.py
new file mode 100755 (executable)
index 0000000..42940cb
--- /dev/null
@@ -0,0 +1,54 @@
+#!/usr/bin/env python3
+
+# This is in its own file rather than inside meson.build
+# because a) mixing the two is ugly and b) trying to
+# make special characters such as \n go through all
+# backends is a fool's errand.
+
+import sys, os, shutil, subprocess
+
+h_array = ['--fhead',
+           "#ifndef __GST_ENUM_TYPES_H__\n#define __GST_ENUM_TYPES_H__\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n",
+           '--fprod',
+           "\n/* enumerations from \"@filename@\" */\n",
+           '--vhead',
+           "GType @enum_name@_get_type (void);\n#define GST_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n",
+           '--ftail',
+           "G_END_DECLS\n\n#endif /* __GST_ENUM_TYPES_H__ */"]
+
+c_array = [
+    '--fhead',
+    "#include \"gst_private.h\"\n#include <gst/gst.h>\n#define C_ENUM(v) ((gint) v)\n#define C_FLAGS(v) ((guint) v)\n ",
+    '--fprod',
+    "\n/* enumerations from \"@filename@\" */",
+    '--vhead',
+    "GType\n@enum_name@_get_type (void)\n{\n  static gsize id = 0;\n  static const G@Type@Value values[] = {",
+    '--vprod',
+    "    { C_@TYPE@(@VALUENAME@), \"@VALUENAME@\", \"@valuenick@\" },",
+    '--vtail',
+    "    { 0, NULL, NULL }\n  };\n\n  if (g_once_init_enter (&id)) {\n    GType tmp = g_@type@_register_static (\"@EnumName@\", values);\n    g_once_init_leave (&id, tmp);\n  }\n\n  return (GType) id;\n}"
+    ]
+
+cmd = []
+argn = 1
+# Find the full command needed to run glib-mkenums
+# On UNIX-like, this is just the full path to glib-mkenums
+# On Windows, this is the full path to interpreter + full path to glib-mkenums
+for arg in sys.argv[1:]:
+    cmd.append(arg)
+    argn += 1
+    if arg.endswith('glib-mkenums'):
+        break
+ofilename = sys.argv[argn]
+headers = sys.argv[argn + 1:]
+
+if ofilename.endswith('.h'):
+    arg_array = h_array
+else:
+    arg_array = c_array
+
+pc = subprocess.Popen(cmd + arg_array + headers, stdout=subprocess.PIPE)
+(stdo, _) = pc.communicate()
+if pc.returncode != 0:
+    sys.exit(pc.returncode)
+open(ofilename, 'wb').write(stdo)
diff --git a/gst/meson.build b/gst/meson.build
new file mode 100644 (file)
index 0000000..5ba17f1
--- /dev/null
@@ -0,0 +1,252 @@
+gst_sources = [
+  'gst.c',
+  'gstobject.c',
+  'gstallocator.c',
+  'gstbin.c',
+  'gstbuffer.c',
+  'gstbufferlist.c',
+  'gstbufferpool.c',
+  'gstbus.c',
+  'gstcaps.c',
+  'gstcapsfeatures.c',
+  'gstchildproxy.c',
+  'gstclock.c',
+  'gstclock-linreg.c',
+  'gstcontext.c',
+  'gstcontrolbinding.c',
+  'gstcontrolsource.c',
+  'gstdatetime.c',
+  'gstdebugutils.c',
+  'gstdevice.c',
+  'gstdeviceprovider.c',
+  'gstdeviceproviderfactory.c',
+  'gstelement.c',
+  'gstelementfactory.c',
+  'gsterror.c',
+  'gstevent.c',
+  'gstformat.c',
+  'gstghostpad.c',
+  'gstdevicemonitor.c',
+  'gstinfo.c',
+  'gstiterator.c',
+  'gstatomicqueue.c',
+  'gstmessage.c',
+  'gstmeta.c',
+  'gstmemory.c',
+  'gstminiobject.c',
+  'gstpad.c',
+  'gstpadtemplate.c',
+  'gstparamspecs.c',
+  'gstpipeline.c',
+  'gstplugin.c',
+  'gstpluginfeature.c',
+  'gstpluginloader.c',
+  'gstpoll.c',
+  'gstpreset.c',
+  'gstprotection.c',
+  'gstquark.c',
+  'gstquery.c',
+  'gstregistry.c',
+  'gstregistrychunks.c',
+  'gstsample.c',
+  'gstsegment.c',
+  'gststreamcollection.c',
+  'gststreams.c',
+  'gststructure.c',
+  'gstsystemclock.c',
+  'gsttaglist.c',
+  'gsttagsetter.c',
+  'gsttask.c',
+  'gsttaskpool.c',
+  'gsttoc.c',
+  'gsttocsetter.c',
+  'gsttracer.c',
+  'gsttracerfactory.c',
+  'gsttracerrecord.c',
+  'gsttracerutils.c',
+  'gsttypefind.c',
+  'gsttypefindfactory.c',
+  'gsturi.c',
+  'gstutils.c',
+  'gstvalue.c',
+  'gstparse.c',
+]
+
+gst_headers = [
+  'gst.h',
+  'glib-compat.h',
+  'gstobject.h',
+  'gstallocator.h',
+  'gstbin.h',
+  'gstbuffer.h',
+  'gstbufferlist.h',
+  'gstbufferpool.h',
+  'gstbus.h',
+  'gstcaps.h',
+  'gstcapsfeatures.h',
+  'gstchildproxy.h',
+  'gstclock.h',
+  'gstcompat.h',
+  'gstcontext.h',
+  'gstcontrolbinding.h',
+  'gstcontrolsource.h',
+  'gstdatetime.h',
+  'gstdebugutils.h',
+  'gstelement.h',
+  'gstelementmetadata.h',
+  'gstdevice.h',
+  'gstdeviceprovider.h',
+  'gstdeviceproviderfactory.h',
+  'gstelementfactory.h',
+  'gsterror.h',
+  'gstevent.h',
+  'gstformat.h',
+  'gstghostpad.h',
+  'gstdevicemonitor.h',
+  'gstinfo.h',
+  'gstiterator.h',
+  'gstatomicqueue.h',
+  'gstmacros.h',
+  'gstmessage.h',
+  'gstmeta.h',
+  'gstmemory.h',
+  'gstminiobject.h',
+  'gstpad.h',
+  'gstpadtemplate.h',
+  'gstparamspecs.h',
+  'gstpipeline.h',
+  'gstplugin.h',
+  'gstpluginfeature.h',
+  'gstpoll.h',
+  'gstpreset.h',
+  'gstprotection.h',
+  'gstquery.h',
+  'gstsample.h',
+  'gstsegment.h',
+  'gststreamcollection.h',
+  'gststreams.h',
+  'gststructure.h',
+  'gstsystemclock.h',
+  'gsttaglist.h',
+  'gsttagsetter.h',
+  'gsttask.h',
+  'gsttaskpool.h',
+  'gsttoc.h',
+  'gsttocsetter.h',
+  'gsttracer.h',
+  'gsttracerfactory.h',
+  'gsttracerrecord.h',
+  'gsttypefind.h',
+  'gsttypefindfactory.h',
+  'gsturi.h',
+  'gstutils.h',
+  'gstvalue.h',
+  'gstregistry.h',
+  'gstparse.h',
+  'math-compat.h',
+]
+install_headers(gst_headers, subdir : 'gstreamer-1.0/gst')
+
+if not get_option('disable_registry')
+  gst_registry = ['gstregistrybinary.c']
+else
+  gst_registry = []
+endif
+
+configure_file(input : 'gstconfig.h.in',
+  output : 'gstconfig.h',
+  install_dir : 'include/gstreamer-1.0/gst',
+  configuration : cdata)
+configure_file(input : 'gstversion.h.in',
+  output : 'gstversion.h',
+  install_dir : 'include/gstreamer-1.0/gst',
+  configuration : cdata)
+
+mkenums = find_program('build_mkenum.py')
+glib_mkenums = find_program('glib-mkenums')
+
+gstenum_h = custom_target('gstenum_h',
+  output : 'gstenumtypes.h',
+  input : gst_headers,
+  install : true,
+  install_dir : 'include/gstreamer-1.0/gst',
+  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+
+gstenum_c = custom_target('gstenum_c',
+  output : 'gstenumtypes.c',
+  input : gst_headers,
+  depends : [gstenum_h],
+  command : [mkenums, glib_mkenums, '@OUTPUT@', '@INPUT@'])
+
+subdir('parse')
+subdir('printf')
+
+libgst_c_args = gst_c_args + [
+  '-D_GNU_SOURCE',
+  '-DGST_EXPORTS',
+  '-DG_LOG_DOMAIN=g_log_domain_gstreamer',
+  '-DGST_DISABLE_DEPRECATED',
+]
+
+# Make it possible to build both static and shared versions
+# at the same time. By default use shared for unit tests etc.
+# This choice is arbitrary.
+if libtype != 'shared'
+  libgst_static = static_library('gstreamer-1.0', gst_sources,
+    gstenum_h, gstenum_c, grammar, parser, gst_registry,
+    c_args : [libgst_c_args],
+    include_directories : [configinc,
+      # HACK, change include paths in .y and .l in final version.
+      include_directories('parse')],
+    install : true,
+    link_with : printf_lib,
+    dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib] + platform_deps,
+  )
+  libgst = libgst_static
+endif
+
+if libtype != 'static'
+  libgst_shared = shared_library('gstreamer-1.0', gst_sources,
+    gstenum_h, gstenum_c, grammar, parser, gst_registry,
+    version : libversion,
+    soversion : soversion,
+    c_args : libgst_c_args,
+    include_directories : [configinc,
+      # HACK, change include paths in .y and .l in final version.
+      include_directories('parse')],
+    link_with : printf_lib,
+    install : true,
+    dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib] + platform_deps,
+    vs_module_defs: vs_module_defs_dir + 'libgstreamer.def',
+  )
+  libgst = libgst_shared
+  if build_gir
+    gst_gir_extra_args = gir_init_section + [ '--c-include=gst/gst.h' ]
+    if meson.is_subproject()
+      # FIXME: There must be a better way to do this
+      # Need to pass the include path to find gst/gst.h and gst/gstenumtypes.h (built)
+      gst_gir_extra_args += ['--cflags-begin',
+         '-I' + meson.current_source_dir() + '/..',
+         '-I' + meson.current_build_dir() + '/..',
+         '--cflags-end']
+    endif
+    gnome.generate_gir(libgst_shared,
+      sources : gst_sources + gst_headers,
+      namespace : 'Gst',
+      nsversion : apiversion,
+      identifier_prefix : 'Gst',
+      symbol_prefix : 'gst',
+      export_packages : 'gstreamer-1.0',
+      includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0' ],
+      install : true,
+      extra_args : gst_gir_extra_args,
+    )
+  endif
+endif
+
+gst_dep = declare_dependency(link_with : libgst,
+  include_directories : [configinc],
+  dependencies : [glib_dep, gobject_dep, gmodule_dep],
+  # Everything that uses libgst needs this built to compile
+  sources : [gstenum_h],
+)
diff --git a/gst/parse/gen_grammar.py.in b/gst/parse/gen_grammar.py.in
new file mode 100755 (executable)
index 0000000..3a7af00
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/env python3
+
+import subprocess, sys, shlex
+
+cfile = sys.argv[1]
+hfile = sys.argv[2]
+yfile = sys.argv[3]
+
+args = ['-d', '-v', '-ppriv_gst_parse_yy', yfile, '-o', cfile]
+bison = [r'@BISON@'] + shlex.split(r'@BISON_ARGS@')
+subprocess.check_call(bison + args)
+
+prefix = '''
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+'''
+
+contents = open(cfile).read()
+content = prefix + contents
+open(cfile, 'w').write(contents)
diff --git a/gst/parse/gen_lex.py.in b/gst/parse/gen_lex.py.in
new file mode 100755 (executable)
index 0000000..e8c6844
--- /dev/null
@@ -0,0 +1,27 @@
+#!/usr/bin/env python3
+
+import subprocess, sys, shlex
+
+cfile = sys.argv[1]
+hfile = sys.argv[2]
+lfile = sys.argv[3]
+tabhfile = sys.argv[4]
+
+args = ['--header-file=' + hfile, '-o', cfile, '-Ppriv_gst_parse_yy', lfile]
+flex = [r'@FLEX@'] + shlex.split(r'@FLEX_ARGS@')
+subprocess.check_call(flex + args)
+
+prefix = '''#ifdef HAVE_CONFIG_H
+#include<config.h>
+#endif
+'''
+parse_snippet = '''void priv_gst_parse_yyset_column (int column_no , void * yyscanner);
+void priv_gst_parse_yyset_column (int column_no , void * yyscanner)
+'''
+
+contents = open(cfile).read()
+if not 'priv_gst_parse_yyget_column' in contents:
+    contents = parse_snippet + contents
+contents = prefix + contents
+
+open(cfile, 'w').write(contents)
diff --git a/gst/parse/meson.build b/gst/parse/meson.build
new file mode 100644 (file)
index 0000000..5370397
--- /dev/null
@@ -0,0 +1,61 @@
+cc = meson.get_compiler('c')
+
+py3 = find_program('python3', required : false)
+if not py3.found()
+  # Maybe 'python' is Python 3
+  py3 = find_program('python')
+endif
+
+# Find flex, configure lex generator
+flex_cdata = configuration_data()
+
+flex = find_program('flex', required : false)
+if not flex.found()
+  flex = find_program('win_flex', required : false)
+  if not flex.found()
+    error('flex not found')
+  endif
+endif
+
+flex_cdata.set('FLEX', flex.path())
+if cc.get_id() == 'msvc'
+  flex_cdata.set('FLEX_ARGS', '--nounistd')
+else
+  flex_cdata.set('FLEX_ARGS', '')
+endif
+
+gen_lex = configure_file(input : 'gen_lex.py.in',
+  output : 'gen_lex.py',
+  configuration : flex_cdata)
+
+# Find bison, configure grammar generator
+bison_cdata = configuration_data()
+
+bison = find_program('bison', required : false)
+if not bison.found()
+  bison = find_program('win_bison', required : false)
+  if not bison.found()
+    error('GNU bison not found')
+  endif
+endif
+
+bison_cdata.set('BISON', bison.path())
+bison_cdata.set('BISON_ARGS', '')
+
+gen_grammar = configure_file(input : 'gen_grammar.py.in',
+  output : 'gen_grammar.py',
+  configuration : bison_cdata)
+
+# Custom targets
+parser = custom_target('parselex',
+  input : 'parse.l',
+  output : ['lex.priv_gst_parse_yy.c', 'parse_lex.h'],
+  command : [py3, gen_lex, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@', 'DUMMY']
+)
+
+grammar = custom_target('parsegrammar',
+  input : 'grammar.y',
+  output : ['grammar.tab.c', 'grammar.tab.h'],
+  command : [py3, gen_grammar, '@OUTPUT0@', '@OUTPUT1@', '@INPUT@'],
+  depends : [parser],
+)
diff --git a/gst/printf/meson.build b/gst/printf/meson.build
new file mode 100644 (file)
index 0000000..8e4122a
--- /dev/null
@@ -0,0 +1,24 @@
+printf_sources = [
+  'asnprintf.c',
+  'printf-args.c',
+  'printf-parse.c',
+  'vasnprintf.c',
+  'printf.c',
+  'printf-extension.c',
+]
+
+printf_args = gst_c_args + [
+#  '-UHAVE_LONG_DOUBLE',
+#  '-UHAVE_LONG_LONG_FORMAT',
+#  ' -UHAVE_WCHAR_T',
+#  '-UHAVE_WCSLEN',
+#  '-UHAVE_WINT_T',
+  '-DSTATIC=G_GNUC_INTERNAL',
+]
+
+printf_lib = static_library('gstprintf',
+    printf_sources,
+    include_directories : [configinc],
+    c_args : printf_args + pic_args,
+    install : false,
+    dependencies : [glib_dep])
diff --git a/libs/gst/base/meson.build b/libs/gst/base/meson.build
new file mode 100644 (file)
index 0000000..8f31b41
--- /dev/null
@@ -0,0 +1,96 @@
+gst_base_sources = [
+  'gstadapter.c',
+  'gstbaseparse.c',
+  'gstbasesink.c',
+  'gstbasesrc.c',
+  'gstbasetransform.c',
+  'gstbitreader.c',
+  'gstbytereader.c',
+  'gstbytewriter.c',
+  'gstcollectpads.c',
+  'gstdataqueue.c',
+  'gstflowcombiner.c',
+  'gstpushsrc.c',
+  'gstqueuearray.c',
+  'gsttypefindhelper.c',
+]
+
+gst_base_headers = [
+  'base.h',
+  'gstadapter.h',
+  'gstbaseparse.h',
+  'gstbasesink.h',
+  'gstbasesrc.h',
+  'gstbasetransform.h',
+  'gstbitreader.h',
+  'gstbytereader.h',
+  'gstbytewriter.h',
+  'gstcollectpads.h',
+  'gstdataqueue.h',
+  'gstflowcombiner.h',
+  'gstpushsrc.h',
+  'gstqueuearray.h',
+  'gsttypefindhelper.h',
+]
+
+if libtype != 'shared'
+  gst_base_static = static_library('gstbase-@0@'.format(apiversion),
+    gst_base_sources,
+    c_args : gst_c_args,
+    install : true,
+    include_directories : [configinc, libsinc],
+    dependencies : [gobject_dep, glib_dep, gst_dep],
+  )
+  gst_base = gst_base_static
+endif
+
+if libtype != 'static'
+  gst_base_shared = shared_library('gstbase-@0@'.format(apiversion),
+    gst_base_sources,
+    c_args : gst_c_args,
+    version : libversion,
+    soversion : soversion,
+    install : true,
+    include_directories : [configinc, libsinc],
+    dependencies : [gobject_dep, glib_dep, gst_dep],
+    vs_module_defs: vs_module_defs_dir + 'libgstbase.def',
+  )
+  gst_base = gst_base_shared
+  if build_gir
+    gnome.generate_gir(gst_base_shared,
+      sources : gst_base_sources + gst_base_headers,
+      namespace : 'GstBase',
+      nsversion : apiversion,
+      identifier_prefix : 'Gst',
+      symbol_prefix : 'gst',
+      export_packages : 'gstreamer-base-1.0',
+      link_with : libgst_shared,
+      include_directories : [configinc, libsinc, privinc],
+      includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gst-1.0'],
+      install : true,
+      extra_args : gir_init_section,
+    )
+  endif
+endif
+
+gst_base_dep = declare_dependency(link_with : gst_base,
+  include_directories : [libsinc],
+  dependencies : [gst_dep])
+
+install_headers('base.h',
+  'gstadapter.h',
+  'gstbaseparse.h',
+  'gstbasesink.h',
+  'gstbasesrc.h',
+  'gstbasetransform.h',
+  'gstbitreader.h',
+  'gstbytereader.h',
+  'gstbytewriter.h',
+  'gstcollectpads.h',
+  'gstdataqueue.h',
+  'gstflowcombiner.h',
+  'gstpushsrc.h',
+  'gstqueuearray.h',
+  'gsttypefindhelper.h',
+  subdir : 'gstreamer-1.0/gst/base',
+)
diff --git a/libs/gst/check/libcheck/meson.build b/libs/gst/check/libcheck/meson.build
new file mode 100644 (file)
index 0000000..4f9a92b
--- /dev/null
@@ -0,0 +1,41 @@
+libcheck_files = [
+  'check.c',
+  'check_error.c',
+  'check_list.c',
+  'check_log.c',
+  'check_msg.c',
+  'check_pack.c',
+  'check_print.c',
+  'check_run.c',
+  'check_str.c',
+  'libcompat.c'
+]
+
+if not cdata.has('HAVE_ALARM')
+  libcheck_files += [ 'alarm.c' ]
+endif
+
+if not cdata.has('HAVE_CLOCK_GETTIME')
+  libcheck_files += [ 'clock_gettime.c' ]
+endif
+
+if not cdata.has('HAVE_DECL_STRSIGNAL')
+  libcheck_files += [ 'strsignal.c' ]
+endif
+
+# FIXME: check for symbols timer_create, timer_settime, timer_delete as well
+if not rt_lib.found()
+  libcheck_files += [ 'timer_create.c', 'timer_settime.c', 'timer_delete.c' ]
+endif
+
+configure_file(input : 'check.h.in',
+  output : 'check.h',
+  configuration : check_cdata)
+
+internal_check_h_inc = include_directories('..')
+
+libcheck = static_library('check',
+  libcheck_files,
+  include_directories : [ configinc, internal_check_h_inc ],
+  dependencies : [rt_lib, mathlib],
+  c_args: gst_c_args + pic_args)
diff --git a/libs/gst/check/meson.build b/libs/gst/check/meson.build
new file mode 100644 (file)
index 0000000..0052c7f
--- /dev/null
@@ -0,0 +1,47 @@
+gst_check_sources = [
+  'gstbufferstraw.c',
+  'gstcheck.c',
+  'gstconsistencychecker.c',
+  'gstharness.c',
+  'gsttestclock.c',
+]
+gst_check_headers = [
+  'check.h',
+  'gstbufferstraw.h',
+  'gstcheck.h',
+  'gstconsistencychecker.h',
+  'gstharness.h',
+  'gsttestclock.h',
+]
+install_headers(gst_check_headers, subdir : 'gstreamer-1.0/gst/check/')
+
+
+check_cdata = configuration_data()
+
+check_cdata.set('ENABLE_SUBUNIT', 0)
+check_cdata.set('CHECK_MAJOR_VERSION', 0)
+check_cdata.set('CHECK_MINOR_VERSION', 9)
+check_cdata.set('CHECK_MICRO_VERSION', 14)
+if host_machine.system() != 'windows'
+  check_cdata.set('HAVE_FORK', 1)
+endif
+
+subdir('libcheck')
+
+configure_file(input : 'libcheck/check.h.in',
+  output : 'internal-check.h',
+  install : true,
+  install_dir : 'include/gstreamer-1.0/gst/check/',
+  configuration : check_cdata)
+
+gst_check = shared_library('gstcheck',
+  gst_check_sources,
+  c_args : gst_c_args,
+  include_directories : [configinc, libsinc],
+  link_with : [libcheck],
+  dependencies : [gobject_dep, glib_dep, gst_dep],
+)
+
+gst_check_dep = declare_dependency(link_with : gst_check,
+  include_directories : [libsinc],
+  dependencies : [gst_dep])
diff --git a/libs/gst/controller/meson.build b/libs/gst/controller/meson.build
new file mode 100644 (file)
index 0000000..2ff95cd
--- /dev/null
@@ -0,0 +1,63 @@
+gst_controller_sources = [
+  'gstargbcontrolbinding.c',
+  'gstdirectcontrolbinding.c',
+  'gsttimedvaluecontrolsource.c',
+  'gstinterpolationcontrolsource.c',
+  'gsttriggercontrolsource.c',
+  'gstlfocontrolsource.c',
+]
+
+gst_controller_headers = [
+  'gstargbcontrolbinding.h',
+  'gstdirectcontrolbinding.h',
+  'gsttimedvaluecontrolsource.h',
+  'gstinterpolationcontrolsource.h',
+  'gsttriggercontrolsource.h',
+  'gstlfocontrolsource.h',
+  'controller.h',
+]
+install_headers(gst_controller_headers, subdir : 'gstreamer-1.0/gst/controller/')
+
+if libtype != 'shared'
+  gst_controller_static = static_library('gstcontroller-@0@'.format(apiversion),
+    gst_controller_sources,
+    c_args : gst_c_args,
+    install : true,
+    include_directories : [configinc, libsinc],
+    dependencies : [gobject_dep, glib_dep, mathlib, gst_dep],
+  )
+  gst_controller = gst_controller_static
+endif
+
+if libtype != 'static'
+  gst_controller_shared = shared_library('gstcontroller-@0@'.format(apiversion),
+    gst_controller_sources,
+    c_args : gst_c_args,
+    install : true,
+    version : libversion,
+    soversion : soversion,
+    include_directories : [configinc, libsinc],
+    dependencies : [gobject_dep, glib_dep, mathlib, gst_dep],
+    vs_module_defs: vs_module_defs_dir + 'libgstcontroller.def',
+  )
+  gst_controller = gst_controller_shared
+  if build_gir
+    gnome.generate_gir(gst_controller_shared,
+      sources : gst_controller_sources + gst_controller_headers,
+      namespace : 'GstController',
+      nsversion : apiversion,
+      identifier_prefix : 'Gst',
+      symbol_prefix : 'gst',
+      export_packages : 'gstreamer-controller-1.0',
+      link_with : libgst_shared,
+      include_directories : [configinc, libsinc, privinc],
+      includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gst-1.0'],
+      install : true,
+      extra_args : gir_init_section,
+    )
+  endif
+endif
+
+gst_controller_dep = declare_dependency(link_with : gst_controller,
+  include_directories : [libsinc],
+  dependencies : [gst_dep])
diff --git a/libs/gst/helpers/meson.build b/libs/gst/helpers/meson.build
new file mode 100644 (file)
index 0000000..b655995
--- /dev/null
@@ -0,0 +1,12 @@
+gst_plugin_scanner = executable('gst-plugin-scanner',
+  'gst-plugin-scanner.c',
+  c_args : gst_c_args,
+  include_directories : [configinc],
+  dependencies : [gobject_dep, gmodule_dep, glib_dep, mathlib, gst_dep],
+  link_with : [printf_lib],
+  install_dir : helpers_install_dir,
+  install: true,
+)
+
+# FIXME: gst-ptp-helper
+# FIXME: gst-completion-helper
diff --git a/libs/gst/meson.build b/libs/gst/meson.build
new file mode 100644 (file)
index 0000000..aef3119
--- /dev/null
@@ -0,0 +1,8 @@
+subdir('base')
+subdir('controller')
+subdir('net')
+subdir('helpers')
+# FIXME: make check work on windows
+if host_machine.system() != 'windows'
+subdir('check')
+endif
diff --git a/libs/gst/net/meson.build b/libs/gst/net/meson.build
new file mode 100644 (file)
index 0000000..dc9bdbc
--- /dev/null
@@ -0,0 +1,65 @@
+gst_net_sources = [
+  'gstnetaddressmeta.c',
+  'gstnetclientclock.c',
+  'gstnetcontrolmessagemeta.c',
+  'gstnettimepacket.c',
+  'gstnettimeprovider.c',
+  'gstptpclock.c',
+  'gstntppacket.c',
+]
+
+gst_net_headers = [
+ 'gstnet.h',
+ 'gstnetaddressmeta.h',
+ 'gstnetclientclock.h',
+ 'gstnetcontrolmessagemeta.h',
+ 'gstnettimepacket.h',
+ 'gstnettimeprovider.h',
+ 'gstptpclock.h',
+ 'net.h',
+]
+install_headers(gst_net_headers, subdir : 'gstreamer-1.0/gst/net/')
+
+if libtype != 'shared'
+  gst_net_static = static_library('gstnet-@0@'.format(apiversion),
+    gst_net_sources,
+    c_args : gst_c_args,
+    include_directories : [configinc, libsinc],
+    install : true,
+    dependencies : [gio_dep, gst_base_dep],
+  )
+  gst_net = gst_net_static
+endif
+
+if libtype != 'static'
+  gst_net_shared = shared_library('gstnet-@0@'.format(apiversion),
+    gst_net_sources,
+    c_args : gst_c_args,
+    include_directories : [configinc, libsinc],
+    version : libversion,
+    soversion : soversion,
+    install : true,
+    dependencies : [gio_dep, gst_base_dep],
+    vs_module_defs: vs_module_defs_dir + 'libgstnet.def',
+  )
+  gst_net = gst_net_shared
+  if build_gir
+    gnome.generate_gir(gst_net_shared,
+      sources : gst_net_sources + gst_net_headers,
+      namespace : 'GstNet',
+      nsversion : apiversion,
+      identifier_prefix : 'Gst',
+      symbol_prefix : 'gst',
+      export_packages : 'gstreamer-net-1.0',
+      link_with : libgst_shared,
+      include_directories : [configinc, libsinc],
+      includes : ['GLib-2.0', 'GObject-2.0', 'GModule-2.0', 'Gio-2.0', 'Gst-1.0'],
+      install : true,
+      extra_args : gir_init_section,
+    )
+  endif
+endif
+
+gst_net_dep = declare_dependency(link_with : gst_net,
+  include_directories : [libsinc],
+  dependencies : [gst_dep])
diff --git a/libs/meson.build b/libs/meson.build
new file mode 100644 (file)
index 0000000..668dcba
--- /dev/null
@@ -0,0 +1 @@
+subdir('gst')
diff --git a/meson.build b/meson.build
new file mode 100644 (file)
index 0000000..bc1cc58
--- /dev/null
@@ -0,0 +1,277 @@
+project('gstreamer', 'c', 'cpp',
+  version : '1.9.1.1',
+  meson_version : '>= 0.33.0',
+  default_options : [ 'warning_level=1',
+                      'c_std=gnu99',
+                      'buildtype=debugoptimized' ])
+
+gst_version = meson.project_version()
+version_arr = gst_version.split('.')
+gst_version_major = version_arr[0]
+gst_version_minor = version_arr[1]
+gst_version_micro = version_arr[2]
+if version_arr.length() == 4
+  gst_version_nano = version_arr[3]
+else
+  gst_version_nano = 0
+endif
+
+apiversion = '1.0'
+soversion = 0
+# maintaining compatibility with the previous libtool versioning
+# current = minor * 100 + micro
+libversion = '@0@.@1@.0'.format(soversion, gst_version_minor.to_int() * 100 + gst_version_micro.to_int())
+
+prefix = get_option('prefix')
+libtype = get_option('library_format')
+
+libexecdir = get_option('libexecdir')
+helpers_install_dir = libexecdir + '/gstreamer-1.0/'
+
+cc = meson.get_compiler('c')
+
+# FIXME: Meson should have a way for portably adding -fPIC when needed for use
+# with static libraries that are linked into shared libraries. Or, it should
+# add it by default with an option to turn it off if needed.
+pic_args = ['-fPIC']
+if host_machine.system() == 'windows'
+  pic_args = []
+endif
+
+# Ignore several spurious warnings for things gstreamer does very commonly
+# If a warning is completely useless and spammy, use '/wdXXXX' to suppress it
+# If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once
+# NOTE: Only add warnings here if you are sure they're spurious
+if cc.get_id() == 'msvc'
+  add_global_arguments('/wd4018', '/wd4244', '/wd4996', language : 'c')
+endif
+
+cdata = configuration_data()
+cdata.set('GST_VERSION_MAJOR', gst_version_major)
+cdata.set('GST_VERSION_MINOR', gst_version_minor)
+cdata.set('GST_VERSION_MICRO', gst_version_micro)
+cdata.set('GST_VERSION_NANO', gst_version_nano)
+cdata.set('GST_API_VERSION', '"@0@"'.format(apiversion))
+cdata.set('GST_DATADIR', '"@0@/@1@"'.format(prefix, get_option('datadir')))
+cdata.set('LOCALEDIR', '"@0@/@1@"'.format(prefix, get_option('localedir')))
+cdata.set('LIBDIR', '"@0@/@1@"'.format(prefix, get_option('libdir')))
+cdata.set('GST_API_VERSION', '"1.0"')
+cdata.set('GETTEXT_PACKAGE', '"gstreamer-1.0"')
+cdata.set('GST_LEVEL_DEFAULT', 'GST_LEVEL_NONE')
+cdata.set('GST_LICENSE', '"LGPL"')
+cdata.set('GST_PACKAGE_ORIGIN', '"Unknown package origin"')
+cdata.set('GST_PACKAGE_NAME', '"GStreamer source release"')
+cdata.set('PACKAGE', '"gstreamer"')
+cdata.set('PACKAGE_NAME', '"GStreamer"')
+cdata.set('PACKAGE_STRING', '"GStreamer @0@"'.format(gst_version))
+cdata.set('PACKAGE_TARNAME', '"gstreamer"')
+cdata.set('PACKAGE_BUGREPORT', '"http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer"')
+cdata.set('PACKAGE_URL', '""')
+cdata.set('PACKAGE_VERSION', '"@0@"'.format(gst_version))
+cdata.set('PLUGINDIR', '"@0@/@1@/gstreamer-1.0"'.format(get_option('prefix'),get_option('libdir')))
+cdata.set('VERSION', '"@0@"'.format(gst_version))
+# FIXME: --with-memory-alignment],[8,N,malloc,pagesize (default is 32)]) option
+cdata.set('MEMORY_ALIGNMENT_MALLOC', 1)
+cdata.set('GST_PLUGIN_SCANNER_INSTALLED', '"@0@/@1@/gst-plugin-scanner"'.format(prefix, helpers_install_dir))
+cdata.set('GST_PTP_HELPER_INSTALLED', '"@0@/@1@/gst-ptp-helper"'.format(prefix, helpers_install_dir))
+
+# These are only needed/used by the ABI tests
+host_defines = [
+  [ 'x86', 'HAVE_CPU_I386' ],
+  [ 'x86_64', 'HAVE_CPU_X86_64' ],
+  [ 'arm', 'HAVE_CPU_ARM' ],
+  [ 'aarch64', 'HAVE_CPU_AARCH64' ],
+  [ 'mips', 'HAVE_CPU_MIPS' ],
+  [ 'powerpc', 'HAVE_CPU_PPC' ],
+  [ 'powerpc64', 'HAVE_CPU_PPC64' ],
+  [ 'alpha', 'HAVE_CPU_ALPHA' ],
+  [ 'sparc', 'HAVE_CPU_SPARC' ],
+  [ 'ia64', 'HAVE_CPU_IA64' ],
+  [ 'hppa', 'HAVE_CPU_HPPA' ],
+  [ 'm68k', 'HAVE_CPU_M68K' ],
+  [ 's390', 'HAVE_CPU_S390' ],
+]
+foreach h : host_defines
+  if h.get(0) == host_machine.cpu()
+    cdata.set(h.get(1), 1)
+  endif
+endforeach
+# FIXME: should really be called HOST_CPU or such
+cdata.set('TARGET_CPU', '"@0@"'.format(host_machine.cpu()))
+
+check_headers = [['dlfcn.h','HAVE_DLFCN_H'],
+  ['inttypes.h', 'HAVE_INTTYPES_H'],
+  ['memory.h', 'HAVE_MEMORY_H'],
+  ['poll.h', 'HAVE_POLL_H'],
+  ['stdint.h', 'HAVE_STDINT_H'],
+  ['stdio_ext.h', 'HAVE_STDIO_EXT_H'],
+  ['strings.h', 'HAVE_STRINGS_H'],
+  ['string.h', 'HAVE_STRING_H'],
+  ['sys/param.h', 'HAVE_SYS_PARAM_H'],
+  ['sys/poll.h', 'HAVE_SYS_POLL_H'],
+  ['sys/prctl.h', 'HAVE_SYS_PRCTL_H'],
+  ['sys/socket.h', 'HAVE_SYS_SOCKET_H'],
+  ['sys/stat.h', 'HAVE_SYS_STAT_H'],
+  ['sys/times.h', 'HAVE_SYS_TIMES_H'],
+  ['sys/time.h', 'HAVE_SYS_TIME_H'],
+  ['sys/types.h', 'HAVE_SYS_TYPES_H'],
+  ['sys/utsname.h', 'HAVE_SYS_UTSNAME_H'],
+  ['sys/wait.h', 'HAVE_SYS_WAIT_H'],
+  ['ucontext.h', 'HAVE_UCONTEXT_H'],
+  ['unistd.h', 'HAVE_UNISTD_H'],
+  ['valgrind/valgrind.h', 'HAVE_VALGRIND_VALGRIND_H'],
+]
+
+if host_machine.system() == 'windows'
+  check_headers += [ ['winsock2.h', 'HAVE_WINSOCK2_H'] ]
+endif
+
+foreach h : check_headers
+  if cc.has_header(h.get(0))
+    cdata.set(h.get(1), 1)
+  endif
+endforeach
+
+gmtoff_src = '''#include <time.h>
+int main(void) {
+  struct tm t;
+  t.tm_gmtoff = 0;
+  return 0;
+}
+'''
+
+if cc.compiles(gmtoff_src, name : 'tm_gmtoff from time.h')
+  cdata.set('HAVE_TM_GMTOFF', 1)
+endif
+
+if cc.has_function('gmtime_r', prefix : '#include<time.h>')
+  cdata.set('HAVE_GMTIME_R', 1)
+endif
+if cc.has_function('localtime_r', prefix : '#include<time.h>')
+  cdata.set('HAVE_LOCALTIME_R', 1)
+endif
+if cc.has_function('sigaction', prefix : '#include<signal.h>')
+  cdata.set('HAVE_SIGACTION', 1)
+endif
+if cc.has_function('fseeko', prefix : '#include<stdio.h>')
+  cdata.set('HAVE_FSEEKO', 1)
+endif
+if cc.has_function('ftello', prefix : '#include<stdio.h>')
+  cdata.set('HAVE_FTELLO', 1)
+endif
+if cc.has_function('fsetpos', prefix : '#include<stdio.h>')
+  cdata.set('HAVE_FSETPOS', 1)
+endif
+if cc.has_function('fgetpos', prefix : '#include<stdio.h>')
+  cdata.set('HAVE_FGETPOS', 1)
+endif
+if cc.has_function('poll', prefix : '#include<poll.h>')
+  cdata.set('HAVE_POLL', 1)
+endif
+if cc.has_function('pselect', prefix : '#include<sys/select.h>')
+  cdata.set('HAVE_PSELECT', 1)
+endif
+cdata.set('HAVE_MMAP', 1)
+
+if cc.has_function('posix_memalign', prefix : '#include<stdlib.h>')
+  cdata.set('HAVE_POSIX_MEMALIGN', 1)
+endif
+if cc.has_function('getpagesize', prefix : '#include<unistd.h>')
+  cdata.set('HAVE_GETPAGESIZE', 1)
+endif
+if cc.has_function('clock_gettime', prefix : '#include <time.h>')
+  cdata.set('HAVE_CLOCK_GETTIME', 1)
+endif
+
+if cc.has_type('ptrdiff_t')
+  cdata.set('HAVE_PTRDIFF_T')
+endif
+
+# -------------------------------------------------------------------------------------
+# config.h things needed by libcheck (FIXME: move into the libcheck meson.build) (tpm)
+# -------------------------------------------------------------------------------------
+# FIXME: check if it is _getpid or getpid on windows (tpm)
+if cc.has_function('getpid', prefix : '#include <sys/types.h>\n#include <unistd.h>')
+  cdata.set('HAVE_GETPID', 1)
+elif cc.has_function('_getpid', prefix : '#include <process.h>')
+  cdata.set('HAVE__GETPID', 1)
+endif
+# FIXME: check for _strdup() but how/where and with what includes? (windows?) (tpm)
+if cc.has_function('strdup', prefix : '#include <string.h>')
+  cdata.set('HAVE_DECL_STRDUP', 1)
+elif cc.has_function('_strdup', prefix : '#include <string.h>')
+  cdata.set('HAVE__STRDUP', 1)
+endif
+if cc.has_function('mkstemp', prefix : '#include <stdlib.h>')
+  cdata.set('HAVE_MKSTEMP', 1)
+endif
+if host_machine.system() != 'windows'
+  cdata.set('HAVE_FORK', 1)
+else
+  # libcheck requires HAVE_FORK to be 0 when fork() is not available
+  cdata.set('HAVE_FORK', 0)
+endif
+if cc.has_function('alarm', prefix : '#include <unistd.h>')
+  cdata.set('HAVE_ALARM', 1)
+endif
+if cc.has_function('localtime_r', prefix : '#include <time.h>')
+  cdata.set('HAVE_DECL_LOCALTIME_R', 1)
+endif
+if cc.has_function('strsignal', prefix : '#include <string.h>')
+  cdata.set('HAVE_DECL_STRSIGNAL', 1)
+endif
+
+configure_file(input : 'config.h.meson',
+  output : 'config.h',
+  configuration : cdata)
+
+
+configinc = include_directories('.')
+libsinc = include_directories('libs')
+privinc = include_directories('gst')
+
+# Find dependencies
+glib_dep = dependency('glib-2.0', version : '>=2.32.0')
+gobject_dep = dependency('gobject-2.0')
+gmodule_dep = dependency('gmodule-2.0')
+if host_machine.system() == 'windows'
+    gio_dep = dependency('gio-2.0')
+else
+    gio_dep = [dependency('gio-2.0'), dependency('gio-unix-2.0')]
+endif
+mathlib = cc.find_library('m', required : false)
+rt_lib = cc.find_library('rt', required : false) # clock_gettime
+
+# Platform deps; only ws2_32 for now
+platform_deps = []
+if host_machine.system() == 'windows'
+  platform_deps = [cc.find_library('ws2_32')]
+endif
+
+gir = find_program('g-ir-scanner', required : false)
+gnome = import('gnome')
+
+# Fixme, not very elegant.
+build_gir = gir.found() and not meson.is_cross_build()
+
+gir_init_section = [ '--add-init-section=extern void gst_init(gint*,gchar**); gst_init(NULL,NULL);' ]
+vs_module_defs_dir = meson.source_root() + '/win32/common/'
+
+gst_c_args = ['-DHAVE_CONFIG_H']
+if libtype == 'static'
+  gst_c_args += ['-DGST_STATIC_COMPILATION']
+endif
+
+subdir('gst')
+subdir('libs')
+subdir('plugins')
+subdir('tools')
+subdir('pkgconfig')
+subdir('tests')
+# FIXME: check for gtk-doc
+if build_machine.system() != 'windows'
+  subdir('docs')
+else
+  message('Disabling gtk-doc while building on Windows')
+endif
+subdir('po')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644 (file)
index 0000000..7ccd5fd
--- /dev/null
@@ -0,0 +1,5 @@
+option('build_tools', type : 'boolean', value : true)
+option('poisoning', type : 'boolean', value : false)
+option('disable_examples', type : 'boolean', value : false)
+option('disable_registry', type : 'boolean', value : false)
+option('library_format', type : 'combo', choices : ['shared', 'static', 'both'], value : 'shared')
diff --git a/pkgconfig/meson.build b/pkgconfig/meson.build
new file mode 100644 (file)
index 0000000..0c90d74
--- /dev/null
@@ -0,0 +1,26 @@
+pkgconf = configuration_data()
+
+pkgconf.set('prefix', get_option('prefix'))
+pkgconf.set('exec_prefix', '${prefix}')
+pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
+pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
+pkgconf.set('GST_API_VERSION', apiversion)
+pkgconf.set('VERSION', gst_version)
+
+pkg_install_dir = '@0@/pkgconfig'.format(get_option('libdir'))
+
+pkg_files = ['gstreamer-base',
+  'gstreamer-check',
+  'gstreamer-controller',
+  'gstreamer-net',
+  'gstreamer'
+]
+
+foreach p : pkg_files
+  infile = p + '.pc.in'
+  outfile = p + '-1.0.pc'
+  configure_file(input : infile,
+    output : outfile,
+    configuration : pkgconf,
+    install_dir : pkg_install_dir)
+endforeach
diff --git a/plugins/elements/meson.build b/plugins/elements/meson.build
new file mode 100644 (file)
index 0000000..76f5814
--- /dev/null
@@ -0,0 +1,49 @@
+gst_elements_sources = [
+  'gstcapsfilter.c',
+  'gstconcat.c',
+  'gstdownloadbuffer.c',
+  'gstelements.c',
+  'gstelements_private.c',
+  'gstfakesink.c',
+  'gstfakesrc.c',
+  'gstfdsink.c',
+  'gstfdsrc.c',
+  'gstfilesrc.c',
+  'gstfilesink.c',
+  'gstfunnel.c',
+  'gstidentity.c',
+  'gstinputselector.c',
+  'gstmultiqueue.c',
+  'gstoutputselector.c',
+  'gstqueue2.c',
+  'gstqueue.c',
+  'gstsparsefile.c',
+  'gststreamiddemux.c',
+  'gsttee.c',
+  'gsttypefindelement.c',
+  'gstvalve.c',
+]
+
+if libtype != 'shared'
+  gst_elements_static = static_library('gstcoreelements',
+    gst_elements_sources,
+    c_args : gst_c_args + ['-DGST_PLUGIN_BUILD_STATIC'],
+    include_directories : [configinc],
+    dependencies : [gobject_dep, glib_dep, gst_dep, gst_base_dep],
+    install : true,
+    install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
+  )
+  gst_elements = gst_elements_static
+endif
+
+if libtype != 'static'
+  gst_elements_shared = shared_library('gstcoreelements',
+    gst_elements_sources,
+    c_args : gst_c_args,
+    include_directories : [configinc],
+    dependencies : [gobject_dep, glib_dep, gst_dep, gst_base_dep],
+    install : true,
+    install_dir : '@0@/gstreamer-1.0'.format(get_option('libdir')),
+  )
+  gst_elements = gst_elements_shared
+endif
diff --git a/plugins/meson.build b/plugins/meson.build
new file mode 100644 (file)
index 0000000..83e7a6d
--- /dev/null
@@ -0,0 +1,3 @@
+subdir('elements')
+# FIXME: not implemented
+#subdir('tracers')
diff --git a/po/meson.build b/po/meson.build
new file mode 100644 (file)
index 0000000..51dd0b6
--- /dev/null
@@ -0,0 +1,45 @@
+i18n = import('i18n')
+
+langs = [
+  'af',
+  'az',
+  'be',
+  'bg',
+  'ca',
+  'cs',
+  'da',
+  'de',
+  'el',
+  'en_GB',
+  'eo',
+  'es',
+  'eu',
+  'fi',
+  'fr',
+  'gl',
+  'hr',
+  'hu',
+  'id',
+  'it',
+  'ja',
+  'lt',
+  'nb',
+  'nl',
+  'pl',
+  'pt_BR',
+  'ro',
+  'ru',
+  'rw',
+  'sk',
+  'sl',
+  'sq',
+  'sr',
+  'sv',
+  'tr',
+  'uk',
+  'vi',
+  'zh_CN',
+  'zh_TW',
+]
+
+i18n.gettext('gstreamer-1.0', languages : langs)
diff --git a/tests/benchmarks/meson.build b/tests/benchmarks/meson.build
new file mode 100644 (file)
index 0000000..0ed4808
--- /dev/null
@@ -0,0 +1,20 @@
+benchmarks = [
+  'caps',
+  'capsnego',
+  'complexity',
+  'controller',
+  'init',
+  'mass-elements',
+  'gstpollstress',
+  'gstpoolstress',
+  'gstclockstress',
+  'gstbufferstress',
+]
+
+foreach b : benchmarks
+  executable(b, '@0@.c'.format(b),
+    c_args : gst_c_args,
+    link_with : [printf_lib],
+    dependencies : [gobject_dep, gmodule_dep, glib_dep, gst_dep, gst_controller_dep],
+    )
+endforeach
diff --git a/tests/check/meson.build b/tests/check/meson.build
new file mode 100644 (file)
index 0000000..9de9010
--- /dev/null
@@ -0,0 +1,159 @@
+have_registry = not get_option('disable_registry')
+have_debug = true # FIXME
+have_parse = true # FIXME
+
+# tests and condition when to skip the test
+core_tests = [
+  [ 'gst/gst', not have_registry ],
+  [ 'gst/gstabi', not have_registry ],
+  [ 'gst/gstatomicqueue' ],
+  [ 'gst/gstbuffer' ],
+  [ 'gst/gstbufferlist' ],
+  [ 'gst/gstbufferpool' ],
+  [ 'gst/gstchildproxy', not have_registry ],
+  [ 'gst/gstclock' ],
+  [ 'gst/gstcontext' ],
+  [ 'gst/gstcontroller' ],
+  [ 'gst/gstcaps' ],
+  [ 'gst/gstcapsfeatures' ],
+  [ 'gst/gstdatetime' ],
+  [ 'gst/gstdevice' ],
+  [ 'gst/gstelement', not have_registry ],
+  [ 'gst/gstelementfactory', not have_registry ],
+  [ 'gst/gstghostpad', not have_registry ],
+  [ 'gst/gstinfo' ],
+  [ 'gst/gstiterator' ],
+  [ 'gst/gstmessage' ],
+  [ 'gst/gstmemory' ],
+  [ 'gst/gstmeta' ],
+  [ 'gst/gstminiobject' ],
+  [ 'gst/gstobject' ],
+  [ 'gst/gstpad', not have_registry ],
+  [ 'gst/gstparamspecs' ],
+  [ 'gst/gstprintf', not have_debug ],
+  [ 'gst/gstpipeline', not have_registry ],
+  [ 'gst/gstpoll' ],
+  [ 'gst/gstplugin', not have_registry ],
+  [ 'gst/gstpreset' ],
+  [ 'gst/gstprotection' ],
+  [ 'gst/gstquery', not have_registry ],
+  [ 'gst/gstregistry', not have_registry ],
+  [ 'gst/gstsegment' ],
+  [ 'gst/gststream' ],
+  [ 'gst/gststructure' ],
+  [ 'gst/gstsystemclock' ],
+  [ 'gst/gsttag' ],
+  [ 'gst/gsttagsetter' ],
+  [ 'gst/gsttask' ],
+  [ 'gst/gsttoc' ],
+  [ 'gst/gsttocsetter' ],
+  [ 'gst/gsttracerrecord' ],
+  [ 'gst/gsturi' ],
+  [ 'gst/gstutils', not have_registry ],
+  [ 'gst/gstvalue' ],
+  [ 'generic/states', not have_registry ],
+  [ 'libs/adapter' ],
+  [ 'libs/baseparse' ],
+  [ 'libs/basesrc', not have_registry ],
+  [ 'libs/basesink', not have_registry ],
+  [ 'libs/bitreader' ],
+  [ 'libs/bytereader' ],
+  [ 'libs/bytewriter' ],
+  [ 'libs/bitreader-noinline' ],
+  [ 'libs/bytereader-noinline' ],
+  [ 'libs/bytewriter-noinline' ],
+  [ 'libs/collectpads', not have_registry ],
+  [ 'libs/controller' ],
+  [ 'libs/flowcombiner' ],
+  [ 'libs/gstharness' ],
+  [ 'libs/gstnetclientclock' ],
+  [ 'libs/gstnettimeprovider' ],
+  [ 'libs/gsttestclock' ],
+  [ 'libs/libsabi' ],
+  [ 'libs/sparsefile' ],
+  [ 'libs/transform1' ],
+  [ 'libs/transform2' ],
+  [ 'libs/typefindhelper' ],
+  [ 'libs/queuearray' ],
+  [ 'elements/capsfilter', not have_registry ],
+  [ 'elements/concat', not have_registry ],
+  [ 'elements/fakesrc', not have_registry ],
+  [ 'elements/fdsrc', not have_registry ],
+  [ 'elements/filesink', not have_registry ],
+  [ 'elements/filesrc', not have_registry ],
+  [ 'elements/funnel', not have_registry ],
+  [ 'elements/identity', not have_registry ],
+  [ 'elements/multiqueue', not have_registry ],
+  [ 'elements/selector', not have_registry ],
+  [ 'elements/streamiddemux', not have_registry ],
+  [ 'elements/tee', not have_registry ],
+  [ 'elements/queue', not have_registry ],
+  [ 'elements/queue2', not have_registry ],
+  [ 'elements/valve', not have_registry ],
+  [ 'pipelines/seek', not have_registry ],
+  [ 'pipelines/queue-error', not have_registry ],
+  [ 'pipelines/parse-disabled', have_parse ],
+  [ 'pipelines/simple-launch-lines', not have_parse ],
+  [ 'pipelines/parse-launch', not have_parse ],
+  [ 'pipelines/cleanup', not have_parse ],
+  [ 'tools/gstinspect' ],
+  # These take quite long, put them at the end
+  [ 'elements/fakesink', not have_registry ],
+  [ 'gst/gstbin', not have_registry ],
+  [ 'gst/gstbus', not have_registry ],
+  [ 'gst/gstevent', not have_registry ],
+  [ 'pipelines/stress', not have_registry ],
+  [ 'generic/sinks', not have_registry ],
+]
+
+test_defines = [
+  '-UG_DISABLE_ASSERT',
+  '-UG_DISABLE_CAST_CHECKS',
+  '-DGST_CHECK_TEST_ENVIRONMENT_BEACON="GST_STATE_IGNORE_ELEMENTS"',
+  '-DTESTFILE="' + meson.current_source_dir() + '/meson.build"',
+  '-DGST_USE_UNSTABLE_API',
+]
+
+test_env = [
+  'GST_PLUGIN_SYSTEM_PATH_1_0=',
+  'GST_PLUGIN_PATH_1_0=' + meson.build_root() + '/plugins',
+  'GST_PLUGIN_SCANNER_1_0='+ meson.build_root() + '/libs/gst/helpers/gst-plugin-scanner',
+  'GST_STATE_IGNORE_ELEMENTS=',
+  'CK_DEFAULT_TIMEOUT=20',
+]
+
+glib_deps = [gio_dep, gobject_dep, gmodule_dep, glib_dep]
+gst_deps = [gst_dep, gst_base_dep, gst_check_dep, gst_net_dep, gst_controller_dep]
+
+foreach t : core_tests
+  test_name = t.get(0)
+  if t.length() == 2
+    skip_test = t.get(1)
+  else
+    skip_test = false
+  endif
+  if not skip_test
+    exe = executable(test_name, '@0@.c'.format(test_name),
+      c_args : gst_c_args + test_defines,
+      include_directories : [configinc],
+      dependencies : glib_deps + gst_deps,
+    )
+    test(test_name, exe,
+      env: test_env + ['GST_REGISTRY=@0@/@1@.registry'.format(meson.current_build_dir(), test_name)]
+    )
+  endif
+endforeach
+
+if have_registry
+  test('gstcpp', executable('gstcpp', 'gst/gstcpp.cc',
+    cpp_args : gst_c_args + test_defines,
+    include_directories : [configinc],
+    dependencies : glib_deps + gst_deps),
+    env: test_env + ['GST_REGISTRY=@0@/gstcpp.registry'.format(meson.current_build_dir())])
+endif
+
+test('gstlibscpp', executable('gstlibscpp', 'libs/gstlibscpp.cc',
+    cpp_args : gst_c_args,
+    include_directories : [configinc],
+    dependencies : glib_deps + gst_deps),
+    env: test_env + ['GST_REGISTRY=@0@/gstlibscpp.registry'.format(meson.current_build_dir())])
diff --git a/tests/examples/adapter/meson.build b/tests/examples/adapter/meson.build
new file mode 100644 (file)
index 0000000..200c5c4
--- /dev/null
@@ -0,0 +1,7 @@
+if cdata.has('HAVE_SYS_TIMES_H') and cdata.has('HAVE_UNISTD_H')
+  executable('adapter_test', 'adapter_test.c',
+    install: false,
+    dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_base_dep],
+    c_args: gst_c_args,
+  )
+endif
diff --git a/tests/examples/controller/meson.build b/tests/examples/controller/meson.build
new file mode 100644 (file)
index 0000000..da4ee04
--- /dev/null
@@ -0,0 +1,23 @@
+progs = [
+  'audio-example',
+  'control-sources',
+  'text-color-example',
+  'absolute-example',
+]
+
+foreach prog : progs
+  executable(prog, prog + '.c',
+    install: false,
+    dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_controller_dep],
+    c_args: gst_c_args,
+  )
+endforeach
+
+gtk_dep = dependency('gtk+-3.0', required : false)
+if gtk_dep.found()
+  executable('controller-graph', 'controller-graph.c',
+    install: false,
+    dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_controller_dep, gtk_dep],
+    c_args: gst_c_args,
+  )
+endif
diff --git a/tests/examples/helloworld/meson.build b/tests/examples/helloworld/meson.build
new file mode 100644 (file)
index 0000000..5eea10b
--- /dev/null
@@ -0,0 +1,5 @@
+executable('helloworld', 'helloworld.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/memory/meson.build b/tests/examples/memory/meson.build
new file mode 100644 (file)
index 0000000..edce02a
--- /dev/null
@@ -0,0 +1,5 @@
+executable('memory_test', 'memory_test.c', 'my-memory.c', 'my-vidmem.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/meson.build b/tests/examples/meson.build
new file mode 100644 (file)
index 0000000..d8b795c
--- /dev/null
@@ -0,0 +1,10 @@
+subdir('adapter')
+subdir('controller')
+subdir('helloworld')
+#subdir('manual') # FIXME
+subdir('memory')
+subdir('netclock')
+subdir('ptp')
+subdir('stepping')
+subdir('streamiddemux')
+subdir('streams')
diff --git a/tests/examples/netclock/meson.build b/tests/examples/netclock/meson.build
new file mode 100644 (file)
index 0000000..6d9589d
--- /dev/null
@@ -0,0 +1,11 @@
+executable('netclock-server', 'netclock-server.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_net_dep],
+  c_args: gst_c_args,
+)
+
+executable('netclock-client', 'netclock-client.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_net_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/ptp/meson.build b/tests/examples/ptp/meson.build
new file mode 100644 (file)
index 0000000..7e89b1e
--- /dev/null
@@ -0,0 +1,5 @@
+executable('ptp-print-times', 'ptp-print-times.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, gst_net_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/stepping/meson.build b/tests/examples/stepping/meson.build
new file mode 100644 (file)
index 0000000..e4d4f28
--- /dev/null
@@ -0,0 +1,5 @@
+executable('framestep1', 'framestep1.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/streamiddemux/meson.build b/tests/examples/streamiddemux/meson.build
new file mode 100644 (file)
index 0000000..88c4823
--- /dev/null
@@ -0,0 +1,5 @@
+executable('streamiddemux-stream', 'streamiddemux-stream.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  c_args: gst_c_args,
+)
diff --git a/tests/examples/streams/meson.build b/tests/examples/streams/meson.build
new file mode 100644 (file)
index 0000000..e087f41
--- /dev/null
@@ -0,0 +1,15 @@
+executable('stream-status', 'stream-status.c',
+  install: false,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  c_args: gst_c_args,
+)
+
+# we assume that if the header is there it actually found pthreads as thread lib
+threads_dep = dependency('threads', required : false)
+if threads_dep.found() and cc.has_header('pthread.h')
+  executable('rtpool-test', 'rtpool-test.c', 'testrtpool.c',
+    install: false,
+    dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep, threads_dep],
+    c_args: gst_c_args,
+  )
+endif
diff --git a/tests/meson.build b/tests/meson.build
new file mode 100644 (file)
index 0000000..e6b1cfd
--- /dev/null
@@ -0,0 +1,9 @@
+subdir('benchmarks')
+# FIXME: make check work on windows
+if host_machine.system() != 'windows'
+subdir('check')
+endif
+if not get_option('disable_examples')
+  subdir('examples')
+endif
+subdir('misc')
diff --git a/tests/misc/meson.build b/tests/misc/meson.build
new file mode 100644 (file)
index 0000000..eedfdc7
--- /dev/null
@@ -0,0 +1,2 @@
+executable('netclock-replay', 'netclock-replay.c',
+    dependencies : [gio_dep, gst_dep, gst_net_dep])
diff --git a/tools/meson.build b/tools/meson.build
new file mode 100644 (file)
index 0000000..2882c83
--- /dev/null
@@ -0,0 +1,23 @@
+executable('gst-inspect-1.0',
+  'gst-inspect.c',
+  install: true,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  link_with: [printf_lib],
+  c_args: gst_c_args,
+)
+
+executable('gst-launch-1.0',
+  'gst-launch.c',
+  install: true,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  link_with: [printf_lib],
+  c_args: gst_c_args,
+)
+
+executable('gst-typefind-1.0',
+  'gst-typefind.c',
+  install: true,
+  dependencies : [glib_dep, gobject_dep, gmodule_dep, mathlib, gst_dep],
+  link_with: [printf_lib],
+  c_args: gst_c_args,
+)