#!/usr/bin/env bash
#MISE description="Build the Python library"
set -e
set -x

#USAGE flag "--target <target>" help="The target to build for "
#USAGE flag "-p --profile <profile>" help="Build with the specified profile" {
#USAGE   choices "dev" "release"
#USAGE }
#USAGE flag "-c --compat <compat>" help="Build with the specified profile" {
#USAGE   choices "manylinux_2_28" "musllinux_1_2" "linux"
#USAGE }
#USAGE flag "-s --sdist" help="Build sdist"

if [ "${usage_target:-}" != "" ]; then
    export CARGO_BUILD_TARGET="${usage_target}"
fi

compat="linux"
if [ "${usage_compat:-}" != "" ]; then
    compat="${usage_compat}"
fi

maturin build --compatibility="${compat}" --profile="${usage_profile:-dev}"

if [ "${usage_sdist:-}" != "" ]; then
    maturin build --compatibility="${compat}" --profile="${usage_profile:-dev}" --sdist
fi
