Skip to content

Commit

Permalink
[shiftmedia-libgcrypt] new port (Windows fork of Libgcrypt) (#26364)
Browse files Browse the repository at this point in the history
* [shiftmedia-libgcrypt] new port

* [shiftmedia-libgcrypt] add license

* [shiftmedia-libgcrypt] fix formatting

* [shiftmedia-libgcrypt] add version

* [shiftmedia-libgcrypt] update to 1.10.1, also support UWP

* [shiftmedia-libgcrypt] update version

* [ci.baseline.txt] restore gpg-error running on CI

* [libgpg-error] add TargetPlatformMinVersion

* [libgpg-error] update versions

* [shiftmedia-libgcrypt] fix supported platform

* [shiftmedia-libgcrypt] fix missing Version in .pc

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] remove leftover warning

* [shiftmedia-libgcrypt] update version

* Update shiftmedia-libgcrypt.json

* Update libgpg-error.json

* [shiftmedia-libgcrypt] install includes instead of moving them around in buildtree

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] wrap paths in quotes

Co-authored-by: Billy O'Neal <bion@microsoft.com>

* [shiftmedia-libgcrypt] support for Windows implies UWP

Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com>

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] use vcpkg_replace_string() instead of patches

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] gpg-error already inupstream .pc as Requires.private

* [shiftmedia-libgcrypt] -L${libdir} already in upstream .pc

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] pass OutDir as property, no need to patch

* [shiftmedia-libgcrypt] update version

* [shiftmedia-libgcrypt] msbuild adds a subfolder to OutDir on UWP

* [shiftmedia-libgcrypt] fix aclocal installation path

* [shiftmedia-libgcrypt] update version

Co-authored-by: Cheney Wang <38240633+Cheney-W@users.noreply.github.com>
Co-authored-by: Billy O'Neal <bion@microsoft.com>
Co-authored-by: Javier Matos Denizac <javier.matosd@gmail.com>
  • Loading branch information
4 people authored Aug 19, 2022
1 parent 727bdba commit e99d9a4
Show file tree
Hide file tree
Showing 9 changed files with 152 additions and 4 deletions.
12 changes: 12 additions & 0 deletions ports/libgpg-error/TargetPlatformMinVersion.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/SMP/libgpg-error_winrt.vcxproj b/SMP/llibgpg-error_winrt.vcxproj
index e1acf679..f9c302be 100644
--- a/SMP/libgpg-error_winrt.vcxproj
+++ b/SMP/libgpg-error_winrt.vcxproj
@@ -3,6 +3,7 @@
<PropertyGroup Label="Globals">
<ProjectGuid>{AA4A762D-A8D7-4F68-9B79-FBE63C6BE105}</ProjectGuid>
<RootNamespace>gpg-error</RootNamespace>
+ <TargetPlatformMinVersion>10.0.17200.0</TargetPlatformMinVersion>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="smp_winrt.props" />
1 change: 1 addition & 0 deletions ports/libgpg-error/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if(VCPKG_TARGET_IS_WINDOWS)
PATCHES
outdir.patch
runtime.patch
TargetPlatformMinVersion.patch
)

if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
Expand Down
2 changes: 1 addition & 1 deletion ports/libgpg-error/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "libgpg-error",
"version": "1.42",
"port-version": 3,
"port-version": 4,
"description": "A common dependency of all GnuPG components",
"homepage": "https://gnupg.org/software/libgpg-error/index.html",
"supports": "!(windows & (arm | arm64))"
Expand Down
107 changes: 107 additions & 0 deletions ports/shiftmedia-libgcrypt/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
set(PACKAGE_VERSION_MAJOR 1)
set(PACKAGE_VERSION_MINOR 10)
set(PACKAGE_VERSION_PATCH 1)
set(PACKAGE_VERSION ${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH})

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO ShiftMediaProject/libgcrypt
REF libgcrypt-${PACKAGE_VERSION}
SHA512 6da8225ec73c51562cd76a0c0abc19506a7378750ed2a9ea45f03df3c8d7cf500840459deb9b0a694a5602fe77ee2b0dd5b2e37376745233350b0f218dff4f1c
HEAD_REF master
)

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()

if(VCPKG_CRT_LINKAGE STREQUAL "static")
set(RuntimeLibraryExt "")
else()
set(RuntimeLibraryExt "DLL")
endif()

# patch output library file path and name; inject RuntimeLibrary property to control CRT linkage
foreach(PROPS IN ITEMS
"${SOURCE_PATH}/SMP/smp_deps.props"
"${SOURCE_PATH}/SMP/smp_winrt_deps.props")
vcpkg_replace_string(
"${PROPS}"
[=[_winrt</TargetName>]=]
[=[</TargetName>]=]
)
vcpkg_replace_string(
"${PROPS}"
[=[<TargetName>lib$(RootNamespace)]=]
[=[<TargetName>$(RootNamespace)]=]
)
vcpkg_replace_string(
"${PROPS}"
[=[</TreatSpecificWarningsAsErrors>]=]
[=[</TreatSpecificWarningsAsErrors><RuntimeLibrary>$(RuntimeLibrary)</RuntimeLibrary>]=]
)
endforeach()

# patch gpg-error library file name
foreach(VCXPROJ IN ITEMS
"${SOURCE_PATH}/SMP/libgcrypt.vcxproj"
"${SOURCE_PATH}/SMP/libgcrypt_winrt.vcxproj")
vcpkg_replace_string(
"${VCXPROJ}"
"_winrt.lib"
".lib"
)
vcpkg_replace_string(
"${VCXPROJ}"
"libgpg-error"
"gpg-error"
)
endforeach()

vcpkg_install_msbuild(
USE_VCPKG_INTEGRATION
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH SMP/libgcrypt.sln
PLATFORM ${TRIPLET_SYSTEM_ARCH}
LICENSE_SUBPATH COPYING.LIB
RELEASE_CONFIGURATION ${CONFIGURATION_RELEASE}
DEBUG_CONFIGURATION ${CONFIGURATION_DEBUG}
SKIP_CLEAN
OPTIONS /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 libgcrypt_winrt)
endif()
file(INSTALL "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/${SOURCE_PATH_SUFFIX}/msvc/${WINRT_SUBFOLDER}/include" DESTINATION "${CURRENT_PACKAGES_DIR}")

set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/include")
set(LIBGCRYPT_CONFIG_LIBS "-lgcrypt")
configure_file("${SOURCE_PATH}/src/libgcrypt.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libgcrypt.pc" @ONLY)

set(exec_prefix "\${prefix}")
set(libdir "\${prefix}/lib")
set(includedir "\${prefix}/../include")
set(LIBGCRYPT_CONFIG_LIBS "-lgcryptd")
configure_file("${SOURCE_PATH}/src/libgcrypt.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libgcrypt.pc" @ONLY)

vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

file(INSTALL "${SOURCE_PATH}/src/libgcrypt.m4" DESTINATION "${CURRENT_PACKAGES_DIR}/share/libgcrypt/aclocal/")

file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/COPYING.LIB" "${CURRENT_PACKAGES_DIR}/debug/lib/COPYING.LIB")
11 changes: 11 additions & 0 deletions ports/shiftmedia-libgcrypt/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "shiftmedia-libgcrypt",
"version": "1.10.1",
"description": "An unofficial LibGCrypt with added custom native Visual Studio project build tools. LibGCrypt",
"homepage": "https://github.com/ShiftMediaProject/libgcrypt",
"license": "LGPL-2.1-only",
"supports": "windows",
"dependencies": [
"libgpg-error"
]
}
3 changes: 1 addition & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,9 +432,8 @@ libgit2:x64-uwp=fail
libgo:arm-uwp=fail
libgo:x64-uwp=fail
libgo:arm64-windows=fail
# the msbuild for libgpg:x64-uwp and libgpg-error:x64-uwp are broken on VS2022 due to TargetPlatformMinVersion not existing
# the msbuild for libgpg:x64-uwp is broken on VS2022 due to TargetPlatformMinVersion not existing
libgpg:x64-uwp=fail
libgpg-error:x64-uwp=fail
libgxps:x64-windows-static=fail
libgxps:x64-windows-static-md=fail
libhdfs3:x64-linux=fail
Expand Down
6 changes: 5 additions & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -3674,7 +3674,7 @@
},
"libgpg-error": {
"baseline": "1.42",
"port-version": 3
"port-version": 4
},
"libgpiod": {
"baseline": "1.6.3",
Expand Down Expand Up @@ -6604,6 +6604,10 @@
"baseline": "1.5.0",
"port-version": 3
},
"shiftmedia-libgcrypt": {
"baseline": "1.10.1",
"port-version": 0
},
"shiva": {
"baseline": "1.0",
"port-version": 5
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libgpg-error.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "728a8999d1083dc72eae0612669f0c34075a3f01",
"version": "1.42",
"port-version": 4
},
{
"git-tree": "1ced42ca6160e2283326366e1c1132fe50acfb97",
"version": "1.42",
Expand Down
9 changes: 9 additions & 0 deletions versions/s-/shiftmedia-libgcrypt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "f69b9722e8207f50879ed85697253223eb014a9c",
"version": "1.10.1",
"port-version": 0
}
]
}

0 comments on commit e99d9a4

Please sign in to comment.