static-php-cli icon indicating copy to clipboard operation
static-php-cli copied to clipboard

How to provide some compiler flags?

Open tricarte opened this issue 1 year ago • 1 comments

I want to do some benchmarks with compiler optimizations such as -O2 -march=native -pipe.

Is it possible to customize these flags? If it's possible, will it apply to all static extensions or just the final php binary?

Also, can we use Intel Profile Guided Optimization? The generated Makefile for PHP source code has PGO targets but I think spc does (can) not use it in any way.

Thanks in advance.

tricarte avatar Feb 10 '24 09:02 tricarte

Currently spc cannot customize compiler flags using command or ENV. If necessary, you can provide some practical suggestions.

Actually I don't have a good solution to implement it yet (distinguish between lib flags and PHP's compilation flags). Maybe reusing the -P to provide flags is a good solution, but we still need to modify the spc source code to reserve a custom shell parameter point.

The generated Makefile for PHP source code has PGO targets but I think spc does (can) not use it in any way.

If it's convenient, you can submit a PR to end the PGO issue.

crazywhalecc avatar Feb 10 '24 12:02 crazywhalecc

Finished, docs: https://static-php.dev/en/guide/env-vars.html

crazywhalecc avatar Apr 13 '24 17:04 crazywhalecc