tikv / jemallocator

Rust allocator using jemalloc as a backend
Other
332 stars 52 forks source link

allow per-target env detection #91

Open Torrekie opened 2 weeks ago

Torrekie commented 2 weeks ago

This fixes #90.

It allows all environment variables that detected by read_and_watch_env and read_and_watch_env_os to be general or target-specific, which allows some unavoidable cross-compiling scene.

When compiling jemalloc-sys under Cargo projects, TARGET is set. Variables can be set as target-specific in the form of <TARGET_TRIPLE>_MYENV. For example, AARCH64_APPLE_IOS_JEMALLOC_OVERRIDE will set JEMALLOC_OVERRIDE when cargo is targeting aarch64-apple-ios, which is not affecting other targets.

When AARCH64_APPLE_IOS_JEMALLOC_OVERRIDE and JEMALLOC_OVERRIDE are both set, the build.rs will prefer prefixed one instead of the non-prefixed one. The unprefixed one would only be used when target-specific one is not set.

BusyJay commented 2 weeks ago

You can ignore the aarch64 failure. The clippy failure is not related to your change, but if you can fix it in this PR we can merge it all together.