From ef9fbf9eba0692e2007ded5709465d7a38f87917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Sat, 24 Jul 2021 23:59:49 +0200 Subject: [PATCH] allow installing lib and include under different prefixes --- CMakeLists.txt | 6 +++++- deltachat-ffi/build.rs | 4 +++- deltachat-ffi/deltachat.pc.in | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d86b0d252..2140540ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,11 @@ add_custom_command( "target/release/libdeltachat.a" "target/release/libdeltachat.so" "target/release/pkgconfig/deltachat.pc" - COMMAND PREFIX=${CMAKE_INSTALL_PREFIX} ${CARGO} build --release --no-default-features + COMMAND + PREFIX=${CMAKE_INSTALL_PREFIX} + LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR} + INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR} + ${CARGO} build --release --no-default-features # Build in `deltachat-ffi` directory instead of using # `--package deltachat_ffi` to avoid feature resolver version diff --git a/deltachat-ffi/build.rs b/deltachat-ffi/build.rs index 0825c1645..a4273dfbf 100644 --- a/deltachat-ffi/build.rs +++ b/deltachat-ffi/build.rs @@ -22,7 +22,9 @@ fn main() { url = env::var("CARGO_PKG_HOMEPAGE").unwrap_or_else(|_| "".to_string()), version = env::var("CARGO_PKG_VERSION").unwrap(), libs_priv = libs_priv, - prefix = env::var("PREFIX").unwrap_or_else(|_| "/usr/local".to_string()), + prefix = env::var("PREFIX").unwrap(), + libdir = env::var("LIBDIR").unwrap(), + includedir = env::var("INCLUDEDIR").unwrap(), ); fs::create_dir_all(target_path.join("pkgconfig")).unwrap(); diff --git a/deltachat-ffi/deltachat.pc.in b/deltachat-ffi/deltachat.pc.in index 956948020..efe378f7f 100644 --- a/deltachat-ffi/deltachat.pc.in +++ b/deltachat-ffi/deltachat.pc.in @@ -1,6 +1,6 @@ prefix={prefix} -libdir=${{prefix}}/lib -includedir=${{prefix}}/include +libdir={libdir} +includedir={includedir} Name: {name} Description: {description}