Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[krb5] Add windows #38706

Merged
merged 7 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 84 additions & 21 deletions ports/krb5/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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_extract_source_archive(
SOURCE_PATH
ARCHIVE ${ARCHIVE}
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_configure_make(
SOURCE_PATH "${SOURCE_PATH}/src"
AUTOCONFIG
OPTIONS
"CFLAGS=-fcommon \$CFLAGS"
)
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})

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")
Expand All @@ -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")
talregev marked this conversation as resolved.
Show resolved Hide resolved
35 changes: 35 additions & 0 deletions ports/krb5/relative_paths.patch
Original file line number Diff line number Diff line change
@@ -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)/../../../'
Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<foo>-config provides configuration information similar to pkg-config (or cmake config). That's why it must exist for each build type, and port usually update the installed files to apply this change correctly. Example: pcre2.

The same applies to similar scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not understand what changes require in this patch.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The requested change was: Do not use a patch. Update the installed krb5-conig files as needed to support release and debug. An example was named.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduced a CI regression because it $(pwd) is inside single quotes,
and because we have more installation order problems with krb5.

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"
11 changes: 9 additions & 2 deletions ports/krb5/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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)"
talregev marked this conversation as resolved.
Show resolved Hide resolved
}
10 changes: 10 additions & 0 deletions ports/krb5/windows_pc_files/krb5-gssapi.pc.in
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions ports/krb5/windows_pc_files/krb5.pc.in
Original file line number Diff line number Diff line change
@@ -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
11 changes: 11 additions & 0 deletions ports/krb5/windows_pc_files/mit-krb5-gssapi.pc.in
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions ports/krb5/windows_pc_files/mit-krb5.pc.in
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4050,7 +4050,7 @@
},
"krb5": {
"baseline": "1.21.2",
"port-version": 0
"port-version": 1
},
"ktx": {
"baseline": "4.3.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/k-/krb5.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "ea9bd42d5123185ac2cc46bf6eb1db73990de124",
"version": "1.21.2",
"port-version": 1
},
{
"git-tree": "287bac02bb53283b043688050edd9d02e0b039c7",
"version": "1.21.2",
Expand Down