Skip to content

Latest commit

 

History

History
585 lines (433 loc) · 15.4 KB

File metadata and controls

585 lines (433 loc) · 15.4 KB

Contents:

Building

Building mrv2 from scratch with all features can take anywhere from 40 minutes to 2 and a half hours, depending on your machine. Building vmrv2 takes about half an hour less.

Dependencies

RedHat

#
# Repositories
#
sudo dnf -y install dnf-plugins-core
sudo dnf -y install epel-release
sudo dnf config-manager --set-enabled powertools

#
# Update dnf database
#
sudo dnf makecache --refresh

#
# Install bundles
#
sudo dnf -y groupinstall "Development Tools"
sudo dnf -y install m4 perl perl-CPAN

# Install IPC::Cmd non-interactively
sudo cpan App::cpanminus && cpanm --notest IPC::Cmd

#
# Install dependencies
#
sudo dnf -y install alsa-lib-devel \
               automake \
	       autoconf \
	       cairo-devel \
               ccache \
	       cmake \
	       curl \
	       dbus-devel \ 
	       dpkg \ 
	       git \
	       gettext \
	       gtk3-devel \
	       libffi-devel \
	       libglvnd-devel \
	       libxkbcommon-devel \
	       libXt-devel \
	       mesa-libGLU-devel \
	       ninja-build \
               openssl-devel \
	       pango-devel \
	       pulseaudio-libs-devel \
	       swig \
	       tk-devel \
	       tcl-devel \ 
	       wayland-devel \
	       wayland-protocols-devel  \
	       wget

# If you are building the Vulkan version of vmrv2, you need to install
# The VulkanSDK components

# Also, if you are on RH 8.10, you might need to compile autoconf from
# source to a newer version.

#
# Vulkan SDK
#
sudo dnf install vulkan-headers vulkan-loader-devel
sudo dnf install vulkan-tools vulkan-validation-layers-devel
sudo dnf install spirv-tools

# The following one may not be found and may require compiling from source
sudo dnf install shaderc

#
# To compile you need a newer compiler than those in Red Hat.
#
sudo dnf install gcc-toolset-14

scl enable gcc-toolset-14 bash

#
# rustup for cargo
#
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"

Ubuntu

#
# Update apt database
#
sudo apt update

#
# Install dependencies (for cutting edge build)
#
sudo apt -y install autoconf \
                    automake \
                    build-essential \
		    ccache \
                    cmake \
		    curl \
		    gettext \
		    git \
                    libpango1.0-dev \
		    libglu1-mesa-dev \
		    xorg-dev \
		    libasound2-dev \
		    libcairo-dev \
		    libdbus-1-dev \
		    libegl-dev \
		    libffi-dev \
		    libgtk-3-dev \
		    libjpeg-turbo8-dev \
		    libpulse-dev \
		    libssl-dev \
		    libx11-dev \
		    libxcursor-dev \
		    libxi-dev \
		    libxkbcommon-dev 
		    libxinerama-dev \
		    libxt-dev \
		    libwayland-dev 
		    ninja-build \
		    perl \
		    rpm \
		    swig \
                    tk-dev \
		    wayland-protocols

#
# These are Dependencies for using OS system libs, instead of building them
# from scratch (-D USE_SYSTEM_LIBS=ON)
#
sudo apt -y install libaom-dev \
     	    	    libdav1d-dev \
		    libexpat1-dev \
		    libglfw3-dev \
		    libimath-dev \
		    libminizip-ng-dev \
		    libopencolorio-dev \
		    libsnappy-dev \
     	    	    libssh2-1-dev \
		    libsvtav1enc-dev \
		    libpystring-dev \
		    libvpx-dev \
		    libx264-dev \
		    libyaml-cpp-dev \
		    meson \
		    nasm \
		    nlohmann-json3-dev \
		    pip \
     	    	    python3-dev

# If you are building the Vulkan version of mrv2, you need to install
# The VulkanSDK:
sudo apt install libvulkan-dev glslang-dev libshaderc-dev spirv-tools

# Install cpanminus and IPC::Cmd non-interactively for libcrypto building
sudo cpan App::cpanminus && cpanm --notest IPC::Cmd

#
# rustup for cargo (needed for libdovi)
#
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"

macOS

#
# Install
#
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

#
# Install development tools
#
xcode-select --install

#
# Install dependencies
#
brew install git gnu-sed swig python cmake ninja gettext openssl readline sqlite3 xz zlib ccache automake autoconf

# If you are building the Vulkan version of vmrv2, you need to install
# The VulkanSDK components.  You don't need to install MoltenVk as it is built
# from source.

#
# rustup for cargo (needed for libdovi)
#
curl https://sh.rustup.rs -sSf | sh
source "$HOME/.cargo/env"

Windows

Additional dependencies are downloaded and built automatically by the CMake superbuild script. For a list of non-system libraries that mrv2 depends on and their licenses, please refer to src/docs/Legal.

If building the NSIS installer, you need to place the root of mrv2 in a path that has less than 20 characters, like:

     /D/code/applications

Building mrv2

If on Windows, enable long paths:

Open the Start Menu, search for PowerShell, right-click it, and select Run as Administrator.

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force

winget install -e --id Ccache.Ccache

On an the MSys terminal, clone the repository:

cd some_dir

#
# Clone the latest cutting-edge build (might be unstable).
#
git clone https://github.com/ggarra13/mrv2.git

git config --global core.longpaths true

#
# Build cargo-c
#
cargo install cargo-c
 
cd mrv2
./runme.sh

The script is a superbuild script that will download all needed dependencies required. It will create a build and a:

BUILD-KERNEL-ARCH/BUILDTYPE/install

directory where all files shall reside.

Make sure you meet the basic dependencies for your platform. See Dependencies.

The runme.sh script will output its progress to the terminal and also save it in:

BUILD-KERNEL-ARCH/BUILDTYPE/compile.log.

The default is to build with all cores in all the Operating Systems. Currently, the build with all settings on takes about 39 minutes on 16 cores.

If you want more or less cores pass another number to any of the runme*.sh scripts. For example, to build with 4 cores, you can do:

./runme.sh -j 4

Also, look in the bin/ directory for other runme.sh scripts which compile a quicker version of mrv2 without features like USD, python or networking.

Debug builds

All runme.sh scripts support two additional parameters. For a debug build, you would do:

./runme.sh debug

To clean up the directory, run a debug build with 8 cores, run:

./runme.sh clean debug -j 8

Building on Windows

For windows, in addition to Visual Studio, you will need a new and fresh copy of Msys. There is a .bat file included in the distribution (in helpers/windows/bat), which needs to be modified to the path of Visual Studio (2019 by default), the optional Windows SDK (none by default) and your copy of Msys. You run the .bat file first, which will set the Visual Studio paths and fire up a Msys console. From then on, all commands described are run in the Msys console.

CMake build options

The main runme.sh script supports passing CMake flags to it and allows turning on or off some options of mrv2. You must pass them like:

-D TLRENDER_USD=OFF

The flags are listed when you start the runme.sh script. If you want to make some change to the flags permanent, you should change them in runme_nolog.sh or create a wrapper script that calls runme.sh.

Building FFmpeg as GPL or LGPL

If you pass -gpl or -lpgl to the runme.sh script, like:

./runme.sh -gpl

The build system will compile FFmpeg as GPL or LGPL on all platforms. The default is to build a LGPL version of FFmpeg as that complies with the BSD binary distribution license. The LGPL version of FFmpeg, however, does not come with libx264, which means you cannot save movie files with the H264 codec on Windows and Linux. It also does not support GoPro Cineform files with alpha.

The GPL version of FFmpeg does not have that restriction and it will compile libx264 on all platforms and work GoPro Cineform with alpha.

Running mrv2

macOS and Linux

If you have a bin directory in your $HOME (ie. ~/bin ), the build scripts will create a symlink there. So you should add ~/bin to your PATH in your .bashrc or .zshrc.

Assuming you complied mrv2 with the ~/bin directory already created, then to start mrv2 then you'd do:

export PATH=~/bin:$PATH  # no need if you add this line to your .bashrc
mrv2

and to run the debug build.

export PATH=~/bin:$PATH  # no need if you add this line to your .bashrc
mrv2-dbg

If you compiled mrv2 without bin directory in your HOME directory, you can start it from the BUILD directory with the mrv2.sh script, like:

BUILD-Linux-amd64/Release/install/bin/mrv2.sh

Windows

On Windows, we cannot create symbolic links, so in Msys you need to type the whole path to the install. That is, for example:

BUILD-Msys-amd64/Release/install/bin/mrv2.exe

If you like to work command line, you should add the whole path to the mrv2.exe to your path. In Msys, you can add it to the .bashrc like shown on macOS and Linux.

For cmd.exe or PowerShell, on the Windows taskbar, right-click the Windows icon and select System. In the Settings window, under Related Settings, click Advanced system settings. On the Advanced tab, click Environment Variables. Find the PATH environment variable and add the full path to mrv2.exe.

For working with a GUI, after the build is done, you should do:

cd BUILD-Msys-amd64/Release/install/bin/  # or similar
explorer .

And in the explorer directory that it will open, you should create a shortcut with the RMB to the mrv2.exe. Once that is done, you can drag and rename the shortcut to your Desktop to have it handy. Note that if you will not be developing mrv2, you should instead proceed to Packaging.

Packaging

Once you build mrv2 and tested that it runs, you might want to create a package for distribution. On macOS, this is a .dmg file. On Linux it is a RPM, DEB or TGZ file. On Windows it is a ZIP or an NSIS EXE installer.

To do so, from the main dir of mrv2, you have to do:

./runmeq.sh -t package

For all architectures, the installers will be stored in:

packages/

That is the root directory of mrv2.

Documenting

Currently, the documentation is generated automatically from the translations. To do so, you must run:

./runmeq.sh -t doc

Translating

mrv2 can support multiple natural language translations. Currently, Chinese, English, French, German, Hindi, Italian, Portuguese, Russian and Spanish are supported. The translation system used is gettext so familiarity with it is desired (albeit not essential). The translations reside in src/po and follow internationalization language code files, like es.po (for Spanish) or de.po (for German).

First, you should create a branch to submit a pull request.

There are GitHub docs, e.g. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request

In a nutshell:

  • fork the mrv2 repo to e.g. your-username/mrv2
  • create a feature branch in you fork (important although not required [1])
  • push one or more commits to your feature branch
  • request a PR on your repo/feature-branch

To create such a file for a new language, open the file cmake/translations.cmake and add a language international code to this line:

set( LANGUAGES es ) # add a new language code inside the parenthesis, like "de".

Then, run:

./runmeq.sh -t po

If there's no .po file for that language yet, gettext's msginit command will be run for you. You may be asked for your email address as part of the process.

Go to mrv2/po/{lang}.po where lang is the language you added.

and edit the text. Make sure to change the charset to UTF-8.

Note that you should use an editor that can write in Unicode (UTF-8) to write non-Occidental languages.

You need to edit "msgstr" strings and leave "msgid" untouched as a reference. If the comment has a "fuzzy" string it means gettext tried to guess the translation, but it will not use it. Remove the fuzzy qualifier and change the "msgstr" string. Note that if the "msgid" has new-lines you need to match them too. Refer to the gettext manual for further information.

Once you are ready to test your translation, run:

./runmeq.sh -t mo

That will create the .mo files for your language.

If you compiled mrv2

To test the translation, you can just run:

./runmeq.sh -t install

or just:

./runmeq.sh

and that will place the .mo files in the: $BUILD-$OS-$ARCH/$BUILD_TYPE/install/share/locale directory.

If you add or remove strings as part of your code changes, you may want to regenerate the .pot files after a while, before calling -t mo. To do so:

./runmeq.sh -t pot

Note that this change is dramatic as your commits of the code changes will get mangled with all the .pot/.po comments, preventing a clean PR (Pull Request) on github.com.

If you did not compile mrv2

Create a pull request on GitHub:

Then, create a new .po file for your the main translations. For example:

cp mrv2/po/en.po mrv2/po/it.po   # For Italian

Then add the file for a new language, open the file cmake/translations.cmake and add a language international code to this line:

set( LANGUAGES en es it ) # add a new language code inside the parenthesis, like "it".

Translate that new .po file manually and then do:

git add mrv2/po/it.po
git commit
git push

submit a GitHub PR with that new file. The mrv2 developers will try to merge your changes later.

Translating on Windows

On Windows, besides the text of mrv2, you also need to translate the text for the NSIS .exe installer.

You can do it by editing the cmake/nsis/mrv2_translations.nsh file. Just follow the examples in that file.

Developing

If you want to become a developer, first familiarize yourself with the build process. Then clone the repository to your github account and send PRs. If you become an avid developer, you can then request access to the main repository.

One additional thing that you will need for making commits to the repository, is:

clang-format

This is part of the LLVM project, you can download it from your usual repositories (apt, brew, etc.), or from:

LLVM Main Download Page

This utility verifies previous to a commit that all the C++ formatting follows the standard used in mrv2.

You might also want to get Doxygen so as to get the source code documentation in docs/Doxygen.