11use std:: collections:: HashMap ;
2+ use std:: hash:: { DefaultHasher , Hash , Hasher } ;
23use std:: io:: Read ;
34use std:: path:: { Path , PathBuf } ;
45use std:: sync:: atomic:: { AtomicBool , Ordering } ;
@@ -235,6 +236,7 @@ struct FingerPrint {
235236 build_targets : BuildTargets ,
236237 install_paths : InstallPaths ,
237238 static_libs : String ,
239+ hasher : DefaultHasher ,
238240}
239241
240242#[ derive( serde:: Serialize , serde:: Deserialize ) ]
@@ -249,21 +251,24 @@ impl FingerPrint {
249251 root_output : & Path ,
250252 build_targets : & BuildTargets ,
251253 install_paths : & InstallPaths ,
254+ capi_config : & CApiConfig ,
252255 ) -> Self {
256+ let mut hasher = DefaultHasher :: new ( ) ;
257+
258+ capi_config. hash ( & mut hasher) ;
259+
253260 Self {
254261 id : id. to_owned ( ) ,
255262 root_output : root_output. to_owned ( ) ,
256263 build_targets : build_targets. clone ( ) ,
257264 install_paths : install_paths. clone ( ) ,
258265 static_libs : String :: new ( ) ,
266+ hasher,
259267 }
260268 }
261269
262270 fn hash ( & self ) -> anyhow:: Result < Option < String > > {
263- use std:: collections:: hash_map:: DefaultHasher ;
264- use std:: hash:: { Hash , Hasher } ;
265-
266- let mut hasher = DefaultHasher :: new ( ) ;
271+ let mut hasher = self . hasher . clone ( ) ;
267272 self . install_paths . hash ( & mut hasher) ;
268273
269274 let mut paths: Vec < & PathBuf > = Vec :: new ( ) ;
@@ -324,23 +329,23 @@ impl FingerPrint {
324329 }
325330}
326331
327- #[ derive( Debug ) ]
332+ #[ derive( Debug , Hash ) ]
328333pub struct CApiConfig {
329334 pub header : HeaderCApiConfig ,
330335 pub pkg_config : PkgConfigCApiConfig ,
331336 pub library : LibraryCApiConfig ,
332337 pub install : InstallCApiConfig ,
333338}
334339
335- #[ derive( Debug ) ]
340+ #[ derive( Debug , Hash ) ]
336341pub struct HeaderCApiConfig {
337342 pub name : String ,
338343 pub subdirectory : String ,
339344 pub generation : bool ,
340345 pub enabled : bool ,
341346}
342347
343- #[ derive( Debug ) ]
348+ #[ derive( Debug , Hash ) ]
344349pub struct PkgConfigCApiConfig {
345350 pub name : String ,
346351 pub filename : String ,
@@ -351,14 +356,14 @@ pub struct PkgConfigCApiConfig {
351356 pub strip_include_path_components : usize ,
352357}
353358
354- #[ derive( Debug ) ]
359+ #[ derive( Debug , Hash ) ]
355360pub enum VersionSuffix {
356361 Major ,
357362 MajorMinor ,
358363 MajorMinorPatch ,
359364}
360365
361- #[ derive( Debug ) ]
366+ #[ derive( Debug , Hash ) ]
362367pub struct LibraryCApiConfig {
363368 pub name : String ,
364369 pub version : Version ,
@@ -388,19 +393,19 @@ impl LibraryCApiConfig {
388393 }
389394}
390395
391- #[ derive( Debug , Default ) ]
396+ #[ derive( Debug , Default , Hash ) ]
392397pub struct InstallCApiConfig {
393398 pub include : Vec < InstallTarget > ,
394399 pub data : Vec < InstallTarget > ,
395400}
396401
397- #[ derive( Debug ) ]
402+ #[ derive( Debug , Hash ) ]
398403pub enum InstallTarget {
399404 Asset ( InstallTargetPaths ) ,
400405 Generated ( InstallTargetPaths ) ,
401406}
402407
403- #[ derive( Clone , Debug ) ]
408+ #[ derive( Clone , Debug , Hash ) ]
404409pub struct InstallTargetPaths {
405410 /// pattern to feed to glob::glob()
406411 ///
@@ -980,7 +985,13 @@ impl CPackage {
980985 args. get_flag ( "meson" ) ,
981986 ) ?;
982987
983- let finger_print = FingerPrint :: new ( & id, root_output, & build_targets, & install_paths) ;
988+ let finger_print = FingerPrint :: new (
989+ & id,
990+ root_output,
991+ & build_targets,
992+ & install_paths,
993+ & capi_config,
994+ ) ;
984995
985996 Ok ( CPackage {
986997 version,
0 commit comments