<h1>
<a href="https://github.com/prefix-dev/rattler-build/">
<img alt="banner" src="https://github.com/prefix-dev/rattler-build/assets/885054/3bad9a38-939d-4513-8c61-dcc4ddb7fb51">
</a>
</h1>
# `rattler-build`: A Fast Conda Package Builder
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.

### Installation
The recommended way of installing `rattler-build`, being a conda-package builder, is through a conda package manager.
Next to `rattler-build` we are also building [`pixi`](https://pixi.sh).
With `pixi` you can install `rattler-build` globally:
```bash
pixi global install rattler-build
```
Other options are:
=== "Conda"
```shell
conda install rattler-build -c conda-forge
mamba install rattler-build -c conda-forge
micromamba install rattler-build -c conda-forge
pixi global install rattler-build
pixi add rattler-build # To a pixi project
```
=== "Homebrew"
```shell
brew install rattler-build
```
=== "Arch Linux"
```shell
pacman -S rattler-build
```
=== "Binary"
```shell
# Download the latest release from the GitHub releases page, for example the linux x86 version with curl:
curl -SL --progress-bar https://github.com/prefix-dev/rattler-build/releases/latest/download/rattler-build-x86_64-unknown-linux-musl
```
You can grab version of `rattler-build` from the [Github
Releases](https://github.com/prefix-dev/rattler-build/releases/).
### Completion
When installing `rattler-build` you might want to enable shell completion.
Afterwards, restart the shell or source the shell config file.
### Bash (default on most Linux systems)
```bash
echo 'eval "$(rattler-build completion --shell bash)"' >> ~/.bashrc
```
### Zsh (default on macOS)
```zsh
echo 'eval "$(rattler-build completion --shell zsh)"' >> ~/.zshrc
```
### PowerShell (pre-installed on all Windows systems)
```pwsh
!!! tip "Failure because no profile file exists"
Make sure your profile file exists, otherwise create it with:
```PowerShell
New-Item -Path $PROFILE -ItemType File -Force
```
### Fish
```fish
```nushell
use ~/.cache/rattler-build/completions.nu *
```
### Elvish
```elv
```yaml
context:
version: "13.4.2"
package:
name: "rich"
version: ${{ version }}
source:
- url: https://pypi.io/packages/source/r/rich/rich-${{ version }}.tar.gz
sha256: d653d6bccede5844304c605d5aac802c7cf9621efd700b46c7ec2b51ea914898
build:
# Thanks to `noarch: python` this package works on all platforms
noarch: python
script:
- python -m pip install . -vv --no-deps --no-build-isolation
requirements:
host:
- pip
- poetry-core >=1.0.0
- python 3.10
run:
# sync with normalized deps from poetry-generated setup.py
- markdown-it-py >=2.2.0
- pygments >=2.13.0,<3.0.0
- python 3.10
- typing_extensions >=4.0.0,<5.0.0
tests:
- python:
imports:
- rich
pip_check: true
about:
homepage: https://github.com/Textualize/rich
license: MIT
license_file: LICENSE
summary: Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal
description: |
Rich is a Python library for rich text and beautiful formatting in the terminal.
The Rich API makes it easy to add color and style to terminal output. Rich
can also render pretty tables, progress bars, markdown, syntax highlighted
source code, tracebacks, and more — out of the box.
documentation: https://rich.readthedocs.io
repository: https://github.com/Textualize/rich
```
A recipe for the `curl` library:
```yaml
context:
version: "8.0.1"
package:
name: curl
version: ${{ version }}
source:
url: http://curl.haxx.se/download/curl-${{ version }}.tar.bz2
sha256: 9b6b1e96b748d04b968786b6bdf407aa5c75ab53a3d37c1c8c81cdb736555ccf
build:
number: 0
requirements:
build:
- ${{ compiler('c') }}
- if: win
then:
- cmake
- ninja
- if: unix
then:
- make
- perl
- pkg-config
- libtool
host:
- if: linux
then:
- openssl
about:
homepage: http://curl.haxx.se/
license: MIT/X derivate (http://curl.haxx.se/docs/copyright.html)
license_file: COPYING
summary: tool and library for transferring data with URL syntax
description: |
Curl is an open source command line tool and library for transferring data
with URL syntax. It is used in command lines or scripts to transfer data.
documentation: https://curl.haxx.se/docs/
repository: https://github.com/curl/curl
```
For the `curl` library recipe, two additional script files (`build.sh` and `build.bat`) are needed.
**`build.sh`**
```bash
#!/bin/bash
# Get an updated config.sub and config.guess
cp $BUILD_PREFIX/share/libtool/build-aux/config.* .
if [[ $target_platform =~ linux.* ]]; then
USESSL="--with-openssl=${PREFIX}"
else
USESSL="--with-secure-transport"
fi;
./configure \
--prefix=${PREFIX} \
--host=${HOST} \
${USESSL} \
--with-ca-bundle=${PREFIX}/ssl/cacert.pem \
--disable-static --enable-shared
make -j${CPU_COUNT} ${VERBOSE_AT}
make install
# Includes man pages and other miscellaneous.
rm -rf "${PREFIX}/share"
```
**`build.bat`**
```cmd
mkdir build
cmake -GNinja ^
-DCMAKE_BUILD_TYPE=Release ^
-DBUILD_SHARED_LIBS=ON ^
-DCMAKE_INSTALL_PREFIX=%LIBRARY_PREFIX% ^
-DCMAKE_PREFIX_PATH=%LIBRARY_PREFIX% ^
-DCURL_USE_SCHANNEL=ON ^
-DCURL_USE_LIBSSH2=OFF ^
-DUSE_ZLIB=ON ^
-DENABLE_UNICODE=ON ^
%SRC_DIR%
IF %ERRORLEVEL% NEQ 0 exit 1
ninja install --verbose
```