From 9661070af1e1548cbac03099399d1b64cc152db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20F=C3=A9ron?= Date: Mon, 23 Oct 2023 10:11:38 +0200 Subject: [PATCH] Link against libc++ on Apple targets --- rust_icu_sys/Cargo.toml | 1 - rust_icu_sys/src/lib.rs | 18 +++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/rust_icu_sys/Cargo.toml b/rust_icu_sys/Cargo.toml index d99757e7..af4d70ce 100644 --- a/rust_icu_sys/Cargo.toml +++ b/rust_icu_sys/Cargo.toml @@ -44,7 +44,6 @@ icu_version_68_plus = [] icu_version_69_max = [] static = [] - [badges] maintenance = { status = "actively-developed" } is-it-maintained-issue-resolution = { repository = "google/rust_icu" } diff --git a/rust_icu_sys/src/lib.rs b/rust_icu_sys/src/lib.rs index 229bde81..d370863d 100644 --- a/rust_icu_sys/src/lib.rs +++ b/rust_icu_sys/src/lib.rs @@ -11,7 +11,11 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +<<<<<<< Updated upstream +======= +#![doc(test(ignore))] +>>>>>>> Stashed changes // Notes: // * deref_nullptr: since rustc 1.53, bindgen causes UB warnings -- see // https://github.com/rust-lang/rust-bindgen/issues/1651 remove this once bindgen has fixed the @@ -23,7 +27,7 @@ non_upper_case_globals, unused_imports, rustdoc::bare_urls, - deref_nullptr, + deref_nullptr )] #[cfg(all(feature = "icu_version_in_env", feature = "icu_config"))] @@ -87,7 +91,15 @@ extern crate libc; #[cfg_attr(feature = "static", link(name = "icui18n", kind = "static"))] #[cfg_attr(feature = "static", link(name = "icuuc", kind = "static"))] #[cfg_attr(feature = "static", link(name = "icudata", kind = "static"))] -#[cfg_attr(feature = "static", link(name = "stdc++", kind = "dylib"))] +// On systems such as macOS, libc++ is the default library +#[cfg_attr( + all(target_vendor = "apple", feature = "static"), + link(name = "c++", kind = "dylib") +)] +#[cfg_attr( + not(all(target_vendor = "apple", feature = "static")), + link(name = "stdc++", kind = "dylib") +)] extern "C" {} impl From for UCharCategory { @@ -124,7 +136,7 @@ impl From for UCharCategory { 28 => UCharCategory::U_INITIAL_PUNCTUATION, 29 => UCharCategory::U_FINAL_PUNCTUATION, 30 => UCharCategory::U_CHAR_CATEGORY_COUNT, - _ => { + _ => { panic!("could not convert: {}", value); } }