3 %bcond_without system_libgit2 # use system installed libgit2
5 Summary: Helper program to build and install C-like libraries
6 Summary(pl.UTF-8): Program pomocniczy do budowania i instalowania bibliotek w stylu C
11 Group: Development/Tools
12 #Source0Download: https://github.com/lu-zero/cargo-c/releases
13 Source0: https://github.com/lu-zero/cargo-c/archive/v%{version}/%{name}-%{version}.tar.gz
14 # Source0-md5: 522cbf41d76cc9b8fb51e5d103b16114
15 # cd %{name}-%{version}
18 # tar cJf cargo-c-crates-%{version}.tar.xz %{name}-%{version}/{vendor,Cargo.lock}
19 Source1: %{name}-crates-%{version}.tar.xz
20 # Source1-md5: 9f752947a78204fc44f77b9466a5d125
21 URL: https://github.com/lu-zero/cargo-c
22 BuildRequires: cargo >= 0.45
23 BuildRequires: curl-devel
24 %if %{with system_libgit2}
25 BuildRequires: libgit2-devel < 1.8.0
26 BuildRequires: libgit2-devel >= 1.7.1
28 BuildRequires: libssh2-devel
29 BuildRequires: openssl-devel
30 BuildRequires: pkgconfig
31 BuildRequires: rpmbuild(macros) >= 2.005
33 BuildRequires: tar >= 1:1.22
35 BuildRequires: zlib-devel
36 %{?with_system_libgit2:Requires: libgit2 >= 1.7.1}
37 ExclusiveArch: %{rust_arches}
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40 %define _debugsource_packages 0
42 %define target_opt --target x86_64-unknown-linux-gnux32
44 %define target_opt %{nil}
48 Cargo subcommands to build and install C-ABI compatible dynamic and
51 %description -l pl.UTF-8
52 Podpolecenia Cargo do budowania i instalowania zgodnych z ABI C
53 bibliotek dynamicznych i statycznych.
59 # curl 7.83.1 vendor/curl-sys/curl
60 # libgit2 1.5.0-alpha vendor/libgit2-sys/libgit2
61 # nghttp2 1.45.0 vendor/libnghttp2-sys/nghttp2 (but system nghttp2 is not supported in rust)
62 # libssh 1.10-dev vendor/libssh2-sys/libssh2
63 # zlib 1.2.11 vendor/libz-sys/src/zlib
65 # use our offline registry
66 export CARGO_HOME="$(pwd)/.cargo"
68 mkdir -p "$CARGO_HOME"
69 cat >.cargo/config <<EOF
71 replace-with = 'vendored-sources'
73 [source.vendored-sources]
74 directory = '$PWD/vendor'
78 export CARGO_HOME="$(pwd)/.cargo"
79 export LIBSSH2_SYS_USE_PKG_CONFIG=1
80 export PKG_CONFIG_ALLOW_CROSS=1
82 cargo -vv build --release --frozen %{target_opt}
85 rm -rf $RPM_BUILD_ROOT
86 export CARGO_HOME="$(pwd)/.cargo"
87 export LIBSSH2_SYS_USE_PKG_CONFIG=1
88 export PKG_CONFIG_ALLOW_CROSS=1
90 cargo -vv install --frozen %{target_opt} \
92 --root $RPM_BUILD_ROOT%{_prefix}
94 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
97 rm -rf $RPM_BUILD_ROOT
100 %defattr(644,root,root,755)
101 %doc LICENSE README.md
102 %attr(755,root,root) %{_bindir}/cargo-capi
103 %attr(755,root,root) %{_bindir}/cargo-cbuild
104 %attr(755,root,root) %{_bindir}/cargo-cinstall
105 %attr(755,root,root) %{_bindir}/cargo-ctest