Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions profiling/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ trigger_time_sample = []
bindgen = { version = "0.69.4" }
cc = { version = "1.0" }

# We can remove this when we're using Rust 1.80+
rustc_version = "0.4"

# profiling release options in root Cargo.toml

[lints.rust]
Expand Down
41 changes: 8 additions & 33 deletions profiling/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bindgen::callbacks::IntKind;
use rustc_version::version_meta;
use std::collections::HashSet;
use std::path::Path;
use std::path::PathBuf;
Expand Down Expand Up @@ -301,18 +300,8 @@ fn generate_bindings(php_config_includes: &str, fibers: bool, zend_error_observe
.expect("bindings to be written successfully");
}

// See https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html
// We can remove this when we're on Rust 1.80+.
fn has_check_cfg() -> bool {
let meta = version_meta().unwrap();
assert_eq!(1, meta.semver.major);
meta.semver.minor >= 80
}

fn cfg_post_startup_cb(vernum: u64) -> bool {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_post_startup_cb)");
}
println!("cargo::rustc-check-cfg=cfg(php_post_startup_cb)");
if vernum >= 70300 {
println!("cargo:rustc-cfg=php_post_startup_cb");
true
Expand All @@ -322,9 +311,7 @@ fn cfg_post_startup_cb(vernum: u64) -> bool {
}

fn cfg_preload(vernum: u64) -> bool {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_preload)");
}
println!("cargo::rustc-check-cfg=cfg(php_preload)");
if vernum >= 70400 {
println!("cargo:rustc-cfg=php_preload");
true
Expand All @@ -334,9 +321,7 @@ fn cfg_preload(vernum: u64) -> bool {
}

fn cfg_run_time_cache(vernum: u64) -> bool {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_run_time_cache)");
}
println!("cargo::rustc-check-cfg=cfg(php_run_time_cache)");
if vernum >= 80000 {
println!("cargo:rustc-cfg=php_run_time_cache");
true
Expand All @@ -350,9 +335,7 @@ fn cfg_trigger_time_sample() -> bool {
}

fn cfg_zend_error_observer(vernum: u64) -> bool {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(zend_error_observer, zend_error_observer_80)");
}
println!("cargo::rustc-check-cfg=cfg(zend_error_observer, zend_error_observer_80)");
if vernum >= 80000 {
println!("cargo:rustc-cfg=zend_error_observer");
if vernum < 80100 {
Expand All @@ -365,9 +348,7 @@ fn cfg_zend_error_observer(vernum: u64) -> bool {
}

fn cfg_php_major_version(vernum: u64) {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php7, php8)");
}
println!("cargo::rustc-check-cfg=cfg(php7, php8)");

let major_version = match vernum {
70000..=79999 => 7,
Expand All @@ -383,9 +364,7 @@ fn cfg_php_major_version(vernum: u64) {
}

fn cfg_fibers(vernum: u64) -> bool {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_has_fibers)");
}
println!("cargo::rustc-check-cfg=cfg(php_has_fibers)");
if vernum >= 80100 {
println!("cargo:rustc-cfg=php_has_fibers");
true
Expand All @@ -395,9 +374,7 @@ fn cfg_fibers(vernum: u64) -> bool {
}

fn cfg_php_feature_flags(vernum: u64) {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_gc_status, php_zend_compile_string_has_position, php_gc_status_extended, php_frameless, php_opcache_restart_hook, php_zend_mm_set_custom_handlers_ex)");
}
println!("cargo::rustc-check-cfg=cfg(php_gc_status, php_zend_compile_string_has_position, php_gc_status_extended, php_frameless, php_opcache_restart_hook, php_zend_mm_set_custom_handlers_ex)");

if vernum >= 70300 {
println!("cargo:rustc-cfg=php_gc_status");
Expand All @@ -416,9 +393,7 @@ fn cfg_php_feature_flags(vernum: u64) {
}

fn cfg_zts() {
if has_check_cfg() {
println!("cargo::rustc-check-cfg=cfg(php_zts)");
}
println!("cargo::rustc-check-cfg=cfg(php_zts)");

let output = Command::new("php-config")
.arg("--include-dir")
Expand Down
Loading