diff -Nru rust-libssh2-sys-0.2.8/build.rs rust-libssh2-sys-0.2.11/build.rs --- rust-libssh2-sys-0.2.8/build.rs 2018-07-13 20:30:35.000000000 +0000 +++ rust-libssh2-sys-0.2.11/build.rs 2018-09-13 21:39:32.000000000 +0000 @@ -1,12 +1,11 @@ extern crate pkg_config; -extern crate cmake; +extern crate cc; #[cfg(target_env = "msvc")] extern crate vcpkg; +use std::fs; use std::env; -use std::fs::File; -use std::io::prelude::*; use std::path::{PathBuf, Path}; use std::process::Command; @@ -15,9 +14,6 @@ return; } - register_dep("Z"); - register_dep("OPENSSL"); - // The system copy of libssh2 is not used by default because it // can lead to having two copies of libssl loaded at once. // See https://github.com/alexcrichton/ssh2-rs/pull/88 @@ -35,104 +31,125 @@ .status(); } - let mut cfg = cmake::Config::new("libssh2"); - let target = env::var("TARGET").unwrap(); + let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); + let mut cfg = cc::Build::new(); + + let include = dst.join("include"); + println!("cargo:include={}", include.display()); + println!("cargo:root={}", dst.display()); + let build = dst.join("build"); + cfg.out_dir(&build); + fs::create_dir_all(&build).unwrap(); + fs::create_dir_all(&include).unwrap(); + + fs::copy("libssh2/include/libssh2.h", include.join("libssh2.h")).unwrap(); + fs::copy("libssh2/include/libssh2_publickey.h", include.join("libssh2_publickey.h")).unwrap(); + fs::copy("libssh2/include/libssh2_sftp.h", include.join("libssh2_sftp.h")).unwrap(); + + cfg.file("libssh2/src/agent.c") + .file("libssh2/src/bcrypt_pbkdf.c") + .file("libssh2/src/blowfish.c") + .file("libssh2/src/channel.c") + .file("libssh2/src/comp.c") + .file("libssh2/src/crypt.c") + .file("libssh2/src/global.c") + .file("libssh2/src/hostkey.c") + .file("libssh2/src/keepalive.c") + .file("libssh2/src/kex.c") + .file("libssh2/src/knownhost.c") + .file("libssh2/src/mac.c") + .file("libssh2/src/misc.c") + .file("libssh2/src/packet.c") + .file("libssh2/src/pem.c") + .file("libssh2/src/publickey.c") + .file("libssh2/src/scp.c") + .file("libssh2/src/session.c") + .file("libssh2/src/sftp.c") + .file("libssh2/src/transport.c") + .file("libssh2/src/userauth.c") + .include(&include) + .include("libssh2/src"); + + cfg.define("HAVE_LONGLONG", None); - // Don't use OpenSSL on Windows, instead use the native Windows backend. if target.contains("windows") { - cfg.define("CRYPTO_BACKEND", "WinCNG"); + cfg.include("libssh2/win32"); + cfg.define("LIBSSH2_WINCNG", None); + cfg.file("libssh2/src/wincng.c"); } else { - cfg.define("CRYPTO_BACKEND", "OpenSSL"); - } - - // If libz-sys was built it'll give us an include directory to learn how to - // link to it, and for MinGW targets we just pass a dummy include dir to - // ensure it's detected (apparently it isn't otherwise?) - match env::var_os("DEP_Z_INCLUDE") { - Some(path) => { cfg.define("ZLIB_INCLUDE_DIR", path); } - None if target.contains("windows-gnu") => { - cfg.define("ZLIB_INCLUDE_DIR", "/"); - } - None => {} + cfg.flag("-fvisibility=hidden"); + cfg.define("HAVE_SNPRINTF", None); + cfg.define("HAVE_UNISTD_H", None); + cfg.define("HAVE_INTTYPES_H", None); + cfg.define("HAVE_STDLIB_H", None); + cfg.define("HAVE_SYS_SELECT_H", None); + cfg.define("HAVE_SYS_SOCKET_H", None); + cfg.define("HAVE_SYS_IOCTL_H", None); + cfg.define("HAVE_SYS_TIME_H", None); + cfg.define("HAVE_SYS_UN_H", None); + cfg.define("HAVE_O_NONBLOCK", None); + cfg.define("LIBSSH2_OPENSSL", None); + cfg.define("HAVE_LIBCRYPT32", None); + cfg.define("HAVE_EVP_AES_128_CTR", None); + + cfg.file("libssh2/src/openssl.c"); + + // Create `libssh2_config.h` + let config = fs::read_to_string("libssh2/src/libssh2_config_cmake.h.in") + .unwrap(); + let config = config.lines() + .filter(|l| !l.contains("#cmakedefine")) + .collect::>() + .join("\n"); + fs::write(build.join("libssh2_config.h"), &config).unwrap(); + cfg.include(&build); + } + + cfg.define("LIBSSH2_HAVE_ZLIB", None); + if let Some(path) = env::var_os("DEP_Z_INCLUDE") { + cfg.include(path); } if let Some(path) = env::var_os("DEP_OPENSSL_INCLUDE") { if let Some(path) = env::split_paths(&path).next() { if let Some(path) = path.to_str() { if path.len() > 0 { - cfg.define("OPENSSL_INCLUDE_DIR", path); + cfg.include(path); } } } } - // Homebrew deprecated OpenSSL and deliberately hides it from cmake, requiring such opt-in - if target.contains("darwin") && Path::new("/usr/local/opt/openssl/include/openssl/ssl.h").exists() { - cfg.define("OPENSSL_ROOT_DIR", "/usr/local/opt/openssl/"); - } - - let dst = cfg.define("BUILD_SHARED_LIBS", "OFF") - .define("ENABLE_ZLIB_COMPRESSION", "ON") - .define("CMAKE_INSTALL_LIBDIR", "lib") - .define("BUILD_EXAMPLES", "OFF") - .define("BUILD_TESTING", "OFF") - .register_dep("OPENSSL") - .register_dep("Z") - .build(); - - // Unfortunately the pkg-config file generated for libssh2 indicates - // that it depends on zlib, but most systems don't actually have a - // zlib.pc, so pkg-config will say that libssh2 doesn't exist. We - // generally take care of the zlib dependency elsewhere, so we just - // remove that part from the pkg-config file - let mut pc = String::new(); - let pkgconfig = dst.join("lib/pkgconfig/libssh2.pc"); - if let Ok(mut f) = File::open(&pkgconfig) { - f.read_to_string(&mut pc).unwrap();; - drop(f); - let pc = pc.replace(",zlib", ""); - let bytes = pc.as_bytes(); - File::create(pkgconfig).unwrap().write_all(bytes).unwrap(); - } + let libssh2h = fs::read_to_string("libssh2/include/libssh2.h").unwrap(); + let version_line = libssh2h.lines() + .find(|l| l.contains("LIBSSH2_VERSION")) + .unwrap(); + let version = &version_line[version_line.find('"').unwrap() + 1..version_line.len() - 1]; + + let pkgconfig = dst.join("lib/pkgconfig"); + fs::create_dir_all(&pkgconfig).unwrap(); + fs::write( + pkgconfig.join("libssh2.pc"), + fs::read_to_string("libssh2/libssh2.pc.in") + .unwrap() + .replace("@prefix@", dst.to_str().unwrap()) + .replace("@exec_prefix@", "") + .replace("@libdir@", dst.join("lib").to_str().unwrap()) + .replace("@includedir@", include.to_str().unwrap()) + .replace("@LIBS@", "") + .replace("@LIBSREQUIRED@", "") + .replace("@LIBSSH2VER@", version), + ).unwrap(); + + cfg.warnings(false); + cfg.compile("ssh2"); if target.contains("windows") { println!("cargo:rustc-link-lib=bcrypt"); println!("cargo:rustc-link-lib=crypt32"); println!("cargo:rustc-link-lib=user32"); } - - // msvc generates libssh2.lib, everywhere else generates libssh2.a - if target.contains("msvc") { - println!("cargo:rustc-link-lib=static=libssh2"); - } else { - println!("cargo:rustc-link-lib=static=ssh2"); - } - println!("cargo:rustc-link-search=native={}/lib", dst.display()); - println!("cargo:include={}/include", dst.display()); -} - -fn register_dep(dep: &str) { - if let Some(s) = env::var_os(&format!("DEP_{}_ROOT", dep)) { - prepend("PKG_CONFIG_PATH", Path::new(&s).join("lib/pkgconfig")); - return - } - if let Some(s) = env::var_os(&format!("DEP_{}_INCLUDE", dep)) { - let root = Path::new(&s).parent().unwrap(); - env::set_var(&format!("DEP_{}_ROOT", dep), root); - let path = root.join("lib/pkgconfig"); - if path.exists() { - prepend("PKG_CONFIG_PATH", path); - return - } - } -} - -fn prepend(var: &str, val: PathBuf) { - let prefix = env::var(var).unwrap_or(String::new()); - let mut v = vec![val]; - v.extend(env::split_paths(&prefix)); - env::set_var(var, &env::join_paths(v).unwrap()); } #[cfg(not(target_env = "msvc"))] diff -Nru rust-libssh2-sys-0.2.8/Cargo.toml rust-libssh2-sys-0.2.11/Cargo.toml --- rust-libssh2-sys-0.2.8/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 +++ rust-libssh2-sys-0.2.11/Cargo.toml 1970-01-01 00:00:00.000000000 +0000 @@ -12,7 +12,7 @@ [package] name = "libssh2-sys" -version = "0.2.8" +version = "0.2.11" authors = ["Alex Crichton "] build = "build.rs" links = "ssh2" @@ -27,13 +27,13 @@ version = "0.2" [dependencies.libz-sys] -version = "1.0.18" -[build-dependencies.cmake] -version = "0.1.2" +version = "1.0.21" +[build-dependencies.cc] +version = "1.0.25" [build-dependencies.pkg-config] version = "0.3.11" [target."cfg(target_env = \"msvc\")".build-dependencies.vcpkg] version = "0.2" [target."cfg(unix)".dependencies.openssl-sys] -version = "0.9" +version = "0.9.35" diff -Nru rust-libssh2-sys-0.2.8/Cargo.toml.orig rust-libssh2-sys-0.2.11/Cargo.toml.orig --- rust-libssh2-sys-0.2.8/Cargo.toml.orig 1970-01-01 00:00:00.000000000 +0000 +++ rust-libssh2-sys-0.2.11/Cargo.toml.orig 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +1,6 @@ [package] name = "libssh2-sys" -version = "0.2.8" +version = "0.2.11" authors = ["Alex Crichton "] links = "ssh2" build = "build.rs" @@ -13,15 +13,15 @@ path = "lib.rs" [dependencies] -libz-sys = "1.0.18" +libz-sys = "1.0.21" libc = "0.2" [target."cfg(unix)".dependencies] -openssl-sys = "0.9" +openssl-sys = "0.9.35" [build-dependencies] pkg-config = "0.3.11" -cmake = "0.1.2" +cc = "1.0.25" [target.'cfg(target_env = "msvc")'.build-dependencies] vcpkg = "0.2" diff -Nru rust-libssh2-sys-0.2.8/debian/cargo-checksum.json rust-libssh2-sys-0.2.11/debian/cargo-checksum.json --- rust-libssh2-sys-0.2.8/debian/cargo-checksum.json 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/cargo-checksum.json 2018-12-10 12:41:52.000000000 +0000 @@ -1 +1 @@ -{"package":"c628b499e8d1a4f4bd09a95d6cb1f8aeb231b46a9d40959bbd0408f14dd63adf","files":{}} +{"package":"Could not get crate checksum","files":{}} diff -Nru rust-libssh2-sys-0.2.8/debian/changelog rust-libssh2-sys-0.2.11/debian/changelog --- rust-libssh2-sys-0.2.8/debian/changelog 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/changelog 2018-12-10 12:41:52.000000000 +0000 @@ -1,3 +1,10 @@ +rust-libssh2-sys (0.2.11-1) unstable; urgency=medium + + * Team upload. + * Package libssh2-sys 0.2.11 from crates.io using debcargo 2.2.9 + + -- Matt Kraai Mon, 10 Dec 2018 04:41:52 -0800 + rust-libssh2-sys (0.2.8-1) unstable; urgency=medium * Package libssh2-sys 0.2.8 from crates.io using debcargo 2.2.5 diff -Nru rust-libssh2-sys-0.2.8/debian/control rust-libssh2-sys-0.2.11/debian/control --- rust-libssh2-sys-0.2.8/debian/control 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/control 2018-12-10 12:41:52.000000000 +0000 @@ -2,20 +2,21 @@ Section: rust Priority: optional Build-Depends: debhelper (>= 11), - dh-cargo (>= 6), + dh-cargo (>= 10), cargo:native , rustc:native , libstd-rust-dev , - librust-cmake-0.1+default-dev (>= 0.1.2~~) , + librust-cc-1+default-dev (>= 1.0.25-~~) , librust-libc-0.2+default-dev , - librust-libz-sys-1+default-dev (>= 1.0.18~~) , - librust-openssl-sys-0.9+default-dev , - librust-pkg-config-0.3+default-dev (>= 0.3.11~~) , + librust-libz-sys-1+default-dev (>= 1.0.21-~~) , + librust-openssl-sys-0.9+default-dev (>= 0.9.35-~~) , + librust-pkg-config-0.3+default-dev (>= 0.3.11-~~) , librust-vcpkg-0.2+default-dev , libssh2-1-dev Maintainer: Debian Rust Maintainers -Uploaders: Ximin Luo -Standards-Version: 4.1.5 +Uploaders: + Ximin Luo +Standards-Version: 4.2.0 Vcs-Git: https://salsa.debian.org/rust-team/debcargo-conf.git [src/libssh2-sys] Vcs-Browser: https://salsa.debian.org/rust-team/debcargo-conf/tree/master/src/libssh2-sys @@ -24,11 +25,11 @@ Multi-Arch: same Depends: ${misc:Depends}, - librust-cmake-0.1+default-dev (>= 0.1.2~~), + librust-cc-1+default-dev (>= 1.0.25-~~), librust-libc-0.2+default-dev, - librust-libz-sys-1+default-dev (>= 1.0.18~~), - librust-openssl-sys-0.9+default-dev, - librust-pkg-config-0.3+default-dev (>= 0.3.11~~), + librust-libz-sys-1+default-dev (>= 1.0.21-~~), + librust-openssl-sys-0.9+default-dev (>= 0.9.35-~~), + librust-pkg-config-0.3+default-dev (>= 0.3.11-~~), librust-vcpkg-0.2+default-dev, libssh2-1-dev Provides: @@ -37,8 +38,8 @@ librust-libssh2-sys-0+default-dev (= ${binary:Version}), librust-libssh2-sys-0.2-dev (= ${binary:Version}), librust-libssh2-sys-0.2+default-dev (= ${binary:Version}), - librust-libssh2-sys-0.2.8-dev (= ${binary:Version}), - librust-libssh2-sys-0.2.8+default-dev (= ${binary:Version}) + librust-libssh2-sys-0.2.11-dev (= ${binary:Version}), + librust-libssh2-sys-0.2.11+default-dev (= ${binary:Version}) Description: Native bindings to the libssh2 library - Rust source code This package contains the source for the Rust libssh2-sys crate, packaged by debcargo for use with cargo and dh-cargo. diff -Nru rust-libssh2-sys-0.2.8/debian/copyright.debcargo.hint rust-libssh2-sys-0.2.11/debian/copyright.debcargo.hint --- rust-libssh2-sys-0.2.8/debian/copyright.debcargo.hint 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/copyright.debcargo.hint 2018-12-10 12:41:52.000000000 +0000 @@ -15,7 +15,7 @@ Files: debian/* Copyright: 2018 Debian Rust Maintainers - 2018 FIXME (overlay) Your Name + 2018 Ximin Luo License: MIT or Apache-2.0 License: Apache-2.0 diff -Nru rust-libssh2-sys-0.2.8/debian/debcargo.toml rust-libssh2-sys-0.2.11/debian/debcargo.toml --- rust-libssh2-sys-0.2.8/debian/debcargo.toml 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/debcargo.toml 2018-12-10 12:41:52.000000000 +0000 @@ -1,4 +1,5 @@ overlay = "." +uploaders = ["Ximin Luo "] excludes = ["libssh2/**"] [packages.lib] diff -Nru rust-libssh2-sys-0.2.8/debian/patches/no-special-snowflake-env.patch rust-libssh2-sys-0.2.11/debian/patches/no-special-snowflake-env.patch --- rust-libssh2-sys-0.2.8/debian/patches/no-special-snowflake-env.patch 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/patches/no-special-snowflake-env.patch 2018-12-10 12:41:52.000000000 +0000 @@ -4,9 +4,11 @@ Forwarded: not-needed Last-Update: 2018-07-28 ---- a/build.rs -+++ b/build.rs -@@ -21,19 +21,20 @@ +Index: libssh2-sys/build.rs +=================================================================== +--- libssh2-sys.orig/build.rs ++++ libssh2-sys/build.rs +@@ -17,19 +17,20 @@ fn main() { // The system copy of libssh2 is not used by default because it // can lead to having two copies of libssl loaded at once. // See https://github.com/alexcrichton/ssh2-rs/pull/88 @@ -35,5 +37,5 @@ + // .status(); + // } - let mut cfg = cmake::Config::new("libssh2"); - + let target = env::var("TARGET").unwrap(); + let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap()); diff -Nru rust-libssh2-sys-0.2.8/debian/watch rust-libssh2-sys-0.2.11/debian/watch --- rust-libssh2-sys-0.2.8/debian/watch 2018-08-03 13:35:59.000000000 +0000 +++ rust-libssh2-sys-0.2.11/debian/watch 2018-12-10 12:41:52.000000000 +0000 @@ -1,4 +1,5 @@ version=4 -opts=filenamemangle=s/.*\/(.*)\/download/libssh2-sys-$1\.tar\.gz/g\ - https://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/libssh2-sys .*/crates/libssh2-sys/@ANY_VERSION@/download +opts=filenamemangle=s/.*\/(.*)\/download/libssh2-sys-$1\.tar\.gz/g,\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha)\d*)$/$1~$2/ \ +https://qa.debian.org/cgi-bin/fakeupstream.cgi?upstream=crates.io/libssh2-sys .*/crates/libssh2-sys/@ANY_VERSION@/download diff -Nru rust-libssh2-sys-0.2.8/lib.rs rust-libssh2-sys-0.2.11/lib.rs --- rust-libssh2-sys-0.2.8/lib.rs 2018-04-14 15:03:39.000000000 +0000 +++ rust-libssh2-sys-0.2.11/lib.rs 2018-08-05 15:15:03.000000000 +0000 @@ -136,7 +136,10 @@ pub const LIBSSH2_KNOWNHOST_KEY_RSA1: c_int = 1 << 18; pub const LIBSSH2_KNOWNHOST_KEY_SSHRSA: c_int = 2 << 18; pub const LIBSSH2_KNOWNHOST_KEY_SSHDSS: c_int = 3 << 18; -pub const LIBSSH2_KNOWNHOST_KEY_UNKNOWN: c_int = 7 << 18; +pub const LIBSSH2_KNOWNHOST_KEY_ECDSA_256: c_int = 4 << 18; +pub const LIBSSH2_KNOWNHOST_KEY_ECDSA_384: c_int = 5 << 18; +pub const LIBSSH2_KNOWNHOST_KEY_ECDSA_521: c_int = 6 << 18; +pub const LIBSSH2_KNOWNHOST_KEY_UNKNOWN: c_int = 15 << 18; pub const LIBSSH2_FXF_READ: c_ulong = 0x00000001; pub const LIBSSH2_FXF_WRITE: c_ulong = 0x00000002;