Port the popt argument parsing library

This is required for the sgdisk tool.
This commit is contained in:
Pirmin Duss
2019-05-10 14:26:40 +02:00
committed by Norman Feske
parent a9f90eb1d5
commit 3873daff94
7 changed files with 138 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
POPT_DIR := $(call select_from_ports,popt)/src/lib/popt
INC_DIR += $(POPT_DIR)

21
lib/mk/popt.mk Normal file
View File

@@ -0,0 +1,21 @@
POPT_DIR := $(call select_from_ports,popt)/src/lib/popt
LIBS += libc
SRC_C := lookup3.c
SRC_C += popt.c
SRC_C += poptconfig.c
SRC_C += popthelp.c
SRC_C += poptint.c
SRC_C += poptparse.c
SRC_C += tdict.c
CC_C_OPT += -Wno-implicit-function-declaration -Wno-unused-but-set-variable -Wno-unused-variable
CC_CXX_WARN_STRICT =
INC_DIR += $(POPT_DIR)
vpath %.c $(POPT_DIR)
SHARED_LIB = 1

46
lib/symbols/popt Normal file
View File

@@ -0,0 +1,46 @@
poptAddAlias T
poptAddItem T
poptAliasOptions B 48
poptBadOption T
poptBitsAdd T
poptBitsArgs T
poptBitsChk T
poptBitsClr T
poptBitsDel T
poptBitsIntersect T
poptBitsUnion T
poptConfigFileToString T
poptDupArgv T
poptFini T
poptFreeContext T
poptGetArg T
poptGetArgs T
poptGetContext T
poptGetInvocationName T
poptGetNextOpt T
poptGetOptArg T
poptHelpOptions D 192
poptHelpOptionsI18N D 8
poptInit T
poptJlu32lpair T
poptParseArgvString T
poptPeekArg T
poptPrintHelp T
poptPrintUsage T
poptReadConfigFile T
poptReadConfigFiles T
poptReadDefaultConfig T
poptReadFile T
poptResetContext T
poptSaneFile T
poptSaveBits T
poptSaveInt T
poptSaveLong T
poptSaveLongLong T
poptSaveShort T
poptSaveString T
poptSetExecPath T
poptSetOtherOptionHelp T
poptStrerror T
poptStrippedArgv T
poptStuffArgs T

1
ports/popt.hash Normal file
View File

@@ -0,0 +1 @@
4bd12ef49b8e8c463ec891b8397b3dd2904ef86b

11
ports/popt.port Normal file
View File

@@ -0,0 +1,11 @@
LICENSE := GPLv2
VERSION := 5.4.13
DOWNLOADS := popt.git
POPT_DIR := src/lib/popt
URL(popt) := https://github.com/devzero2000/POPT.git
REV(popt) := rpm-$(VERSION)-release
DIR(popt) := $(POPT_DIR)
PATCHES := src/lib/popt/patches/*.patch

View File

@@ -0,0 +1,6 @@
--- src/lib/popt/configmake.h 1970-01-01 01:00:00.000000000 +0100
+++ src/lib/popt/configmake.h 2019-05-10 14:46:10.263888225 +0200
@@ -0,0 +1,3 @@
+/* DO NOT EDIT! GENERATED AUTOMATICALLY! */
+#define POPT_ALIAS "/popt"
+#define PACKAGE "popt"

View File

@@ -0,0 +1,50 @@
--- src/lib/popt/popt.c 2019-05-10 14:05:51.713604568 +0200
+++ src/lib/popt/popt.c 2019-05-10 09:29:26.091811422 +0200
@@ -42,6 +42,7 @@
/*@unchecked@*/
unsigned int _poptGroupMask = POPT_GROUP_MASK;
+/*
#if !defined(HAVE_STRERROR) && !defined(__LCLINT__)
static char * strerror(int errno)
{
@@ -54,6 +55,7 @@
return POPT_("unknown errno");
}
#endif
+*/
#ifdef MYDEBUG
/*@unused@*/
--- src/lib/popt/system.h 2019-05-10 14:05:51.165600535 +0200
+++ src/lib/popt/system.h 2019-05-10 11:36:49.041594010 +0200
@@ -143,6 +143,9 @@
#else
+#define X_OK 1
+#define FLT_MIN 1.175494351e-38F
+#define FLT_MAX 3.402823466e+38F
#endif /* defined(_MSC_VER) || defined(__MINGW32__) */
@@ -175,19 +178,6 @@
/*@*/;
/*@=incondefs@*/
-#if !defined(HAVE_STPCPY)
-/* Copy SRC to DEST, returning the address of the terminating '\0' in DEST. */
-static inline char * stpcpy (char *dest, const char * src) {
- register char *d = dest;
- register const char *s = src;
-
- do
- *d++ = *s;
- while (*s++ != '\0');
- return d - 1;
-}
-#endif
-
/* Memory allocation via macro defs to get meaningful locations from mtrace() */
#if defined(HAVE_MCHECK_H) && defined(__GNUC__)
#define vmefail() (fprintf(stderr, "virtual memory exhausted.\n"), exit(EXIT_FAILURE), NULL)