@@ -21,12 +21,13 @@ use std::env;
2121use std:: path:: { Path , PathBuf } ;
2222
2323fn link_libraries ( ) {
24- // TODO: Link to system Arrow, `libarrow` is under `/usr/lib/x86_64-linux-gnu/` on Ubuntu
25- println ! ( "cargo:rustc-link-search=native=/usr/lib/x86_64-linux-gnu/" ) ;
26- println ! ( "cargo:rustc-link-lib=dylib=arrow_compute" ) ;
27- println ! ( "cargo:rustc-link-lib=dylib=arrow_dataset" ) ;
28- println ! ( "cargo:rustc-link-lib=dylib=arrow_acero" ) ;
29- println ! ( "cargo:rustc-link-lib=dylib=arrow" ) ;
24+ println ! ( "cargo:rerun-if-env-changed=PKG_CONFIG_PATH" ) ;
25+
26+ let _arrow = pkg_config:: Config :: new ( )
27+ . statik ( false )
28+ . cargo_metadata ( true )
29+ . probe ( "arrow" )
30+ . expect ( "Arrow development files not found via pkg-config. Set PKG_CONFIG_PATH if needed." ) ;
3031
3132 println ! ( "cargo:rustc-link-lib=graphar" ) ;
3233}
@@ -63,6 +64,11 @@ fn build_graphar() -> Vec<PathBuf> {
6364 . define ( "CMAKE_BUILD_TYPE" , cmake_build_type)
6465 . define ( "GRAPHAR_BUILD_STATIC" , "ON" )
6566 . define ( "GRAPHAR_ENABLE_SANITIZER" , "OFF" ) ;
67+
68+ if let Ok ( prefix) = pkg_config:: get_variable ( "arrow" , "prefix" ) {
69+ build. define ( "CMAKE_PREFIX_PATH" , prefix) ;
70+ }
71+ println ! ( "cargo:rerun-if-env-changed=PKG_CONFIG_PATH" ) ;
6672 let build_dir = build. build ( ) ;
6773
6874 let lib_path = build_dir. join ( "build" ) ;
0 commit comments