aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libtasn1
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/libtasn1
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libtasn1')
-rw-r--r--vcpkg/ports/libtasn1/clang-fortify.patch64
-rw-r--r--vcpkg/ports/libtasn1/msvc_fixes.patch86
-rw-r--r--vcpkg/ports/libtasn1/portfile.cmake59
-rw-r--r--vcpkg/ports/libtasn1/vcpkg.json19
4 files changed, 228 insertions, 0 deletions
diff --git a/vcpkg/ports/libtasn1/clang-fortify.patch b/vcpkg/ports/libtasn1/clang-fortify.patch
new file mode 100644
index 0000000..0631b6b
--- /dev/null
+++ b/vcpkg/ports/libtasn1/clang-fortify.patch
@@ -0,0 +1,64 @@
+diff --git a/lib/gl/cdefs.h b/lib/gl/cdefs.h
+index 7b8ed5b..63574f9 100644
+--- a/lib/gl/cdefs.h
++++ b/lib/gl/cdefs.h
+@@ -140,6 +140,7 @@
+ #endif
+
+
++#ifndef __GNULIB_CDEFS
+ /* Fortify support. */
+ #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
+ #define __bos0(ptr) __builtin_object_size (ptr, 0)
+@@ -201,6 +202,8 @@
+ ? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
+ : __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s)))) \
+
++#endif
++
+ #if __GNUC_PREREQ (4,3)
+ # define __warnattr(msg) __attribute__((__warning__ (msg)))
+ # define __errordecl(name, msg) \
+diff --git a/lib/gl/libc-config.h b/lib/gl/libc-config.h
+index a56665b..876e1a1 100644
+--- a/lib/gl/libc-config.h
++++ b/lib/gl/libc-config.h
+@@ -137,8 +137,10 @@
+ # undef __attribute_returns_twice__
+ # undef __attribute_used__
+ # undef __attribute_warn_unused_result__
++# ifndef __GNULIB_CDEFS
+ # undef __bos
+ # undef __bos0
++# endif
+ # undef __errordecl
+ # undef __extension__
+ # undef __extern_always_inline
+@@ -147,21 +149,27 @@
+ # undef __fortified_attr_access
+ # undef __fortify_function
+ # undef __glibc_c99_flexarr_available
++# ifndef __GNULIB_CDEFS
+ # undef __glibc_fortify
+ # undef __glibc_fortify_n
++# endif
+ # undef __glibc_has_attribute
+ # undef __glibc_has_builtin
+ # undef __glibc_has_extension
+ # undef __glibc_likely
+ # undef __glibc_macro_warning
+ # undef __glibc_macro_warning1
++# ifndef __GNULIB_CDEFS
+ # undef __glibc_objsize
+ # undef __glibc_objsize0
+ # undef __glibc_safe_len_cond
+ # undef __glibc_safe_or_unknown_len
++# endif
+ # undef __glibc_unlikely
++# ifndef __GNULIB_CDEFS
+ # undef __glibc_unsafe_len
+ # undef __glibc_unsigned_or_positive
++# endif
+ # undef __inline
+ # undef __ptr_t
+ # undef __restrict
diff --git a/vcpkg/ports/libtasn1/msvc_fixes.patch b/vcpkg/ports/libtasn1/msvc_fixes.patch
new file mode 100644
index 0000000..5ed4e99
--- /dev/null
+++ b/vcpkg/ports/libtasn1/msvc_fixes.patch
@@ -0,0 +1,86 @@
+diff --git a/src/asn1Coding.c b/src/asn1Coding.c
+index 86c1d07..6fcfc4d 100644
+--- a/src/asn1Coding.c
++++ b/src/asn1Coding.c
+@@ -23,7 +23,12 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
++#ifdef _MSC_VER
++#include <io.h>
++#endif
+ #include <getopt.h>
+ #include <assert.h>
+
+diff --git a/src/asn1Decoding.c b/src/asn1Decoding.c
+index c6f192e..3e4e21d 100644
+--- a/src/asn1Decoding.c
++++ b/src/asn1Decoding.c
+@@ -23,7 +23,12 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
++#ifdef _MSC_VER
++#include <io.h>
++#endif
+ #include <getopt.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+diff --git a/src/asn1Parser.c b/src/asn1Parser.c
+index b6844a8..445c716 100644
+--- a/src/asn1Parser.c
++++ b/src/asn1Parser.c
+@@ -23,7 +23,12 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
++#ifdef _MSC_VER
++#include <io.h>
++#endif
+ #include <getopt.h>
+ #include <assert.h>
+
+diff --git a/src/benchmark.c b/src/benchmark.c
+index 010d58e..6c613df 100644
+--- a/src/benchmark.c
++++ b/src/benchmark.c
+@@ -21,9 +21,16 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <signal.h>
++#ifndef _MSC_VER
+ #include <sys/time.h>
++#endif
+ #include <time.h>
++#ifdef HAVE_UNISTD_H
+ #include <unistd.h>
++#endif
++#ifdef _MSC_VER
++#include <io.h>
++#endif
+ #include "benchmark.h"
+
+ int benchmark_must_finish = 0;
+diff --git a/src/benchmark.h b/src/benchmark.h
+index 3272649..6b6bf32 100644
+--- a/src/benchmark.h
++++ b/src/benchmark.h
+@@ -21,7 +21,9 @@
+ #ifndef BENCHMARK_H
+ # define BENCHMARK_H
+
++#ifndef _MSC_VER
+ # include <sys/time.h>
++#endif
+ # include <time.h>
+ # include <signal.h>
+ # if defined _WIN32
diff --git a/vcpkg/ports/libtasn1/portfile.cmake b/vcpkg/ports/libtasn1/portfile.cmake
new file mode 100644
index 0000000..0ac24d6
--- /dev/null
+++ b/vcpkg/ports/libtasn1/portfile.cmake
@@ -0,0 +1,59 @@
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.mirrorservice.org/sites/ftp.gnu.org/gnu/libtasn1/libtasn1-${VERSION}.tar.gz"
+ "https://ftp.gnu.org/gnu/libtasn1/libtasn1-${VERSION}.tar.gz"
+ FILENAME "libtasn1-${VERSION}.tar.gz"
+ SHA512 287f5eddfb5e21762d9f14d11997e56b953b980b2b03a97ed4cd6d37909bda1ed7d2cdff9da5d270a21d863ab7e54be6b85c05f1075ac5d8f0198997cf335ef4
+)
+
+vcpkg_extract_source_archive(SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ SOURCE_BASE "v${VERSION}"
+ PATCHES
+ msvc_fixes.patch
+ clang-fortify.patch # ported from https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=522aea1093a598246346b3e1c426505c344fe19a
+)
+
+vcpkg_find_acquire_program(BISON)
+
+set(EXTRA_OPTS "")
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+ # $LIBS is an environment variable that vcpkg already pre-populated with some libraries.
+ # We need to re-purpose it when passing LIBS option to make to avoid overriding the vcpkg's own list.
+ list(APPEND EXTRA_OPTS "LIBS=-lgettimeofday -lgetopt \$LIBS")
+else()
+ # restore the default ac_cv_prog_cc_g flags, otherwise it fails to compile
+ set(VCPKG_C_FLAGS "-g -O2")
+ set(VCPKG_CXX_FLAGS "-g -O2")
+endif()
+
+# The upstream doesn't add this macro to the configure
+if (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ list(APPEND EXTRA_OPTS "CFLAGS=\$CFLAGS -DASN1_STATIC")
+endif()
+
+set(ENV{GTKDOCIZE} true) # true, the program
+vcpkg_configure_make(
+ SOURCE_PATH "${SOURCE_PATH}"
+ AUTOCONFIG
+ OPTIONS
+ --disable-doc
+ --disable-gtk-doc
+ --disable-gcc-warnings
+ ${EXTRA_OPTS}
+ "YACC=${BISON}"
+)
+
+vcpkg_install_make()
+vcpkg_fixup_pkgconfig()
+
+file(REMOVE_RECURSE
+ "${CURRENT_PACKAGES_DIR}/debug/share"
+ "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug"
+)
+
+vcpkg_install_copyright(
+ FILE_LIST
+ "${SOURCE_PATH}/COPYING"
+ "${SOURCE_PATH}/doc/COPYING.LESSER"
+ "${SOURCE_PATH}/doc/COPYING"
+)
diff --git a/vcpkg/ports/libtasn1/vcpkg.json b/vcpkg/ports/libtasn1/vcpkg.json
new file mode 100644
index 0000000..7dfd363
--- /dev/null
+++ b/vcpkg/ports/libtasn1/vcpkg.json
@@ -0,0 +1,19 @@
+{
+ "name": "libtasn1",
+ "version": "4.19.0",
+ "port-version": 2,
+ "description": "A secure communications library implementing the SSL, TLS and DTLS protocols",
+ "homepage": "https://www.gnutls.org/",
+ "license": null,
+ "supports": "!uwp",
+ "dependencies": [
+ {
+ "name": "getopt",
+ "platform": "windows & !mingw"
+ },
+ {
+ "name": "gettimeofday",
+ "platform": "windows & !mingw"
+ }
+ ]
+}