aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/argtable2
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/argtable2
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/argtable2')
-rw-r--r--vcpkg/ports/argtable2/0001-fix-install-dirs.patch35
-rw-r--r--vcpkg/ports/argtable2/0002-include-correct-headers.patch60
-rw-r--r--vcpkg/ports/argtable2/0003-add-dependence-getopt.patch42
-rw-r--r--vcpkg/ports/argtable2/portfile.cmake32
-rw-r--r--vcpkg/ports/argtable2/undef-eoverflow.diff14
-rw-r--r--vcpkg/ports/argtable2/vcpkg.json19
6 files changed, 202 insertions, 0 deletions
diff --git a/vcpkg/ports/argtable2/0001-fix-install-dirs.patch b/vcpkg/ports/argtable2/0001-fix-install-dirs.patch
new file mode 100644
index 0000000..d852ffa
--- /dev/null
+++ b/vcpkg/ports/argtable2/0001-fix-install-dirs.patch
@@ -0,0 +1,35 @@
+From 6594abbd953d0e26105fd6c982990eb702f27804 Mon Sep 17 00:00:00 2001
+From: Nicole Mazzuca <mazzucan@outlook.com>
+Date: Tue, 22 Sep 2020 15:22:00 -0700
+Subject: [PATCH 1/2] fix install dirs
+
+---
+ src/CMakeLists.txt | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 773c4c8..03e112c 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -1,5 +1,4 @@
+-# for now, install in subdirectory of source directory by default
+-SET( CMAKE_INSTALL_PREFIX .. )
++include(GNUInstallDirs)
+
+ IF( WIN32 )
+ ADD_LIBRARY( argtable2 arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
+@@ -7,5 +6,9 @@ ELSE( WIN32 )
+ ADD_LIBRARY( argtable2 arg_date.c arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_rex.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
+ ENDIF( WIN32 )
+
+-INSTALL( TARGETS argtable2 ARCHIVE DESTINATION lib)
+-SET_TARGET_PROPERTIES( argtable2 PROPERTIES DEBUG_POSTFIX d )
++INSTALL(TARGETS argtable2
++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
++)
++INSTALL(FILES argtable2.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+--
+2.24.3 (Apple Git-128)
+
diff --git a/vcpkg/ports/argtable2/0002-include-correct-headers.patch b/vcpkg/ports/argtable2/0002-include-correct-headers.patch
new file mode 100644
index 0000000..f2e4d5f
--- /dev/null
+++ b/vcpkg/ports/argtable2/0002-include-correct-headers.patch
@@ -0,0 +1,60 @@
+From 271423adb2900c8bf4aad5d73d7ef1efbb5c35d8 Mon Sep 17 00:00:00 2001
+From: Nicole Mazzuca <mazzucan@outlook.com>
+Date: Tue, 22 Sep 2020 15:17:18 -0700
+Subject: [PATCH 2/2] include correct headers
+
+---
+ src/arg_date.c | 4 +++-
+ src/arg_int.c | 1 +
+ src/getopt.c | 1 +
+ 3 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/src/arg_date.c b/src/arg_date.c
+index 22b59e2..5004b42 100644
+--- a/src/arg_date.c
++++ b/src/arg_date.c
+@@ -37,6 +37,8 @@ USA.
+ #include <strings.h>
+ #endif
+
++#include <string.h>
++
+ #include "argtable2.h"
+
+ /* local error codes */
+@@ -112,7 +114,7 @@ static void errorfn(struct arg_date *parent, FILE *fp, int errorcode, const char
+ char buff[200];
+
+ fprintf(fp,"illegal timestamp format \"%s\"\n",argval);
+- bzero(&tm,sizeof(tm));
++ memset(&tm, 0, sizeof(tm));
+ strptime("1999-12-31 23:59:59","%F %H:%M:%S",&tm);
+ strftime(buff, sizeof(buff), parent->format, &tm);
+ printf("correct format is \"%s\"\n", buff);
+diff --git a/src/arg_int.c b/src/arg_int.c
+index 29c20e5..bc10012 100644
+--- a/src/arg_int.c
++++ b/src/arg_int.c
+@@ -30,6 +30,7 @@ USA.
+
+ #include "argtable2.h"
+ #include <limits.h>
++#include <ctype.h>
+
+ /* local error codes */
+ enum {EMINCOUNT=1,EMAXCOUNT,EBADINT,EOVERFLOW};
+diff --git a/src/getopt.c b/src/getopt.c
+index b208529..b13acc6 100644
+--- a/src/getopt.c
++++ b/src/getopt.c
+@@ -47,6 +47,7 @@
+ #endif
+
+ #include <stdio.h>
++#include <string.h>
+
+ /* Comment out all this code if we are using the GNU C Library, and are not
+ actually compiling the library itself. This code is part of the GNU C
+--
+2.24.3 (Apple Git-128)
+
diff --git a/vcpkg/ports/argtable2/0003-add-dependence-getopt.patch b/vcpkg/ports/argtable2/0003-add-dependence-getopt.patch
new file mode 100644
index 0000000..422f76e
--- /dev/null
+++ b/vcpkg/ports/argtable2/0003-add-dependence-getopt.patch
@@ -0,0 +1,42 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 8a4bd5b..7dc50f1 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -9,6 +9,7 @@ endif(COMMAND cmake_policy)
+
+ OPTION( HAVE_GETOPT_H "Have the getopt library" 0 )
+ IF( HAVE_GETOPT_H )
++ find_package(unofficial-getopt-win32 REQUIRED)
+ ADD_DEFINITIONS( -DHAVE_GETOPT_H )
+ ENDIF( HAVE_GETOPT_H )
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 03e112c..8c58082 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -1,7 +1,12 @@
+ include(GNUInstallDirs)
+
+ IF( WIN32 )
++ if(HAVE_GETOPT_H)
++ ADD_LIBRARY( argtable2 arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_str.c argtable2.c argtable2.h)
++ target_link_libraries(argtable2 PRIVATE unofficial::getopt-win32::getopt)
++ else()
+ ADD_LIBRARY( argtable2 arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
++ endif()
+ ELSE( WIN32 )
+ ADD_LIBRARY( argtable2 arg_date.c arg_dbl.c arg_end.c arg_file.c arg_int.c arg_lit.c arg_rem.c arg_rex.c arg_str.c argtable2.c argtable2.h getopt.c getopt.h getopt1.c )
+ ENDIF( WIN32 )
+diff --git a/src/argtable2.c b/src/argtable2.c
+index c4d210c..1bc0a3e 100644
+--- a/src/argtable2.c
++++ b/src/argtable2.c
+@@ -46,7 +46,7 @@ USA.
+ #endif
+
+ #include "argtable2.h"
+-#include "./getopt.h"
++//#include "./getopt.h"
+
+ static
+ void arg_register_error(struct arg_end *end, void *parent, int error, const char *argval)
diff --git a/vcpkg/ports/argtable2/portfile.cmake b/vcpkg/ports/argtable2/portfile.cmake
new file mode 100644
index 0000000..c3dfa8f
--- /dev/null
+++ b/vcpkg/ports/argtable2/portfile.cmake
@@ -0,0 +1,32 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+vcpkg_from_sourceforge(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO argtable/argtable
+ REF argtable-2.13
+ FILENAME "argtable2-13.tar.gz"
+ SHA512 3d8303f3ba529e3241d918c0127a16402ece951efb964d14a06a3a7d29a252812ad3c44e96da28798871e9923e73a2cfe7ebc84139c1397817d632cae25c4585
+ PATCHES
+ 0001-fix-install-dirs.patch
+ 0002-include-correct-headers.patch
+ 0003-add-dependence-getopt.patch
+ undef-eoverflow.diff
+)
+
+set(HAVE_GETOPT_H "")
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ set(HAVE_GETOPT_H 1)
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ -DCMAKE_DEBUG_POSTFIX=d
+ -DHAVE_GETOPT_H=${HAVE_GETOPT_H}
+)
+
+vcpkg_cmake_install()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
diff --git a/vcpkg/ports/argtable2/undef-eoverflow.diff b/vcpkg/ports/argtable2/undef-eoverflow.diff
new file mode 100644
index 0000000..a12b5df
--- /dev/null
+++ b/vcpkg/ports/argtable2/undef-eoverflow.diff
@@ -0,0 +1,14 @@
+diff --git a/src/arg_int.c b/src/arg_int.c
+index bc10012..ffcd408 100644
+--- a/src/arg_int.c
++++ b/src/arg_int.c
+@@ -33,6 +33,9 @@ USA.
+ #include <ctype.h>
+
+ /* local error codes */
++#ifdef EOVERFLOW
++#undef EOVERFLOW
++#endif
+ enum {EMINCOUNT=1,EMAXCOUNT,EBADINT,EOVERFLOW};
+
+ static void resetfn(struct arg_int *parent)
diff --git a/vcpkg/ports/argtable2/vcpkg.json b/vcpkg/ports/argtable2/vcpkg.json
new file mode 100644
index 0000000..6d1a525
--- /dev/null
+++ b/vcpkg/ports/argtable2/vcpkg.json
@@ -0,0 +1,19 @@
+{
+ "name": "argtable2",
+ "version": "2.13",
+ "port-version": 11,
+ "description": "Argtable is an ANSI C library for parsing GNU style command line options with a minimum of fuss.",
+ "homepage": "http://argtable.sourceforge.net",
+ "license": "LGPL-2.0-only",
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "getopt",
+ "platform": "windows & !mingw"
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}