Background
I'm using brew to manage system packages. Many of them are dependencies on PHP so when they are updated, compiled PHPs break. Take icu4c and intl for example.
To combat this, I figured I script (re)brewing of each PHP version I need.
What I do manually:
export OPENSSL_PREFIX=$(brew --prefix openssl@1.1)
export OPENSSL_CFLAGS="-I${OPENSSL_PREFIX}/include"
export OPENSSL_LIBS="-L${OPENSSL_PREFIX}/lib -lcrypto -lssl"
# this is for 7.3
export CFLAGS="-Wno-implicit-function-declaration"
phpbrew install -j 12 7.3 +bcmath +bz2 +calendar +cli +ctype +dom +fileinfo +filter +ipc +json +mbregex +mbstring +mhash +pcntl +pcre +pdo +phar +posix +readline +sockets +tokenizer +xml +curl +zip +opcache +intl +session +iconv +sqlite +mysql +pgsql +mcrypt +openssl=$OPENSSL_PREFIX -- --with-openssl="shared,${OPENSSL_PREFIX}" --without-pcre-jit
curl https://gist.githubusercontent.com/nickolasburr/d24481ded3dcf19d5fc45ccb9892b0cd/raw/8e39f300b24c984183fc24fbc68a6608bf33f832/valet-php@7.3-icu.patch | git apply --ignore-whitespace --verbose
For newer PHP versions, I don't need to set some stuff, apply patches etc so the procedure changes.
Problems
~/.phpbrew/config.yaml is a nice way to delegate all variants to a config file. I want almost all my PHP versions to have similar set of variants. Therefore I figured I create some virtual variant and include all the switches to configure there. This is a simplified version
variants:
my-variant:
pcre:
- --
- --without-pcre-jit
openssl:
- "${OPENSSL_PREFIX}"
- --
- --with-openssl="shared,${OPENSSL_PREFIX}"
I'm simply trying to use this config file to do the same as with specifying them all inline, but it fails:
./configure '--cache-file=/Users/foo/.phpbrew/cache/config.cache' '--prefix=/Users/foo/.phpbrew/php/812test' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--enable-dom' '--with-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--enable-opcache' '--enable-bcmath' '--with-bz2=/usr/local/opt/bzip2' '--enable-calendar' '--enable-cli' '--enable-ctype' '--enable-fileinfo' '--enable-filter' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-intl' '--with-iconv=/usr/local/opt/libiconv' '--enable-json' '--enable-mbregex' '--enable-mbstring' '--with-mhash=/usr/local' '--with-mcrypt=/usr/local' '--enable-pcntl' '0=$(brew --prefix openssl@1.1)' '1=--' '--enable-pdo' '--enable-posix' '--with-readline=/usr/local/opt/readline' '--enable-sockets' '--with-curl' '--with-zip' '--with-sqlite3' '--with-pdo-sqlite' '--with-mysqli=mysqlnd' '--with-pdo-mysql=mysqlnd' '--with-pgsql=/usr/local/Cellar/postgresql@14/14.6/bin' '--with-pdo-pgsql=/usr/local/Cellar/postgresql@14/14.6/bin' '2=--with-openssl="shared,${OPENSSL_PREFIX}"' '--with-config-file-path=/Users/foo/.phpbrew/php/812test/etc/cli' '--with-config-file-scan-dir=/Users/foo/.phpbrew/php/812test/var/db/cli' 'PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/opt/curl/lib/pkgconfig' >> '/Users/foo/.phpbrew/build/812test/build.log' 2>&1
Error: Configure failed:
The last 5 lines in the log file:
configure: error: invalid variable name: `0'
Openssl options are not parsed properly. What's the notation I should use in yaml to come up with equivalent of my inline command? I had a look at this and tried multiple notations but I can't figure it out.
-
Is there a better (built-in) way in phpbrew to achieve what I want, rather than creating a shell script for each PHP version? Some of them need special switches and commands to be run before/after phpbrew install.
-
I know I can pin system dependencies in brew but you can't go a long way with it. You have to update or other things break in time. Is there a better way to have working PHP setups rather than periodically recompiling all PHP versions with newer dependencies?
Background
I'm using
brewto manage system packages. Many of them are dependencies on PHP so when they are updated, compiled PHPs break. Takeicu4candintlfor example.To combat this, I figured I script (re)brewing of each PHP version I need.
What I do manually:
For newer PHP versions, I don't need to set some stuff, apply patches etc so the procedure changes.
Problems
~/.phpbrew/config.yamlis a nice way to delegate all variants to a config file. I want almost all my PHP versions to have similar set of variants. Therefore I figured I create some virtual variant and include all the switches toconfigurethere. This is a simplified versionI'm simply trying to use this config file to do the same as with specifying them all inline, but it fails:
Openssl options are not parsed properly. What's the notation I should use in yaml to come up with equivalent of my inline command? I had a look at this and tried multiple notations but I can't figure it out.
Is there a better (built-in) way in
phpbrewto achieve what I want, rather than creating a shell script for each PHP version? Some of them need special switches and commands to be run before/afterphpbrew install.I know I can pin system dependencies in
brewbut you can't go a long way with it. You have to update or other things break in time. Is there a better way to have working PHP setups rather than periodically recompiling all PHP versions with newer dependencies?