You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Checks the PHP Zend API version for compatibility with ext-php-rs, setting
182
-
/// any configuration flags required.
183
-
fncheck_php_version(info:&PHPInfo) -> Result<()>{
184
-
let version = info.zend_version()?;
185
-
186
-
if !(MIN_PHP_API_VER..=MAX_PHP_API_VER).contains(&version){
187
-
bail!("The current version of PHP is not supported. Current PHP API version: {}, requires a version between {} and {}", version,MIN_PHP_API_VER,MAX_PHP_API_VER);
188
-
}
189
-
190
-
// Infra cfg flags - use these for things that change in the Zend API that don't
191
-
// rely on a feature and the crate user won't care about (e.g. struct field
192
-
// changes). Use a feature flag for an actual feature (e.g. enums being
193
-
// introduced in PHP 8.1).
194
-
//
195
-
// PHP 8.0 is the baseline - no feature flags will be introduced here.
196
-
//
197
-
// The PHP version cfg flags should also stack - if you compile on PHP 8.2 you
198
-
// should get both the `php81` and `php82` flags.
199
-
constPHP_81_API_VER:u32 = 20210902;
200
-
201
-
if version >= PHP_81_API_VER{
202
-
println!("cargo:rustc-cfg=php81");
203
-
}
204
-
205
-
Ok(())
206
-
}
207
-
208
130
fnmain() -> Result<()>{
209
131
let out_dir = env::var_os("OUT_DIR").context("Failed to get OUT_DIR")?;
210
132
let out_path = PathBuf::from(out_dir).join("bindings.rs");
@@ -229,14 +151,12 @@ fn main() -> Result<()> {
229
151
returnOk(());
230
152
}
231
153
232
-
let php = find_php()?;
233
-
let info = PHPInfo::get(&php)?;
234
-
let provider = Provider::new(&info)?;
154
+
let php_build = find_php()?;
155
+
let provider = Provider::new(&php_build)?;
235
156
236
157
let includes = provider.get_includes()?;
237
158
let defines = provider.get_defines()?;
238
159
239
-
check_php_version(&info)?;
240
160
build_wrapper(&defines,&includes)?;
241
161
let bindings = generate_bindings(&defines,&includes)?;
let devel = DevelPack::new(&version, is_zts, arch)?;
40
46
ifletOk(linker) = get_rustc_linker(){
41
47
iflooks_like_msvc_linker(&linker){
42
48
println!("cargo:warning=It looks like you are using a MSVC linker. You may encounter issues when attempting to load your compiled extension into PHP if your MSVC linker version is not compatible with the linker used to compile your PHP. It is recommended to use `rust-lld` as your linker.");
43
49
}
44
50
}
45
51
46
-
Ok(Self{info, devel })
52
+
Ok(Self{build, devel })
47
53
}
48
54
49
55
fnget_includes(&self) -> Result<Vec<PathBuf>>{
@@ -56,9 +62,9 @@ impl<'a> PHPProvider<'a> for Provider<'a> {
0 commit comments