From fa02f969e64898065b807d2200d769d0128375f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Haudebourg?= Date: Mon, 22 Feb 2021 12:17:38 +0100 Subject: [PATCH] Load `libEGL.so.1` by default. --- CHANGELOG.md | 4 ++++ Cargo.toml | 2 +- README.md | 10 +++++----- examples/load-minimal.rs | 2 +- examples/wayland-dynamic.rs | 2 +- src/lib.rs | 26 +++++++++++++------------- 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4222cc9..aad1ade 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unpublished] +## [3.0.1] +### Changed +- Load `libEGL.so.1` by default instead of `libEGL.so`. + ## [3.0.0] ### Changed - Impl `Debug` for `Static`, `Dynamic` and `Instance`. diff --git a/Cargo.toml b/Cargo.toml index d9e0cc8..e23e4ab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "khronos-egl" -version = "3.0.0" +version = "3.0.1" authors = ["Timothée Haudebourg ", "Sean Kerr "] license = "MIT/Apache-2.0" description = "Rust bindings for EGL" diff --git a/README.md b/README.md index 49d7348..6c4ddcc 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ which is left unmaintained. ## Usage You can access the EGL API using an [`Instance`](https://docs.rs/khronos-egl/latest/khronos-egl/struct.Instance.html) -object defined by either statically linking with `libEGL.so` at compile time, +object defined by either statically linking with `libEGL.so.1` at compile time, or dynamically loading the EGL library at runtime. ### Static linking @@ -93,12 +93,12 @@ necessary to find the EGL library at runtime. You can then load the EGL API into a `Instance>` as follows: ```rust -let lib = libloading::Library::new("libEGL.so").expect("unable to find libEGL.so"); -let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so") }; +let lib = libloading::Library::new("libEGL.so.1").expect("unable to find libEGL.so.1"); +let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so.1") }; ``` -Here, `egl::EGL1_4` is used to specify what is the minimum required version of EGL that must be provided by `libEGL.so`. -This will return a `DynamicInstance`, however in that case where `libEGL.so` provides a more recent version of EGL, +Here, `egl::EGL1_4` is used to specify what is the minimum required version of EGL that must be provided by `libEGL.so.1`. +This will return a `DynamicInstance`, however in that case where `libEGL.so.1` provides a more recent version of EGL, you can still upcast ths instance to provide version specific features: ```rust match egl.upcast::() { diff --git a/examples/load-minimal.rs b/examples/load-minimal.rs index fa30210..409376d 100644 --- a/examples/load-minimal.rs +++ b/examples/load-minimal.rs @@ -9,7 +9,7 @@ use egl::{ }; fn main() { - let minimal_egl = unsafe { Arc::new(egl::DynamicInstance::load().expect("unable to load libEGL.so")) }; + let minimal_egl = unsafe { Arc::new(egl::DynamicInstance::load().expect("unable to load libEGL.so.1")) }; println!("EGL version is {}", minimal_egl.version()); diff --git a/examples/wayland-dynamic.rs b/examples/wayland-dynamic.rs index a0e1e45..cb9748c 100644 --- a/examples/wayland-dynamic.rs +++ b/examples/wayland-dynamic.rs @@ -174,7 +174,7 @@ fn create_surface( } fn main() { - let egl = unsafe { Arc::new(egl::DynamicInstance::::load_required().expect("unable to load libEGL.so")) }; + let egl = unsafe { Arc::new(egl::DynamicInstance::::load_required().expect("unable to load libEGL.so.1")) }; // Setup Open GL. egl.bind_api(egl::OPENGL_API) diff --git a/src/lib.rs b/src/lib.rs index 458b2ea..6e52eff 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ //! ## Usage //! //! You can access the EGL API using an [`Instance`] -//! object defined by either statically linking with `libEGL.so` at compile time, +//! object defined by either statically linking with `libEGL.so.1` at compile time, //! or dynamically loading the EGL library at runtime. //! //! ### Static linking @@ -87,17 +87,17 @@ //! //! ``` //! # extern crate khronos_egl as egl; -//! let lib = libloading::Library::new("libEGL.so").expect("unable to find libEGL.so"); -//! let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so") }; +//! let lib = libloading::Library::new("libEGL.so.1").expect("unable to find libEGL.so.1"); +//! let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so.1") }; //! ``` //! -//! Here, `egl::EGL1_4` is used to specify what is the minimum required version of EGL that must be provided by `libEGL.so`. -//! This will return a `DynamicInstance`, however in that case where `libEGL.so` provides a more recent version of EGL, +//! Here, `egl::EGL1_4` is used to specify what is the minimum required version of EGL that must be provided by `libEGL.so.1`. +//! This will return a `DynamicInstance`, however in that case where `libEGL.so.1` provides a more recent version of EGL, //! you can still upcast ths instance to provide version specific features: //! ``` //! # extern crate khronos_egl as egl; -//! # let lib = libloading::Library::new("libEGL.so").expect("unable to find libEGL.so"); -//! # let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so") }; +//! # let lib = libloading::Library::new("libEGL.so.1").expect("unable to find libEGL.so.1"); +//! # let egl = unsafe { egl::DynamicInstance::::load_required_from(lib).expect("unable to load libEGL.so.1") }; //! match egl.upcast::() { //! Some(egl1_5) => { //! // do something with EGL 1.5 @@ -1981,14 +1981,14 @@ macro_rules! api { } #[inline(always)] - /// Create an EGL instance by finding and loading the `libEGL.so` library. + /// Create an EGL instance by finding and loading the `libEGL.so.1` library. /// - /// This is equivalent to `DynamicInstance::load_from_filename("libEGL.so")`. + /// This is equivalent to `DynamicInstance::load_from_filename("libEGL.so.1")`. /// /// ## Safety /// This is fundamentally unsafe since there are no guaranties the found library complies to the EGL API. pub unsafe fn load() -> Result, libloading::Error> { - Self::load_from_filename("libEGL.so") + Self::load_from_filename("libEGL.so.1") } } }; @@ -2193,15 +2193,15 @@ macro_rules! api { } #[inline(always)] - /// Create an EGL instance by finding and loading the `libEGL.so` library. + /// Create an EGL instance by finding and loading the `libEGL.so.1` library. /// This function fails if the EGL library does not provide the minimum required version given by the type parameter. /// - /// This is equivalent to `DynamicInstance::load_required_from_filename("libEGL.so")`. + /// This is equivalent to `DynamicInstance::load_required_from_filename("libEGL.so.1")`. /// /// ## Safety /// This is fundamentally unsafe since there are no guaranties the found library complies to the EGL API. pub unsafe fn load_required() -> Result, LoadError> { - Self::load_required_from_filename("libEGL.so") + Self::load_required_from_filename("libEGL.so.1") } } }