mirror of
https://github.com/cemu-project/vcpkg.git
synced 2025-02-22 18:47:09 +01:00
[libpopt] add version 1.16
This commit is contained in:
parent
1c9873a0da
commit
c71fffc32b
3
ports/libpopt/CONTROL
Normal file
3
ports/libpopt/CONTROL
Normal file
@ -0,0 +1,3 @@
|
||||
Source: libpopt
|
||||
Version: 1.16-10~vcpkg1
|
||||
Description: Library for parsing command line parameters
|
57
ports/libpopt/cmake/CMakeLists.txt
Normal file
57
ports/libpopt/cmake/CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
||||
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)
|
||||
|
||||
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})
|
||||
set_target_properties(popt PROPERTIES COMPILE_FLAGS "/wd4996")
|
||||
|
||||
install(TARGETS popt
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
install(FILES "popt.h" DESTINATION "include")
|
61
ports/libpopt/cmake/config.h.cmake
Normal file
61
ports/libpopt/cmake/config.h.cmake
Normal file
@ -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
|
50
ports/libpopt/cmake/popt.def
Normal file
50
ports/libpopt/cmake/popt.def
Normal file
@ -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
|
62
ports/libpopt/patches/0004-vcpkg-fixmsvc.patch
Normal file
62
ports/libpopt/patches/0004-vcpkg-fixmsvc.patch
Normal file
@ -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"
|
35
ports/libpopt/portfile.cmake
Normal file
35
ports/libpopt/portfile.cmake
Normal file
@ -0,0 +1,35 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
set(LIBPOPT_VERSION 1.16)
|
||||
set(LIBPOPT_HASH bae2dd4e5d682ef023fdc77ae60c4aad01a3a576d45af9d78d22490c11e410e60edda37ede171920746d4ae0d5de3c060d15cecfd41ba75b727a811be828d694)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/popt-${LIBPOPT_VERSION})
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://rpm5.org/files/popt/popt-${LIBPOPT_VERSION}.tar.gz"
|
||||
FILENAME "popt-${LIBPOPT_VERSION}.tar.gz"
|
||||
SHA512 ${LIBPOPT_HASH}
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES "${CMAKE_CURRENT_LIST_DIR}/patches/0004-vcpkg-fixmsvc.patch"
|
||||
)
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/config.h.cmake DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/cmake/popt.def DESTINATION ${SOURCE_PATH})
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS -DPOPT_USE_CONFIG=1
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
vcpkg_copy_pdbs()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
file(COPY ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/libpopt)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libpopt/COPYING ${CURRENT_PACKAGES_DIR}/share/libpopt/copyright)
|
Loading…
x
Reference in New Issue
Block a user