[libdvdnav-devel] [Git][videolan/libdvdread][master] 4 commits: meson: Add Meson build support
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Thu Apr 17 20:12:20 UTC 2025
Jean-Baptiste Kempf pushed to branch master at VideoLAN / libdvdread
Commits:
fae9d394 by robxnano at 2025-04-15T16:46:59+01:00
meson: Add Meson build support
- - - - -
1d076038 by robxnano at 2025-04-15T16:46:59+01:00
meson: Add cross files from dav1d for MinGW
- - - - -
5d4a17c7 by robxnano at 2025-04-15T16:46:59+01:00
ci: Switch to Meson build
- - - - -
786e7358 by robxnano at 2025-04-15T16:46:59+01:00
Update NEWS
- - - - -
12 changed files:
- .gitlab-ci.yml
- NEWS
- doc/doxygen.cfg.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/dvdread/meson.build
- + src/meson.build
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -5,17 +5,14 @@ variables:
GIT_SUBMODULE_STRATEGY: normal
build-debian:
- image: registry.videolan.org/vlc-debian-unstable:20200529132440
+ image: registry.videolan.org/dav1d-debian-unstable:20250207200301
stage: build
tags:
- docker
- amd64
script:
- - autoreconf -fisv
- - mkdir build
- - cd build
- - ../configure
- - make -j $(getconf _NPROCESSORS_ONLN)
+ - meson setup build
+ - meson compile -C build
build-macos:
stage: build
@@ -23,34 +20,32 @@ build-macos:
- amd64
- macos
script:
- - autoreconf -fisv
- - mkdir build
- - cd build
- - ../configure
- - make -j $(getconf _NPROCESSORS_ONLN)
+ - meson setup build
+ - meson compile -C build
-build-win64:
- image: registry.videolan.org/vlc-debian-win64:20201106143728
+build-win:
+ image: registry.videolan.org/dav1d-debian-unstable:20250207200301
stage: build
tags:
- docker
- amd64
script:
- - autoreconf -fisv
- - mkdir build
- - cd build
- - ../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:20201106141924
+
+build-win-arm:
+ image: registry.videolan.org/vlc-debian-llvm-msvcrt:20250305204125
stage: build
tags:
- docker
- amd64
script:
- - autoreconf -fisv
- - mkdir build
- - cd build
- - ../configure --host=i686-w64-mingw32
- - 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]
=====================================
NEWS
=====================================
@@ -1,3 +1,7 @@
+libdvdread (6.2.0)
+ * Switch build system to Meson
+ * Use visibility attributes for exported symbols
+
libdvdread (6.1.3)
* Improvements for OpenBSD
* Fix crashes on some DVD (0 PCGI SRP)
=====================================
doc/doxygen.cfg.in
=====================================
@@ -25,20 +25,20 @@ DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
-PROJECT_NAME = @PACKAGE_NAME
+PROJECT_NAME = @PROJECT_NAME@
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = @PACKAGE_VERSION@
+PROJECT_NUMBER = @PROJECT_VERSION@
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
-OUTPUT_DIRECTORY = @top_builddir@/doc
+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
@@ -114,7 +114,7 @@ FULL_PATH_NAMES = NO
# If left blank the directory from which doxygen is run is used as the
# path to strip.
-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
@@ -521,7 +521,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
-INPUT = @top_srcdir@/src
+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, which is
@@ -729,13 +729,13 @@ HTML_FILE_EXTENSION = .html
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
-HTML_HEADER = @top_srcdir@/doc/header.html
+HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
-HTML_FOOTER = @top_srcdir@/doc/footer.html
+HTML_FOOTER = @INPUT_DIRECTORY@/footer.html
# 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
=====================================
doc/meson.build
=====================================
@@ -0,0 +1,31 @@
+# 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_conf = configuration_data()
+doxyfile_conf.set('INPUT', f'@dvdread_src_root@/src/dvdread \\\n @dvdread_build_root@/src/dvdread')
+doxyfile_conf.set('PROJECT_NAME', 'libdvdread')
+doxyfile_conf.set('STRIP_FROM_PATH', f'@dvdread_src_root@/src \\\n @dvdread_build_root@/src')
+doxyfile_conf.set('OUTPUT_DIRECTORY', meson.current_build_dir())
+doxyfile_conf.set('INPUT_DIRECTORY', meson.current_source_dir())
+doxyfile_conf.set('PROJECT_VERSION', meson.project_version())
+
+doxyfile = configure_file(
+ input: 'doxygen.cfg.in',
+ output: 'Doxyfile',
+ configuration: doxyfile_conf,
+)
+
+custom_target('docs',
+ depend_files: dvdread_api_headers,
+ command: [doxygen, '-q', doxyfile],
+ output: ['html'],
+ install: true,
+ install_dir: get_option('datadir') / 'doc/libdvdread',
+ install_tag: 'doc',
+)
=====================================
meson.build
=====================================
@@ -0,0 +1,148 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+project('libdvdread', 'c',
+ version: '6.2.0',
+ meson_version: '>= 0.60.0',
+ default_options: ['buildtype=debugoptimized',
+ 'c_std=c11',
+ 'default_library=both',
+ 'warning_level=2'])
+
+dvdread_src_root = meson.current_source_dir()
+dvdread_build_root = meson.current_build_dir()
+cc = meson.get_compiler('c')
+
+# Configuration data for config.h
+cdata = configuration_data()
+
+# Include directories
+dvdread_inc_dirs = include_directories('.', 'src', 'src/dvdread')
+
+# The version number for the shared library
+dvdread_soname_version = '8.0.0'
+
+dvdread_version = meson.project_version()
+dvdread_version_split = dvdread_version.split('.')
+cdata.set_quoted('PACKAGE_VERSION', dvdread_version)
+
+#
+# OS/Compiler checks and defines
+#
+
+# Arguments in test_args will be used even on feature tests
+test_args = ['-D_DEFAULT_SOURCE']
+
+optional_arguments = []
+optional_link_arguments = []
+extra_dependencies = []
+
+if host_machine.system() == 'sunos'
+ test_args += '-D__EXTENSIONS__'
+endif
+
+# Header checks
+
+check_headers = [
+ 'sys/param.h',
+ 'limits.h',
+]
+
+foreach h : check_headers
+ if cc.has_header(h, args: test_args)
+ cdata.set('HAVE_' + h.underscorify().to_upper(), 1)
+ endif
+endforeach
+
+cdata.set('UNUSED', cc.has_function_attribute('unused') ? '__attribute__((unused))' : '')
+
+if host_machine.endian() == 'big'
+ cdata.set('WORDS_BIGENDIAN', 1)
+endif
+
+if host_machine.system() == 'windows'
+# dvdread_headers += files('msvc/contrib/win32_cs.h')
+ if cc.has_function('gettimeofday', prefix: '#include <sys/time.h>', args: test_args)
+ cdata.set('HAVE_GETTIMEOFDAY', 1)
+ endif
+elif host_machine.system() == 'linux'
+ if cc.has_function('getmntent_r', prefix: '#include <mntent.h>', args: test_args)
+ cdata.set('HAVE_GETMNTENT_R', 1)
+ endif
+endif
+
+if cc.has_function('strerror_r', prefix: '#include <string.h>', args: test_args)
+ cdata.set('HAVE_STRERROR_R', 1)
+ cdata.set('HAVE_DECL_STRERROR_R', 1)
+elif cc.has_function('strerror_s', prefix: '#include <string.h>', args: test_args)
+ cdata.set('HAVE_STRERROR_S', 1)
+endif
+
+
+# External dependencies and libraries
+
+# libdvdcss is loaded dynamically if it is not found or requested
+libdl_dependency = []
+libdvdcss_dependency = dependency('libdvdcss',
+ version: '>= 1.2', method: 'pkg-config', required: get_option('libdvdcss'))
+if libdvdcss_dependency.found()
+ cdata.set('HAVE_DVDCSS_DVDCSS_H', 1)
+elif host_machine.system() == 'windows'
+ if get_option('dlfcn') in ['external', 'auto']
+ # Using MinGW dlfcn wrapper
+ libdl_dependency = cc.find_library('dl', required: get_option('dlfcn') == 'external')
+ if libdl_dependency.found()
+ cdata.set('HAVE_DLFCN_H', 1)
+ endif
+ endif
+ if not cdata.has('HAVE_DLFCN')
+ cdata.set('USING_BUILTIN_DLFCN', 1)
+ endif
+else
+ # Using builtin dlfcn (may require linking to libdl depending on the system)
+ if not cc.has_function('dlopen', prefix: '#include <dlfcn.h>', args: test_args)
+ libdl_dependency = cc.find_library('dl')
+ endif
+ cdata.set('HAVE_DLFCN_H', 1)
+endif
+
+# 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 get_option('warning_level') in ['2', '3', 'everything']
+ optional_arguments += '-Wsign-compare'
+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)
+
+install_data(['AUTHORS', 'COPYING', 'NEWS', 'README.md', 'TODO'],
+ install_dir: get_option('datadir') / 'doc/libdvdread',
+ install_tag: 'doc')
+
+if import('fs').is_file('.git/logs/HEAD')
+ git_exe = find_program('git', required: false, disabler: true)
+ custom_target('ChangeLog', output: 'ChangeLog',
+ depend_files: '.git/logs/HEAD',
+ command: ['git', 'log'], capture: true,
+ install: true,
+ install_dir: get_option('datadir') / 'doc/libdvdread',
+ install_tag: 'doc')
+endif
+
+# Include subdir meson.build files
+# The order is important!
+
+subdir('src/dvdread')
+
+subdir('src')
+
+subdir('doc')
+
=====================================
meson_options.txt
=====================================
@@ -0,0 +1,22 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+# General options
+
+option('enable_docs',
+ type: 'boolean',
+ value: false,
+ description: 'Build (with Doxygen) and install API documentation')
+
+# Optional dependencies to be found on the system
+
+option('libdvdcss',
+ type: 'feature',
+ value: 'auto',
+ description: 'Link directly against libdvdcss')
+
+option('dlfcn',
+ type: 'combo',
+ choices: ['external', 'builtin', 'auto'],
+ value: 'auto',
+ description: 'Use external dlfcn for MinGW')
=====================================
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/dvdread/meson.build
=====================================
@@ -0,0 +1,25 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+dvdread_api_headers = files(
+ 'attributes.h',
+ 'bitreader.h',
+ 'dvd_reader.h',
+ 'dvd_udf.h',
+ 'ifo_print.h',
+ 'ifo_read.h',
+ 'ifo_types.h',
+ 'nav_print.h',
+ 'nav_read.h',
+ 'nav_types.h',
+)
+
+dvdread_api_headers += configure_file(input: 'version.h.in',
+ output: 'version.h',
+ configuration: {'DVDREAD_VERSION_MAJOR': dvdread_version_split[0],
+ 'DVDREAD_VERSION_MINOR': dvdread_version_split[1],
+ 'DVDREAD_VERSION_MICRO': dvdread_version_split[2]})
+
+# Install headers
+install_headers(dvdread_api_headers,
+ subdir: 'dvdread')
=====================================
src/meson.build
=====================================
@@ -0,0 +1,54 @@
+# Copyright (C) 2025 Rob Hall
+# SPDX-License-Identifier: MIT
+
+# libdvdread source files
+dvdread_src = files(
+ 'bitreader.c',
+ 'dvd_input.c',
+ 'dvd_reader.c',
+ 'dvd_udf.c',
+ 'ifo_print.c',
+ 'ifo_read.c',
+ 'logger.c',
+ 'md5.c',
+ 'nav_print.c',
+ 'nav_read.c',
+)
+
+#
+# Library definitions
+#
+
+if host_machine.system() == 'windows' and get_option('default_library') == 'static'
+ api_export_flags = []
+else
+ api_export_flags = '-DDVDREAD_API_EXPORT'
+endif
+
+# The final libdvdread library
+libdvdread = library('dvdread', dvdread_src,
+ include_directories: dvdread_inc_dirs,
+ dependencies: [
+ libdvdcss_dependency,
+ libdl_dependency,
+ ],
+ c_args: [api_export_flags],
+ gnu_symbol_visibility: 'hidden',
+ version: dvdread_soname_version,
+ install: true,
+)
+
+# Make the library usable as a dependency in this and other projects
+dvdread_dep = declare_dependency(link_with: libdvdread,
+ include_directories: include_directories('.'))
+
+meson.override_dependency('dvdread', dvdread_dep)
+
+# Generate pkg-config .pc file
+pkg_mod = import('pkgconfig')
+pkg_mod.generate(libraries: libdvdread,
+ version: meson.project_version(),
+ filebase: 'dvdread',
+ name: 'libdvdread',
+ description: 'Low level DVD access library',
+)
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/3e209ec010327b6efc6a167689e47a6f8f84b399...786e73584b46393fbea4abdb4a25920cde82b9ec
--
View it on GitLab: https://code.videolan.org/videolan/libdvdread/-/compare/3e209ec010327b6efc6a167689e47a6f8f84b399...786e73584b46393fbea4abdb4a25920cde82b9ec
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libdvdnav-devel
mailing list