Skip to content

Commit

Permalink
meson: Test for minimum macOS/iOS version when targeting Darwin
Browse files Browse the repository at this point in the history
This is necessary to prevent linking/dyld issues with `getentropy` and
`CCRandomGenerateBytes` being missing on macOS < 10.10 or iOS < 8.0.

This requirement was set in Rust 1.75.

See rust-lang/rust#116319

Fixes #1097

Part-of: <https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/993>
  • Loading branch information
amyspark committed Jul 15, 2024
1 parent b8ee7fc commit 98c4b02
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ cargo_c = find_program('cargo-cbuild', version:'>= 0.9.19')
rustc = find_program('rustc', version:'>= @0@'.format(msrv))
makedef = find_program('meson/makedef.py', native: true)

if host_system in ['darwin', 'ios']
# Validate unconditional presence of getentropy and CCRandomGenerateBytes.
# https://github.com/rust-lang/rust/pull/116319
cc.compiles('''#include <Availability.h>
#include <TargetConditionals.h>
#if !((TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200L) || (TARGET_OS_IOS && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000L))
# error "https://gitlab.gnome.org/GNOME/librsvg/-/issues/1097"
#endif''',
name: 'Targets at least macOS 10.12 or iOS 10',
required: rustc.version().version_compare('>= 1.75.0')
)
endif

py = import('python')

python = py.find_installation()
Expand Down

0 comments on commit 98c4b02

Please sign in to comment.