summaryrefslogtreecommitdiff
path: root/recipes/build-tools/cargo-c.recipe
blob: 9f18536baf5a52576f10132add51cfece5b5941f (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
29
30
31
32
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python

class Recipe(recipe.Recipe):
    name = 'cargo-c'
    version = '0.9.26'
    stype = SourceType.TARBALL
    btype = BuildType.CARGO
    url = 'https://github.com/lu-zero/cargo-c/archive/refs/tags/v0.9.26.tar.gz'
    tarball_checksum = '6101c4f1d6b17f6b42982dd908f194493e966a91d5a3cf9c210c65dbf66683b3'
    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

    patches = [
        # https://github.com/lu-zero/cargo-c/pull/277
        name + '/0001-Fix-linking-with-Android-NDK-linker.patch',
    ]

    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'))