]> git.pld-linux.org Git - packages/cargo-c.git/blob - cargo-c.spec
up to 0.9.29
[packages/cargo-c.git] / cargo-c.spec
1 #
2 # Conditional build:
3 %bcond_without  system_libgit2          # use system installed libgit2
4
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
7 Name:           cargo-c
8 Version:        0.9.29
9 Release:        1
10 License:        MIT
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}
16 # cargo vendor
17 # cd ..
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
27 %endif
28 BuildRequires:  libssh2-devel
29 BuildRequires:  openssl-devel
30 BuildRequires:  pkgconfig
31 BuildRequires:  rpmbuild(macros) >= 2.005
32 BuildRequires:  rust
33 BuildRequires:  tar >= 1:1.22
34 BuildRequires:  xz
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)
39
40 %define         _debugsource_packages   0
41 %ifarch x32
42 %define         target_opt      --target x86_64-unknown-linux-gnux32
43 %else
44 %define         target_opt      %{nil}
45 %endif
46
47 %description
48 Cargo subcommands to build and install C-ABI compatible dynamic and
49 static libraries.
50
51 %description -l pl.UTF-8
52 Podpolecenia Cargo do budowania i instalowania zgodnych z ABI C
53 bibliotek dynamicznych i statycznych.
54
55 %prep
56 %setup -q -b1
57
58 # bundled:
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
64
65 # use our offline registry
66 export CARGO_HOME="$(pwd)/.cargo"
67
68 mkdir -p "$CARGO_HOME"
69 cat >.cargo/config <<EOF
70 [source.crates-io]
71 replace-with = 'vendored-sources'
72
73 [source.vendored-sources]
74 directory = '$PWD/vendor'
75 EOF
76
77 %build
78 export CARGO_HOME="$(pwd)/.cargo"
79 export LIBSSH2_SYS_USE_PKG_CONFIG=1
80 export PKG_CONFIG_ALLOW_CROSS=1
81
82 cargo -vv build --release --frozen %{target_opt}
83
84 %install
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
89
90 cargo -vv install --frozen %{target_opt} \
91         --path . \
92         --root $RPM_BUILD_ROOT%{_prefix}
93
94 %{__rm} $RPM_BUILD_ROOT%{_prefix}/.crates*
95
96 %clean
97 rm -rf $RPM_BUILD_ROOT
98
99 %files
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
This page took 0.10491 seconds and 4 git commands to generate.