Debian Codegraph @

debian/patches/use-system-isal.patch

raw
1 Index: isal-sys/Cargo.toml
2 ===================================================================
3 --- isal-sys.orig/Cargo.toml
4 +++ isal-sys/Cargo.toml
5 @@ -33,18 +33,10 @@ path = "src/lib.rs"
6 [dependencies]
7
8 [build-dependencies.bindgen]
9 -version = "^0.69"
10 +version = "^0.72"
11 optional = true
12
13 -[build-dependencies.cc]
14 -version = "^1"
15 -
16 -[build-dependencies.copy_dir]
17 -version = "0.1.3"
18 -
19 [features]
20 -default = ["static"]
21 +default = ["use-system-isal"]
22 regenerate-bindings = ["dep:bindgen"]
23 -shared = []
24 -static = []
25 use-system-isal = []
26 Index: isal-sys/build.rs
27 ===================================================================
28 --- isal-sys.orig/build.rs
29 +++ isal-sys/build.rs
30 @@ -1,123 +1,9 @@
31 use std::path::PathBuf;
32 -use std::{
33 - io::{self, Write},
34 - process::{Command, Stdio},
35 -};
36
37 fn main() {
38 println!("cargo:rerun-if-changed=build.rs");
39
40 - let is_static = cfg!(feature = "static");
41 - let is_shared = cfg!(feature = "shared");
42 - let target = std::env::var("TARGET").unwrap();
43 - let out_dir = PathBuf::from(&std::env::var("OUT_DIR").unwrap());
44 -
45 - // Copy isa-l source into out; not allow to modify things outside of out dir
46 - let src_dir = out_dir.join("isa-l");
47 - if src_dir.exists() {
48 - std::fs::remove_dir_all(&src_dir).unwrap(); // maybe from a previous build
49 - }
50 - copy_dir::copy_dir("isa-l", &src_dir).unwrap();
51 -
52 - let install_path = std::env::var("ISAL_INSTALL_PREFIX")
53 - .map(|p| PathBuf::from(&p).clone())
54 - .unwrap_or(out_dir.clone());
55 -
56 - let current_dir = std::env::current_dir().unwrap();
57 - std::env::set_current_dir(&src_dir).unwrap();
58 -
59 - // build from source
60 - #[cfg(not(feature = "use-system-isal"))]
61 - {
62 - #[cfg(not(target_os = "windows"))]
63 - let cmd = {
64 - let status = Command::new("./autogen.sh")
65 - .stdout(Stdio::piped())
66 - .stderr(Stdio::piped())
67 - .output()
68 - .unwrap();
69 - io::stdout().write_all(&status.stdout).unwrap();
70 - io::stderr().write_all(&status.stderr).unwrap();
71 - if !status.status.success() {
72 - panic!("autogen failed");
73 - }
74 -
75 - let compiler = cc::Build::new().get_compiler();
76 - let cflags = compiler.cflags_env().into_string().unwrap();
77 -
78 - let mut configure_args = vec![
79 - format!("--prefix={}", install_path.display()),
80 - format!("--host={}", target),
81 - format!("--enable-static={}", if is_static { "yes" } else { "no" }),
82 - format!("--enable-shared={}", if is_shared { "yes" } else { "no" }),
83 - format!("CFLAGS={}", cflags),
84 - format!("CC={}", compiler.path().display()),
85 - ];
86 -
87 - if !cfg!(target_os = "macos") {
88 - let ldflag = if is_static { "static" } else { "shared" };
89 - configure_args.push(format!("LDFLAGS=-{}", ldflag));
90 - configure_args.push("--with-pic=yes".to_string());
91 - }
92 -
93 - let status = Command::new("./configure")
94 - .args(&configure_args)
95 - .stdout(Stdio::piped())
96 - .stderr(Stdio::piped())
97 - .output()
98 - .unwrap();
99 - io::stdout().write_all(&status.stdout).unwrap();
100 - io::stderr().write_all(&status.stderr).unwrap();
101 - if !status.status.success() {
102 - panic!("configure failed");
103 - }
104 -
105 - Command::new("make")
106 - .args(&["install-libLTLIBRARIES"])
107 - .stdout(Stdio::piped())
108 - .stderr(Stdio::piped())
109 - .spawn()
110 - };
111 -
112 - #[cfg(target_os = "windows")]
113 - let mut cmd = {
114 - Command::new("nmake")
115 - .args(["-f", "Makefile.nmake"])
116 - .stdout(Stdio::piped())
117 - .stderr(Stdio::piped())
118 - .spawn()
119 - };
120 -
121 - std::env::set_current_dir(&current_dir).unwrap();
122 -
123 - let output = cmd.unwrap().wait_with_output().unwrap();
124 - io::stdout().write_all(&output.stdout).unwrap();
125 - io::stderr().write_all(&output.stderr).unwrap();
126 - if !output.status.success() {
127 - panic!("Building isa-l failed");
128 - }
129 - }
130 -
131 - let libname = if cfg!(target_os = "windows") {
132 - println!("cargo:rustc-link-search=native={}", src_dir.display());
133 - if cfg!(feature = "static") {
134 - "isa-l_static"
135 - } else {
136 - "isa-l"
137 - }
138 - } else {
139 - for subdir in ["bin", "lib", "lib64"] {
140 - let search_path = install_path.join(subdir);
141 - println!("cargo:rustc-link-search=native={}", search_path.display());
142 - }
143 - "isal"
144 - };
145 -
146 - #[cfg(feature = "static")]
147 - println!("cargo:rustc-link-lib=static={}", libname);
148 -
149 - #[cfg(feature = "shared")]
150 - println!("cargo:rustc-link-lib={}", libname);
151 + println!("cargo:rustc-link-lib=isal");
152
153 #[cfg(feature = "regenerate-bindings")]
154 {
155 @@ -125,7 +11,7 @@ fn main() {
156 bindgen::Builder::default()
157 // The input header we would like to generate
158 // bindings for.
159 - .header("isa-l/include/igzip_lib.h")
160 + .header("/usr/include/isa-l/igzip_lib.h")
161 // Tell cargo to invalidate the built crate whenever any of the
162 // included header files changed.
163 .parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))