[build] Compile BoringSSL as PIC (CMAKE_POSITION_INDEPENDENT_CODE)
Closes #3
Change-Id: Ie3cbb3a25a1263fb74f4ee489b68707189ae999f
diff --git a/boringssl/boringssl b/boringssl/boringssl
index e6eef1c..892a31b 160000
--- a/boringssl/boringssl
+++ b/boringssl/boringssl
@@ -1 +1 @@
-Subproject commit e6eef1ca16a022e476bbaedffef044597cfc8f4b
+Subproject commit 892a31b5fb6f621903681f4f597156e3db3526fe
diff --git a/build.rs b/build.rs
index 6662e83..1af1bd1 100644
--- a/build.rs
+++ b/build.rs
@@ -49,6 +49,12 @@
let built_with = built_with(&abs_build_dir_1);
let have_ninja = have_ninja();
let build = |build_dir, flags: &[&str]| {
+ // Add CMAKE_POSITION_INDEPENDENT_CODE=1 to the list of CMake variables.
+ // This causes compilation with -fPIC, which is required on some
+ // platforms. This was added to address
+ // https://github.com/google/mundane/issues/3
+ let mut flags = flags.to_vec();
+ flags.push("-DCMAKE_POSITION_INDEPENDENT_CODE=1");
fn with_ninja<'a, 'b>(flags: &'a [&'b str]) -> Vec<&'b str> {
let mut flags = flags.to_vec();
flags.push("-GNinja");
@@ -63,19 +69,19 @@
// introducing the complexity necessary to support that use case.
match built_with {
Some(BuildSystem::Ninja) => {
- run("cmake", &with_ninja(flags));
+ run("cmake", &with_ninja(&flags));
run("ninja", &["crypto"]);
}
Some(BuildSystem::Make) => {
- run("cmake", flags);
+ run("cmake", &flags);
run("make", &["crypto"]);
}
None => {
if have_ninja {
- run("cmake", &with_ninja(flags));
+ run("cmake", &with_ninja(&flags));
run("ninja", &["crypto"]);
} else {
- run("cmake", flags);
+ run("cmake", &flags);
run("make", &["crypto"]);
}
}