diff --git a/dev-rust/cargo_c/cargo_c-0.9.8.recipe b/dev-rust/cargo_c/cargo_c-0.9.8.recipe new file mode 100644 index 000000000..0ff4354de --- /dev/null +++ b/dev-rust/cargo_c/cargo_c-0.9.8.recipe @@ -0,0 +1,68 @@ +SUMMARY="Cargo applet to build and install C-ABI compatibile dynamic and static libraries" +DESCRIPTION="It produces and installs a correct pkg-config file, a static \ +library and a dynamic library, and a C header to be used by any C (and \ +C-compatible) software." +HOMEPAGE="https://github.com/lu-zero/cargo-c" +COPYRIGHT="2020 Luca Barbato" +LICENSE="MIT" +REVISION="1" +SOURCE_URI="https://github.com/lu-zero/cargo-c/archive/v$portVersion.tar.gz" +CHECKSUM_SHA256="7c649061826e0ad3c2c8735718f4a0c4afd12eed9b9fdc5fe59e34582902e1c5" +SOURCE_URI_2="https://github.com/lu-zero/cargo-c/releases/download/v$portVersion/Cargo.lock#noarchive" +CHECKSUM_SHA256_2="11f23a09ef06ca2125027e24574124a99089863fb4226570b6adbe317848b670" +SOURCE_DIR="cargo-c-$portVersion" +PATCHES="cargo_c-$portVersion.patchset" + +ARCHITECTURES="?all !x86_gcc2 x86_64" +SECONDARY_ARCHITECTURES="x86" + +PROVIDES=" + cargo_c$secondaryArchSuffix + cmd:cargo_capi = $portVersion + cmd:cargo_cbuild = $portVersion + cmd:cargo_cinstall = $portVersion + cmd:cargo_ctest = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libcrypto$secondaryArchSuffix + lib:libcurl$secondaryArchSuffix + lib:libgit2$secondaryArchSuffix + lib:libssh2$secondaryArchSuffix + lib:libssl$secondaryArchSuffix + lib:libz$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + devel:libcrypto$secondaryArchSuffix + devel:libcurl$secondaryArchSuffix + devel:libgit2$secondaryArchSuffix + devel:libssh2$secondaryArchSuffix + devel:libssl$secondaryArchSuffix + devel:libz$secondaryArchSuffix + " +BUILD_PREREQUIRES=" + cmd:cargo$secondaryArchSuffix + cmd:gcc$secondaryArchSuffix + cmd:pkg_config$secondaryArchSuffix + " + +BUILD() +{ + cp $sourceDir2/Cargo.lock Cargo.lock + + cargo fetch --locked +} + +INSTALL() +{ + cargo install --locked --root $prefix --path . + + rm -f $prefix/{.crates.toml,.crates2.json} +} + +TEST() +{ + cargo test --release +} diff --git a/dev-rust/cargo_c/patches/cargo_c-0.9.8.patchset b/dev-rust/cargo_c/patches/cargo_c-0.9.8.patchset new file mode 100644 index 000000000..2ce1ef6bb --- /dev/null +++ b/dev-rust/cargo_c/patches/cargo_c-0.9.8.patchset @@ -0,0 +1,60 @@ +From d749dcc1b6a4fe8aee785def086a6fdbc9bec9bb Mon Sep 17 00:00:00 2001 +From: begasus +Date: Mon, 6 Jun 2022 08:36:19 +0200 +Subject: Add support for Haiku + + +diff --git a/src/build_targets.rs b/src/build_targets.rs +index c0e5240..300af37 100644 +--- a/src/build_targets.rs ++++ b/src/build_targets.rs +@@ -81,7 +81,8 @@ impl BuildTargets { + | ("freebsd", _) + | ("dragonfly", _) + | ("netbsd", _) +- | ("android", _) => { ++ | ("android", _) ++ | ("haiku", _) => { + let static_lib = targetdir.join(&format!("lib{}.a", lib_name)); + let shared_lib = targetdir.join(&format!("lib{}.so", lib_name)); + (shared_lib, static_lib, None, None) +diff --git a/src/install.rs b/src/install.rs +index f958c72..864c627 100644 +--- a/src/install.rs ++++ b/src/install.rs +@@ -84,9 +84,12 @@ impl LibType { + let env = &target.env; + + match (os.as_str(), env.as_str()) { +- ("linux", _) | ("freebsd", _) | ("dragonfly", _) | ("netbsd", _) | ("android", _) => { +- LibType::So +- } ++ ("linux", _) ++ | ("freebsd", _) ++ | ("dragonfly", _) ++ | ("netbsd", _) ++ | ("android", _) ++ | ("haiku", _) => LibType::So, + ("macos", _) | ("ios", _) => LibType::Dylib, + ("windows", _) => LibType::Windows, + _ => unimplemented!("The target {}-{} is not supported yet", os, env), +diff --git a/src/target.rs b/src/target.rs +index 79ab283..f447f2d 100644 +--- a/src/target.rs ++++ b/src/target.rs +@@ -72,7 +72,11 @@ impl Target { + if os == "android" { + lines.push(format!("-Wl,-soname,lib{}.so", lib_name)); + } else if env != "musl" +- && (os == "linux" || os == "freebsd" || os == "dragonfly" || os == "netbsd") ++ && (os == "linux" ++ || os == "freebsd" ++ || os == "dragonfly" ++ || os == "netbsd" ++ || os == "haiku") + { + lines.push(format!("-Wl,-soname,lib{}.so.{}", lib_name, major)); + } else if os == "macos" || os == "ios" { +-- +2.36.1 +