about summary refs log tree commit diff
path: root/pkgs/build-support/rust/hooks/maturin-build-hook.sh
blob: c1e701425f00de742ed09651941d50ddfda681ef (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
maturinBuildHook() {
    echo "Executing maturinBuildHook"

    runHook preBuild

    # Put the wheel to dist/ so that regular Python tooling can find it.
    local dist="$PWD/dist"

    if [ ! -z "${buildAndTestSubdir-}" ]; then
        pushd "${buildAndTestSubdir}"
    fi

    (
    set -x
    @setEnv@ maturin build \
        --jobs=$NIX_BUILD_CORES \
        --offline \
        --target @rustTargetPlatformSpec@ \
        --manylinux off \
        --strip \
        --release \
        --out "$dist" \
        ${maturinBuildFlags-}
    )

    if [ ! -z "${buildAndTestSubdir-}" ]; then
        popd
    fi

    # These are python build hooks and may depend on ./dist
    runHook postBuild

    echo "Finished maturinBuildHook"
}

buildPhase=maturinBuildHook