@@ -167,6 +167,7 @@ Common practice is to also add program prefix and suffix (for example, to have
167167 EXTENSION_DIR=/path/to/php/extensions \
168168 --with-layout=GNU \
169169 --localstatedir=/var \
170+ --sysconfdir=/etc \
170171 --program-suffix=84 \
171172 # ...
172173```
@@ -177,7 +178,7 @@ PHP Autotools directory structure with GNU layout:
177178
178179``` sh
179180📂 < INSTALL_ROOT> # 📂
180- └─📂 ${prefix} # └─📂 /usr/local/include
181+ └─📂 ${prefix} # └─📂 /usr/local
181182 ├─📂 ${bindir} # ├─📂 bin
182183 └─📂 ${sysconfdir} # └─📂 etc
183184 ├─📂 php-fpm.d # ├─📂 php-fpm.d
@@ -201,7 +202,7 @@ PHP Autotools directory structure with GNU layout:
201202 └─📂 man8 # └─📂 man8
202203 ├─📂 pear # └─📂 pear
203204 └─📂 php # └─📂 php
204- └─📂 fpm # └─📂 fpm
205+ └─📂 fpm # └─📂 fpm
205206 └─📂 ${localstatedir} # └─📂 var
206207 └─📂 log # └─📂 log
207208 └─📂 ${runstatedir} # └─📂 var/run
@@ -244,7 +245,7 @@ DESTDIR=/stage cmake --install . --prefix /usr
244245
245246To adjust the installation locations, the
246247[ GNUInstallDirs] ( https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html )
247- module is used to set additional ` CMAKE_INSTALL_* ` variables.
248+ module is used to set the ` CMAKE_INSTALL_* ` variables.
248249
249250* ` CMAKE_INSTALL_BINDIR ` - name of the bin directory
250251* ` CMAKE_INSTALL_DATADIR ` - name of the etc directory
@@ -310,9 +311,21 @@ PHP installation directory structure when using CMake:
310311> [ !NOTE]
311312> The ` DATAROOTDIR ` and ` DATADIR ` are treated separately to be able to adjust
312313> only the ` DATADIR ` with project specific files, while leaving the
313- > ` DATAROOTDIR ` intact for man or other files. See also
314+ > ` DATAROOTDIR ` intact for man or other files. See
314315> [ GNU] ( https://www.gnu.org/prep/standards/html_node/Directory-Variables.html )
315- > explanation for more info.
316+ > for more info.
317+
318+ > [ !NOTE]
319+ > The CMake ` GNUInstallDirs ` module also adjusts GNU-related variables according
320+ > to various standards, so there are some special cases.
321+ >
322+ > When the ` CMAKE_INSTALL_PREFIX ` is set to ` /usr ` , the ` SYSCONFDIR ` ,
323+ > ` LOCALSTATEDIR ` , and ` RUNSTATEDIR ` become ` /etc ` , ` /var ` , and
324+ > ` /var/run ` instead of ` /usr/etc ` , and ` /usr/var ` , and ` /usr/var/run ` . Similar
325+ > adjustments are done when install prefix is ` / ` or ` /opt/... ` . See
326+ > [ GNUInstallDirs] ( https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases )
327+ > for more info. The [ PHP/Install] ( /docs/cmake-modules/PHP/Install.md ) bypasses
328+ > some of these adjustmens inside the ` install() ` command for convenience.
316329
317330Instead of setting the installation prefix at the configuration phase using
318331` CMAKE_INSTALL_PREFIX ` variable or ` --install-prefix ` option, there is
@@ -331,13 +344,13 @@ root directory:
331344 "inherits" : " all-enabled" ,
332345 "displayName" : " Acme PHP configuration" ,
333346 "description" : " Customized PHP build" ,
334- "installDir" : " /install/prefix " ,
347+ "installDir" : " /usr " ,
335348 "cacheVariables" : {
336349 "CMAKE_INSTALL_BINDIR" : " home/user/.local/bin" ,
337350 "PHP_BUILD_SYSTEM" : " Acme Linux" ,
338351 "PHP_BUILD_PROVIDER" : " Acme" ,
339352 "PHP_BUILD_COMPILER" : " GCC" ,
340- "PHP_BUILD_ARCH" : " x86 " ,
353+ "PHP_BUILD_ARCH" : " x86_64 " ,
341354 "PHP_VERSION_LABEL" : " -acme" ,
342355 "PHP_EXTENSION_DIR" : " lib/php83/extensions"
343356 }
0 commit comments