2017-09-06 21:07:49 +00:00
|
|
|
# Build Instructions
|
|
|
|
|
|
|
|
Shaka Packager supports building on Windows, Mac and Linux host systems.
|
|
|
|
|
|
|
|
## Linux build dependencies
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Most development is done on Ubuntu (currently 22.04 LTS, Jammy Jellyfish). The
|
2017-09-06 21:07:49 +00:00
|
|
|
dependencies mentioned here are only for Ubuntu. There are some instructions
|
|
|
|
for [other distros below](#notes-for-other-linux-distros).
|
|
|
|
|
|
|
|
```shell
|
|
|
|
sudo apt-get update
|
2021-10-13 18:00:37 +00:00
|
|
|
sudo apt-get install -y \
|
|
|
|
curl \
|
2023-12-01 17:32:19 +00:00
|
|
|
build-essential cmake git ninja-build python3
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Note that `git` must be v1.7.6 or above to support relative paths in submodules.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
## Mac system requirements
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
* [Xcode](https://developer.apple.com/xcode) 7.3+.
|
|
|
|
* The OS X 10.10 SDK or later. Run
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
```shell
|
|
|
|
ls `xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs
|
|
|
|
```
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
to check whether you have it.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
## Install Ninja (recommended) using Homebrew
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
brew install ninja
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
## Windows system requirements
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
* Visual Studio 2017 or newer.
|
|
|
|
* Windows 10 or newer.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Recommended version of Visual Studio is 2022, the Community edition
|
|
|
|
should work for open source development of tools like Shaka Packager
|
|
|
|
but please check the Community license terms for your specific
|
|
|
|
situation.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Install the "Desktop development with C++" workload which will install
|
|
|
|
CMake and other needed tools.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
If you use chocolatey, you can install these dependencies with:
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
```ps1
|
|
|
|
choco install -y `
|
|
|
|
git cmake ninja python `
|
|
|
|
visualstudio2022community visualstudio2022-workload-nativedesktop `
|
|
|
|
visualstudio2022buildtools windows-sdk-10.0
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
# Find python install
|
|
|
|
$pythonpath = Get-Item c:\Python* | sort CreationDate | Select-Object -First 1
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
# Symlink python3 to python
|
|
|
|
New-Item -ItemType SymbolicLink `
|
|
|
|
-Path "$pythonpath/python3.exe" -Target "$pythonpath/python.exe"
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
# Update global PATH
|
|
|
|
$env:PATH += ";C:\Program Files\Git\bin;c:\Program Files\CMake\bin;$pythonpath"
|
|
|
|
setx PATH "$env:PATH"
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
## Get the code
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Dependencies are now managed via git submodules. To get a complete
|
|
|
|
checkout you can run:
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
git clone --recurse-submodules https://github.com/shaka-project/shaka-packager.git
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Build Shaka Packager
|
|
|
|
|
|
|
|
#### Linux and Mac
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
Shaka Packager uses [CMake](https://cmake.org) as the main build tool,
|
|
|
|
with Ninja as the recommended generator (outside of Windows).
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
If you want to build debug code, replace `Release` above with `Debug`.
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
You can change other build settings with `-D` flags to CMake, for example
|
|
|
|
you can build a shared `libpackager` instead of static by adding
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
-DBUILD_SHARED_LIBS="ON"
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
After configuring CMake you can run the build with
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake --build build --parallel
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
#### Windows
|
|
|
|
|
|
|
|
Windows build instructions are similar. Using Tools > Command Line >
|
|
|
|
Developer Command Prompt should open a terminal with cmake and ctest in the
|
|
|
|
PATH. Omit the `-G Ninja` to use the default backend, and pass `--config`
|
|
|
|
during build to select the desired configuration from Visual Studio.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake -B build
|
|
|
|
cmake --build build --parallel --config Release
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Build artifacts
|
|
|
|
|
|
|
|
After a successful build, you can find build artifacts including the main
|
2023-12-01 17:32:19 +00:00
|
|
|
`packager` binary in build output directory (`build/packager/` for a Ninja
|
|
|
|
build, `build/packager/Release/` for a Visual Studio release build, or
|
|
|
|
`build/packager/Debug/` for a Visual Studio debug build).
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2022-03-07 19:56:34 +00:00
|
|
|
See [Shaka Packager Documentation](https://shaka-project.github.io/shaka-packager/html/)
|
2017-09-06 21:07:49 +00:00
|
|
|
on how to use `Shaka Packager`.
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
### Installation
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
To install Shaka Packager, run:
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake --install build/ --strip --config Release
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
You can customize the output location with `--prefix` (default `/usr/local` on
|
|
|
|
Linux and macOS) and the `DESTDIR` environment variable. These are provided by
|
|
|
|
CMake and follow standard conventions for installation. For example, to build
|
|
|
|
a package by installing to `foo` instead of the system root, and to use `/usr`
|
|
|
|
instead of `/usr/local`, you could run:
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
DESTDIR=foo cmake --install build/ --strip --config Release --prefix=/usr
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
### Update your checkout
|
|
|
|
|
|
|
|
To update an existing checkout, you can run
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
git pull origin main --rebase
|
|
|
|
git submodule update --init --recursive
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
The first command updates the primary Packager source repository and rebases on
|
|
|
|
top of tip-of-tree (aka the Git branch `origin/main`). You can also use other
|
|
|
|
common Git commands to update the repo.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
The second updates submodules for third-party dependencies.
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
## Notes for other linux distros
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
The docker files at `packager/testing/dockers` have the most up to
|
|
|
|
date commands for installing dependencies. For example:
|
|
|
|
|
2018-08-15 00:21:29 +00:00
|
|
|
### Alpine Linux
|
|
|
|
|
|
|
|
Use `apk` command to install dependencies:
|
|
|
|
|
|
|
|
```shell
|
2021-10-13 18:00:37 +00:00
|
|
|
apk add --no-cache \
|
|
|
|
bash curl \
|
2023-12-01 17:32:19 +00:00
|
|
|
bsd-compat-headers linux-headers \
|
|
|
|
build-base cmake git ninja python3
|
2018-08-15 00:21:29 +00:00
|
|
|
```
|
|
|
|
|
2017-09-06 21:07:49 +00:00
|
|
|
### Arch Linux
|
|
|
|
|
|
|
|
Instead of running `sudo apt-get install` to install build dependencies, run:
|
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
pacman -Suy --needed --noconfirm \
|
2021-10-13 18:00:37 +00:00
|
|
|
core/which \
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake gcc git ninja python3
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Debian
|
|
|
|
|
|
|
|
Same as Ubuntu.
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
```shell
|
|
|
|
apt-get install -y \
|
|
|
|
curl \
|
|
|
|
build-essential cmake git ninja-build python3
|
|
|
|
```
|
|
|
|
|
2017-09-06 21:07:49 +00:00
|
|
|
### Fedora
|
|
|
|
|
|
|
|
Instead of running `sudo apt-get install` to install build dependencies, run:
|
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
yum install -y \
|
2021-10-13 18:00:37 +00:00
|
|
|
which \
|
2023-12-01 17:32:19 +00:00
|
|
|
libatomic \
|
|
|
|
cmake gcc-c++ git ninja-build python3
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2021-10-13 18:00:37 +00:00
|
|
|
### CentOS
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
For CentOS, Ninja is only available from the CRB (Code Ready Builder) repo
|
|
|
|
|
|
|
|
```shell
|
|
|
|
dnf update -y
|
|
|
|
dnf install -y yum-utils
|
|
|
|
dnf config-manager --set-enabled crb
|
|
|
|
```
|
|
|
|
|
|
|
|
then same as Fedora
|
|
|
|
|
|
|
|
```shell
|
|
|
|
yum install -y \
|
|
|
|
which \
|
|
|
|
libatomic \
|
|
|
|
cmake gcc-c++ git ninja-build python3
|
|
|
|
```
|
2021-10-13 18:00:37 +00:00
|
|
|
|
2017-09-06 21:07:49 +00:00
|
|
|
### OpenSUSE
|
|
|
|
|
|
|
|
Use `zypper` command to install dependencies:
|
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
zypper in -y \
|
2021-10-13 18:00:37 +00:00
|
|
|
curl which \
|
2023-12-01 17:32:19 +00:00
|
|
|
cmake gcc9-c++ git ninja python3
|
|
|
|
```
|
|
|
|
|
|
|
|
OpenSuse 15 doesn't have the required gcc 9+ by default, but we can install
|
|
|
|
it as gcc9 and symlink it.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
ln -s g++-9 /usr/bin/g++
|
|
|
|
ln -s gcc-9 /usr/bin/gcc
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## Tips, tricks, and troubleshooting
|
|
|
|
|
|
|
|
### Xcode license agreement
|
|
|
|
|
2018-08-13 21:50:31 +00:00
|
|
|
If you are getting the error
|
2017-09-06 21:07:49 +00:00
|
|
|
|
|
|
|
> Agreeing to the Xcode/iOS license requires admin privileges, please re-run as
|
|
|
|
> root via sudo.
|
|
|
|
|
2018-08-13 21:50:31 +00:00
|
|
|
the Xcode license has not been accepted yet which (contrary to the message) any
|
2017-09-06 21:07:49 +00:00
|
|
|
user can do by running:
|
|
|
|
|
|
|
|
```shell
|
2021-10-13 18:00:37 +00:00
|
|
|
xcodebuild -license
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
Only accepting for all users of the machine requires root:
|
|
|
|
|
|
|
|
```shell
|
2021-10-13 18:00:37 +00:00
|
|
|
sudo xcodebuild -license
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
2021-02-03 19:02:13 +00:00
|
|
|
### Using an IDE
|
|
|
|
|
2023-12-01 17:32:19 +00:00
|
|
|
No specific instructions are available. However most IDEs with CMake
|
|
|
|
support should work out of the box
|
2021-02-03 19:02:13 +00:00
|
|
|
|
2017-09-06 21:07:49 +00:00
|
|
|
## Contributing
|
|
|
|
|
|
|
|
If you have improvements or fixes, we would love to have your contributions.
|
2022-03-07 19:56:34 +00:00
|
|
|
See https://github.com/shaka-project/shaka-packager/blob/main/CONTRIBUTING.md for
|
2017-09-06 21:07:49 +00:00
|
|
|
details.
|
|
|
|
|
|
|
|
We have continue integration tests setup on pull requests. You can also verify
|
|
|
|
locally by running the tests manually.
|
|
|
|
|
|
|
|
```shell
|
2023-12-01 17:32:19 +00:00
|
|
|
ctest -C Debug -V --test-dir build
|
2017-09-06 21:07:49 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
You can find out more about GoogleTest at its
|
|
|
|
[GitHub page](https://github.com/google/googletest).
|
2023-12-01 17:32:19 +00:00
|
|
|
|
|
|
|
You should install `clang-format` (using `apt install` or `brew
|
|
|
|
install` depending on platform) to ensure that all code changes are
|
|
|
|
properly formatted.
|
|
|
|
|
|
|
|
You should commit or stage (with `git add`) any code changes first. Then run
|
|
|
|
|
|
|
|
```shell
|
|
|
|
git clang-format --style Chromium origin/main
|
|
|
|
```
|
|
|
|
|
|
|
|
This will run formatting over just the files you modified (any changes
|
|
|
|
since origin/main).
|