Skip to content

Commit 6f185d8

Browse files
committed
Add initial Conan configuration
1 parent 65d75fd commit 6f185d8

File tree

6 files changed

+337
-32
lines changed

6 files changed

+337
-32
lines changed

.github/workflows/ci.yaml

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ jobs:
5656
run: |
5757
sudo apt-get -y install \
5858
build-essential \
59+
re2c \
60+
bison \
61+
libxml2-dev \
5962
libssl-dev \
6063
libpcre2-dev \
64+
libsqlite3-dev \
6165
libbz2-dev \
6266
libcurl4-openssl-dev \
6367
libdb5.3++-dev \
@@ -71,6 +75,7 @@ jobs:
7175
firebird-dev \
7276
libsodium-dev \
7377
libicu-dev \
78+
libzip-dev \
7479
aspell \
7580
libaspell-dev \
7681
libavif-dev \
@@ -79,6 +84,7 @@ jobs:
7984
libpng-dev \
8085
libwebp-dev \
8186
libxpm-dev \
87+
libonig-dev \
8288
libtidy-dev \
8389
libargon2-dev \
8490
libxslt1-dev \
@@ -101,6 +107,7 @@ jobs:
101107
libsasl2-dev \
102108
libpq-dev \
103109
libmm-dev \
110+
zlib1g-dev \
104111
libdmalloc-dev \
105112
dovecot-core \
106113
dovecot-pop3d \
@@ -135,6 +142,137 @@ jobs:
135142
- name: Install PHP
136143
run: cmake --install php-build/all-enabled
137144

145+
linux-externalproject-module:
146+
runs-on: ubuntu-latest
147+
name: Downloading dependencies with ExternalProject module on Linux
148+
steps:
149+
- name: Install base dependencies
150+
run: |
151+
sudo apt-get -y install \
152+
build-essential \
153+
libssl-dev \
154+
libpcre2-dev \
155+
libbz2-dev \
156+
libcurl4-openssl-dev \
157+
libdb5.3++-dev \
158+
libenchant-2-dev \
159+
libgmp-dev \
160+
libc-client-dev \
161+
libkrb5-dev \
162+
unixodbc-dev \
163+
freetds-dev \
164+
apache2-dev \
165+
firebird-dev \
166+
libsodium-dev \
167+
libicu-dev \
168+
libzip-dev \
169+
aspell \
170+
libaspell-dev \
171+
libavif-dev \
172+
libfreetype-dev \
173+
libjpeg-dev \
174+
libwebp-dev \
175+
libxpm-dev \
176+
libtidy-dev \
177+
libargon2-dev \
178+
libxslt1-dev \
179+
libcapstone-dev \
180+
libedit-dev \
181+
libcdb-dev \
182+
liblmdb-dev \
183+
libqdbm-dev \
184+
libtokyocabinet-dev \
185+
libsnmp-dev \
186+
snmp \
187+
snmpd \
188+
snmp-mibs-downloader \
189+
libexpat1-dev \
190+
libacl1-dev \
191+
libapparmor-dev \
192+
libselinux1-dev \
193+
libsystemd-dev \
194+
libldap2-dev \
195+
libsasl2-dev \
196+
libpq-dev \
197+
libmm-dev \
198+
libdmalloc-dev \
199+
dovecot-core \
200+
dovecot-pop3d \
201+
dovecot-imapd \
202+
sendmail;
203+
204+
- name: Install CMake
205+
uses: lukka/get-cmake@latest
206+
207+
- name: Checkout
208+
uses: actions/checkout@v4
209+
with:
210+
fetch-depth: 2
211+
212+
- name: Build and install
213+
run: |
214+
cmake --preset all-enabled
215+
cmake --build --preset all-enabled -j
216+
217+
linux-conan:
218+
runs-on: ubuntu-latest
219+
name: Downloading dependencies with Conan on Linux
220+
steps:
221+
- name: Install packages
222+
run: |
223+
sudo apt-get -y install \
224+
build-essential \
225+
freetds-dev \
226+
apache2-dev \
227+
firebird-dev \
228+
libc-client-dev \
229+
aspell \
230+
libaspell-dev \
231+
libcdb-dev \
232+
libtokyocabinet-dev \
233+
libsnmp-dev \
234+
libacl1-dev \
235+
libedit-dev \
236+
snmp \
237+
snmpd \
238+
snmp-mibs-downloader \
239+
libapparmor-dev \
240+
libpq-dev \
241+
libmm-dev \
242+
libsystemd-dev \
243+
libwebp-dev \
244+
libxpm-dev \
245+
libzip-dev \
246+
liblmdb-dev \
247+
libonig-dev \
248+
libldap2-dev \
249+
libtidy-dev \
250+
libdmalloc-dev \
251+
dovecot-core \
252+
dovecot-pop3d \
253+
dovecot-imapd \
254+
sendmail;
255+
256+
- name: Install CMake
257+
uses: lukka/get-cmake@latest
258+
259+
- name: Install Conan
260+
uses: conan-io/setup-conan@v1
261+
262+
- name: Checkout
263+
uses: actions/checkout@v4
264+
with:
265+
fetch-depth: 2
266+
267+
- name: Install dependencies with Conan
268+
run: |
269+
conan install . --output-folder=php-build-conan --build=missing --profile:build=default --profile:host=default
270+
271+
- name: Build and install
272+
run: |
273+
cmake --preset conan
274+
cmake --build --preset conan -j
275+
138276
windows:
139277
runs-on: windows-latest
140278
name: Windows

cmake/CMakePresets.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"include": [
44
"cmake/presets/all-disabled.json",
55
"cmake/presets/all-enabled.json",
6+
"cmake/presets/conan.json",
67
"cmake/presets/windows.json"
78
],
89
"configurePresets": [

cmake/cmake/modules/PHP/Package/LibXml2.cmake

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ set_package_properties(
3939
set(PHP_LIBXML2_MIN_VERSION 2.9.0)
4040

4141
# Download version when system dependency is not found.
42-
set(PHP_LIBXML2_DOWNLOAD_VERSION 2.14.4)
42+
set(PHP_LIBXML2_DOWNLOAD_VERSION 2.14.5)
4343

4444
macro(php_package_libxml2_find)
4545
if(TARGET LibXml2::LibXml2)
@@ -83,10 +83,12 @@ macro(_php_package_libxml2_download)
8383
list(APPEND options "-DZLIB_ROOT=${INSTALL_DIR}")
8484
endif()
8585

86-
# LibXml2 has hardcoded dl library check, while, for example, on Haiku
87-
# dlopen is in root library.
86+
# LibXml2 had hardcoded dl library check in versions <= 2.14.5.
8887
# https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/331
89-
if(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
88+
if(
89+
CMAKE_SYSTEM_NAME STREQUAL "Haiku"
90+
AND PHP_LIBXML2_DOWNLOAD_VERSION VERSION_LESS_EQUAL 2.14.5
91+
)
9092
list(APPEND options "-DLIBXML2_WITH_MODULES=OFF")
9193
endif()
9294

cmake/cmake/modules/PHP/Package/Oniguruma.cmake

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ Finds or downloads the Oniguruma library:
77
include(PHP/Package/Oniguruma)
88
```
99
10-
Wrapper for finding the `Oniguruma` library.
11-
12-
Module first tries to find the `Oniguruma` library on the system. If not
13-
successful it tries to download it from the upstream source and builds it
14-
together with the PHP build.
10+
This module first tries to find the `Oniguruma` library on the system. If not
11+
successful it downloads it from the upstream source during the main project
12+
configuration phase and then configures and builds it during the main project's
13+
build phase.
1514
1615
## Examples
1716
@@ -25,39 +24,32 @@ target_link_libraries(php_ext_foo PRIVATE Oniguruma::Oniguruma)
2524

2625
include(ExternalProject)
2726
include(FeatureSummary)
27+
include(FetchContent)
2828

2929
# Minimum required version for the Oniguruma dependency.
30-
#set(PHP_ONIGURUMA_MIN_VERSION ?.?.??)
30+
set(PHP_ONIGURUMA_MIN_VERSION 5.9.6) # This is the 1st tag available on GitHub.
3131

3232
# Download version when system dependency is not found.
3333
set(PHP_ONIGURUMA_DOWNLOAD_VERSION 6.9.10)
3434

35-
macro(php_package_oniguruma_find)
36-
if(TARGET Oniguruma::Oniguruma)
37-
set(Oniguruma_FOUND TRUE)
38-
get_property(Oniguruma_DOWNLOADED GLOBAL PROPERTY _PHP_Oniguruma_DOWNLOADED)
39-
set(PHP_ONIG_KOI8 FALSE)
40-
else()
41-
find_package(Oniguruma ${PHP_ONIGURUMA_MIN_VERSION})
42-
43-
if(NOT Oniguruma_FOUND)
44-
_php_package_oniguruma_download()
45-
endif()
46-
endif()
47-
endmacro()
48-
49-
macro(_php_package_oniguruma_download)
50-
message(STATUS "Downloading Oniguruma ${PHP_ONIGURUMA_DOWNLOAD_VERSION}")
51-
35+
macro(php_package_oniguruma)
5236
FetchContent_Declare(
5337
Oniguruma
5438
URL https://github.com/petk/oniguruma/archive/refs/tags/v${PHP_ONIGURUMA_DOWNLOAD_VERSION}.tar.gz
5539
SOURCE_SUBDIR non-existing
56-
OVERRIDE_FIND_PACKAGE
40+
FIND_PACKAGE_ARGS ${PHP_ONIGURUMA_MIN_VERSION}
5741
)
5842

43+
#find_package(Oniguruma ${PHP_ONIGURUMA_MIN_VERSION})
44+
5945
FetchContent_MakeAvailable(Oniguruma)
6046

47+
if(NOT Oniguruma_FOUND)
48+
_php_package_oniguruma_init()
49+
endif()
50+
endmacro()
51+
52+
macro(_php_package_oniguruma_init)
6153
set(options "-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>")
6254

6355
list(
@@ -106,9 +98,6 @@ macro(_php_package_oniguruma_download)
10698
endif()
10799
endblock()
108100

109-
# Mark package as found.
110-
set(Oniguruma_FOUND TRUE)
111-
112101
define_property(
113102
GLOBAL
114103
PROPERTY _PHP_Oniguruma_DOWNLOADED
@@ -121,4 +110,21 @@ macro(_php_package_oniguruma_download)
121110
set(PHP_ONIG_KOI8 FALSE)
122111
endmacro()
123112

124-
php_package_oniguruma_find()
113+
php_package_oniguruma()
114+
115+
macro(php_package_oniguruma_find)
116+
if(TARGET Oniguruma::Oniguruma)
117+
get_property(Oniguruma_DOWNLOADED GLOBAL PROPERTY _PHP_Oniguruma_DOWNLOADED)
118+
set(PHP_ONIG_KOI8 FALSE)
119+
else()
120+
find_package(Oniguruma ${PHP_ONIGURUMA_MIN_VERSION})
121+
122+
if(NOT Oniguruma_FOUND)
123+
_php_package_oniguruma_download()
124+
endif()
125+
endif()
126+
endmacro()
127+
128+
macro(_php_package_oniguruma_download)
129+
message(STATUS "Downloading Oniguruma ${PHP_ONIGURUMA_DOWNLOAD_VERSION}")
130+
endmacro()

0 commit comments

Comments
 (0)