Codebase list rust-stfu8 / 2bc9ee7
Update nitrokey to 3.4.3 Robin Krahl 5 years ago
6 changed file(s) with 52 addition(s) and 63 deletion(s). Raw diff Collapse all Expand all
0 rust-nitrokey-sys (3.4.1-2) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
0 rust-nitrokey-sys (3.4.3-1) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
11
2 * Team upload.
3
4 [ Robin Krahl ]
5 * Package nitrokey-sys 3.4.1 from crates.io using debcargo 2.2.9
2 * Package nitrokey-sys 3.4.3 from crates.io using debcargo 2.2.9
63 * Don't link against libhidapi-libusb since we don't directly use its symbols
74 (and libnitrokey already links against it, as it should).
85
9 -- Ximin Luo <infinity0@debian.org> Thu, 27 Dec 2018 14:51:23 -0800
6 -- Robin Krahl <robin.krahl@ireas.org> Sat, 19 Jan 2019 23:35:15 +0000
107
118 rust-nitrokey-sys (3.4.1-1) unstable; urgency=medium
129
88
99 Files: debian/*
1010 Copyright:
11 2018 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2018 Wolfgang Silbermayr <wolfgang@silbermayr.at>
11 2018-2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
12 2018-2019 Wolfgang Silbermayr <wolfgang@silbermayr.at>
13 2018-2019 Robin Krahl <robin.krahl@ireas.org>
1314 License: LGPL-3.0
1415
1516 License: LGPL-3.0
2020
2121 Files: debian/*
2222 Copyright:
23 2018 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
24 2018 Wolfgang Silbermayr <wolfgang@silbermayr.at>
23 2018-2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
24 2018-2019 Wolfgang Silbermayr <wolfgang@silbermayr.at>
25 2018-2019 Robin Krahl <robin.krahl@ireas.org>
2526 License: LGPL-3.0
2627
2728 License: LGPL-3.0
00 overlay = "."
1 uploaders = ["Wolfgang Silbermayr <wolfgang@silbermayr.at>"]
1 uploaders = ["Wolfgang Silbermayr <wolfgang@silbermayr.at>", "Robin Krahl <robin.krahl@ireas.org>"]
22
33 excludes = ["libnitrokey-*"]
44
1010 ===================================================================
1111 --- nitrokey-sys.orig/build.rs
1212 +++ nitrokey-sys/build.rs
13 @@ -1,104 +1,3 @@
14 -extern crate cc;
15 -
13 @@ -1,94 +1,3 @@
1614 -use std::env;
15 -use std::fs;
1716 -use std::io;
1817 -use std::io::{Read, Write};
19 -use std::fs;
2018 -use std::path;
19 -use std::string;
2120 -
21 -use cc;
22 -
23 -#[derive(Clone, Copy, Debug, PartialEq)]
2224 -struct Version {
23 - major: String,
24 - minor: String,
25 - git: String,
25 - major: u32,
26 - minor: u32,
27 - patch: Option<u32>,
2628 -}
2729 -
28 -fn stringify(err: env::VarError) -> String {
29 - format!("{}", err)
30 -impl string::ToString for Version {
31 - fn to_string(&self) -> String {
32 - match self.patch {
33 - Some(patch) => format!("v{}.{}.{}", self.major, self.minor, patch),
34 - None => format!("v{}.{}", self.major, self.minor),
35 - }
36 - }
3037 -}
3138 -
32 -fn extract_git_version(pre: &str) -> Result<String, String> {
33 - // If a pre-release version is set, it is expected to have the format
34 - // pre.v<maj>.<min>.<n>.g<hash>, where <maj> and <min> are the last major and minor version,
35 - // <n> is the number of commits since this version and <hash> is the hash of the last commit.
36 - let parts: Vec<&str> = pre.split('.').collect();
37 - if parts.len() != 5 {
38 - return Err(format!("'{}' is not a valid pre-release version", pre));
39 - }
40 - Ok(format!("{}.{}-{}-{}", parts[1], parts[2], parts[3], parts[4]))
41 -}
42 -
43 -fn get_version() -> Result<Version, String> {
44 - let major = env::var("CARGO_PKG_VERSION_MAJOR").map_err(stringify)?;
45 - let minor = env::var("CARGO_PKG_VERSION_MINOR").map_err(stringify)?;
46 - let patch = env::var("CARGO_PKG_VERSION_PATCH").map_err(stringify)?;
47 - let pre = env::var("CARGO_PKG_VERSION_PRE").map_err(stringify)?;
48 -
49 - let git = match pre.is_empty() {
50 - true => match patch.is_empty() {
51 - true => format!("v{}.{}", major, minor),
52 - false => format!("v{}.{}.{}", major, minor, patch),
53 - },
54 - false => extract_git_version(&pre)?,
55 - };
56 -
57 - Ok(Version {
58 - major,
59 - minor,
60 - git,
61 - })
62 -}
39 -const LIBNITROKEY_VERSION: Version = Version {
40 - major: 3,
41 - minor: 4,
42 - patch: Some(1),
43 -};
6344 -
6445 -fn prepare_version_source(
65 - version: &Version,
46 - version: Version,
6647 - out_path: &path::Path,
67 - library_path: &path::Path
48 - library_path: &path::Path,
6849 -) -> io::Result<path::PathBuf> {
6950 - let out = out_path.join("version.cc");
7051 - let template = library_path.join("version.cc.in");
7556 - drop(file);
7657 -
7758 - let data = data
78 - .replace("@PROJECT_VERSION_MAJOR@", &version.major)
79 - .replace("@PROJECT_VERSION_MINOR@", &version.minor)
80 - .replace("@PROJECT_VERSION_GIT@", &version.git);
59 - .replace("@PROJECT_VERSION_MAJOR@", &version.major.to_string())
60 - .replace("@PROJECT_VERSION_MINOR@", &version.minor.to_string())
61 - .replace("@PROJECT_VERSION_GIT@", &version.to_string());
8162 -
8263 - let mut file = fs::File::create(&out)?;
8364 - file.write_all(data.as_bytes())?;
8667 -}
8768 -
8869 fn main() {
70 - if env::var("USE_SYSTEM_LIBNITROKEY").is_ok() {
71 - println!("cargo:rustc-link-lib=nitrokey");
72 - return;
73 - }
74 -
8975 - let out_dir = env::var("OUT_DIR").expect("Environment variable OUT_DIR is not set");
9076 - let out_path = path::PathBuf::from(out_dir);
91 -
92 - let version = get_version().expect("Could not extract library version");
9377 -
9478 - let sources = [
9579 - "DeviceCommunicationExceptions.cpp",
10084 - "log.cc",
10185 - "misc.cc",
10286 - ];
103 - let library_dir = format!("libnitrokey-{}", version.git);
87 - let library_dir = format!("libnitrokey-{}", LIBNITROKEY_VERSION.to_string());
10488 - let library_path = path::Path::new(&library_dir);
10589 -
106 - let version_source = prepare_version_source(&version, &out_path, &library_path)
90 - let version_source = prepare_version_source(LIBNITROKEY_VERSION, &out_path, &library_path)
10791 - .expect("Could not prepare the version source file");
10892 -
10993 - cc::Build::new()
11094 - .cpp(true)
95 - .flag("-std=c++14")
11196 - .include(library_path.join("libnitrokey"))
11297 - .files(sources.iter().map(|s| library_path.join(s)))
11398 - .file(version_source)
11499 - .compile("libnitrokey.a");
115100 -
116 - println!("cargo:rustc-link-lib=hidapi-libusb");
117 + println!("cargo:rustc-link-lib=nitrokey");
101 - let hidapi_library_name = if cfg!(target_os = "linux") {
102 - "hidapi-libusb"
103 - } else {
104 - "hidapi"
105 - };
106 - println!("cargo:rustc-link-lib={}", hidapi_library_name);
107 + println!("cargo:rustc-link-lib=libnitrokey");
118108 }
11 ===================================================================
22 --- nitrokey-sys.orig/Cargo.toml
33 +++ nitrokey-sys/Cargo.toml
4 @@ -22,5 +22,3 @@ readme = "README.md"
4 @@ -23,5 +23,3 @@ readme = "README.md"
55 categories = ["external-ffi-bindings"]
66 license = "LGPL-3.0"
77 repository = "https://git.ireas.org/nitrokey-sys-rs/"