From 71befd7c15718cd5aa0394ea093135a45cd97f9e Mon Sep 17 00:00:00 2001 From: talregev Date: Thu, 23 May 2024 09:57:12 +0300 Subject: [PATCH] [krb5] Add windows (#38706) Take elements from this PR: #38685 - [x] Changes comply with the [maintainer guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md). - [x] SHA512s are updated for each updated download. - [x] The "supports" clause reflects platforms that may be fixed by this new version. - [x] Any fixed [CI baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt) entries are removed from that file. - [x] Any patches that are no longer applied are deleted from the port's directory. - [x] The version database is fixed by rerunning `./vcpkg x-add-version --all` and committing the result. - [x] Only one version is added to each modified port's versions file. --------- Co-authored-by: Sharadh Rajaraman Co-authored-by: Sharadh Rajaraman <3754080+sharadhr@users.noreply.github.com> Co-authored-by: WangWeiLin-MV <156736127+WangWeiLin-MV@users.noreply.github.com> --- ports/krb5/portfile.cmake | 105 ++++++++++++++---- ports/krb5/relative_paths.patch | 35 ++++++ ports/krb5/vcpkg.json | 11 +- ports/krb5/windows_pc_files/krb5-gssapi.pc.in | 10 ++ ports/krb5/windows_pc_files/krb5.pc.in | 14 +++ .../windows_pc_files/mit-krb5-gssapi.pc.in | 11 ++ ports/krb5/windows_pc_files/mit-krb5.pc.in | 15 +++ versions/baseline.json | 2 +- versions/k-/krb5.json | 5 + 9 files changed, 184 insertions(+), 24 deletions(-) create mode 100644 ports/krb5/relative_paths.patch create mode 100644 ports/krb5/windows_pc_files/krb5-gssapi.pc.in create mode 100644 ports/krb5/windows_pc_files/krb5.pc.in create mode 100644 ports/krb5/windows_pc_files/mit-krb5-gssapi.pc.in create mode 100644 ports/krb5/windows_pc_files/mit-krb5.pc.in diff --git a/ports/krb5/portfile.cmake b/ports/krb5/portfile.cmake index 8248a04cee..583706371d 100644 --- a/ports/krb5/portfile.cmake +++ b/ports/krb5/portfile.cmake @@ -1,24 +1,92 @@ -vcpkg_download_distfile(ARCHIVE - URLS "https://kerberos.org/dist/krb5/1.21/krb5-${VERSION}.tar.gz" - FILENAME "krb5-${VERSION}.tar.gz" - SHA512 4e09296b412383d53872661718dbfaa90201e0d85f69db48e57a8d4bd73c95a90c7ec7b6f0f325f6bc967f8d203b256b071c0191facf080aca0e2caec5d0ac49 + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO krb5/krb5 + REF krb5-${VERSION}-final + SHA512 184ef8645d7e17f30a8e3d4005364424d2095b3d0c96f26ecef0c2dd2f3a096a0dd40558ed113121483717e44f6af41e71be0e5e079c76a205535d0c11a2ea34 + HEAD_REF master + PATCHES + relative_paths.patch ) -vcpkg_extract_source_archive( - SOURCE_PATH - ARCHIVE ${ARCHIVE} -) +if (VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + vcpkg_find_acquire_program(PERL) + get_filename_component(PERL_PATH "${PERL}" DIRECTORY) + vcpkg_add_to_path("${PERL_PATH}") + vcpkg_build_nmake( + SOURCE_PATH "${SOURCE_PATH}/src" + PROJECT_NAME Makefile.in + TARGET prep-windows + ) + file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/" DESTINATION "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug") + vcpkg_install_nmake( + SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}" + PROJECT_NAME "Makefile" + OPTIONS + "NO_LEASH=1" + OPTIONS_RELEASE + "KRB_INSTALL_DIR=${CURRENT_PACKAGES_DIR}" + OPTIONS_DEBUG + "KRB_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/debug" + ) + set(tools + ccapiserver + gss-client + gss-server + kcpytkt + kdeltkt + kdestroy + kfwcpcc + kinit + klist + kpasswd + kswitch + kvno + mit2ms + ms2mit + ) + vcpkg_copy_tools( + TOOL_NAMES ${tools} + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/bin" + AUTO_CLEAN + ) + foreach(tool_name ${tools}) + list(APPEND debug_tools_to_remove "${CURRENT_PACKAGES_DIR}/debug/bin/${tool_name}${VCPKG_TARGET_EXECUTABLE_SUFFIX}") + endforeach() + file(REMOVE ${debug_tools_to_remove}) -vcpkg_configure_make( - SOURCE_PATH "${SOURCE_PATH}/src" - AUTOCONFIG - OPTIONS - "CFLAGS=-fcommon \$CFLAGS" -) + set(WINDOWS_PC_FILES + krb5-gssapi + krb5 + mit-krb5-gssapi + mit-krb5 + ) -vcpkg_install_make() + foreach (PC_FILE ${WINDOWS_PC_FILES}) + configure_file("${CURRENT_PORT_DIR}/windows_pc_files/${PC_FILE}.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/${PC_FILE}.pc" @ONLY) + endforeach() + + if(NOT DEFINED VCPKG_BUILD_TYPE) + foreach (PC_FILE ${WINDOWS_PC_FILES}) + configure_file("${CURRENT_PORT_DIR}/windows_pc_files/${PC_FILE}.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/${PC_FILE}.pc" @ONLY) + endforeach() + endif() +else() + vcpkg_configure_make( + SOURCE_PATH "${SOURCE_PATH}/src" + AUTOCONFIG + OPTIONS + "CFLAGS=-fcommon \$CFLAGS" + ) + vcpkg_install_make() +endif() vcpkg_fixup_pkgconfig() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/krb5/cat1") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/krb5/cat5") @@ -29,9 +97,4 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/krb5/") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/var") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/var") -# remove due to absolute path error -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/krb5/bin/compile_et") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/krb5/bin/krb5-config") -file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/krb5/debug/") - -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/doc/copyright.rst") +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/NOTICE") diff --git a/ports/krb5/relative_paths.patch b/ports/krb5/relative_paths.patch new file mode 100644 index 0000000000..d6499a2b80 --- /dev/null +++ b/ports/krb5/relative_paths.patch @@ -0,0 +1,35 @@ +diff --git a/src/build-tools/krb5-config.in b/src/build-tools/krb5-config.in +index 8e6eb8660..89a401dab 100755 +--- a/src/build-tools/krb5-config.in ++++ b/src/build-tools/krb5-config.in +@@ -27,7 +27,7 @@ + # Configurable parameters set by autoconf + version_string="Kerberos 5 release @KRB5_VERSION@" + +-prefix=@prefix@ ++prefix='$(pwd)/../../../' + exec_prefix=@exec_prefix@ + includedir=@includedir@ + libdir=@libdir@ +@@ -39,7 +39,7 @@ PTHREAD_CFLAGS='@PTHREAD_CFLAGS@' + DL_LIB='@DL_LIB@' + DEFCCNAME='@DEFCCNAME@' + DEFKTNAME='@DEFKTNAME@' +-DEFCKTNAME='@DEFCKTNAME@' ++DEFCKTNAME='$(pwd)/../../../var/krb5/user/%{euid}/client.keytab' + + LIBS='@LIBS@' + GEN_LIB=@GEN_LIB@ +diff --git a/src/util/et/compile_et.sh b/src/util/et/compile_et.sh +index f17ddba71..6a98a8bab 100755 +--- a/src/util/et/compile_et.sh ++++ b/src/util/et/compile_et.sh +@@ -2,7 +2,7 @@ + # + # + AWK=@AWK@ +-DIR=@DIR@ ++DIR='$(pwd)/../../../share/et' + + usage="usage: $0 [ -d scriptDir ] [ --textdomain domain [ --localedir dir ] ]" + usage="$usage inputfile.et" diff --git a/ports/krb5/vcpkg.json b/ports/krb5/vcpkg.json index 15590ee842..a0910f3f1d 100644 --- a/ports/krb5/vcpkg.json +++ b/ports/krb5/vcpkg.json @@ -1,8 +1,15 @@ { + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "krb5", "version": "1.21.2", - "description": "Network authentication protocol", + "port-version": 1, + "description": [ + "Kerberos is a network authentication protocol.", + "It is designed to provide strong authentication for client/server applications by using secret-key cryptography.", + "A free implementation of this protocol is available from the Massachusetts Institute of Technology.", + "Kerberos is available in many commercial products as well." + ], "homepage": "https://web.mit.edu/kerberos/", "license": "MIT", - "supports": "linux" + "supports": "linux | (x64 & !static & !uwp & windows)" } diff --git a/ports/krb5/windows_pc_files/krb5-gssapi.pc.in b/ports/krb5/windows_pc_files/krb5-gssapi.pc.in new file mode 100644 index 0000000000..90875b5007 --- /dev/null +++ b/ports/krb5/windows_pc_files/krb5-gssapi.pc.in @@ -0,0 +1,10 @@ +prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include +vendor=MIT + +Name: krb5-gssapi +Description: Kerberos implementation of the GSSAPI +Version: @VERSION@ +Requires: mit-krb5-gssapi diff --git a/ports/krb5/windows_pc_files/krb5.pc.in b/ports/krb5/windows_pc_files/krb5.pc.in new file mode 100644 index 0000000000..8822afc700 --- /dev/null +++ b/ports/krb5/windows_pc_files/krb5.pc.in @@ -0,0 +1,14 @@ +prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include +vendor=MIT + +defccname=FILE:/tmp/krb5cc_%{uid} +defktname=FILE:/etc/krb5.keytab +defcktname=FILE:${prefix}/var/krb5/user/%{euid}/client.keytab + +Name: krb5 +Description: An implementation of Kerberos network authentication +Version: @VERSION@ +Requires: mit-krb5 diff --git a/ports/krb5/windows_pc_files/mit-krb5-gssapi.pc.in b/ports/krb5/windows_pc_files/mit-krb5-gssapi.pc.in new file mode 100644 index 0000000000..0e5dfc8308 --- /dev/null +++ b/ports/krb5/windows_pc_files/mit-krb5-gssapi.pc.in @@ -0,0 +1,11 @@ +prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: mit-krb5-gssapi +Description: Kerberos implementation of the GSSAPI +Version: @VERSION@ +Requires.private: mit-krb5 +Cflags: -I${includedir} +Libs: -L${libdir} -lgssapi64 diff --git a/ports/krb5/windows_pc_files/mit-krb5.pc.in b/ports/krb5/windows_pc_files/mit-krb5.pc.in new file mode 100644 index 0000000000..eb48aa7554 --- /dev/null +++ b/ports/krb5/windows_pc_files/mit-krb5.pc.in @@ -0,0 +1,15 @@ +prefix=${pcfiledir}/../.. +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +defccname=FILE:/tmp/krb5cc_%{uid} +defktname=FILE:/etc/krb5.keytab +defcktname=FILE:${prefix}/var/krb5/user/%{euid}/client.keytab + +Name: mit-krb5 +Description: An implementation of Kerberos network authentication +Version: @VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -lkrb5_64 -lkrbcc64 -lxpprof64 -lkfwlogon -lcomerr64 -lk5sprt64 +Libs.private: -lk5sprt64 diff --git a/versions/baseline.json b/versions/baseline.json index a22072cde7..0b7e8430fe 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -4054,7 +4054,7 @@ }, "krb5": { "baseline": "1.21.2", - "port-version": 0 + "port-version": 1 }, "ktx": { "baseline": "4.3.1", diff --git a/versions/k-/krb5.json b/versions/k-/krb5.json index b31559b05d..3fea961e9c 100644 --- a/versions/k-/krb5.json +++ b/versions/k-/krb5.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "ea9bd42d5123185ac2cc46bf6eb1db73990de124", + "version": "1.21.2", + "port-version": 1 + }, { "git-tree": "287bac02bb53283b043688050edd9d02e0b039c7", "version": "1.21.2",