Bug 1850713: remove duplicated setting of early hint preloader id in `ScriptLoader...
[gecko.git] / third_party / jpeg-xl / BUILDING.md
blob7e9bc2aad3a40064f0eb61dda9d45cea4d9fccaf
1 # Compilation
3 For more details and other workflows see the "Advanced guide" below.
5 ## Checking out the code
7 ```bash
8 git clone https://github.com/libjxl/libjxl.git --recursive --shallow-submodules
9 ```
11 This repository uses git submodules to handle some third party dependencies
12 under `third_party`, that's why it is important to pass `--recursive`. If you
13 didn't check out with `--recursive`, or any submodule has changed, run:
15 ```bash
16 git submodule update --init --recursive --depth 1 --recommend-shallow
17 ```
19 The `--shallow-submodules` and `--depth 1 --recommend-shallow` options create
20 shallow clones which only downloads the commits requested, and is all that is
21 needed to build `libjxl`. Should full clones be necessary, you could always run:
23 ```bash
24 git submodule foreach git fetch --unshallow
25 git submodule update --init --recursive
26 ```
28 which pulls the rest of the commits in the submodules.
30 Important: If you downloaded a zip file or tarball from the web interface you
31 won't get the needed submodules and the code will not compile. You can download
32 these external dependencies from source running `./deps.sh`. The git workflow
33 described above is recommended instead.
35 ## Installing dependencies
37 Required dependencies for compiling the code, in a Debian/Ubuntu based
38 distribution run:
40 ```bash
41 sudo apt install cmake pkg-config libbrotli-dev
42 ```
44 Optional dependencies for supporting other formats in the `cjxl`/`djxl` tools,
45 in a Debian/Ubuntu based distribution run:
47 ```bash
48 sudo apt install libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev
49 ```
51 We recommend using a recent Clang compiler (version 7 or newer), for that
52 install clang and set `CC` and `CXX` variables.
54 ```bash
55 sudo apt install clang
56 export CC=clang CXX=clang++
57 ```
59 ## Building
61 ```bash
62 cd libjxl
63 mkdir build
64 cd build
65 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF ..
66 cmake --build . -- -j$(nproc)
67 ```
69 The encoder/decoder tools will be available in the `build/tools` directory.
71 ## <a name="installing"></a> Installing
73 ```bash
74 sudo cmake --install .
75 ```
78 ## Building JPEG XL for developers
80 For experienced developers, we provide build instructions for several other environments:
82 *   [Building on Debian](doc/developing_in_debian.md)
83 *   Building on Windows with [vcpkg](doc/developing_in_windows_vcpkg.md) (Visual Studio 2019)
84 *   Building on Windows with [MSYS2](doc/developing_in_windows_msys.md)
85 *   [Cross Compiling for Windows with Crossroad](doc/developing_with_crossroad.md)