The rattler-build
tooling and library creates cross-platform relocatable
binaries / packages from a simple recipe format. The recipe format is heavily
inspired by conda-build
and boa
, and the output of a regular rattler-build
run is a package that can be installed using mamba
, rattler
or conda
.
rattler-build
does not have any dependencies on conda-build
or Python and
works as a standalone binary.
You can grab a prerelease version of rattler-build
from the Github
Releases.
It is (of course) also available from conda-forge:
pixi global install rattler-build
# or with micromamba
micromamba install rattler-build -c conda-forge
You can install rattler-build
via Homebrew:
brew install rattler-build
rattler-build
is available on Arch Linux in the extra repository:
pacman -S rattler-build
rattler-build
is available for Alpine Edge. It can be installed via apk after enabling the testing repository.
apk add rattler-build
Currently rattler-build
needs some dependencies on the host system which are
executed as subprocess. We plan to reduce the number of external dependencies
over time by writing what we need in Rust to make rattler-build
fully
self-contained.
tar
to unpack tarballs downloaded from the internet in a variety of formats.
.gz
, .bz2
and .xz
are widely used and one might have to install the
compression packages as well (e.g. gzip
, bzip2
, ...)patch
to patch source code after downloadinginstall_name_tool
is necessary on macOS to rewrite the rpath
of shared
libraries and executables to make it relativepatchelf
is required on Linux to rewrite the rpath
and runpath
of shared
libraries and executablesgit
to checkout Git repositories (not implemented yet, but will require git
in the future)msvc
on Windows because we cannot ship the MSVC compiler on conda-forge
(needs to be installed on the host machine)On Windows, to obtain these dependencies from conda-forge, one can install
m2-patch
, m2-bzip2
, m2-gzip
, m2-tar
.
We have extensive documentation for rattler-build
. You can find the book
here.
There is a GitHub Action for rattler-build
. It can be used to install rattler-build
in CI/CD workflows and run a build command. Please check out the GitHub Action documentation for more information.
rattler-build
comes with two commands: build
and test
.
The build
command takes a --recipe recipe.yaml
as input and produces a
package as output. The test
subcommand can be used to test existing packages
(tests are shipped with the package).
There is also a terminal user interface (TUI) that can help with building multiple packages and easily viewing logs.
Note You can find all examples below in the
examples
folder and run them withrattler-build
.
A simple example recipe for the xtensor
header-only C++ library:
# yaml-language-server: $schema=https://raw.githubusercontent.com/prefix-dev/recipe-format/main/schema.json
context:
name: xtensor
version: 0.24.6
package:
name: ${{ name|lower }}
version: ${{ version }}
source:
url: https://github.com/xtensor-stack/xtensor/archive/${{ version }}.tar.gz
sha256: f87259b51aabafdd1183947747edfff4cff75d55375334f2e81cee6dc68ef655
build:
number: 0
script:
- if: win
then: |
cmake -G "Ninja" -D BUILD_TESTS=OFF -D CMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% %SRC_DIR%
ninja install
else: |
cmake ${CMAKE_ARGS} -G "Ninja" -DBUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=$PREFIX $SRC_DIR -DCMAKE_INSTALL_LIBDIR=lib
ninja install
requirements:
build:
- ${{ compiler('cxx') }}
- cmake
- ninja
host:
- xtl >=0.7,<0.8
run:
- xtl >=0.7,<0.8
run_constraints:
- xsimd >=8.0.3,<10
tests:
- script:
- if: unix or emscripten
then:
- test -d ${PREFIX}/include/xtensor
- test -f ${PREFIX}/include/xtensor/xarray.hpp
- test -f ${PREFIX}/share/cmake/xtensor/xtensorConfig.cmake
- test -f ${PREFIX}/share/cmake/xtensor/xtensorConfigVersion.cmake
- if: win
then:
- if not exist %LIBRARY_PREFIX%\include\xtensor\xarray.hpp (exit 1)
- if not exist %LIBRARY_PREFIX%\share\cmake\xtensor\xtensorConfig.cmake (exit 1)
- if not exist %LIBRARY_PREFIX%\share\cmake\xtensor\xtensorConfigVersion.cmake (exit 1)
about:
homepage: https://github.com/xtensor-stack/xtensor
license: BSD-3-Clause
license_file: LICENSE
summary: The C++ tensor algebra library
description: Multi dimensional arrays with broadcasting and lazy computing
documentation: https://xtensor.readthedocs.io
repository: https://github.com/xtensor-stack/xtensor
extra:
recipe-maintainers:
- some-maintainer