first commit
This commit is contained in:
88
third_party/opus/meson/README.md
vendored
Normal file
88
third_party/opus/meson/README.md
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
# Using the Meson Build System for the Opus Project
|
||||
|
||||
This guide provides instructions for using the Meson build system to build the Opus project with various configuration options. Meson is a fast and efficient build system that aims to be easy to use and understand.
|
||||
|
||||
Please note that software documentation can sometimes become outdated as new versions are released. For the most up-to-date and accurate information, we recommend referring to the official Meson documentation, which can be found at [mesonbuild.com](https://mesonbuild.com/).
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before proceeding, ensure that you have the following prerequisites installed:
|
||||
|
||||
- [Meson](https://mesonbuild.com/Quick-guide.html)
|
||||
- [Ninja](https://ninja-build.org/) (recommended as the build backend, although other backends are also available)
|
||||
- [Git](https://git-scm.com/) (optional, but recommended for version control integration)
|
||||
- A working C compiler
|
||||
|
||||
## Build and Test Instructions
|
||||
|
||||
Follow the steps below to build the Opus project using Meson.
|
||||
|
||||
### Check out Source
|
||||
Clone the Opus repository using Git:
|
||||
|
||||
```shell
|
||||
git clone https://gitlab.xiph.org/xiph/opus
|
||||
cd opus
|
||||
```
|
||||
|
||||
### Configure
|
||||
To configure the build with Meson, you can set the desired configuration options using the -D flag followed by the option name and value. For the Opus project-specific build options, please refer to the [meson_options.txt](./../meson_options.txt) file. For general Meson options use the command meson `setup --help` to get a list of these options.
|
||||
|
||||
For example, to setup and disable tests, use the following command:
|
||||
|
||||
```shell
|
||||
meson setup builddir -Dtests=disabled
|
||||
```
|
||||
|
||||
### Build
|
||||
|
||||
```shell
|
||||
meson compile -C builddir
|
||||
```
|
||||
|
||||
After a successful build, you can find the compiled Opus library and associated files in the builddir directory.
|
||||
|
||||
### Testing with Meson
|
||||
|
||||
Opus provides a comprehensive test suite to ensure the functionality and correctness of the project. You can execute the tests using Meson's built-in testing functionality.
|
||||
|
||||
To run the Opus tests using Meson:
|
||||
|
||||
```shell
|
||||
meson test -C builddir
|
||||
```
|
||||
|
||||
## Platform Support and Bug Reporting
|
||||
|
||||
The Opus Meson build system aims to provide support for the same platforms as [GStreamer](https://gstreamer.freedesktop.org/), a widely used multimedia framework. GStreamer supports a wide range of operating systems and platforms, including Linux, Windows (MSVC and MingW), Android, macOS, iOS, and various BSD systems.
|
||||
|
||||
While efforts are made to ensure compatibility and stability across these platforms, bugs or issues may still arise in specific configurations. If you encounter any problems during the configuration process or while building the Opus project, we encourage you to file an issue in the [project's issue tracker](https://gitlab.xiph.org/xiph/opus/-/issues).
|
||||
|
||||
When reporting an issue, please provide the following information to help us understand and effectively reproduce the configuration problem:
|
||||
|
||||
1. Detailed description of the issue, including any error messages or unexpected behavior observed.
|
||||
2. Steps to reproduce the problem, including the Meson command and any specific configuration options used.
|
||||
3. Operating system and version (e.g., Windows 10, macOS Big Sur, Ubuntu 20.04).
|
||||
4. Meson version (e.g., Meson 0.60.0).
|
||||
5. Any relevant information about the platform, toolchain, or dependencies used.
|
||||
6. Additional context or details that might assist in troubleshooting the issue.
|
||||
|
||||
By providing thorough information when reporting configuration issues, you contribute to improving the Opus project's compatibility and reliability across different platforms.
|
||||
|
||||
We appreciate your help in identifying and addressing any configuration-related problems, ensuring a better experience for all users of the Opus project.
|
||||
|
||||
## Platform Specific Examples
|
||||
|
||||
Note: Examples can become outdated. Always refer to the documentation for the latest reference.
|
||||
|
||||
### Windows Visual Studio
|
||||
|
||||
To generate Visual Studio projects, Meson needs to know the settings of your installed version of Visual Studio. The recommended approach is to run Meson under the Visual Studio Command Prompt.
|
||||
|
||||
You can find the Visual Studio Command Prompt by searching from the Start Menu. However, the name varies for each Visual Studio version. For Visual Studio 2022, look for "x64 Native Tools Command Prompt for VS 2022". The following steps remain the same:
|
||||
|
||||
```shell
|
||||
meson setup builddir -Dtests=enabled --backend vs
|
||||
```
|
||||
|
||||
For more information about the Visual Studio backend options and additional customization, please refer to the [Using with Visual Studio](https://mesonbuild.com/Using-with-Visual-Studio.html) documentation.
|
||||
86
third_party/opus/meson/get-version.py
vendored
Executable file
86
third_party/opus/meson/get-version.py
vendored
Executable file
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Opus get-version.py
|
||||
#
|
||||
# Extracts versions for build:
|
||||
# - Opus package version based on 'git describe' or $srcroot/package_version
|
||||
# - libtool version based on configure.ac
|
||||
# - macos lib version based on configure.ac
|
||||
#
|
||||
# Usage:
|
||||
# get-version.py [--package-version | --libtool-version | --darwin-version]
|
||||
import argparse
|
||||
import subprocess
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
|
||||
if __name__ == '__main__':
|
||||
arg_parser = argparse.ArgumentParser(description='Extract Opus package version or libtool version')
|
||||
group = arg_parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument('--libtool-version', action='store_true')
|
||||
group.add_argument('--package-version', action='store_true')
|
||||
group.add_argument('--darwin-version', action='store_true')
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
srcroot = os.path.normpath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
# package version
|
||||
if args.package_version:
|
||||
package_version = None
|
||||
|
||||
# check if git checkout
|
||||
git_dir = os.path.join(srcroot, '.git')
|
||||
is_git = os.path.isdir(git_dir) or os.path.isfile(git_dir)
|
||||
have_git = shutil.which('git') is not None
|
||||
|
||||
if is_git and have_git:
|
||||
git_cmd = subprocess.run(['git', '--git-dir=' + git_dir, 'describe', 'HEAD'], stdout=subprocess.PIPE)
|
||||
if git_cmd.returncode:
|
||||
print('ERROR: Could not extract package version via `git describe` in', srcroot, file=sys.stderr)
|
||||
sys.exit(-1)
|
||||
package_version = git_cmd.stdout.decode('ascii').strip().lstrip('v')
|
||||
else:
|
||||
with open(os.path.join(srcroot, 'package_version'), 'r') as f:
|
||||
for line in f:
|
||||
if line.startswith('PACKAGE_VERSION="'):
|
||||
package_version = line[17:].strip().lstrip('v').rstrip('"')
|
||||
if package_version:
|
||||
break
|
||||
|
||||
if not package_version:
|
||||
print('ERROR: Could not extract package version from package_version file in', srcroot, file=sys.stderr)
|
||||
sys.exit(-1)
|
||||
|
||||
print(package_version)
|
||||
sys.exit(0)
|
||||
|
||||
# libtool version + darwin version
|
||||
elif args.libtool_version or args.darwin_version:
|
||||
opus_lt_cur = None
|
||||
opus_lt_rev = None
|
||||
opus_lt_age = None
|
||||
|
||||
with open(os.path.join(srcroot, 'configure.ac'), 'r') as f:
|
||||
for line in f:
|
||||
if line.strip().startswith('OPUS_LT_CURRENT='):
|
||||
opus_lt_cur = line[16:].strip()
|
||||
elif line.strip().startswith('OPUS_LT_REVISION='):
|
||||
opus_lt_rev = line[17:].strip()
|
||||
elif line.strip().startswith('OPUS_LT_AGE='):
|
||||
opus_lt_age = line[12:].strip()
|
||||
|
||||
if opus_lt_cur and opus_lt_rev and opus_lt_age:
|
||||
opus_lt_cur = int(opus_lt_cur)
|
||||
opus_lt_rev = int(opus_lt_rev)
|
||||
opus_lt_age = int(opus_lt_age)
|
||||
if args.libtool_version:
|
||||
print('{}.{}.{}'.format(opus_lt_cur - opus_lt_age, opus_lt_age, opus_lt_rev))
|
||||
elif args.darwin_version:
|
||||
print('{}.{}.{}'.format(opus_lt_cur + 1, 0, 0))
|
||||
sys.exit(0)
|
||||
else:
|
||||
print('ERROR: Could not extract libtool version from configure.ac file in', srcroot, file=sys.stderr)
|
||||
sys.exit(-1)
|
||||
else:
|
||||
sys.exit(-1)
|
||||
28
third_party/opus/meson/read-sources-list.py
vendored
Executable file
28
third_party/opus/meson/read-sources-list.py
vendored
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# opus/read-sources-list.py
|
||||
#
|
||||
# Parses .mk files and extracts list of source files.
|
||||
# Prints one line per source file list, with filenames space-separated.
|
||||
|
||||
import sys
|
||||
|
||||
if len(sys.argv) < 2:
|
||||
sys.exit('Usage: {} sources_foo.mk [sources_bar.mk...]'.format(sys.argv[0]))
|
||||
|
||||
for input_fn in sys.argv[1:]:
|
||||
with open(input_fn, 'r', encoding='utf8') as f:
|
||||
text = f.read()
|
||||
text = text.replace('\\\n', '')
|
||||
|
||||
# Remove empty lines
|
||||
lines = [line for line in text.split('\n') if line.strip()]
|
||||
|
||||
# Print SOURCES_XYZ = file1.c file2.c
|
||||
for line in lines:
|
||||
values = line.strip().split('=', maxsplit=2)
|
||||
if len(values) != 2:
|
||||
raise RuntimeError('Unable to parse line "{}" from file "{}"'.format(line, input_fn))
|
||||
var, files = values
|
||||
sources_list = [f for f in files.split(' ') if f]
|
||||
print(var.strip(), '=', ' '.join(sources_list))
|
||||
Reference in New Issue
Block a user