vcpkg/ports/libmariadb/portfile.cmake
Jack·Boos·Yu 5293c8685a
[libmariadb] Fix plugin installation, fix pkgconfig (#18769)
* [libmariadb] Fix plugin installation, fix pkgconfig

* fix installation

* update version stuff

Co-authored-by: Billy Robert ONeal III <bion@microsoft.com>
2021-07-22 16:19:26 -07:00

82 lines
2.5 KiB
CMake

if (EXISTS "${CURRENT_INSTALLED_DIR}/share/libmysql")
message(FATAL_ERROR "FATAL ERROR: libmysql and libmariadb are incompatible.")
endif()
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mariadb-corporation/mariadb-connector-c
REF 7d304d26c787a3f0430624db977b615aba56e4bb # v3.1.12
SHA512 16e74b2cbe401492ef294e2442a00ef1739089152a88d9263ca4d17b65260554b330630e9405813fd9089fa445d676e3b6aa91ac94128ad6b0a299e8b7edc1b3
HEAD_REF 3.1
PATCHES
arm64.patch
md.patch
disable-test-build.patch
fix-InstallPath.patch
fix-iconv.patch
export-cmake-targets.patch
fix-build-error-with-cmake3.20.patch #This can be removed in next release, which has been merged to upstream.
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
zlib WITH_EXTERNAL_ZLIB
iconv WITH_ICONV
)
if("openssl" IN_LIST FEATURES)
set(WITH_SSL OPENSSL)
else()
set(WITH_SSL OFF)
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DINSTALL_PLUGINDIR=plugin/${PORT}
-DWITH_UNIT_TESTS=OFF
-DWITH_CURL=OFF
-DWITH_SSL=${WITH_SSL}
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets(CONFIG_PATH share/unofficial-libmariadb TARGET_PATH share/unofficial-libmariadb)
vcpkg_fixup_pkgconfig()
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
# remove debug header
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
endif()
if(VCPKG_BUILD_TYPE STREQUAL "debug")
# move headers
file(RENAME
${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/include)
endif()
if (NOT VCPKG_TARGET_IS_WINDOWS)
vcpkg_copy_tools(TOOL_NAMES mariadb_config AUTO_CLEAN)
endif()
# remove plugin folder
file(REMOVE_RECURSE
${CURRENT_PACKAGES_DIR}/lib/mariadb
${CURRENT_PACKAGES_DIR}/debug/lib/mariadb)
# copy & remove header files
file(REMOVE
${CURRENT_PACKAGES_DIR}/include/mariadb/my_config.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/mysql_version.h.in
${CURRENT_PACKAGES_DIR}/include/mariadb/CMakeLists.txt
${CURRENT_PACKAGES_DIR}/include/mariadb/Makefile.am)
file(RENAME
${CURRENT_PACKAGES_DIR}/include/mariadb
${CURRENT_PACKAGES_DIR}/include/mysql)
# copy license file
file(INSTALL ${SOURCE_PATH}/COPYING.LIB DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)