diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-01-27 10:19:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-27 09:19:25 +0000 |
commit | bbba83927890b706d48e4cc5fe24671e595e39d7 (patch) | |
tree | 5636d0c46dffc38fc8ddcfe4b1cf5f8183b2e5cc /ports/jniapi/build.rs | |
parent | b10875956a3efe3c0a44763d80ad69fa0fc166fc (diff) | |
download | servo-bbba83927890b706d48e4cc5fe24671e595e39d7.tar.gz servo-bbba83927890b706d48e4cc5fe24671e595e39d7.zip |
Remove the libsimpleservo C API (#31172)
This is unused and unmaintained. It also added a bit of complication
to the build.
Diffstat (limited to 'ports/jniapi/build.rs')
-rw-r--r-- | ports/jniapi/build.rs | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/ports/jniapi/build.rs b/ports/jniapi/build.rs new file mode 100644 index 00000000000..759c2376f20 --- /dev/null +++ b/ports/jniapi/build.rs @@ -0,0 +1,43 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +use std::env; +use std::fs::File; +use std::path::PathBuf; + +use gl_generator::{Api, Fallbacks, Profile, Registry}; +use serde_json::{self, Value}; +use vergen::EmitBuilder; + +fn main() { + let target = env::var("TARGET").unwrap(); + let dest = PathBuf::from(&env::var("OUT_DIR").unwrap()); + + if let Err(error) = EmitBuilder::builder() + .fail_on_error() + .git_sha(true /* short */) + .emit() + { + println!( + "cargo:warning=Could not generate git version information: {:?}", + error + ); + println!("cargo:rustc-env=VERGEN_GIT_SHA=nogit"); + } + + // Generate GL bindings. For now, we only support EGL. + if target.contains("android") { + let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap(); + Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, []) + .write_bindings(gl_generator::StaticStructGenerator, &mut file) + .unwrap(); + println!("cargo:rustc-link-lib=EGL"); + } + + let mut default_prefs = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + default_prefs.push("../../resources/prefs.json"); + let prefs: Value = serde_json::from_reader(File::open(&default_prefs).unwrap()).unwrap(); + let file = File::create(&dest.join("prefs.json")).unwrap(); + serde_json::to_writer(file, &prefs).unwrap(); +} |