libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

developing_with_crossroad.md (3980B)


      1 # Cross Compiling for Windows with Crossroad
      2 
      3 [Crossroad](https://pypi.org/project/crossroad/) is a tool to set up cross-compilation environments on GNU/Linux distributions.  These instructions assume a Debian/Ubuntu system.  However, they can likely be adapted to other Linux environments.  Since Ubuntu can be run on Windows through WSL, these instruction may be useful for developing directly on Windows.
      4 
      5 ## Install Crossroad
      6 
      7 Crossroad requires tools included with `python3-docutils` and `mingw-w64`.  They may be installed using:
      8 
      9 ```bash
     10 sudo aptitude install python3-docutils mingw-w64
     11 ```
     12 
     13 The `zstandard` python package is also required, but is not available in the repositories.  It may be installed using `pip`.
     14 
     15 ```bash
     16 pip3 install zstandard
     17 ```
     18 
     19 After the dependencies are installed, crossroad itself maybe installed with `pip`.
     20 
     21 ```bash
     22 pip3 install crossroad
     23 ```
     24 
     25 If there are errors while running crossroad, it may need to be downloaded and installed directly using `setup.py`.  Instructions are on the crossroad homepage.
     26 
     27 ## Update Debian Alternatives
     28 
     29 Since `libjxl` uses C++ features that require posix threads, the symlinks used by the Debian alternative system need to be updated:
     30 
     31 ```bash
     32 sudo update-alternatives --config x86_64-w64-mingw32-g++
     33 ```
     34 
     35 Select the option that indicates `posix` usage.  Repeat for `gcc` and `i686`:
     36 
     37 ```bash
     38 sudo update-alternatives --config x86_64-w64-mingw32-gcc
     39 sudo update-alternatives --config i686-w64-mingw32-gcc
     40 sudo update-alternatives --config i686-w64-mingw32-g++
     41 ```
     42 
     43 ## Create a New Crossroad Project
     44 
     45 Crossroad supports the following platforms:
     46 
     47 ```
     48 native               Native platform (x86_64 GNU/Linux)
     49 android-x86          Generic Android/Bionic on x86
     50 android-mips64       Generic Android/Bionic on MIPS64
     51 android-x86-64       Generic Android/Bionic on x86-64
     52 w64                  Windows 64-bit
     53 w32                  Windows 32-bit
     54 android-arm64        Generic Android/Bionic on ARM64
     55 android-mips         Generic Android/Bionic on MIPS
     56 android-arm          Generic Android/Bionic on ARM
     57 ```
     58 
     59 To begin cross compiling for Windows, a new project needs to be created:
     60 
     61 ```bash
     62 crossroad w64 [project-name]
     63 ```
     64 
     65 ## Install Dependencies
     66 
     67 Since the `gimp` development package is required to build the GIMP plugin and also includes most of the packages required by `libjxl`, install it first.
     68 
     69 ```bash
     70 crossroad install gimp
     71 ```
     72 
     73 `gtest` and `brotli` are also required.
     74 
     75 ```bash
     76 crossroad install gtest brotli
     77 ```
     78 
     79 If any packages are later found to be missing, you may search for them using:
     80 
     81 ```bash
     82 crossroad search [...]
     83 ```
     84 
     85 ## Build `libjxl`
     86 
     87 Download the source from the libjxl [releases](https://github.com/libjxl/libjxl/releases) page.  Alternatively, you may obtain the latest development version with `git`.  Run `./deps.sh` to ensure additional third-party dependencies are downloaded.  Unfortunately, the script `./ci.sh` does not work with Crossroad, so `cmake` will need to be called directly.
     88 
     89 Create a build directory within the source directory.  If you haven't already, start your crossroad project and run `cmake`:
     90 
     91 ```bash
     92 mkdir build
     93 cd build
     94 crossroad w64 libjxl
     95 crossroad cmake -DCMAKE_BUILD_TYPE=Release \
     96    -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF \
     97    -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_MANPAGES=OFF \
     98    -DJPEGXL_ENABLE_PLUGINS=ON -DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
     99    -DJPEGXL_FORCE_SYSTEM_GTEST=ON ..
    100 ```
    101 
    102 Check the output to see if any dependencies were missed and need to be installed.  If all went well, you may now run `cmake` to build `libjxl`:
    103 
    104 ```bash
    105 cmake --build .
    106 ```
    107 
    108 ## Try out the GIMP Plugin
    109 
    110 The plugin is built statically, so there should be no need to install `dll` files.  To try out the plugin:
    111 
    112 1. [Download](https://www.gimp.org/downloads/) and install the stable version of GIMP (currently 2.10.24).
    113 
    114 2. Create a new folder: `C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins\file-jxl`
    115 
    116 3. Copy `build/plugins/gimp/file-jxl.exe` to the new folder.