Skip to content

Commit

Permalink
Merge pull request #2116 from Mab879/fix_2022
Browse files Browse the repository at this point in the history
Remove the option to build with PCRE2
  • Loading branch information
jan-cerny authored Jun 5, 2024
2 parents a95bfc9 + a5f358a commit 98456d8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 176 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Build
working-directory: ./build
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True ../
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
make all
- name: Test
Expand All @@ -65,7 +65,7 @@ jobs:
- name: Build
working-directory: ./build
run: |
cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=True -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True ../
cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=True -DCMAKE_BUILD_TYPE=RelWithDebInfo ../
make all
- name: Test
working-directory: ./build
Expand All @@ -88,7 +88,7 @@ jobs:
- name: Build
working-directory: ./build
run: |
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True -DWITH_CRYPTO=nss ../
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_CRYPTO=nss ../
make all
- name: Test
working-directory: ./build
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
- name: Build
run: |
cd $GITHUB_WORKSPACE/build
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DWITH_PCRE2=True -DENABLE_PROBES=False ../
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DENABLE_PROBES=False ../
make all
- name: Test
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Deps
run: "${{ github.workspace }}\\vcpkg\\vcpkg.exe install curl libxml2 libxslt bzip2 pcre pthreads zlib getopt-win32 xmlsec --triplet x64-windows"
run: "${{ github.workspace }}\\vcpkg\\vcpkg.exe install curl libxml2 libxslt bzip2 pcre2 pthreads zlib getopt-win32 xmlsec --triplet x64-windows"

- name: Configure
working-directory: ./build
Expand Down
17 changes: 3 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,8 @@ find_package(Doxygen)
find_package(GConf)
find_package(Ldap)
find_package(OpenDbx)
if(WITH_PCRE2)
find_package(PCRE2 REQUIRED)
else()
find_package(PCRE REQUIRED)
endif()
find_package(PCRE2 REQUIRED)

find_package(PerlLibs)
find_package(Popt)
find_package(Systemd)
Expand Down Expand Up @@ -197,12 +194,7 @@ else()
set(YAML_FILTER_FOUND FALSE)
endif()

if(PCRE2_FOUND)
set(HAVE_PCRE2 1)
message("-- Using PCRE2")
elseif(PCRE_FOUND)
message("-- Using PCRE")
endif()
message("-- Using PCRE2")

check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
check_function_exists(posix_memalign HAVE_POSIX_MEMALIGN)
Expand Down Expand Up @@ -341,8 +333,6 @@ cmake_dependent_option(ENABLE_OSCAP_UTIL_CHROOT "enables the oscap-chroot utilit
option(ENABLE_OSCAP_UTIL_AUTOTAILOR "enables the autotailor utility that is able to perform command-line tailoring" TRUE)
option(ENABLE_OSCAP_REMEDIATE_SERVICE "enables the oscap-remediate service" FALSE)

option(WITH_PCRE2 "use PCRE2 library" FALSE)

# ---------- TEST-SUITE SWITCHES

# Tests will be turned off on Windows, because the test suite uses bash
Expand Down Expand Up @@ -577,7 +567,6 @@ include_directories(
${LIBXML2_INCLUDE_DIR}
${XMLSEC_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${PCRE_INCLUDE_DIRS}
${PCRE2_INCLUDE_DIRS}
)

Expand Down
37 changes: 0 additions & 37 deletions cmake/FindPCRE.cmake

This file was deleted.

10 changes: 3 additions & 7 deletions cmake/FindPCRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 DEFAULT_MSG PCRE2_LIBRARY PCRE2_INCLUDE_DIR)

# Copy the results to the output variables.
IF(PCRE2_FOUND)
SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})
ELSE(PCRE2_FOUND)
SET(PCRE_LIBRARIES)
SET(PCRE_INCLUDE_DIRS)
ENDIF(PCRE2_FOUND)
SET(PCRE2_LIBRARIES ${PCRE2_LIBRARY})
SET(PCRE2_INCLUDE_DIRS ${PCRE2_INCLUDE_DIR})


MARK_AS_ADVANCED(PCRE2_INCLUDE_DIRS PCRE2_LIBRARIES)
1 change: 0 additions & 1 deletion config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#define OSCAP_DEFAULT_CPE_PATH "@OSCAP_DEFAULT_CPE_PATH@"
#define OSCAP_TEMP_DIR "@OSCAP_TEMP_DIR@"

#cmakedefine HAVE_PCRE2

#cmakedefine HAVE_ATOMIC_BUILTINS

Expand Down
20 changes: 4 additions & 16 deletions docs/developer/developer.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,13 @@ Build dependencies may vary depending on enabled features (by the `cmake` comman
Some of the dependencies are optional, if they are not detected, openscap will be compiled
without respective optional features.

On RHEL 7 / CentOS 7, the command to install the build dependencies is:

----
sudo yum install \
cmake dbus-devel GConf2-devel libacl-devel libblkid-devel libcap-devel libcurl-devel \
libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel \
pcre-devel perl-XML-Parser perl-XML-XPath perl-devel python-devel rpm-devel swig \
bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel
----

On Fedora 24+, the command to install the build dependencies is:

----
sudo dnf install \
cmake dbus-devel GConf2-devel libacl-devel libblkid-devel libcap-devel libcurl-devel \
libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel \
pcre-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig \
pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python3-devel python3-dbusmock rpm-devel swig \
bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel
----

Expand All @@ -75,7 +65,7 @@ On RHEL 8+ / CentOS 8+, the command to install the build dependencies is:
sudo dnf install \
cmake dbus-devel libacl-devel libblkid-devel libcap-devel libcurl-devel \
libgcrypt-devel libselinux-devel libxml2-devel libxslt-devel libattr-devel make openldap-devel \
pcre-devel perl-XML-Parser perl-XML-XPath perl-devel python36-devel rpm-devel swig \
pcre2-devel perl-XML-Parser perl-XML-XPath perl-devel python36-devel rpm-devel swig \
bzip2-devel gcc-c++ libyaml-devel xmlsec1-devel xmlsec1-openssl-devel
----

Expand All @@ -89,10 +79,8 @@ libxml-xpath-perl libperl-dev libbz2-dev librpm-dev g++ libyaml-dev \
libxmlsec1-dev libxmlsec1-openssl
----

Since version 1.3.9 OpenSCAP can use either PCRE or PCRE2 library to handle regular
expressions. The default behaviour for 1.3.x line of versions is to try and link
with PCRE. In order to switxh the build system to PCRE2 one must configure
CMake with '-DWITH_PCRE2=True' parameter. Dependencies: Debian/Ubuntu — pcre2-dev,
Since version 1.4.0 OpenSCAP uses PCRE2 library to handle regular
expressions. Dependencies: Debian/Ubuntu — pcre2-dev,
Fedora/RHEL — pcre2-devel.

When you have all the build dependencies installed you can build the library.
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ set_target_properties(openscap PROPERTIES
C_VISIBILITY_PRESET hidden
)

target_link_libraries(openscap ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${XMLSEC_LIBRARIES} ${OPENSSL_LIBRARIES} ${LIBXSLT_EXSLT_LIBRARIES} ${PCRE_LIBRARIES} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries(openscap ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${XMLSEC_LIBRARIES} ${OPENSSL_LIBRARIES} ${LIBXSLT_EXSLT_LIBRARIES} ${PCRE2_LIBRARIES} ${CURL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if (BZIP2_FOUND)
target_link_libraries(openscap ${BZIP2_LIBRARIES})
endif()
Expand Down
1 change: 0 additions & 1 deletion src/OVAL/probes/oval_fts.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,6 @@ OVAL_FTS *oval_fts_open_prefixed(const char *prefix, SEXP_t *path, SEXP_t *filen
ofts->ofts_path_op = path_op;
if (regex != NULL) {
ofts->ofts_path_regex = regex;
oscap_pcre_optimize(regex);
}

if (filesystem == OVAL_RECURSE_FS_LOCAL) {
Expand Down
Loading

0 comments on commit 98456d8

Please sign in to comment.