vcpkg/ports/openscap/fix-build.patch
Kai Pastor 5a8ff0088a
[libxml2,libxslt] Revise dependency handling (#24935)
* Update mingw support expressions

* Update versions

* Use pkg-config for complete libgcrypt dependencies

* Remove crypto from default features

Align with CMake build system defaults.

* Drop unused liblzma dependency

* Update versions

* Skip installation of docs

* Update versions

* Restructure patches

* Update versions

* CI [skip actions]

* Revise libxml2 wrapper

* Omit CONFIG from find_package(LibXml2)

* Test libxml2 with, and fix for, CMake 3.7

* Update versions

* More libxml2 wrapper changes

* libxslt gcrypt variable name changes

* Install usage

* Trim portfile

* [openscap] Use vcpkg pkg-config database

* [openscap] Unbreak find_package(Threads)

* Update versions

* Update CI baseline

* REQUIRED is a literal

* Update versions

* Always load libxml2 config instead of find module [skip actions]

* [libxmlmm] Fix linking to libxml2

libxml2 needs iconv include dir on Windows.

* [libxmlmm] License field and processing

* [libxmlmm] Export unofficial CMake config

* [libxmlmm] Change target prefix, not global default

* Revert cmake-user changes

* Set LIBXML2_FOUND

* Update versions

* Fix xslt-config

* Update versions

* Adjust tidy-html5

* Update versions

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2022-07-06 14:30:42 -07:00

122 lines
4.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4de5b57..5f483a3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -140,15 +140,25 @@ find_package(SWIG)
find_package(LibXml2 REQUIRED)
find_package(LibXslt REQUIRED)
find_package(BZip2)
+find_package(OpenSSL REQUIRED)
+find_package(ZLIB REQUIRED)
# PThread
-set(CMAKE_THREAD_PREFER_PTHREAD)
-set(THREADS_PREFER_PTHREAD_FLAG)
-set(THREADS_USE_PTHREADS_WIN32 true)
-find_package(Threads REQUIRED)
-check_library_exists(pthread pthread_timedjoin_np "" HAVE_PTHREAD_TIMEDJOIN_NP)
-check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)
-check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP)
+if (WIN32)
+ set(CMAKE_THREAD_PREFER_PTHREAD)
+ set(THREADS_PREFER_PTHREAD_FLAG)
+ set(THREADS_USE_PTHREADS_WIN32 true)
+ find_package(pthread CONFIG REQUIRED)
+ set(CMAKE_THREAD_LIBS_INIT ${PThreads4W_LIBRARY})
+ check_library_exists(pthread pthread_timedjoin_np "" HAVE_PTHREAD_TIMEDJOIN_NP)
+ check_library_exists(pthread pthread_setname_np "" HAVE_PTHREAD_SETNAME_NP)
+ check_library_exists(pthread pthread_getname_np "" HAVE_PTHREAD_GETNAME_NP)
+else()
+ find_package(Threads REQUIRED)
+endif()
+
+# OpenSSL
+link_libraries(OpenSSL::SSL OpenSSL::Crypto)
# WITH_CRYPTO
set(WITH_CRYPTO "gcrypt" CACHE STRING "gcrypt|nss3")
@@ -373,19 +383,9 @@ message(STATUS "asciidoc: ${ASCIIDOC_EXECUTABLE}")
# ---------- PATHS
-if(WIN32)
- # Windows installer does not allow full paths.
- # The install path can be changed by user in Windows installer.
- # We will use relative names - "schemas", "xsl" and "cpe"
- # directories will be located in the same directory as oscap.exe.
- set(OSCAP_DEFAULT_SCHEMA_PATH "schemas")
- set(OSCAP_DEFAULT_XSLT_PATH "xsl")
- set(OSCAP_DEFAULT_CPE_PATH "cpe")
-else()
- set(OSCAP_DEFAULT_SCHEMA_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/schemas")
- set(OSCAP_DEFAULT_XSLT_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/xsl")
- set(OSCAP_DEFAULT_CPE_PATH "${CMAKE_INSTALL_FULL_DATADIR}/openscap/cpe")
-endif()
+set(OSCAP_DEFAULT_SCHEMA_PATH share/openscap/schemas)
+set(OSCAP_DEFAULT_XSLT_PATH share/openscap/xsl)
+set(OSCAP_DEFAULT_CPE_PATH share/openscap/cpe)
set(OSCAP_TEMP_DIR "/tmp" CACHE STRING "use different temporary directory to execute sce scripts (default=/tmp)")
# ---------- RPATHS for linking
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 2a3f373..781d05a 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -6,27 +6,32 @@ if(ENABLE_OSCAP_UTIL)
add_executable(oscap ${UTILS_SOURCES})
target_link_libraries(oscap openscap)
if(WIN32)
- set(OSCAP_UTIL_DESTINATION ".")
+ find_path(GETOPT_INCLUDE_DIR getopt.h)
+ include(SelectLibraryConfigurations)
+ find_library(GETOPT_LIBRARY_RELEASE NAMES getopt)
+ find_library(GETOPT_LIBRARY_DEBUG NAMES getopt PATH_SUFFIXES debug/lib)
+ select_library_configurations(GETOPT)
+
+ message("GETOPT_INCLUDE_DIR: ${GETOPT_INCLUDE_DIR}")
+ message("GETOPT_LIBRARY: ${GETOPT_LIBRARY}")
+
+ target_include_directories(oscap PRIVATE ${GETOPT_INCLUDE_DIR})
+ target_link_libraries(oscap PRIVATE ${GETOPT_LIBRARY})
+
+ set(OSCAP_UTIL_DESTINATION tools)
# Install the 'oscap' utility
install(TARGETS "oscap"
DESTINATION ${OSCAP_UTIL_DESTINATION}
)
- # Install all recursively dependent DLLs for oscap.exe
- set(APPS "\${CMAKE_INSTALL_PREFIX}/oscap.exe") # the \ before $ is required by BundleUtilities
- set(VCPKG_DLL_DIR "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin")
- install(CODE "
- include(BundleUtilities)
- fixup_bundle(\"${APPS}\" \"\" \"${VCPKG_DLL_DIR}\")
- ")
else()
- set(OSCAP_UTIL_DESTINATION ${CMAKE_INSTALL_BINDIR})
+ set(OSCAP_UTIL_DESTINATION tools)
# Install the 'oscap' utility
install(TARGETS "oscap"
DESTINATION ${OSCAP_UTIL_DESTINATION}
)
# Install manual page
install(FILES "oscap.8"
- DESTINATION "${CMAKE_INSTALL_MANDIR}/man8"
+ DESTINATION share/openscap/man8
)
endif()
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9e18613..e84a21f 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -125,4 +125,8 @@ else()
set(OPENSCAP_INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
-install(TARGETS openscap DESTINATION ${OPENSCAP_INSTALL_DESTINATION})
+install(TARGETS openscap
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)