(#491): rsvg_internals: Don't require environment variables when building as rust crate

For the libtool case, when we are building rsvg_internals as part of
the C library, we *do* need the libtool stuff in
generate_convenience_lib().  In this case, that function needs to know
LIBRSVG_BUILD_DIR and LIBRSVG_TARGET_DIR.

However, when building rsvg_internals as part of the standalone
librsvg_crate, those variables are not needed, since that compilation
scheme doesn't use libtool.

Fixes #491
parent ea761422
......@@ -3,21 +3,20 @@ use std::fs::File;
use std::io::{BufWriter, Write};
use std::path::Path;
#[cfg(unix)]
#[cfg(all(unix, feature = "c-library"))]
use std::os::unix::fs::symlink;
#[cfg(all(windows, not(target_env = "msvc")))]
#[cfg(all(windows, not(target_env = "msvc"), feature="c-library"))]
use std::os::windows::fs::symlink_file as symlink;
#[cfg(not(target_env = "msvc"))]
#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
use std::fs;
#[cfg(not(target_env = "msvc"))]
#[cfg(all(not(target_env = "msvc"), feature="c-library"))]
use std::path::PathBuf;
fn main() {
generate_srgb_tables();
#[cfg(not (target_env = "msvc"))]
generate_convenience_lib().unwrap();
}
......@@ -80,7 +79,7 @@ fn generate_srgb_tables() {
/// Generate libtool archive file librsvg_internals.la
/// From: https://docs.rs/libtool/0.1.1/libtool/
#[cfg(not (target_env = "msvc"))]
#[cfg(all(feature = "c-library", not(target_env = "msvc")))]
pub fn generate_convenience_lib() -> std::io::Result<()> {
let target = env::var("TARGET").expect("TARGET was not set");
let build_dir = env::var("LIBRSVG_BUILD_DIR").expect("LIBRSVG_BUILD_DIR was not set");
......@@ -124,3 +123,8 @@ pub fn generate_convenience_lib() -> std::io::Result<()> {
symlink(&old_lib_path, &new_lib_path)?;
Ok(())
}
#[cfg(not(all(feature = "c-library", not(target_env = "msvc"))))]
pub fn generate_convenience_lib() -> std::io::Result<()> {
Ok(())
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment