#1 Remove unused *-sys dependencies
Closed 2 years ago by decathorpe. Opened 5 years ago by hvenev.
https://git.venev.name/hristo/fedora/rust-curl-sys.git master  into  rawhide

Remove unused *-sys dependencies
Hristo Venev • 5 years ago  
curl-sys-fix-metadata.diff
file modified
+13 -10
@@ -1,6 +1,6 @@

- --- curl-sys-0.4.15/Cargo.toml	1969-12-31T16:00:00-08:00

- +++ curl-sys-0.4.15/Cargo.toml	2018-11-09T17:37:46.873564-08:00

- @@ -28,10 +28,6 @@

+ --- curl-sys-0.4.17/Cargo.toml	1970-01-01T02:00:00+02:00

+ +++ curl-sys-0.4.17/Cargo.toml	2019-03-18T16:54:38.982805+02:00

+ @@ -28,12 +28,6 @@

   [dependencies.libc]

   version = "0.2.2"

   
@@ -8,10 +8,12 @@

  -version = "0.1"

  -optional = true

  -

-  [dependencies.libz-sys]

-  version = "1.0.18"

+ -[dependencies.libz-sys]

+ -version = "1.0.18"

   [build-dependencies.cc]

- @@ -42,20 +38,12 @@

+  version = "1.0"

+  

+ @@ -42,20 +36,9 @@

   

   [features]

   default = ["ssl"]
@@ -19,17 +21,18 @@

  -http2 = ["libnghttp2-sys"]

  +http2 = []

   spnego = []

-  ssl = ["openssl-sys"]

+ -ssl = ["openssl-sys"]

  -static-curl = []

  -static-ssl = ["openssl-sys/vendored"]

-  [target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys]

-  version = "0.9"

-  optional = true

+ -[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies.openssl-sys]

+ -version = "0.9"

+ -optional = true

  -[target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg]

  -version = "0.2"

  -[target."cfg(windows)".dependencies.winapi]

  -version = "0.3"

  -features = ["winsock2", "ws2def"]

+ +ssl = []

   [badges.appveyor]

   repository = "alexcrichton/curl-rust"

   

curl-sys-remove-unused-deps.diff curl-sys-remove-libnghttp2-sys.diff
file renamed
+9 -4
@@ -1,7 +1,12 @@

- --- curl-sys-0.4.9/lib.rs.orig	2018-09-12 12:59:06.000000000 -0700

- +++ curl-sys-0.4.9/lib.rs	2018-09-13 13:12:04.228581344 -0700

- @@ -7,8 +7,6 @@ extern crate libz_sys;

-  extern crate openssl_sys;

+ --- a/lib.rs

+ +++ b/lib.rs

+ @@ -2,13 +2,8 @@

+  #![doc(html_root_url = "https://docs.rs/curl-sys/0.3")]

+  

+  extern crate libc;

+ -extern crate libz_sys;

+ -#[cfg(all(unix, not(target_os = "macos"), feature = "ssl"))]

+ -extern crate openssl_sys;

   #[cfg(windows)]

   extern crate winapi;

  -#[cfg(feature = "http2")]

rust-curl-sys.spec
file modified
+6 -17
@@ -7,7 +7,7 @@

  

  Name:           rust-%{crate}

  Version:        0.4.17

- Release:        1%{?dist}

+ Release:        2%{?dist}

  Summary:        Native bindings to the libcurl library

  

  License:        MIT
@@ -16,17 +16,15 @@

  # Initial patched metadata

  # * No windows

  # * No "static" features

- # * libnghttp2-sys is only needed for bundled curl

+ # * *-sys is only needed for bundled curl

  Patch0:         curl-sys-fix-metadata.diff

- Patch1:         curl-sys-remove-libnghttp2-sys.diff

+ Patch1:         curl-sys-remove-unused-deps.diff

  

  ExclusiveArch:  %{rust_arches}

  

  BuildRequires:  rust-packaging

  BuildRequires:  (crate(cc/default) >= 1.0.0 with crate(cc/default) < 2.0.0)

  BuildRequires:  (crate(libc/default) >= 0.2.2 with crate(libc/default) < 0.3.0)

- BuildRequires:  (crate(libz-sys/default) >= 1.0.18 with crate(libz-sys/default) < 2.0.0)

- BuildRequires:  (crate(openssl-sys/default) >= 0.9.0 with crate(openssl-sys/default) < 0.10.0)

  BuildRequires:  (crate(pkg-config/default) >= 0.3.3 with crate(pkg-config/default) < 0.4.0)

  BuildRequires:  pkgconfig(libcurl)

  
@@ -73,18 +71,6 @@

  %files       -n %{name}+http2-devel

  %ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml

  

- %package     -n %{name}+openssl-sys-devel

- Summary:        %{summary}

- BuildArch:      noarch

- 

- %description -n %{name}+openssl-sys-devel %{_description}

- 

- This package contains library source intended for building other packages

- which use "openssl-sys" feature of "%{crate}" crate.

- 

- %files       -n %{name}+openssl-sys-devel

- %ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml

- 

  %package     -n %{name}+spnego-devel

  Summary:        %{summary}

  BuildArch:      noarch
@@ -127,6 +113,9 @@

  %endif

  

  %changelog

+ * Thu Mar 28 2019 Hristo Venev <hristo@venev.name> - 0.4.17-2

+ - Remove unused *-sys dependencies

+ 

  * Wed Mar 13 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.4.17-1

  - Update to 0.4.17

  

no initial comment

libz-sys and libnghttp2-sys are only used so that the corresponding C libraries are linked against the bundled static libcurl (which is not built).

We probably need to put proper patch for upstream so that we don't patch code at all.

The problem is that whether the bundled curl is used is decided during build time after features (and dependencies) have been set.

If we convinced upstream to not automagically build curl if they can't find the system one, the problem remains: Cargo optional dependencies are only of the form

  • single-feature -> feature
  • single-feature -> package
  • single-feature -> package AND package-with-feature

What we want is something like
static-curl AND ssl -> openssl-sys

which cannot be expressed at the moment.

Apparently it is possible, as shown in https://github.com/rustgd/collision-rs/blob/master/Cargo.toml

I'll test that and try to upstream it.

That didn't work. Features are not set when evaulating target.'cfg(...)'.dependencies.

This has been fixed for a while.

Pull-Request has been closed by decathorpe

2 years ago