[libbluray-devel] [Git][videolan/libbluray][master] 6 commits: devtools: Fix multiple inclusion of headers

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Thu Apr 3 08:06:39 UTC 2025



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


Commits:
88e8ee55 by robxnano at 2025-04-01T14:38:05+01:00
devtools: Fix multiple inclusion of headers

- - - - -
4aa8a5b4 by robxnano at 2025-04-01T22:51:27+01:00
meson: Add Meson build support

Increases the soversion to 3.0.0, and requires version 1.2.0 of
libudfread or later.

- - - - -
18346081 by robxnano at 2025-04-01T22:51:49+01:00
meson: Add cross files from dav1d

- - - - -
51b605e9 by robxnano at 2025-04-01T22:52:03+01:00
ci: Switch to Meson build

- - - - -
e67426ef by robxnano at 2025-04-01T22:53:54+01:00
Update ChangeLog

- - - - -
4066744f by robxnano at 2025-04-01T22:54:16+01:00
Update libudfread submodule for Meson support

- - - - -


18 changed files:

- .gitlab-ci.yml
- ChangeLog
- contrib/libudfread
- doc/doxygen-config → doc/Doxyfile.in
- + doc/meson.build
- + meson.build
- + meson_options.txt
- + package/crossfiles/aarch64-w64-mingw32.meson
- + package/crossfiles/armv7-w64-mingw32.meson
- + package/crossfiles/i686-w64-mingw32.meson
- + package/crossfiles/x86_64-w64-mingw32.meson
- + src/devtools/meson.build
- src/devtools/strings.h
- src/devtools/util.h
- + src/examples/meson.build
- + src/libbluray/bdj/meson.build
- + src/libbluray/meson.build
- + src/meson.build


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -5,7 +5,7 @@ variables:
     GIT_SUBMODULE_STRATEGY: normal
 
 build-debian:
-    image: registry.videolan.org/vlc-debian-unstable:20250323132008
+    image: registry.videolan.org/dav1d-debian-unstable:20250207200301
     stage: build
     except:
         - schedules
@@ -13,11 +13,8 @@ build-debian:
         - docker
         - amd64
     script:
-        - mkdir build
-        - cd build
-        - ../bootstrap
-        - ../configure
-        - make -j $(getconf _NPROCESSORS_ONLN)
+        - meson setup build
+        - meson compile -C build
 
 build-macos:
     stage: build
@@ -37,14 +34,11 @@ build-macos:
         - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`pwd -P`/lib/pkgconfig/"
         - cd ../
         - export PATH="/Users/videolanci/sandbox/bin:$PATH"
-        - mkdir build
-        - cd build
-        - ../bootstrap
-        - ../configure
-        - make -j $(getconf _NPROCESSORS_ONLN)
+        - meson setup build
+        - meson compile -C build
 
-build-win64:
-    image: registry.videolan.org/vlc-debian-win64:20240122094311
+build-win:
+    image: registry.videolan.org/dav1d-debian-unstable:20250207200301
     stage: build
     except:
         - schedules
@@ -52,23 +46,14 @@ build-win64:
         - docker
         - amd64
     script:
-        - CONTRIB_TARBALL=`wget --output-document - https://artifacts.videolan.org/vlc/win64/SHA512SUM 2>/dev/null | cut -d '/' -f 2`
-        - wget -nv https://artifacts.videolan.org/vlc/win64/$CONTRIB_TARBALL
-        - tar xf "$CONTRIB_TARBALL"
-        - cd x86_64-w64-mingw32
-        - wget -nv -O ./change_prefix.sh 'https://code.videolan.org/videolan/vlc/-/raw/master/contrib/src/change_prefix.sh'
-        - chmod +x ./change_prefix.sh
-        - ./change_prefix.sh
-        - cd ..
-        - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:`realpath x86_64-w64-mingw32`/lib/pkgconfig/"
-        - mkdir build
-        - cd build
-        - ../bootstrap
-        - ../configure --host=x86_64-w64-mingw32
-        - make -j $(getconf _NPROCESSORS_ONLN)
+        - meson setup build --cross-file package/crossfiles/${CROSSFILE}.meson
+        - meson compile -C build
+    parallel:
+      matrix:
+        - CROSSFILE: [i686-w64-mingw32, x86_64-w64-mingw32]
 
-build-win32:
-    image: registry.videolan.org/vlc-debian-win32:20240122094311
+build-win-arm:
+    image: registry.videolan.org/vlc-debian-llvm-msvcrt:20250305204125
     stage: build
     except:
         - schedules
@@ -76,11 +61,11 @@ build-win32:
         - docker
         - amd64
     script:
-        - mkdir build
-        - cd build
-        - ../bootstrap
-        - ../configure --host=i686-w64-mingw32 --without-libxml2 --without-fontconfig --without-freetype
-        - make -j $(getconf _NPROCESSORS_ONLN)
+        - meson setup build --cross-file package/crossfiles/${CROSSFILE}.meson
+        - meson compile -C build
+    parallel:
+      matrix:
+        - CROSSFILE: [armv7-w64-mingw32, aarch64-w64-mingw32]
 
 pages:
     stage: build


=====================================
ChangeLog
=====================================
@@ -1,3 +1,7 @@
+- Switch build system to Meson.
+- Require libudfread 1.2.0.
+- Use visibility attributes for exported symbols.
+
 2022-11-25: Version 1.3.4
 - Improve API documentation.
 - Improve JVM probing.


=====================================
contrib/libudfread
=====================================
@@ -1 +1 @@
-Subproject commit a35513813819efadca82c4b90edbe1407b1b9e05
+Subproject commit a089d1bd4118f5072a1dbb76f459dc41bb106bb5


=====================================
doc/doxygen-config → doc/Doxyfile.in
=====================================
@@ -58,7 +58,7 @@ PROJECT_LOGO           =
 # entered, it will be relative to the location where doxygen was started. If
 # left blank the current directory will be used.
 
-OUTPUT_DIRECTORY       = doc/doxygen
+OUTPUT_DIRECTORY       = @OUTPUT_DIRECTORY@
 
 # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
 # directories (in 2 levels) under the output directory of each output format and
@@ -152,7 +152,7 @@ FULL_PATH_NAMES        = NO
 # will be relative from the directory where doxygen is started.
 # This tag requires that the tag FULL_PATH_NAMES is set to YES.
 
-STRIP_FROM_PATH        =
+STRIP_FROM_PATH        = @STRIP_FROM_PATH@
 
 # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
 # path mentioned in the documentation of a class, which tells the reader which
@@ -780,15 +780,7 @@ WARN_LOGFILE           =
 # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
 # Note: If this tag is empty the current directory is searched.
 
-INPUT                  = \
-    src/libbluray/bluray.h \
-    src/libbluray/bluray-version.h \
-    src/file/filesystem.h \
-    src/libbluray/keys.h \
-    src/util/log_control.h \
-    src/libbluray/bdnav/meta_data.h \
-    src/libbluray/decoders/overlay.h \
-    src/libbluray/player_settings.h
+INPUT                  =  @INPUT@
 
 # This tag can be used to specify the character encoding of the source files
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -1068,7 +1060,7 @@ COLS_IN_ALPHA_INDEX    = 5
 # while generating the index headers.
 # This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
 
-IGNORE_PREFIX          =
+IGNORE_PREFIX          = bd_ BD_
 
 #---------------------------------------------------------------------------
 # Configuration options related to the HTML output
@@ -1122,7 +1114,7 @@ HTML_HEADER            =
 # that doxygen normally uses.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
-HTML_FOOTER            = doc/doxygen-footer.html
+HTML_FOOTER            = @HTML_FOOTER@
 
 # The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
 # sheet that is used by each HTML page. It can be used to fine-tune the look of


=====================================
doc/meson.build
=====================================
@@ -0,0 +1,26 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+if not get_option('enable_docs')
+    subdir_done()
+endif
+
+doxygen = find_program('doxygen', required: true)
+
+doxyfile = configure_file(
+    input: 'Doxyfile.in',
+    output: 'Doxyfile',
+    configuration: {'INPUT': meson.project_build_root() / 'src/libbluray',
+                    'STRIP_FROM_PATH': meson.project_build_root() / 'src',
+                    'OUTPUT_DIRECTORY': meson.current_build_dir(),
+                    'PROJECT_VERSION': meson.project_version(),
+                    'HTML_FOOTER': meson.current_source_dir() / 'doxygen-footer.html'})
+
+custom_target('docs',
+    depends: libbluray_internal_headers,
+    env: ['QUIET=yes'],
+    command: [doxygen, doxyfile],
+    output: ['html'],
+    install: true,
+    install_tag: 'doc',
+    install_dir: get_option('datadir') / 'doc/libbluray')


=====================================
meson.build
=====================================
@@ -0,0 +1,244 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+project('libbluray', 'c',
+    version: '1.4.0',
+    subproject_dir: 'contrib',
+    default_options: ['buildtype=debugoptimized',
+                      'c_std=c99',
+                      'default_library=both',
+                      'optimization=3',
+                      'warning_level=2'],
+    meson_version: '>= 0.60.0')
+
+libbluray_src_root = meson.current_source_dir()
+cc = meson.get_compiler('c')
+fs = import('fs')
+
+# Configuration data for config.h
+cdata = configuration_data()
+add_project_arguments('-DHAVE_CONFIG_H=1', language: 'c')
+
+# Include directories
+libbluray_inc_dirs = [include_directories('.', 'src', 'src/libbluray', 'src/libbluray/disc')]
+
+# The version number for the shared library
+libbluray_soname_version = '3.0.0'
+
+libbluray_version = meson.project_version()
+libbluray_version_split = libbluray_version.split('.')
+cdata.set_quoted('VERSION', libbluray_version)
+
+#
+# OS/Compiler checks and defines
+#
+
+# Arguments in test_args will be used even on feature tests
+test_args = []
+
+optional_arguments = []
+optional_link_arguments = []
+extra_dependencies = []
+
+if host_machine.system() == 'windows'
+    test_args += ['-D_WIN32_WINNT=0x0502', '-D_WIN32_IE=0x0501']
+    if cc.get_argument_syntax() != 'msvc'
+        extra_dependencies += cc.find_library('ssp')
+        test_args += '-D__USE_MINGW_ANSI_STDIO=1'
+    endif
+else
+    test_args += '-D_POSIX_C_SOURCE=200809L'
+endif
+
+if host_machine.system() == 'darwin'
+    extra_dependencies += dependency('appleframeworks',
+        modules: ['CoreFoundation', 'DiskArbitration'])
+elif host_machine.system() == 'netbsd'
+    test_args += '-D_NETBSD_SOURCE'
+elif host_machine.system() == 'openbsd'
+    test_args += '-D_BSD_SOURCE'
+elif host_machine.system() == 'freebsd'
+    test_args += ['-D__BSD_VISIBLE=1', '-D__XSI_VISIBLE=1']
+elif host_machine.system() == 'sunos'
+    test_args += '-D__EXTENSIONS__'
+elif host_machine.system() == 'linux'
+    test_args += '-D_DEFAULT_SOURCE'
+endif
+
+# Java compilation options
+
+jdk_home = get_option('jdk_home')
+bdj_type = get_option('bdj_type')
+
+if host_machine.system() == 'windows'
+    java_os = 'win32'
+elif host_machine.system() == 'sunos'
+    java_os = 'solaris'
+else
+    java_os = host_machine.system()
+endif
+
+if host_machine.cpu_family() == 'x86_64'
+    java_arch = 'amd64'
+elif host_machine.cpu_family() == 'aarch64'
+    java_arch = 'arm'
+elif host_machine.cpu_family() == 'x86'
+    java_arch = 'i386'
+else
+    java_arch = host_machine.cpu_family()
+endif
+
+cdata.set_quoted('JAVA_ARCH', java_arch)
+cdata.set_quoted('JDK_HOME', jdk_home)
+
+if bdj_type == 'j2me'
+    cdata.set('HAVE_BDJ_J2ME', 1)
+endif
+
+if jdk_home == ''
+    # Use fallback instead of looking for a directory that doesn't exist
+    if not fs.exists('jni' / java_os / 'jni_md.h')
+        warning(f'No jni_md.h found in jni/@java_os@, using a fallback.')
+        java_os = 'linux'
+    endif
+    libbluray_inc_dirs += include_directories(
+        'jni',
+        'jni'/ java_os)
+else
+    libbluray_inc_dirs += include_directories(
+        jdk_home / 'include',
+        jdk_home / 'include'/ java_os)
+endif
+
+# Header checks
+
+check_headers = [
+    'dirent.h',
+    'mntent.h',
+    'strings.h',
+    'sys/time.h',
+]
+
+foreach h : check_headers
+    if cc.has_header(h, args: test_args)
+        cdata.set('HAVE_' + h.underscorify().to_upper(), 1)
+    endif
+endforeach
+
+if host_machine.system() == 'netbsd'
+    if cc.has_function('getvfsstat', prefix: '#include <sys/statvfs.h>', args: test_args)
+        cdata.set('HAVE_GETVFSSTAT', 1)
+    endif
+elif host_machine.system() != 'darwin'
+    if cc.has_function('getfsstat', prefix: '#include <sys/types.h>\n#include <sys/mount.h>', args: test_args)
+        cdata.set('HAVE_GETFSSTAT', 1)
+    endif
+endif
+
+# These args are defined in the source files
+dladdr_args = host_machine.system() == 'darwin' ? '-D_DARWIN_C_SOURCE' : '-D_GNU_SOURCE'
+if cc.has_function('dladdr', prefix: '#include <dlfcn.h>', args: [test_args, dladdr_args])
+    cdata.set('HAVE_DLADDR', 1)
+endif
+
+# External dependencies and libraries
+
+if host_machine.system() == 'windows'
+    libdl_dependency = []
+    thread_dependency = []
+else
+    if cc.has_function('dlopen', prefix: '#include <dlfcn.h>', args: test_args)
+        libdl_dependency = []
+    else
+        libdl_dependency = cc.find_library('dl')
+    endif
+    thread_dependency = dependency('threads')
+    cdata.set('HAVE_DLFCN_H', 1)
+    cdata.set('HAVE_PTHREAD_H', 1)
+endif
+
+freetype_dependency = dependency('freetype2', required: get_option('freetype'))
+if freetype_dependency.found()
+    cdata.set('HAVE_FT2', 1)
+endif
+
+fontconfig_dependency = []
+use_system_fonts = false
+if host_machine.system() == 'windows'
+    system_font_mode = 'Windows'
+    if freetype_dependency.found()
+        use_system_fonts = true
+    endif
+else
+    system_font_mode = 'fontconfig'
+    if freetype_dependency.found()
+        fontconfig_dependency = dependency('fontconfig', required: get_option('fontconfig'))
+        if fontconfig_dependency.found()
+            use_system_fonts = true
+            cdata.set('HAVE_FONTCONFIG', 1)
+        endif
+    endif
+endif
+
+libxml2_dependency = dependency('libxml-2.0', version: '>= 2.6', required: get_option('libxml2'))
+if libxml2_dependency.found()
+    cdata.set('HAVE_LIBXML2', 1)
+endif
+
+# libudfread will be built as a subproject if not found on the system
+libudfread_dependency = dependency('libudfread', version: '>= 1.2.0')
+cdata.set('HAVE_LIBUDFREAD', 1)
+
+# Compiler flag tests
+
+# Compiler flags that should be set
+# But when the compiler does not supports them
+# it is not an error and silently tolerated
+if cc.get_argument_syntax() != 'msvc'
+    optional_arguments += [
+        '-Werror=implicit-function-declaration',
+        '-Werror-implicit-function-declaration',
+        '-Wdisabled-optimization',
+        '-Wpointer-arith',
+        '-Wredundant-decls',
+        '-Wcast-qual',
+        '-Wwrite-strings',
+        '-Wtype-limits',
+        '-Wundef',
+        '-Wmissing-prototypes',
+        '-Wshadow',
+    ]
+    if get_option('buildtype') not in ['debug', 'plain']
+        optional_arguments += '-fomit-frame-pointer'
+    endif
+endif
+
+add_project_arguments(cc.get_supported_arguments(optional_arguments), language: 'c')
+add_project_link_arguments(cc.get_supported_link_arguments(optional_link_arguments), language: 'c')
+add_project_arguments(test_args, language: 'c')
+
+# Generate config.h
+config_h_target = configure_file(output: 'config.h', configuration: cdata)
+
+
+# Include subdir meson.build files
+# The order is important!
+
+subdir('src/libbluray')
+
+subdir('src')
+
+subdir('src/libbluray/bdj')
+
+subdir('src/devtools')
+
+subdir('src/examples')
+
+subdir('doc')
+
+summary(java_summary + {
+    'Font support (freetype2)': freetype_dependency.found(),
+    f'Use system fonts (@system_font_mode@)': use_system_fonts,
+    'Metadata support (libxml2)': libxml2_dependency.found(),
+    'External libudfread': libudfread_dependency.type_name() != 'internal',
+})


=====================================
meson_options.txt
=====================================
@@ -0,0 +1,74 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+# General options
+
+option('enable_docs',
+    type: 'boolean',
+    value: false,
+    description: 'Build libbluray documentation with Doxygen')
+
+option('enable_tools',
+    type: 'boolean',
+    value: true,
+    description: 'Build libbluray cli tools')
+
+option('enable_devtools',
+    type: 'boolean',
+    value: false,
+    description: 'Build libbluray development tools')
+
+option('enable_examples',
+    type: 'boolean',
+    value: false,
+    description: 'Build libbluray examples')
+
+# BD-J JAR options
+
+option('bdj_jar',
+    type: 'feature',
+    value: 'auto',
+    description: 'Build the BD-J JAR file (requires Java)')
+
+option('java9',
+    type: 'boolean',
+    value: true,
+    description: 'Build with Java 9+ (drop support for Java >= 1.7.0)')
+
+option('jdk_home',
+    type: 'string',
+    value: '',
+    description: 'Path to the JDK')
+
+option('bdj_type',
+    type: 'combo',
+    choices: ['j2me', 'j2se'],
+    value: 'j2se',
+    description: 'Type of the BD-J implementation')
+
+option('bdj_bootclasspath',
+    type: 'string',
+    value: '',
+    description: 'BD-J build-time bootclass path')
+
+# Optional dependencies to be found on the system
+
+option('embed_udfread',
+    type: 'boolean',
+    value: true,
+    description: 'When building libudfread as subproject, don\'t install library or headers')
+
+option('fontconfig',
+    type: 'feature',
+    value: 'auto',
+    description: 'System font support with fontconfig (except Windows)')
+
+option('freetype',
+    type: 'feature',
+    value: 'auto',
+    description: 'Font support with freetype2')
+
+option('libxml2',
+    type: 'feature',
+    value: 'auto',
+    description: 'Metadata support with libxml2')


=====================================
package/crossfiles/aarch64-w64-mingw32.meson
=====================================
@@ -0,0 +1,16 @@
+[binaries]
+c = 'aarch64-w64-mingw32-clang'
+cpp = 'aarch64-w64-mingw32-clang++'
+ar = 'aarch64-w64-mingw32-ar'
+strip = 'aarch64-w64-mingw32-strip'
+windres = 'aarch64-w64-mingw32-windres'
+pkgconfig = 'pkg-config'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'aarch64'
+cpu = 'aarch64'
+endian = 'little'


=====================================
package/crossfiles/armv7-w64-mingw32.meson
=====================================
@@ -0,0 +1,16 @@
+[binaries]
+c = 'armv7-w64-mingw32-clang'
+cpp = 'armv7-w64-mingw32-clang++'
+ar = 'armv7-w64-mingw32-ar'
+strip = 'armv7-w64-mingw32-strip'
+windres = 'armv7-w64-mingw32-windres'
+pkgconfig = 'pkg-config'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'arm'
+cpu = 'armv7'
+endian = 'little'


=====================================
package/crossfiles/i686-w64-mingw32.meson
=====================================
@@ -0,0 +1,17 @@
+[binaries]
+c = 'i686-w64-mingw32-gcc'
+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'
+exe_wrapper = 'wine'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86'
+cpu = 'i686'
+endian = 'little'


=====================================
package/crossfiles/x86_64-w64-mingw32.meson
=====================================
@@ -0,0 +1,17 @@
+[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'
+pkgconfig = 'x86_64-w64-mingw32-pkg-config'
+exe_wrapper = 'wine'
+
+[built-in options]
+c_link_args = ['-static-libgcc']
+
+[host_machine]
+system = 'windows'
+cpu_family = 'x86_64'
+cpu = 'x86_64'
+endian = 'little'


=====================================
src/devtools/meson.build
=====================================
@@ -0,0 +1,30 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+if get_option('enable_devtools')
+
+    executable('bdjo_dump', 'bdjo_dump.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('bdj_test', 'bdj_test.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('clpi_dump', ['clpi_dump.c', 'util.c'],
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('hdmv_test', 'hdmv_test.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('mobj_dump', ['mobj_dump.c', '../libbluray/hdmv/mobj_print.c'],
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('mpls_dump', ['mpls_dump.c', 'util.c'],
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+endif


=====================================
src/devtools/strings.h
=====================================
@@ -17,6 +17,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifndef BLURAY_STRINGS_H
+#define BLURAY_STRINGS_H
+
 typedef struct {
     int value;
     const char *str;
@@ -120,3 +123,5 @@ _lookup_str(const VALUE_MAP *map, int val)
     }
     return "?";
 }
+
+#endif // BLURAY_STRINGS_H


=====================================
src/devtools/util.h
=====================================
@@ -17,6 +17,9 @@
  * <http://www.gnu.org/licenses/>.
  */
 
+#ifndef BLURAY_UTIL_H
+#define BLURAY_UTIL_H
+
 #include <stdint.h>
 
 #include "util/attributes.h"
@@ -41,3 +44,4 @@
 
 void indent_printf(int level, const char *fmt, ...) BD_ATTR_FORMAT_PRINTF(2,3);
 
+#endif // BLURAY_UTIL_H


=====================================
src/examples/meson.build
=====================================
@@ -0,0 +1,37 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+if get_option('enable_tools')
+
+    executable('bd_info', 'bd_info.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs,
+        install: true)
+
+    executable('bd_list_titles', 'list_titles.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs,
+        install: true)
+
+    executable('bd_splice', 'bdsplice.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs,
+        install: true)
+
+endif
+
+if get_option('enable_examples')
+
+    executable('index_dump', 'index_dump.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('libbluray_test', 'libbluray_test.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+    executable('sound_dump', 'sound_dump.c',
+        dependencies: libbluray_dep,
+        include_directories: libbluray_inc_dirs)
+
+endif


=====================================
src/libbluray/bdj/meson.build
=====================================
@@ -0,0 +1,42 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+java_src_version = '1.5'
+
+ant = find_program('ant', required: get_option('bdj_jar'), disabler: true)
+
+if ant.found() and add_languages('java', native: false, required: get_option('bdj_jar'))
+    javac_version = meson.get_compiler('java').version()
+    if get_option('java9') and bdj_type == 'j2se'
+        if javac_version.version_compare('>= 18.0')
+            java_src_version = '1.8'
+        else
+            java_src_version = '1.7'
+        endif
+    endif
+    java_summary = { 'Build BD-J JAR': true,
+                     '    javac version': javac_version,
+                     '    Java binary version': java_src_version }
+else
+    java_summary = { 'Build BD-J JAR': false }
+    message('Compiling the JAR requires both Java and Ant, disabling.')
+    subdir_done()
+endif
+
+awt_src = bdj_type == 'j2me' ? 'java-j2me' : 'java-j2se:java-build-support'
+
+jar = custom_target('bdj-jar',
+    command: [ant, '-f', files('build.xml'),
+              '-Dbuild=' + meson.project_build_root() / '@PRIVATE_DIR@',
+              '-Ddist=' + meson.current_build_dir(),
+              '-Dbootclasspath=' + get_option('bdj_bootclasspath'),
+              '-Dsrc_awt=:' + awt_src,
+              f'-Dversion=@bdj_type at -@libbluray_version@',
+              f'-Djava_version_asm=@java_src_version@',
+              f'-Djava_version_bdj=@java_src_version@'],
+    output: [f'libbluray- at bdj_type@- at libbluray_version@.jar',
+             f'libbluray-awt- at bdj_type@- at libbluray_version@.jar'],
+    install: true,
+    install_tag: 'runtime',
+    install_dir: get_option('datadir') / 'java',
+)


=====================================
src/libbluray/meson.build
=====================================
@@ -0,0 +1,35 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+libbluray_internal_headers = []
+libbluray_api_headers = files(
+    '../file/filesystem.h',
+    '../util/log_control.h',
+    'bluray.h',
+    'bdnav/clpi_data.h',
+    'keys.h',
+    'bdnav/meta_data.h',
+    'decoders/overlay.h',
+    'player_settings.h',
+)
+
+# Copy headers to correct path for use as subproject
+foreach h: libbluray_api_headers
+    basename = fs.name(h)
+    if meson.version().version_compare('>= 0.64.0')
+        libbluray_internal_headers += fs.copyfile(h, basename)
+    else
+        configure_file(input: h, output: basename, copy: true)
+    endif
+endforeach
+
+libbluray_api_headers += configure_file(
+    input: 'bluray-version.h.in',
+    output: 'bluray-version.h',
+    configuration: {'BLURAY_VERSION_MAJOR': libbluray_version_split[0],
+                    'BLURAY_VERSION_MINOR': libbluray_version_split[1],
+                    'BLURAY_VERSION_MICRO': libbluray_version_split[2]})
+
+# Install headers
+install_headers(libbluray_api_headers,
+                subdir: 'libbluray')


=====================================
src/meson.build
=====================================
@@ -0,0 +1,131 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+# libbluray source files
+libbluray_src = files(
+    'libbluray/bluray.c',
+    'libbluray/register.c',
+    'libbluray/bdj/bdj.c',
+    'libbluray/bdj/bdjo_parse.c',
+    'libbluray/bdj/bdjo_parse.c',
+    'libbluray/bdj/native/bdjo.c',
+    'libbluray/bdj/native/java_awt_BDFontMetrics.c',
+    'libbluray/bdj/native/java_awt_BDGraphics.c',
+    'libbluray/bdj/native/org_videolan_Libbluray.c',
+    'libbluray/bdj/native/org_videolan_Logger.c',
+    'libbluray/bdj/native/register_native.c',
+    'libbluray/bdj/native/util.c',
+    'libbluray/bdnav/navigation.c',
+    'libbluray/bdnav/mpls_parse.c',
+    'libbluray/bdnav/meta_parse.c',
+    'libbluray/bdnav/extdata_parse.c',
+    'libbluray/bdnav/bdmv_parse.c',
+    'libbluray/bdnav/sound_parse.c',
+    'libbluray/bdnav/uo_mask.c',
+    'libbluray/bdnav/bdid_parse.c',
+    'libbluray/bdnav/clpi_parse.c',
+    'libbluray/bdnav/index_parse.c',
+    'libbluray/decoders/textst_decode.c',
+    'libbluray/decoders/textst_render.c',
+    'libbluray/decoders/pg_decode.c',
+    'libbluray/decoders/ig_decode.c',
+    'libbluray/decoders/pes_buffer.c',
+    'libbluray/decoders/graphics_processor.c',
+    'libbluray/decoders/m2ts_demux.c',
+    'libbluray/decoders/rle.c',
+    'libbluray/decoders/m2ts_filter.c',
+    'libbluray/decoders/graphics_controller.c',
+    'libbluray/disc/aacs.c',
+    'libbluray/disc/bdplus.c',
+    'libbluray/disc/dec.c',
+    'libbluray/disc/disc.c',
+    'libbluray/disc/properties.c',
+    'libbluray/disc/udf_fs.c',
+    'libbluray/hdmv/mobj_print.c',
+    'libbluray/hdmv/mobj_parse.c',
+    'libbluray/hdmv/hdmv_vm.c',
+    'file/file.c',
+    'file/filesystem.c',
+    'util/bits.c',
+    'util/logging.c',
+    'util/refcnt.c',
+    'util/time.c',
+    'util/array.c',
+    'util/mutex.c',
+    'util/event_queue.c',
+    'util/strutl.c',
+)
+
+# Platform-specific source files
+if host_machine.system() == 'windows'
+    libbluray_src += files(
+        'file/dir_win32.c',
+        'file/dirs_win32.c',
+        'file/dl_win32.c',
+        'file/file_win32.c',
+        'file/mount.c',
+    )
+elif host_machine.system() == 'darwin'
+    libbluray_src += files(
+        'file/dir_posix.c',
+        'file/dirs_darwin.c',
+        'file/dl_posix.c',
+        'file/file_posix.c',
+        'file/mount_darwin.c',
+    )
+else
+    libbluray_src += files(
+        'file/dir_posix.c',
+        'file/dirs_xdg.c',
+        'file/dl_posix.c',
+        'file/file_posix.c',
+    )
+    if cdata.has('HAVE_GETFSSTAT') or cdata.has('HAVE_GETVFSSTAT')
+        libbluray_src += files('file/mount_getfsstat.c')
+    else
+        libbluray_src += files('file/mount.c')
+    endif
+endif
+
+#
+# Library definitions
+#
+
+if host_machine.system() == 'windows' and get_option('default_library') == 'static'
+    api_export_flags = []
+else
+    api_export_flags = '-DBLURAY_API_EXPORT'
+endif
+
+# The final libbluray library
+libbluray = library('bluray', libbluray_src,
+    include_directories: libbluray_inc_dirs,
+    dependencies: [
+        fontconfig_dependency,
+        freetype_dependency,
+        libdl_dependency,
+        libudfread_dependency,
+        libxml2_dependency,
+        thread_dependency,
+        extra_dependencies,
+    ],
+    c_args: [api_export_flags],
+    gnu_symbol_visibility: 'hidden',
+    version: libbluray_soname_version,
+    install: true,
+)
+
+# Make the library usable as a dependency in this and other projects
+libbluray_dep = declare_dependency(link_with: libbluray,
+    sources: libbluray_internal_headers,
+    include_directories: '.')
+
+meson.override_dependency('libbluray', libbluray_dep)
+
+# Generate pkg-config .pc file
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(libraries: libbluray,
+    version: meson.project_version(),
+    name: 'libbluray',
+    description: 'library supporting Blu-ray playback',
+)



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/f9ddf6989a90c30f861fa5f1337ab610217855ae...4066744f4f4cf66d58fcb3e320813d788e9017ba

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/f9ddf6989a90c30f861fa5f1337ab610217855ae...4066744f4f4cf66d58fcb3e320813d788e9017ba
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the libbluray-devel mailing list