Skip to content

Commit 01abf4c

Browse files
authored
fixed macos build by manually installing pcre (cppcheck-opensource#4597)
* Makefile: bail out if `pcre-config` is missing * CI-unixish.yml: install `pcre` for `macos` via `brew` since it suddenly disappeared from the runner images
1 parent c26a8fb commit 01abf4c

3 files changed

Lines changed: 20 additions & 9 deletions

File tree

.github/workflows/CI-unixish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ jobs:
3939
- name: Install missing software on macos
4040
if: contains(matrix.os, 'macos')
4141
run: |
42-
brew install coreutils qt@5 tinyxml2
42+
# pcre was removed from runner images in November 2022
43+
brew install coreutils qt@5 tinyxml2 pcre
4344
4445
- name: CMake build on ubuntu (with GUI / system tinyxml2)
4546
if: contains(matrix.os, 'ubuntu')
@@ -88,7 +89,8 @@ jobs:
8889
- name: Install missing software on macos
8990
if: contains(matrix.os, 'macos')
9091
run: |
91-
brew install coreutils qt@5
92+
# pcre was removed from runner images in November 2022
93+
brew install coreutils qt@5 pcre
9294
9395
- name: CMake build on ubuntu (with GUI)
9496
if: contains(matrix.os, 'ubuntu')
@@ -330,7 +332,8 @@ jobs:
330332
- name: Install missing software on macos
331333
if: contains(matrix.os, 'macos')
332334
run: |
333-
brew install coreutils python3
335+
# pcre was removed from runner images in November 2022
336+
brew install coreutils python3 pcre
334337
335338
- name: Install missing Python packages
336339
run: |

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,15 @@ else ifeq ($(CXX), c++)
151151
endif
152152

153153
ifeq ($(HAVE_RULES),yes)
154-
override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)
154+
PCRE_CONFIG = $(shell which pcre-config)
155+
ifeq ($(PCRE_CONFIG),)
156+
$(error Did not find pcre-config)
157+
endif
158+
override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell $(PCRE_CONFIG) --cflags)
155159
ifdef LIBS
156-
LIBS += $(shell pcre-config --libs)
160+
LIBS += $(shell $(PCRE_CONFIG) --libs)
157161
else
158-
LIBS=$(shell pcre-config --libs)
162+
LIBS=$(shell $(PCRE_CONFIG) --libs)
159163
endif
160164
endif
161165

tools/dmake.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -429,11 +429,15 @@ int main(int argc, char **argv)
429429
<< "\n";
430430

431431
fout << "ifeq ($(HAVE_RULES),yes)\n"
432-
<< " override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell pcre-config --cflags)\n"
432+
<< " PCRE_CONFIG = $(shell which pcre-config)\n"
433+
<< " ifeq ($(PCRE_CONFIG),)\n"
434+
<< " $(error Did not find pcre-config)\n"
435+
<< " endif\n"
436+
<< " override CXXFLAGS += -DHAVE_RULES -DTIXML_USE_STL $(shell $(PCRE_CONFIG) --cflags)\n"
433437
<< " ifdef LIBS\n"
434-
<< " LIBS += $(shell pcre-config --libs)\n"
438+
<< " LIBS += $(shell $(PCRE_CONFIG) --libs)\n"
435439
<< " else\n"
436-
<< " LIBS=$(shell pcre-config --libs)\n"
440+
<< " LIBS=$(shell $(PCRE_CONFIG) --libs)\n"
437441
<< " endif\n"
438442
<< "endif\n\n";
439443

0 commit comments

Comments
 (0)