aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/shiftmedia-libgnutls
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/shiftmedia-libgnutls
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/shiftmedia-libgnutls')
-rw-r--r--vcpkg/ports/shiftmedia-libgnutls/external-libtasn1.patch118
-rw-r--r--vcpkg/ports/shiftmedia-libgnutls/pkgconfig.patch13
-rw-r--r--vcpkg/ports/shiftmedia-libgnutls/portfile.cmake176
-rw-r--r--vcpkg/ports/shiftmedia-libgnutls/vcpkg-cmake-wrapper.cmake2
-rw-r--r--vcpkg/ports/shiftmedia-libgnutls/vcpkg.json24
5 files changed, 333 insertions, 0 deletions
diff --git a/vcpkg/ports/shiftmedia-libgnutls/external-libtasn1.patch b/vcpkg/ports/shiftmedia-libgnutls/external-libtasn1.patch
new file mode 100644
index 0000000..68a94c4
--- /dev/null
+++ b/vcpkg/ports/shiftmedia-libgnutls/external-libtasn1.patch
@@ -0,0 +1,118 @@
+diff --git a/SMP/libgnutls.vcxproj.filters b/SMP/libgnutls.vcxproj.filters
+index ef202f4ac..a397e1574 100644
+--- a/SMP/libgnutls.vcxproj.filters
++++ b/SMP/libgnutls.vcxproj.filters
+@@ -103,9 +103,6 @@
+ <Filter Include="Header Files\lib\inih">
+ <UniqueIdentifier>{ae0c3eeb-53df-4c72-a85a-6b46de35e7ba}</UniqueIdentifier>
+ </Filter>
+- <Filter Include="Source Files\libtasn1">
+- <UniqueIdentifier>{32be60b7-8c65-486e-9df5-7e529443cf07}</UniqueIdentifier>
+- </Filter>
+ <Filter Include="Source Files\lib\nettle\gost">
+ <UniqueIdentifier>{1f3549a8-3c3d-475f-8fd6-20451d336464}</UniqueIdentifier>
+ </Filter>
+@@ -1535,30 +1532,6 @@
+ <ClCompile Include="..\lib\nettle\sysrng-bcrypt.c">
+ <Filter>Source Files\lib\nettle</Filter>
+ </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\coding.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\decoding.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\element.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\errors.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\gstr.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\parser_aux.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\structure.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\version.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+ <ClCompile Include="..\lib\nettle\gost\acpkm.c">
+ <Filter>Source Files\lib\nettle\gost</Filter>
+ </ClCompile>
+diff --git a/SMP/libgnutls_files.props b/SMP/libgnutls_files.props
+index 55049b70b..2bb76e3b0 100644
+--- a/SMP/libgnutls_files.props
++++ b/SMP/libgnutls_files.props
+@@ -175,13 +175,6 @@
+ <ItemGroup>
+ <ClCompile Include="lib\gnutls_asn1_tab.c" />
+ <ClCompile Include="lib\pkix_asn1_tab.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\coding.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\decoding.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\element.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\gstr.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\parser_aux.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\structure.c" />
+- <ClCompile Include="..\devel\libtasn1\lib\version.c" />
+ <ClCompile Include="..\gnulib\lib\c-strcasecmp.c" />
+ <ClCompile Include="..\gnulib\lib\c-strncasecmp.c" />
+ <ClCompile Include="..\gnulib\lib\cloexec.c" />
+@@ -545,9 +538,6 @@
+ </ClCompile>
+ <ClCompile Include="..\gnulib\lib\stdio-write.c">
+ <PreprocessorDefinitions>REPLACE_PRINTF_POSIX=1;REPLACE_FPRINTF_POSIX=1;REPLACE_VPRINTF_POSIX=1;REPLACE_VFPRINTF_POSIX=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\errors.c">
+- <ObjectFileName>$(IntDir)\tasn1_$(filename).obj</ObjectFileName>
+ </ClCompile>
+ <ClCompile Include="..\lib\algorithms\ecc.c">
+ <ObjectFileName>$(IntDir)\alg_%(Filename).obj</ObjectFileName>
+diff --git a/SMP/libgnutls_winrt.vcxproj.filters b/SMP/libgnutls_winrt.vcxproj.filters
+index f6a355e7e..299749c2a 100644
+--- a/SMP/libgnutls_winrt.vcxproj.filters
++++ b/SMP/libgnutls_winrt.vcxproj.filters
+@@ -103,9 +103,6 @@
+ <Filter Include="Header Files\lib\inih">
+ <UniqueIdentifier>{ae0c3eeb-53df-4c72-a85a-6b46de35e7ba}</UniqueIdentifier>
+ </Filter>
+- <Filter Include="Source Files\libtasn1">
+- <UniqueIdentifier>{32be60b7-8c65-486e-9df5-7e529443cf07}</UniqueIdentifier>
+- </Filter>
+ <Filter Include="Header Files\lib\nettle\gost">
+ <UniqueIdentifier>{4fada990-3138-4089-a6c7-ae722a0e7fe9}</UniqueIdentifier>
+ </Filter>
+@@ -1535,30 +1532,6 @@
+ <ClCompile Include="..\lib\nettle\sysrng-bcrypt.c">
+ <Filter>Source Files\lib\nettle</Filter>
+ </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\coding.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\decoding.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\element.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\errors.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\gstr.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\parser_aux.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\structure.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+- <ClCompile Include="..\devel\libtasn1\lib\version.c">
+- <Filter>Source Files\libtasn1</Filter>
+- </ClCompile>
+ <ClCompile Include="..\lib\accelerated\afalg.c">
+ <Filter>Source Files\lib\accelerated</Filter>
+ </ClCompile>
diff --git a/vcpkg/ports/shiftmedia-libgnutls/pkgconfig.patch b/vcpkg/ports/shiftmedia-libgnutls/pkgconfig.patch
new file mode 100644
index 0000000..3eecc76
--- /dev/null
+++ b/vcpkg/ports/shiftmedia-libgnutls/pkgconfig.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/gnutls.pc.in b/lib/gnutls.pc.in
+index 7cdedda5..11785bcd 100644
+--- a/lib/gnutls.pc.in
++++ b/lib/gnutls.pc.in
+@@ -18,7 +18,7 @@ Name: GnuTLS
+ Description: Transport Security Layer implementation for the GNU system
+ URL: https://www.gnutls.org/
+ Version: @VERSION@
+-Libs: -L${libdir} -lgnutls
++Libs: -L${libdir} @GNUTLS_LIBS@
+ Libs.private: @LIBZ_PC@ @LIBINTL@ @LIBSOCKET@ @INET_PTON_LIB@ @LIBPTHREAD@ @LIB_SELECT@ @TSS_LIBS@ @GMP_LIBS@ @LIBUNISTRING@ @LIBATOMIC_LIBS@ @GNUTLS_LIBS_PRIVATE@
+ @GNUTLS_REQUIRES_PRIVATE@
+ Cflags: -I${includedir}
diff --git a/vcpkg/ports/shiftmedia-libgnutls/portfile.cmake b/vcpkg/ports/shiftmedia-libgnutls/portfile.cmake
new file mode 100644
index 0000000..7e6618b
--- /dev/null
+++ b/vcpkg/ports/shiftmedia-libgnutls/portfile.cmake
@@ -0,0 +1,176 @@
+set(GNULIB_REF "3639c57")
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO ShiftMediaProject/gnutls
+ REF ${VERSION}
+ SHA512 db318ee923d0810484e98342cc395624efc52b7227020fc14b9fa9ae63e4b8bf254cfd90470e051cd992fb167fb839fff340430a223bcc50d1422f1738a5b599
+ HEAD_REF master
+ PATCHES
+ external-libtasn1.patch
+ pkgconfig.patch
+)
+
+file(REMOVE_RECURSE "${SOURCE_PATH}/devel/perlasm")
+
+vcpkg_download_distfile(
+ GNULIB_SNAPSHOT
+ URLS "https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=snapshot;h=${GNULIB_REF};sf=tgz"
+ FILENAME "gnulib-${GNULIB_REF}.tar.gz"
+ SHA512 bc99be736d2907049d498f44d8f24db4beb2b3645459451b595087b9406ac1eebe4cbb4f2ef65df9e65823e01db4b4800b75eb9537236797fe1edcc65418c520
+)
+
+vcpkg_extract_source_archive(
+ GNULIB_SOURCE_PATH
+ ARCHIVE "${GNULIB_SNAPSHOT}"
+ SOURCE_BASE ${GNULIB_REF}
+)
+
+file(REMOVE_RECURSE "${SOURCE_PATH}/gnulib")
+file(RENAME "${GNULIB_SOURCE_PATH}" "${SOURCE_PATH}/gnulib")
+
+include("${CURRENT_HOST_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake")
+yasm_tool_helper(OUT_VAR YASM)
+file(TO_NATIVE_PATH "${YASM}" YASM)
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ set(CONFIGURATION_RELEASE ReleaseDLL)
+ set(CONFIGURATION_DEBUG DebugDLL)
+else()
+ set(CONFIGURATION_RELEASE Release)
+ set(CONFIGURATION_DEBUG Debug)
+endif()
+
+if(VCPKG_TARGET_IS_UWP)
+ string(APPEND CONFIGURATION_RELEASE WinRT)
+ string(APPEND CONFIGURATION_DEBUG WinRT)
+endif()
+
+set(_gnutlsproject "${SOURCE_PATH}/SMP/libgnutls.vcxproj")
+file(READ "${_gnutlsproject}" _contents)
+string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.props" />]]
+ "<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.props\" />"
+ _contents "${_contents}")
+string(REPLACE [[<Import Project="$(VCTargetsPath)\BuildCustomizations\yasm.targets" />]]
+ "<Import Project=\"${CURRENT_HOST_INSTALLED_DIR}/share/vs-yasm/yasm.targets\" />"
+ _contents "${_contents}")
+string(REGEX REPLACE "${VCPKG_ROOT_DIR}/installed/[^/]+/share" "${CURRENT_HOST_INSTALLED_DIR}/share" _contents "${_contents}") # Above already
+file(WRITE "${_gnutlsproject}" "${_contents}")
+
+if(VCPKG_CRT_LINKAGE STREQUAL "static")
+ set(RuntimeLibraryExt "")
+else()
+ set(RuntimeLibraryExt "DLL")
+endif()
+
+# patch output library file path and name
+foreach(PROPS IN ITEMS
+"${SOURCE_PATH}/SMP/smp_deps.props"
+"${SOURCE_PATH}/SMP/smp_winrt_deps.props")
+vcpkg_replace_string(
+ "${PROPS}"
+ [=[_winrt</TargetName>]=]
+ [=[</TargetName>]=]
+ IGNORE_UNCHANGED
+)
+vcpkg_replace_string(
+ "${PROPS}"
+ [=[<TargetName>lib$(RootNamespace)]=]
+ [=[<TargetName>$(RootNamespace)]=]
+)
+endforeach()
+
+# patch hogweed, gpm, nettle, zlib libraries file names; inject RuntimeLibrary property to control CRT linkage
+foreach(VCXPROJ IN ITEMS
+"${SOURCE_PATH}/SMP/libgnutls.vcxproj"
+"${SOURCE_PATH}/SMP/libgnutls_winrt.vcxproj")
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "_winrt.lib"
+ ".lib"
+ IGNORE_UNCHANGED
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "libhogweed"
+ "hogweed"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "hogweedd"
+ "hogweed"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "libgmp"
+ "gmp"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "gmpd"
+ "gmp"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "libnettle"
+ "nettle"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "nettled"
+ "nettle"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ "libzlib"
+ "zlib"
+)
+vcpkg_replace_string(
+ "${VCXPROJ}"
+ [=[</DisableSpecificWarnings>]=]
+ [=[</DisableSpecificWarnings><RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>]=]
+)
+endforeach()
+
+vcpkg_install_msbuild(
+ USE_VCPKG_INTEGRATION
+ SOURCE_PATH "${SOURCE_PATH}"
+ PROJECT_SUBPATH SMP/libgnutls.sln
+ PLATFORM ${TRIPLET_SYSTEM_ARCH}
+ LICENSE_SUBPATH LICENSE
+ RELEASE_CONFIGURATION ${CONFIGURATION_RELEASE}
+ DEBUG_CONFIGURATION ${CONFIGURATION_DEBUG}
+ SKIP_CLEAN
+ OPTIONS /p:YasmPath="${YASM}" /p:OutDir=..\\msvc
+ OPTIONS_DEBUG /p:RuntimeLibrary=MultiThreadedDebug${RuntimeLibraryExt}
+ OPTIONS_RELEASE /p:RuntimeLibrary=MultiThreaded${RuntimeLibraryExt}
+)
+
+get_filename_component(SOURCE_PATH_SUFFIX "${SOURCE_PATH}" NAME)
+if(VCPKG_TARGET_IS_UWP)
+ set(WINRT_SUBFOLDER libgnutls_winrt)
+endif()
+file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/msvc/${WINRT_SUBFOLDER}/include" DESTINATION "${CURRENT_PACKAGES_DIR}")
+
+set(GNUTLS_REQUIRES_PRIVATE "Requires.private: gmp, nettle, hogweed, libtasn1")
+set(GNUTLS_LIBS_PRIVATE "-lcrypt32 -lws2_32 -lkernel32 -lncrypt")
+
+set(prefix "${CURRENT_INSTALLED_DIR}")
+set(exec_prefix "\${prefix}")
+set(libdir "\${prefix}/lib")
+set(includedir "\${prefix}/include")
+set(GNUTLS_LIBS "-lgnutls")
+configure_file("${SOURCE_PATH}/lib/gnutls.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/gnutls.pc" @ONLY)
+
+if(NOT VCPKG_BUILD_TYPE)
+ set(prefix "${CURRENT_INSTALLED_DIR}/debug")
+ set(exec_prefix "\${prefix}")
+ set(libdir "\${prefix}/lib")
+ set(includedir "\${prefix}/../include")
+ set(GNUTLS_LIBS "-lgnutlsd")
+ configure_file("${SOURCE_PATH}/lib/gnutls.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/gnutls.pc" @ONLY)
+endif()
+
+vcpkg_fixup_pkgconfig()
+vcpkg_copy_pdbs()
+file(COPY "${CURRENT_PORT_DIR}/vcpkg-cmake-wrapper.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/gnutls")
diff --git a/vcpkg/ports/shiftmedia-libgnutls/vcpkg-cmake-wrapper.cmake b/vcpkg/ports/shiftmedia-libgnutls/vcpkg-cmake-wrapper.cmake
new file mode 100644
index 0000000..41ef03f
--- /dev/null
+++ b/vcpkg/ports/shiftmedia-libgnutls/vcpkg-cmake-wrapper.cmake
@@ -0,0 +1,2 @@
+find_library(GNUTLS_LIBRARY NAMES gnutls gnutlsd NAMES_PER_DIR)
+_find_package(${ARGS})
diff --git a/vcpkg/ports/shiftmedia-libgnutls/vcpkg.json b/vcpkg/ports/shiftmedia-libgnutls/vcpkg.json
new file mode 100644
index 0000000..18fb93a
--- /dev/null
+++ b/vcpkg/ports/shiftmedia-libgnutls/vcpkg.json
@@ -0,0 +1,24 @@
+{
+ "name": "shiftmedia-libgnutls",
+ "version": "3.8.7",
+ "port-version": 2,
+ "description": "Unofficial GnuTLS fork with added custom native Visual Studio project build tools. ",
+ "homepage": "https://github.com/ShiftMediaProject/gnutls",
+ "license": "LGPL-2.1-only",
+ "supports": "windows & !arm & !mingw & !xbox",
+ "dependencies": [
+ "gettext",
+ "gmp",
+ "libtasn1",
+ "nettle",
+ {
+ "name": "vs-yasm",
+ "host": true
+ },
+ {
+ "name": "yasm-tool-helper",
+ "host": true
+ },
+ "zlib"
+ ]
+}