Skip to content

Commit 715a5ae

Browse files
committed
Fixing nits and CI build
1 parent 6eb2483 commit 715a5ae

File tree

2 files changed

+53
-40
lines changed

2 files changed

+53
-40
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,14 @@ jobs:
3232
- { name: LLVM15, CC: clang-15, CXX: clang++-15, packages: clang-15 libomp-15-dev llvm-15-dev libc++-15-dev libc++abi1-15 lld-15 clang-tools-15 mlir-15-tools libmlir-15-dev }
3333
build_type:
3434
- Release
35-
target:
36-
- build
3735
generator:
3836
- Unix Makefiles
3937
php:
4038
- 8.3-dev
4139
env:
4240
CC: ${{ matrix.compiler.CC }}
4341
CXX: ${{ matrix.compiler.CXX }}
44-
SRC_DIR: ${{ github.workspace }}/php-src
45-
BINARY_DIR: ${{ github.workspace }}/php-src
46-
INSTALL_PREFIX: ${{ github.workspace }}/php-src/install
4742
CMAKE_BUILD_TYPE: ${{ matrix.build_type }}
48-
GENERATOR: ${{ matrix.generator }}
49-
TARGET: ${{ matrix.target }}
5043
steps:
5144
- name: Install compiler ${{ matrix.compiler.name }}
5245
run: |
@@ -132,14 +125,13 @@ jobs:
132125
133126
- name: Setup SNMP agents
134127
run: |
135-
cd php-build/all-enabled/php/php-src
136-
sudo cp ext/snmp/tests/snmpd.conf /etc/snmp
137-
sudo cp ext/snmp/tests/bigtest /etc/snmp
128+
cd php-build/all-enabled/php-src
129+
sudo cp ext/snmp/tests/{snmpd.conf,bigtest} /etc/snmp
138130
sudo systemctl restart snmpd
139131
140132
- name: Setup Dovecot for testing imap extension
141133
run: |
142-
cd php-build/all-enabled/php/php-src/
134+
cd php-build/all-enabled/php-src
143135
sudo sh ext/imap/tests/setup/setup.sh
144136
sudo systemctl restart dovecot
145137

CMakeLists.txt

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,37 @@
1-
# Wrapper for integrating PHP sources with CMake
2-
#
3-
# This file uses the FetchContent module to download the PHP source code (from
4-
# a tarball), integrate additional CMake files, and apply necessary patches to
5-
# enable building PHP with CMake.
6-
#
7-
# While not part of the CMake-based build system itself, this file serves as a
8-
# wrapper to bridge the upstream PHP source code with the CMake-based build
9-
# system in this repository, streamlining the integration process.
1+
#[=============================================================================[
2+
Wrapper for integrating PHP sources with CMake
3+
4+
This file uses the FetchContent module to download the PHP source code (from a
5+
tarball), integrate CMake files, and apply necessary patches to enable building
6+
PHP with CMake.
7+
8+
While not part of the CMake-based build system itself, this file serves as a
9+
wrapper to bridge the upstream PHP source code with the CMake-based build system
10+
in this repository, streamlining the integration process.
11+
12+
Basic usage:
13+
14+
cmake -B <build-dir> [<options>...]
15+
16+
Configuration variables:
17+
18+
PHP_VERSION_DOWNLOAD
19+
PHP version to download. Format: <major>.<minor>[.<patch>][<extra>]
20+
21+
<OTHER_PHP_CONFIGURATION_VARIABLES>
22+
See build system documentation.
23+
24+
For example:
25+
26+
cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3-dev
27+
will download PHP-8.3 Git branch archive file from GitHub.
28+
29+
cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3
30+
will download latest stable 8.3 release tarball from php.net.
31+
32+
cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3.15
33+
will download specific PHP version tarball from php.net.
34+
#]=============================================================================]
1035

1136
cmake_minimum_required(VERSION 3.25...3.31)
1237

@@ -33,19 +58,6 @@ project(
3358
################################################################################
3459

3560
block(PROPAGATE phpUrl)
36-
# The PHP_VERSION_DOWNLOAD format: <major>.<minor>[.<patch>][<extra>]
37-
#
38-
# For example:
39-
#
40-
# cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3-dev
41-
# will download PHP-8.3 Git branch archive file from GitHub.
42-
#
43-
# cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3.15
44-
# will download this specific PHP version tarball from php.net.
45-
#
46-
# cmake -B <build-dir> -D PHP_VERSION_DOWNLOAD=8.3
47-
# will download latest stable 8.3 release tarball from php.net.
48-
#
4961
set(
5062
PHP_VERSION_DOWNLOAD ${PROJECT_VERSION}
5163
CACHE STRING "The PHP version to download"
@@ -66,14 +78,24 @@ block(PROPAGATE phpUrl)
6678
string(REGEX MATCH [[^([0-9]+\.[0-9]+)]] _ "${PHP_VERSION_DOWNLOAD}")
6779
message(
6880
FATAL_ERROR
69-
"Version ${PHP_VERSION_DOWNLOAD} is not supported by the current "
70-
"php-build-system Git repository branch. "
71-
"Please, checkout php-build-system Git branch if available:\n"
81+
"Version ${PHP_VERSION_DOWNLOAD} is not supported by the current Git "
82+
"branch of the php-build-system repository. Please checkout the "
83+
"PHP-${CMAKE_MATCH_1} Git branch if it exists:\n"
7284
" git checkout PHP-${CMAKE_MATCH_1}"
7385
)
7486
endif()
7587

76-
if(PHP_VERSION_DOWNLOAD STREQUAL phpDevelopmentBranch)
88+
set(branch "")
89+
set(version "")
90+
91+
if(PHP_VERSION_DOWNLOAD MATCHES "^${phpDevelopmentBranch}(-dev)?(.*)$")
92+
if(CMAKE_MATCH_2)
93+
message(
94+
WARNING
95+
"PHP ${phpDevelopmentBranch} is marked as development branch. Version "
96+
"has been set to ${phpDevelopmentBranch}-dev"
97+
)
98+
endif()
7799
set(branch "master")
78100
elseif(PHP_VERSION_DOWNLOAD MATCHES [[^([0-9]+\.[0-9]+)-dev$]])
79101
set(branch "PHP-${CMAKE_MATCH_1}")
@@ -94,14 +116,13 @@ block(PROPAGATE phpUrl)
94116
if(error)
95117
message(
96118
WARNING
97-
"Latest PHP version could not be determined. "
98-
"Setting version to ${PROJECT_VERSION}-dev.\n${error}"
119+
"Latest PHP version could not be determined. Setting version to "
120+
"${PROJECT_VERSION}-dev.\n${error}"
99121
)
100122
set(version "")
101123
set(branch "PHP-${PROJECT_VERSION}")
102124
endif()
103125
else()
104-
set(branch "")
105126
set(version ${PHP_VERSION_DOWNLOAD})
106127
endif()
107128

0 commit comments

Comments
 (0)