diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libpopt | |
Diffstat (limited to 'vcpkg/ports/libpopt')
| -rw-r--r-- | vcpkg/ports/libpopt/0004-vcpkg-fixmsvc.patch | 62 | ||||
| -rw-r--r-- | vcpkg/ports/libpopt/CMakeLists.txt | 65 | ||||
| -rw-r--r-- | vcpkg/ports/libpopt/config.h.cmake | 61 | ||||
| -rw-r--r-- | vcpkg/ports/libpopt/popt.def | 50 | ||||
| -rw-r--r-- | vcpkg/ports/libpopt/portfile.cmake | 32 | ||||
| -rw-r--r-- | vcpkg/ports/libpopt/vcpkg.json | 12 |
6 files changed, 282 insertions, 0 deletions
diff --git a/vcpkg/ports/libpopt/0004-vcpkg-fixmsvc.patch b/vcpkg/ports/libpopt/0004-vcpkg-fixmsvc.patch new file mode 100644 index 0000000..d9bc082 --- /dev/null +++ b/vcpkg/ports/libpopt/0004-vcpkg-fixmsvc.patch @@ -0,0 +1,62 @@ +diff -Naur a/poptconfig.c b/poptconfig.c +--- a/poptconfig.c 2009-05-20 16:18:07.000000000 +0300 ++++ b/poptconfig.c 2017-01-21 03:10:17.116120500 +0300 +@@ -141,17 +141,23 @@ + int poptSaneFile(const char * fn) + { + struct stat sb; +- uid_t uid = getuid(); ++#ifndef _MSC_VER ++ uid_t uid = getuid(); ++#endif // ! _MSC_VER + + if (stat(fn, &sb) == -1) + return 1; ++#ifndef _MSC_VER + if ((uid_t)sb.st_uid != uid) + return 0; ++#endif // ! _MSC_VER + if (!S_ISREG(sb.st_mode)) + return 0; + /*@-bitwisesigned@*/ +- if (sb.st_mode & (S_IWGRP|S_IWOTH)) +- return 0; ++#ifndef _MSC_VER ++ if (sb.st_mode & (S_IWGRP | S_IWOTH)) ++ return 0; ++#endif // ! _MSC_VER + /*@=bitwisesigned@*/ + return 1; + } +diff -Naur a/popthelp.c b/popthelp.c +--- a/popthelp.c 2009-08-28 03:06:33.000000000 +0300 ++++ b/popthelp.c 2017-01-21 02:59:26.665695800 +0300 +@@ -10,7 +10,10 @@ + + #include "system.h" + +-#define POPT_USE_TIOCGWINSZ ++#ifndef _MSC_VER ++#define POPT_USE_TIOCGWINSZ ++#endif ++ + #ifdef POPT_USE_TIOCGWINSZ + #include <sys/ioctl.h> + #endif +diff -Naur a/system.h b/system.h +--- a/system.h 2008-12-18 19:09:49.000000000 +0200 ++++ b/system.h 2017-01-21 03:10:59.195367500 +0300 +@@ -100,4 +100,13 @@ + #endif + #define UNUSED(x) x __attribute__((__unused__)) + ++#if defined(_MSC_VER) ++#define X_OK 0 ++ ++#include <BaseTsd.h> ++typedef SSIZE_T ssize_t; ++ ++#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) ++#endif ++ + #include "popt.h" diff --git a/vcpkg/ports/libpopt/CMakeLists.txt b/vcpkg/ports/libpopt/CMakeLists.txt new file mode 100644 index 0000000..c6c3b8d --- /dev/null +++ b/vcpkg/ports/libpopt/CMakeLists.txt @@ -0,0 +1,65 @@ +cmake_minimum_required(VERSION 3.0) +project(popt VERSION 1.16 LANGUAGES C) + +set(PACKAGE "popt") +set(POPT_SYSCONFDIR "C:\\\\") +set(CMAKE_DEBUG_POSTFIX "d") + +file(GLOB SOURCES "popt.c" + "poptconfig.c" + "popthelp.c" + "poptint.c" + "poptparse.c" + "popt.def" +) + +option(POPT_USE_CONFIG "Use configuration file" OFF) + +if(POPT_USE_CONFIG) + include(CheckIncludeFile) + include(CheckFunctionExists) + + if(ANDROID AND ANDROID_NATIVE_API_LEVEL LESS "28") + set(HAVE_GLOB_H FALSE CACHE INTERNAL "") + endif() + + check_include_file(float.h HAVE_FLOAT_H) + check_include_file(fnmatch.h HAVE_FNMATCH_H) + check_include_file(glob.h HAVE_GLOB_H) + check_include_file(langinfo.h HAVE_LANGINFO_H) + check_include_file(libintl.h HAVE_LIBINTL_H) + check_include_file(mcheck.h HAVE_MCHECK_H) + check_include_file(unistd.h HAVE_UNISTD_H) + + + check_function_exists(gettext HAVE_GETTEXT) + check_function_exists(iconv HAVE_ICONV) + check_function_exists(mtrace HAVE_MTRACE) + check_function_exists(srandom HAVE_SRANDOM) + check_function_exists(stpcpy HAVE_STPCPY) + check_function_exists(strerror HAVE_STRERROR) + check_function_exists(vasprintf HAVE_VASPRINTF) + check_function_exists(__secure_getenv HAVE___SECURE_GETENV) + + configure_file(config.h.cmake config.h @ONLY) + add_definitions(-DHAVE_CONFIG_H) +endif() + +add_definitions(-D_CRT_SECURE_NO_WARNINGS) + +include_directories(${CMAKE_BINARY_DIR}) + +add_library(popt ${SOURCES}) +if (MSVC) + target_compile_options(popt PRIVATE /wd4996) +else() + target_compile_options(popt PRIVATE -Wno-error=implicit-function-declaration) +endif() + +install(TARGETS popt + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(FILES "popt.h" DESTINATION "include")
\ No newline at end of file diff --git a/vcpkg/ports/libpopt/config.h.cmake b/vcpkg/ports/libpopt/config.h.cmake new file mode 100644 index 0000000..f641fc7 --- /dev/null +++ b/vcpkg/ports/libpopt/config.h.cmake @@ -0,0 +1,61 @@ +#ifndef CONFIG_H +#define CONFIG_H + +/* Define to 1 if translation of program messages to the user's native language is requested. */ +#cmakedefine ENABLE_NLS 1 + +/* Define if the GNU dcgettext() function is already present or preinstalled. */ +#cmakedefine HAVE_DCGETTEXT 1 + +/* Define to 1 if you have the <float.h> header file. */ +#cmakedefine HAVE_FLOAT_H 1 + +/* Define to 1 if you have the <fnmatch.h> header file. */ +#cmakedefine HAVE_FNMATCH_H 1 + +/* Define if the GNU gettext() function is already present or preinstalled. */ +#cmakedefine HAVE_GETTEXT 1 + +/* Define to 1 if you have the <glob.h> header file. */ +#cmakedefine HAVE_GLOB_H 1 + +/* Define if you have the iconv() function and it works. */ +#cmakedefine HAVE_ICONV 1 + +/* Define to 1 if you have the <langinfo.h> header file. */ +#cmakedefine HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the <libintl.h> header file. */ +#cmakedefine HAVE_LIBINTL_H 1 + +/* Define to 1 if you have the <mcheck.h> header file. */ +#cmakedefine HAVE_MCHECK_H 1 + +/* Define to 1 if you have the `mtrace' function. */ +#cmakedefine HAVE_MTRACE 1 + +/* Define to 1 if you have the `srandom' function. */ +#cmakedefine HAVE_SRANDOM 1 + +/* Define to 1 if you have the `stpcpy' function. */ +#cmakedefine HAVE_STPCPY 1 + +/* Define to 1 if you have the `strerror' function. */ +#cmakedefine HAVE_STRERROR 1 + +/* Define to 1 if you have the <unistd.h> header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vasprintf' function. */ +#cmakedefine HAVE_VASPRINTF 1 + +/* Define to 1 if you have the `__secure_getenv' function. */ +#cmakedefine HAVE___SECURE_GETENV 1 + +/* Name of package */ +#cmakedefine PACKAGE "@PACKAGE@" + +/* Full path to default POPT configuration directory */ +#cmakedefine POPT_SYSCONFDIR "@POPT_SYSCONFDIR@" + +#endif
\ No newline at end of file diff --git a/vcpkg/ports/libpopt/popt.def b/vcpkg/ports/libpopt/popt.def new file mode 100644 index 0000000..20bb70a --- /dev/null +++ b/vcpkg/ports/libpopt/popt.def @@ -0,0 +1,50 @@ +EXPORTS + _poptArgMask + _poptBitsK + _poptBitsM + _poptBitsN + _poptGroupMask + poptAddAlias + poptAddItem + poptAliasOptions + poptBadOption + poptBitsAdd + poptBitsArgs + poptBitsChk + poptBitsClr + poptBitsDel + poptBitsIntersect + poptBitsUnion + poptConfigFileToString + poptDupArgv + poptFini + poptFreeContext + poptGetArg + poptGetArgs + poptGetContext + poptGetInvocationName + poptGetNextOpt + poptGetOptArg + poptHelpOptions + poptInit + poptParseArgvString + poptPeekArg + poptPrintHelp + poptPrintUsage + poptReadConfigFile + poptReadConfigFiles + poptReadDefaultConfig + poptReadFile + poptResetContext + poptSaneFile + poptSaveBits + poptSaveInt + poptSaveLong + poptSaveLongLong + poptSaveShort + poptSaveString + poptSetExecPath + poptSetOtherOptionHelp + poptStrerror + poptStrippedArgv + poptStuffArgs
\ No newline at end of file diff --git a/vcpkg/ports/libpopt/portfile.cmake b/vcpkg/ports/libpopt/portfile.cmake new file mode 100644 index 0000000..538af68 --- /dev/null +++ b/vcpkg/ports/libpopt/portfile.cmake @@ -0,0 +1,32 @@ +set(LIBPOPT_VERSION 1.16) +set(LIBPOPT_HASH bae2dd4e5d682ef023fdc77ae60c4aad01a3a576d45af9d78d22490c11e410e60edda37ede171920746d4ae0d5de3c060d15cecfd41ba75b727a811be828d694) + +vcpkg_download_distfile(ARCHIVE + URLS + "https://ftp.openbsd.org/pub/OpenBSD/distfiles/popt-${LIBPOPT_VERSION}.tar.gz" + FILENAME "popt-${LIBPOPT_VERSION}.tar.gz" + SHA512 ${LIBPOPT_HASH} +) + +vcpkg_extract_source_archive( + SOURCE_PATH + ARCHIVE "${ARCHIVE}" + PATCHES + 0004-vcpkg-fixmsvc.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/config.h.cmake" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/popt.def" DESTINATION "${SOURCE_PATH}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS -DPOPT_USE_CONFIG=1 +) + +vcpkg_cmake_install() +vcpkg_copy_pdbs() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/libpopt/vcpkg.json b/vcpkg/ports/libpopt/vcpkg.json new file mode 100644 index 0000000..9b0d106 --- /dev/null +++ b/vcpkg/ports/libpopt/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "libpopt", + "version": "1.16", + "port-version": 18, + "description": "Library for parsing command line parameters", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} |