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
141
fnmain() -> Result<()>{
209
142
let out_dir = env::var_os("OUT_DIR").context("Failed to get OUT_DIR")?;
210
143
let out_path = PathBuf::from(out_dir).join("bindings.rs");
@@ -229,14 +162,12 @@ fn main() -> Result<()> {
229
162
returnOk(());
230
163
}
231
164
232
-
let php = find_php()?;
233
-
let info = PHPInfo::get(&php)?;
234
-
let provider = Provider::new(&info)?;
165
+
let php_build = find_php()?;
166
+
let provider = Provider::new(&php_build)?;
235
167
236
168
let includes = provider.get_includes()?;
237
169
let defines = provider.get_defines()?;
238
170
239
-
check_php_version(&info)?;
240
171
build_wrapper(&defines,&includes)?;
241
172
let bindings = generate_bindings(&defines,&includes)?;
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
50
}
44
51
}
45
52
46
-
Ok(Self{info, devel })
53
+
Ok(Self{build, devel })
47
54
}
48
55
49
56
fnget_includes(&self) -> Result<Vec<PathBuf>>{
@@ -56,9 +63,9 @@ impl<'a> PHPProvider<'a> for Provider<'a> {
0 commit comments