From 3873daff94523cefc3871794b3a69b118f5748b4 Mon Sep 17 00:00:00 2001 From: Pirmin Duss Date: Fri, 10 May 2019 14:26:40 +0200 Subject: [PATCH] Port the popt argument parsing library This is required for the sgdisk tool. --- lib/import/import-popt.mk | 3 ++ lib/mk/popt.mk | 21 +++++++++++ lib/symbols/popt | 46 ++++++++++++++++++++++++ ports/popt.hash | 1 + ports/popt.port | 11 ++++++ src/lib/popt/patches/autoconfig.patch | 6 ++++ src/lib/popt/patches/popt.patch | 50 +++++++++++++++++++++++++++ 7 files changed, 138 insertions(+) create mode 100644 lib/import/import-popt.mk create mode 100644 lib/mk/popt.mk create mode 100644 lib/symbols/popt create mode 100644 ports/popt.hash create mode 100644 ports/popt.port create mode 100644 src/lib/popt/patches/autoconfig.patch create mode 100644 src/lib/popt/patches/popt.patch diff --git a/lib/import/import-popt.mk b/lib/import/import-popt.mk new file mode 100644 index 0000000..a7ad280 --- /dev/null +++ b/lib/import/import-popt.mk @@ -0,0 +1,3 @@ +POPT_DIR := $(call select_from_ports,popt)/src/lib/popt + +INC_DIR += $(POPT_DIR) diff --git a/lib/mk/popt.mk b/lib/mk/popt.mk new file mode 100644 index 0000000..347b99c --- /dev/null +++ b/lib/mk/popt.mk @@ -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 diff --git a/lib/symbols/popt b/lib/symbols/popt new file mode 100644 index 0000000..bfc8c6e --- /dev/null +++ b/lib/symbols/popt @@ -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 diff --git a/ports/popt.hash b/ports/popt.hash new file mode 100644 index 0000000..8945aa5 --- /dev/null +++ b/ports/popt.hash @@ -0,0 +1 @@ +4bd12ef49b8e8c463ec891b8397b3dd2904ef86b diff --git a/ports/popt.port b/ports/popt.port new file mode 100644 index 0000000..2ed921e --- /dev/null +++ b/ports/popt.port @@ -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 diff --git a/src/lib/popt/patches/autoconfig.patch b/src/lib/popt/patches/autoconfig.patch new file mode 100644 index 0000000..52a4088 --- /dev/null +++ b/src/lib/popt/patches/autoconfig.patch @@ -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" diff --git a/src/lib/popt/patches/popt.patch b/src/lib/popt/patches/popt.patch new file mode 100644 index 0000000..f525eab --- /dev/null +++ b/src/lib/popt/patches/popt.patch @@ -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)