Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

honour PHP_CONFIG & rebuild automatically when env vars change #210

Merged
merged 2 commits into from
Dec 11, 2022

Conversation

ju1ius
Copy link
Contributor

@ju1ius ju1ius commented Nov 30, 2022

Closes #208.
Closes #209.

Please see the linked issues for a rationale.

Summary of the changes

Build scripts

  • the unix_build.rs script now honours the PHP_CONFIG environment variable, like cargo php install
  • use cargo:rerun-if-env-changed for the PHP, PHP_CONFIG and PATH environment variables, in order to avoid needless recompilations of the whole dependency tree.

Documentation

While trying to document the aforementioned changes, I realized that there was no chapter about installing and setting up a PHP environment to develop PHP extensions. So I refactored the first chapters of the book into a Getting Started section, including instructions on how to quickly setup a PHP environment.

Do not hesitate to point-out spelling/grammar mistakes as I'm not a native english speaker.

@ju1ius ju1ius changed the title rebuild automatically when env vars change honour PHP_CONFIG & rebuild automatically when env vars change Nov 30, 2022
@ptondereau ptondereau merged commit 4ca5c0d into davidcole1340:master Dec 11, 2022
@ju1ius ju1ius deleted the ju1ius/build-env branch December 11, 2022 21:26
@joehoyle
Copy link
Collaborator

I think this might have caused an issue for me. I'm seeing

     Fresh skeptic v0.13.7
   Compiling ext-php-rs v0.10.0
     Running `.../debug/build/ext-php-rs-a3bbbf43415ad934/build-script-build`

On every cargo check / cargo build which takes maybe 3+ seconds, which also makes Rust-Analyzer super slow. Is the intention here that if the env vars don't change, the build should still be cached? I had to switch back to 0.8.3 where I get fully cached builds again

@ptondereau
Copy link
Collaborator

ptondereau commented Jan 27, 2023

@joehoyle hey can you submit a ticket please, I'll take a look! BTW while working on it, I didn't see that regression

@ju1ius
Copy link
Contributor Author

ju1ius commented Jan 27, 2023

Is the intention here that if the env vars don't change, the build should still be cached?

Yes, that's how cargo:rerun-if-env-changed is supposed to work, unless something else is interfering...

@ju1ius
Copy link
Contributor Author

ju1ius commented Jan 28, 2023

Found a 3 years old issue on the cargo repo that might be related.
Maybe it's worth investigating?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cargo build should track environment variables PHP_CONFIG env var not honored by build script
3 participants