From d881308c048ab9f401bc225de532c8b76844008f Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Tue, 10 Sep 2024 05:44:19 +0200 Subject: [PATCH] [libconfuse] Update, official build, cleanup (#40851) --- ports/libconfuse/CMakeLists.txt | 139 ------------------ ports/libconfuse/config.h.in | 99 ------------- ports/libconfuse/portfile.cmake | 47 +++--- .../unofficial-libconfuse-config.cmake | 21 +++ ports/libconfuse/vcpkg.json | 16 +- versions/baseline.json | 4 +- versions/l-/libconfuse.json | 5 + 7 files changed, 53 insertions(+), 278 deletions(-) delete mode 100644 ports/libconfuse/CMakeLists.txt delete mode 100644 ports/libconfuse/config.h.in create mode 100644 ports/libconfuse/unofficial-libconfuse-config.cmake diff --git a/ports/libconfuse/CMakeLists.txt b/ports/libconfuse/CMakeLists.txt deleted file mode 100644 index 651dab2f06..0000000000 --- a/ports/libconfuse/CMakeLists.txt +++ /dev/null @@ -1,139 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -set(ac_init_line_re "AC_INIT\\(([^,]+), ([^,]+), ([^,]+), ([^)]+)\\)") -file(STRINGS - ${CMAKE_CURRENT_LIST_DIR}/configure.ac - ac_init_line - REGEX ${ac_init_line_re} -) - -string(REGEX REPLACE "${ac_init_line_re}" "\\1" PACKAGE_NAME ${ac_init_line}) -string(REGEX REPLACE "${ac_init_line_re}" "\\2" PACKAGE_VERSION ${ac_init_line}) -string(REGEX REPLACE "${ac_init_line_re}" "\\3" PACKAGE_BUGREPORT ${ac_init_line}) -string(REGEX REPLACE "${ac_init_line_re}" "\\4" PACKAGE ${ac_init_line}) - -set(PACKAGE_TARNAME ${PACKAGE}) -set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") - -string(REGEX REPLACE "([0-9]+.[0-9]+.[0-9]+).*" "\\1" SEMANTIC_VERSION ${PACKAGE_VERSION}) - -project(libconfuse VERSION ${SEMANTIC_VERSION} LANGUAGES C) - -include(CheckFunctionExists) -include(CheckIncludeFile) -include(GNUInstallDirs) - -find_package(FLEX REQUIRED) -find_package(Gettext QUIET) -find_package(Intl QUIET) - -set(CMAKE_DISABLE_SOURCE_CHANGES ON) -set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) - -if (GETTEXT_FOUND) - set(ENABLE_NLS 1) -endif () - -# libconfig.pc.in -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix ${prefix}) -set(libdir ${prefix}/${CMAKE_INSTALL_LIBDIR}) -set(includedir ${prefix}/${CMAKE_INSTALL_INCLUDEDIR}) -set(VERSION ${PROJECT_VERSION}) - -if (Intl_FOUND AND Intl_LIBRARIES) - set(LTLIBINTL ${Intl_LIBRARIES}) -endif () - -configure_file(libconfuse.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libconfuse.pc @ONLY) - -check_function_exists(dcgettext HAVE_DCGETTEXT) -check_function_exists(fmemopen HAVE_FMEMOPEN) -check_function_exists(funopen HAVE_FUNOPEN) -check_function_exists(gettext HAVE_GETTEXT) -check_function_exists(iconv HAVE_ICONV) -check_function_exists(strcasecmp HAVE_STRCASECMP) -check_function_exists(strdup HAVE_STRDUP) -check_function_exists(_strdup HAVE__STRDUP) -check_function_exists(strndup HAVE_STRNDUP) -check_function_exists(setenv HAVE_SETENV) -check_function_exists(unsetenv HAVE_UNSETENV) -check_function_exists(_putenv HAVE__PUTENV) - -if (MSVC) - check_function_exists(_fileno HAVE__FILENO) - check_function_exists(_isatty HAVE__ISATTY) - check_function_exists(_stricmp HAVE_STRCASECMP) -endif () - -check_include_file(stdlib.h HAVE_STDLIB_H) -check_include_file(string.h HAVE_STRING_H) - -check_include_file(strings.h HAVE_STRINGS_H) -check_include_file(sys/stat.h HAVE_SYS_STAT_H) -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(windows.h HAVE_WINDOWS_H) - -configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) - -flex_target( - CONFUSE - src/lexer.l - ${CMAKE_CURRENT_BINARY_DIR}/lexer.c - COMPILE_FLAGS -Pcfg_yy -) - -set(libconfuse_sources - src/confuse.c - ${FLEX_CONFUSE_OUTPUTS} -) - -if (NOT HAVE_FMEMOPEN) - list(APPEND libconfuse_sources src/fmemopen.c) -endif () - -add_library(libconfuse ${libconfuse_sources}) - -if (BUILD_SHARED_LIBS) - if (WIN32) - target_compile_definitions(libconfuse PRIVATE BUILDING_DLL) - endif () -else () - target_compile_definitions(libconfuse PUBLIC BUILDING_STATIC) -endif () - -string(COMPARE EQUAL "${CMAKE_C_COMPILER_ID}" "GNU" USING_GNUC) - -target_compile_definitions(libconfuse - PUBLIC - $ - PRIVATE - $<$:_CRT_SECURE_NO_WARNINGS> - $<$:_CRT_NONSTDC_NO_DEPRECATE> - $<$:strcasecmp=_stricmp> - $<$:_GNU_SOURCE> -) - -target_include_directories(libconfuse - PUBLIC - $ - $ - $ -) - -set_target_properties(libconfuse PROPERTIES PUBLIC_HEADER src/confuse.h) - -install(TARGETS libconfuse EXPORT unofficial-libconfuse-config) - -install( - EXPORT unofficial-libconfuse-config - NAMESPACE unofficial::libconfuse:: - DESTINATION share/unofficial-libconfuse - PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ -) - -install( - FILES ${CMAKE_CURRENT_BINARY_DIR}/libconfuse.pc - DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig -) diff --git a/ports/libconfuse/config.h.in b/ports/libconfuse/config.h.in deleted file mode 100644 index 3a43264bd1..0000000000 --- a/ports/libconfuse/config.h.in +++ /dev/null @@ -1,99 +0,0 @@ -/* Define if translation of program messages to the user's native - language is requested. */ -#cmakedefine ENABLE_NLS - -/* Define if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_STRING_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_STRINGS_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_UNISTD_H - -/* Define if you have the header file. */ -#cmakedefine HAVE_WINDOWS_H - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you have the `_fileno' function. */ -#cmakedefine HAVE__FILENO - -/* Define if you have the `_isatty' function. */ -#cmakedefine HAVE__ISATTY - -/* Define if the GNU dcgettext() function is already present or preinstalled. */ -#cmakedefine HAVE_DCGETTEXT - -/* Define if you have the `fmemopen' function. */ -#cmakedefine HAVE_FMEMOPEN - -/* Define if you have the `funopen' function. */ -#cmakedefine HAVE_FUNOPEN - -/* Define if the GNU gettext() function is already present or preinstalled. */ -#cmakedefine HAVE_GETTEXT - -/* Define if you have the iconv() function. */ -#cmakedefine HAVE_ICONV - -/* Define if you have the `strcasecmp' function. */ -#cmakedefine HAVE_STRCASECMP - -/* Define if you have the `strdup' function. */ -#cmakedefine HAVE_STRDUP - -/* Define if you have the `_strdup' function. */ -#cmakedefine HAVE__STRDUP - -/* Define if you have the strndup function */ -#cmakedefine HAVE_STRNDUP - -/* Define if you have the `setenv' function. */ -#cmakedefine HAVE_SETENV - -/* Define if you have the `unsetenv' function. */ -#cmakedefine HAVE_UNSETENV - -/* Define if you have the `_putenv' function. */ -#cmakedefine HAVE__PUTENV - -/* Define if `lex' declares `yytext' as a `char *' by default, not a - `char[]'. */ -/*#undef YYTEXT_POINTER*/ - -/* Define to empty if `const' does not conform to ANSI C. */ -/*#undef const*/ - -/* Name of package */ -#define PACKAGE "@PACKAGE@" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "@PACKAGE_NAME@" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "@PACKAGE_STRING@" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "@PACKAGE_TARNAME@" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "@PACKAGE_VERSION@" - -/* Version number of package */ -#define VERSION "@PACKAGE_VERSION@" - -#define LOCALEDIR "@CMAKE_INSTALL_LOCALEDIR@" diff --git a/ports/libconfuse/portfile.cmake b/ports/libconfuse/portfile.cmake index 30c291ecc0..5b4a432dea 100644 --- a/ports/libconfuse/portfile.cmake +++ b/ports/libconfuse/portfile.cmake @@ -1,39 +1,36 @@ -vcpkg_from_github( - OUT_SOURCE_PATH SOURCE_PATH - REPO martinh/libconfuse - REF 67e1207c8de440525a3fdde1448a586791ebc052 - SHA512 15d4eb0640fe74cc90910820715a70b2f944d2ed9753cca3be90f0ac6840beeda6a370b0624588d81ed2def2f8463e404473721351a685af711cf1d59efb870a - HEAD_REF master +# Don't change to vcpkg_from_github: The raw repo lacks gettext macros. +vcpkg_download_distfile(ARCHIVE + URLS "https://github.com/libconfuse/libconfuse/releases/download/v${VERSION}/confuse-${VERSION}.tar.xz" + FILENAME "libconfuse-confuse-${VERSION}.tar.xz" + SHA512 93cc62d98166199315f65a2f6f540a9c0d33592b69a2c6a57fd17f132aecc6ece39b9813b96c9a49ae2b66a99b7eba1188a9ce9e360e1c5fb4b973619e7088a0 +) +vcpkg_extract_source_archive(SOURCE_PATH + ARCHIVE "${ARCHIVE}" ) - -file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") -file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h.in" DESTINATION "${SOURCE_PATH}") vcpkg_find_acquire_program(FLEX) get_filename_component(FLEX_DIR "${FLEX}" DIRECTORY) vcpkg_add_to_path("${FLEX_DIR}") -vcpkg_cmake_configure( +set(ENV{AUTOPOINT} true) # true, the program + +vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" + AUTOCONFIG + OPTIONS + --disable-examples + --disable-nls ) - -vcpkg_cmake_install() - +vcpkg_install_make() vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() -if(VCPKG_LIBRARY_LINKAGE STREQUAL static) - vcpkg_replace_string( - "${CURRENT_PACKAGES_DIR}/include/confuse.h" - "ifdef BUILDING_STATIC" - "if 1 // ifdef BUILDING_STATIC" - ) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/confuse.h" "ifdef BUILDING_STATIC" "if 1") endif() -vcpkg_cmake_config_fixup(PACKAGE_NAME unofficial-${PORT}) +file(INSTALL "${CURRENT_PORT_DIR}/unofficial-libconfuse-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/unofficial-libconfuse") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share") -# Handle copyright -configure_file("${SOURCE_PATH}/LICENSE" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" COPYONLY) - -vcpkg_fixup_pkgconfig() +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libconfuse/unofficial-libconfuse-config.cmake b/ports/libconfuse/unofficial-libconfuse-config.cmake new file mode 100644 index 0000000000..b5e70d0ccc --- /dev/null +++ b/ports/libconfuse/unofficial-libconfuse-config.cmake @@ -0,0 +1,21 @@ +if(NOT TARGET unofficial::libconfuse::libconfuse) + add_library(unofficial::libconfuse::libconfuse UNKNOWN IMPORTED) + get_filename_component(z_vcpkg_libconfuse_prefix "${CMAKE_CURRENT_LIST_DIR}" PATH) + get_filename_component(z_vcpkg_libconfuse_prefix "${z_vcpkg_libconfuse_prefix}" PATH) + find_library(Z_VCPKG_libconfuse_LIBRARY_RELEASE NAMES confuse PATHS "${z_vcpkg_libconfuse_prefix}/lib" NO_DEFAULT_PATH REQUIRED) + set_target_properties(unofficial::libconfuse::libconfuse PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${z_vcpkg_libconfuse_prefix}/include" + IMPORTED_CONFIGURATIONS RELEASE + IMPORTED_LOCATION_RELEASE "${Z_VCPKG_libconfuse_LIBRARY_RELEASE}" + IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C" + ) + if("@VCPKG_BUILD_TYPE@" STREQUAL "") + find_library(Z_VCPKG_libconfuse_LIBRARY_DEBUG NAMES libconfuse PATHS "${z_vcpkg_libconfuse_prefix}/debug/lib" NO_DEFAULT_PATH REQUIRED) + set_property(TARGET unofficial::libconfuse::libconfuse APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(unofficial::libconfuse::libconfuse PROPERTIES + IMPORTED_LOCATION_DEBUG "${Z_VCPKG_libconfuse_LIBRARY_DEBUG}" + IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C" + ) + endif() + unset(z_vcpkg_libconfuse_prefix) +endif() diff --git a/ports/libconfuse/vcpkg.json b/ports/libconfuse/vcpkg.json index a193aa2c04..0a78c5593a 100644 --- a/ports/libconfuse/vcpkg.json +++ b/ports/libconfuse/vcpkg.json @@ -1,17 +1,7 @@ { "name": "libconfuse", - "version-date": "2019-07-14", - "port-version": 4, + "version": "3.3", "description": "Small configuration file parser library for C", - "homepage": "https://github.com/martinh/libconfuse", - "dependencies": [ - { - "name": "vcpkg-cmake", - "host": true - }, - { - "name": "vcpkg-cmake-config", - "host": true - } - ] + "homepage": "https://github.com/libconfuse/libconfuse", + "license": "ISC" } diff --git a/versions/baseline.json b/versions/baseline.json index ef50dbb504..83f23c7620 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4329,8 +4329,8 @@ "port-version": 5 }, "libconfuse": { - "baseline": "2019-07-14", - "port-version": 4 + "baseline": "3.3", + "port-version": 0 }, "libcopp": { "baseline": "2.2.0", diff --git a/versions/l-/libconfuse.json b/versions/l-/libconfuse.json index 96eefd9a6f..2ab8998f5d 100644 --- a/versions/l-/libconfuse.json +++ b/versions/l-/libconfuse.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "f6e1479c9870ee0be6ad0e196345ea28ef0875de", + "version": "3.3", + "port-version": 0 + }, { "git-tree": "395e64637b555a051b308e0e2e69b1bfd152b381", "version-date": "2019-07-14",