summaryrefslogtreecommitdiff
path: root/recipes/build-tools/cargo-c.recipe
blob: 13df28b4d16d3c47b51d834700eb679dfeb3e2a2 (plain)
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
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

class Recipe(recipe.Recipe):
    name = 'cargo-c'
    version = '0.9.30'
    stype = SourceType.TARBALL
    btype = BuildType.CARGO
    url = 'https://github.com/lu-zero/cargo-c/archive/refs/tags/v0.9.30.tar.gz'
    tarball_checksum = '174cfc3a69263c3e54b95e00c4bd61b13377f7f72d4bf60aa714fd9e7ed3849c'
    tarball_dirname = '%(name)s-%(version)s'
    # Get this from the release page on github
    cargo_lock = f'{name}/{version}-Cargo.lock'
    # Need system openssl on Linux
    use_system_libs = True

    deps = ['zlib', 'pkg-config']
    # Need openssl on macOS. On Windows, a prebuilt openssl crate is downloaded.
    platform_deps = {
        Platform.DARWIN: ['openssl'],
    }

    files_bins = ['cargo-capi', 'cargo-cbuild', 'cargo-cinstall', 'cargo-ctest']

    def prepare(self):
        if self.config.platform == Platform.DARWIN:
            self.set_env('OPENSSL_LIB_DIR', self.config.libdir)
            self.set_env('OPENSSL_INCLUDE_DIR', os.path.join(self.config.prefix, 'include'))
            self.set_env('RUSTFLAGS', "-C link-args=-Wl,-headerpad_max_install_names")