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 library version 1.19.2 #16074

Merged
merged 37 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a7487bd
My WIP recipes
madebr Apr 20, 2022
8e7ddc1
conan v2 fixes
xakod Nov 16, 2022
d2d85dc
static fix, patches
xakod Nov 16, 2022
59e579d
linter fixes
xakod Nov 16, 2022
1d76262
fixes
xakod Nov 16, 2022
384d167
fix options
xakod Nov 16, 2022
00d6e40
msvc build fixes
xakod Nov 17, 2022
8e408de
move patch to conanfile, it needs to be optional
xakod Nov 17, 2022
94137a1
Fixes
madebr Nov 19, 2022
78e4b3f
fixes
xakod Feb 16, 2023
c4d5798
fix test_packages
xakod Feb 16, 2023
302165c
* minor fix
xakod Mar 3, 2023
6d08e4c
try 1.19.2 version
xakod May 8, 2023
5fc1f4c
bump openssl
xakod May 9, 2023
67d54dd
fix openssl?
xakod May 9, 2023
55dff34
try to fix 1.19.2
xakod May 9, 2023
b0476dc
Update conanfile.py
Jun 2, 2023
336fee8
update a bit
xakod Nov 8, 2023
91bfbda
try to fix windows
xakod Nov 8, 2023
7fa7dd7
try to fix msvc
xakod Nov 15, 2023
118282a
Add ksu fix
xakod Feb 19, 2024
6832d02
Fix patches
xakod Feb 19, 2024
871169b
minor fixes
xakod Feb 19, 2024
5f60e0c
Minor fixes
xakod Feb 19, 2024
d66d9dc
try to fix shared build
xakod Feb 22, 2024
ffb887f
Disable macos
xakod Feb 22, 2024
179bb6e
Try to fix lib names
xakod Feb 22, 2024
4c3998e
Missing deps
xakod Feb 22, 2024
b43cb3a
disable msvc, remove old patches
xakod Feb 22, 2024
411d85e
simplify build
uilianries Jun 3, 2024
c939982
run autorreconf
uilianries Jun 3, 2024
2bcdb8f
validate pkgconfig
uilianries Jun 3, 2024
d97a826
Simplify krb5
uilianries Jun 5, 2024
d24ceb4
verify ssl when downloading
uilianries Jun 5, 2024
3e8276c
remove libdb as requirement
uilianries Jun 5, 2024
dd326f6
Merge pull request #5 from uilianries/krb5
Jun 5, 2024
e86a6a5
Skip static dependencies
uilianries Jun 5, 2024
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
18 changes: 18 additions & 0 deletions recipes/krb5/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
sources:
"1.19.2":
url: "https://kerberos.org/dist/krb5/1.19/krb5-1.19.2.tar.gz"
sha256: "10453fee4e3a8f8ce6129059e5c050b8a65dab1c257df68b99b3112eaa0cdf6a"
patches:
"1.19.2":
- patch_file: "patches/1.19.2-0001-no-html+tests.patch"
patch_type: "conan"
patch_description: "no-html+tests"
- patch_file: "patches/1.19.2-0002-no-tests.patch"
patch_type: "conan"
patch_description: "no-tests"
- patch_file: "patches/1.19.2-0003-disable_ksu_root.patch"
patch_description: "no ksu install as root user"
patch_type: "conan"
- patch_file: "patches/1.19.2-0004-missing_zlib.patch"
patch_description: "fix zlib linkage"
patch_type: "conan"
284 changes: 284 additions & 0 deletions recipes/krb5/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,284 @@
from conan import ConanFile
from conan.tools.build import cross_building
from conan.tools.env import VirtualBuildEnv, VirtualRunEnv
from conan.errors import ConanInvalidConfiguration
from conan.tools.files import copy, get, rmdir, chdir, replace_in_file, export_conandata_patches, apply_conandata_patches
from conan.tools.gnu import Autotools, AutotoolsToolchain,AutotoolsDeps, PkgConfigDeps
from conan.tools.layout import basic_layout
from conan.tools.microsoft import is_msvc, VCVars, NMakeDeps, NMakeToolchain
import glob
import os

required_conan_version = ">=1.52.0"

class Krb5Conan(ConanFile):
name = "krb5"
description = "Kerberos is a network authentication protocol. It is designed to provide strong authentication " \
"for client/server applications by using secret-key cryptography."
homepage = "https://web.mit.edu/kerberos"
topics = ("kerberos", "network", "authentication", "protocol", "client", "server", "cryptography")
license = "NOTICE"
url = "https://github.com/conan-io/conan-center-index"

options = {
"shared": [True, False],
"fPIC": [True, False],
"thread": [True, False],
"use_dns_realms": [True, False],
"leash": [True, False],
"with_tls": [False, "openssl"],
"with_tcl": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"thread": True,
"use_dns_realms": False,
"leash": False,
"with_tls": "openssl",
"with_tcl": False,
}
settings = "os", "arch", "compiler", "build_type"

def layout(self):
basic_layout(self, src_folder="src")

@property
def _settings_build(self):
return getattr(self, "settings_build", self.settings)

def validate(self):
if is_msvc(self):
raise ConanInvalidConfiguration("MSVC is not supported (yet)") # Possible problem with uicc 32-bit executable
if is_msvc(self) and not self.options.shared:
raise ConanInvalidConfiguration("Visual Studio only builds shared libraries")
if self.settings.os == "Macos":
raise ConanInvalidConfiguration("Macos is not supported (yet)")

def config_options(self):
if self.settings.os == "Windows":
self.options.rm_safe("fPIC")
if is_msvc(self):
self.options.rm_safe("thread")
self.options.rm_safe("with_tls")
self.options.rm_safe("with_tcl")
else:
self.options.rm_safe("leash")

def configure(self):
if self.options.get_safe("shared"):
self.options.rm_safe("fPIC")
self.settings.rm_safe("compiler.libcxx")
self.settings.rm_safe("compiler.cppstd")

def export_sources(self):
export_conandata_patches(self)

def source(self):
get(self, **self.conan_data["sources"][self.version],
destination=self.source_folder, strip_root=True)

def generate(self):
env = VirtualBuildEnv(self)
env.generate()

if is_msvc(self):
tc = NMakeToolchain(self)
env = tc.environment()
env.define("KRB_INSTALL_DIR", self.package_folder)
tc.generate(env)

tc = NMakeDeps(self)
tc.generate()

vcvars = VCVars(self)
vcvars.generate()
else:
env = VirtualBuildEnv(self)
env.generate()
if not cross_building(self):
env = VirtualRunEnv(self)
env.generate(scope="build")
tc = AutotoolsToolchain(self)
yes_no = lambda v: "yes" if v else "no"
tls_impl = {
"openssl": "openssl",
}.get(str(self.options.get_safe('with_tls')))
tc.configure_args.extend([
f"--enable-thread-support={yes_no(self.options.get_safe('thread'))}",
f"--enable-dns-for-realm={yes_no(self.options.use_dns_realms)}",
f"--enable-pkinit={yes_no(self.options.get_safe('with_tls'))}",
f"--with-crypto-impl={(tls_impl or 'builtin')}",
f"--with-spake-openssl={yes_no(self.options.get_safe('with_tls') == 'openssl')}",
"--disable-nls",
"--disable-rpath",
"--without-libedit",
"--without-readline",
"--with-system-verto",
# "--with-system-et}",
# "--with-system-ss}",
f"--with-tcl={(self.deps_cpp_info['tcl'].rootpath if self.options.get_safe('with_tcl') else 'no')}",
])
tc.generate()
deps = AutotoolsDeps(self)
deps.generate()
pkg = PkgConfigDeps(self)
pkg.generate()

def requirements(self):
# if self.settings.os != "Windows":
# self.requires("e2fsprogs/1.45.6")
if not is_msvc(self):
self.requires("libverto/0.3.2")
if self.options.get_safe("with_tls") == "openssl":
self.requires("openssl/[>=1.1 <4]")
if self.options.get_safe("with_tcl"):
self.requires("tcl/8.6.11")

def build_requirements(self):
if not self.conf.get("tools.gnu:pkg_config", check_type=str):
self.tool_requires("pkgconf/1.9.3")
if not is_msvc(self):
self.build_requires("automake/1.16.5")
self.build_requires("bison/3.8.2")
if is_msvc(self):
self.tool_requires("strawberryperl/5.32.1.1")
if self._settings_build.os == "Windows":
self.win_bash = True
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
self.tool_requires("msys2/cci.latest")

def _build_autotools(self):
autotools = Autotools(self)
autotools.configure(os.path.join(self.source_folder,"src"))
autotools.make()

@property
def _nmake_args(self):
nmake_args = []
if self.settings.build_type != "Debug":
nmake_args.append("NODEBUG=1")
if not self.options.leash:
nmake_args.append("NO_LEASH=1")
if self.options.use_dns_realms:
nmake_args.append("KRB5_USE_DNS_REALMS=1")
return nmake_args

def _build_msvc(self):
with chdir(self, os.path.join(self.source_folder, "src")):
self.run("nmake -f Makefile.in prep-windows")
self.run("nmake {}".format(" ".join(self._nmake_args)))

def build(self):
if not self.options.shared:
with chdir(self, os.path.join(self.source_folder,"src", "kadmin", "dbutil")):
replace_in_file(self, "kdb5_util.c",
"krb5_keyblock master_keyblock;",
"extern krb5_keyblock master_keyblock;")
with chdir(self, os.path.join(self.source_folder,"src", "tests", "create")):
replace_in_file(self, "kdb5_mkdums.c",
"krb5_keyblock master_keyblock;",
"extern krb5_keyblock master_keyblock;")
replace_in_file(self, "kdb5_mkdums.c",
"krb5_principal master_princ;",
"static krb5_principal master_princ;")
replace_in_file(self, "kdb5_mkdums.c",
"krb5_pointer master_random;",
"static krb5_pointer master_random;")
with chdir(self, os.path.join(self.source_folder,"src", "tests", "verify")):
replace_in_file(self, "kdb5_verify.c",
"krb5_keyblock master_keyblock;",
"extern krb5_keyblock master_keyblock;")
replace_in_file(self, "kdb5_verify.c",
"krb5_principal master_princ;",
"static krb5_principal master_princ;")
apply_conandata_patches(self)
if is_msvc(self):
self._build_msvc()
else:
self._build_autotools()

def package(self):
copy(self, "NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
if is_msvc(self):
with chdir(self, os.path.join(self.source_folder, "src")):
self.run("nmake install {}".format(" ".join(self._nmake_args)))

for pdb in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")):
os.unlink(pdb)
else:
autotools = Autotools(self)
autotools.install()

rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "share"))
rmdir(self, os.path.join(self.package_folder, "var"))

def package_info(self):
krb5_lib = "krb5"
krb5support = "krb5support"
crypto_libs = []
gssapi_lib = "gssapi_krb5"
if is_msvc(self):
suffix = {
"x86_64": "64",
"x86": "32",
}[str(self.settings.arch)]

krb5_lib += "_" + suffix
krb5support = "k5sprt" + suffix
gssapi_lib = "gssapi" + suffix
else:
crypto_libs.append("k5crypto")

self.cpp_info.components["mit-krb5"].libs = [krb5_lib] + crypto_libs + [krb5support]
if not is_msvc(self):
self.cpp_info.components["mit-krb5"].libs.append("com_err") # is a common library, that can potentially be packaged (but I don't know who "owns" it)

if self.options.get_safe('with_tls') == "openssl":
self.cpp_info.components["mit-krb5"].requires.append("openssl::ssl")
self.cpp_info.components["mit-krb5"].names["pkg_config"] = "mit-krb5"
if self.settings.os == "Linux":
self.cpp_info.components["mit-krb5"].system_libs = ["resolv"]

self.cpp_info.components["libkrb5"].libs = []
self.cpp_info.components["libkrb5"].requires = ["mit-krb5"]
self.cpp_info.components["libkrb5"].names["pkg_config"] = "krb5"

self.cpp_info.components["mit-krb5-gssapi"].libs = [gssapi_lib]
self.cpp_info.components["mit-krb5-gssapi"].requires = ["mit-krb5"]
self.cpp_info.components["mit-krb5-gssapi"].names["pkg_config"] = "mit-krb5-gssapi"
if not is_msvc(self) and self.settings.os == "Windows" and self.options.get_safe("shared"):
self.cpp_info.components["mit-krb5-gssapi"].defines.append("GSS_DLL_FILE")

self.cpp_info.components["krb5-gssapi"].libs = []
self.cpp_info.components["krb5-gssapi"].requires = ["mit-krb5-gssapi"]
self.cpp_info.components["krb5-gssapi"].names["pkg_config"] = "krb5-gssapi"

bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bin_path))
self.env_info.PATH.append(bin_path)

if not is_msvc(self):
self.cpp_info.components["gssrpc"].libs = ["gssrpc"]
self.cpp_info.components["gssrpc"].requires = ["mit-krb5-gssapi"]
self.cpp_info.components["gssrpc"].names["pkg_config"] = "gssrpc"

self.cpp_info.components["kadm-client"].libs = ["kadm5clnt"]
self.cpp_info.components["kadm-client"].requires = ["mit-krb5-gssapi", "gssrpc"]
self.cpp_info.components["kadm-client"].names["pkg_config"] = "kadm-client"

self.cpp_info.components["kdb"].libs = ["kdb5"]
self.cpp_info.components["kdb"].requires = ["mit-krb5-gssapi", "mit-krb5", "gssrpc"]
self.cpp_info.components["kdb"].names["pkg_config"] = "kdb-client"

self.cpp_info.components["kadm-server"].libs = ["kadm5srv"]
self.cpp_info.components["kadm-server"].requires = ["kdb", "mit-krb5-gssapi"]
self.cpp_info.components["kadm-server"].names["pkg_config"] = "kadm-server"

self.cpp_info.components["krad"].libs = ["krad"]
self.cpp_info.components["krad"].requires = ["libkrb5", "libverto::libverto"]

krb5_config = os.path.join(bin_path, "krb5-config").replace("\\", "/")
self.output.info("Appending KRB5_CONFIG environment variable: {}".format(krb5_config))
self.env_info.KRB5_CONFIG = krb5_config
22 changes: 22 additions & 0 deletions recipes/krb5/all/patches/1.19.2-0001-no-html+tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--- src/windows/leash/Makefile.in
+++ src/windows/leash/Makefile.in
@@ -3,7 +3,7 @@

EXE_NAME=leash

-SUBDIRS= htmlhelp
+SUBDIRS=

OBJS= \
$(OUTPRE)Leash.obj \
--- src/lib/rpc/Makefile.in
+++ src/lib/rpc/Makefile.in
@@ -2,7 +2,7 @@
BUILDTOP=$(REL)..$(S)..
DEFINES = -DGSSAPI_KRB5 -DDEBUG_GSSAPI=0 -DGSSRPC__IMPL

-SUBDIRS=unit-test
+#SUBDIRS=unit-test

##DOSBUILDTOP = ..\..
##DOSLIBNAME=libgssrpc.lib
13 changes: 13 additions & 0 deletions recipes/krb5/all/patches/1.19.2-0002-no-tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/Makefile.in b/src/Makefile.in
index 8f14e9bf2..dfb6843c9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -30,7 +30,7 @@ SUBDIRS=util include lib \
plugins/preauth/spake \
plugins/preauth/test \
plugins/tls/k5tls \
- kdc kadmin kprop clients appl tests \
+ kdc kadmin kprop clients appl \
config-files build-tools man doc @po@
WINSUBDIRS=include util lib ccapi windows clients appl plugins\preauth\spake
BUILDTOP=$(REL).
13 changes: 13 additions & 0 deletions recipes/krb5/all/patches/1.19.2-0003-disable_ksu_root.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/config/pre.in b/src/config/pre.in
index 3752174..98dbe0f 100644
--- a/src/config/pre.in
+++ b/src/config/pre.in
@@ -184,7 +184,7 @@ INSTALL_PROGRAM=@INSTALL_PROGRAM@ $(INSTALL_STRIP)
INSTALL_SCRIPT=@INSTALL_PROGRAM@
INSTALL_DATA=@INSTALL_DATA@
INSTALL_SHLIB=@INSTALL_SHLIB@
-INSTALL_SETUID=$(INSTALL) $(INSTALL_STRIP) -m 4755 -o root
+INSTALL_SETUID=$(INSTALL) $(INSTALL_STRIP) -m 755
## This is needed because autoconf will sometimes define @exec_prefix@ to be
## ${prefix}.
prefix=@prefix@
13 changes: 13 additions & 0 deletions recipes/krb5/all/patches/1.19.2-0004-missing_zlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/plugins/tls/k5tls/Makefile.in b/src/plugins/tls/k5tls/Makefile.in
index 9f2de7d..a67f38f 100644
--- a/src/plugins/tls/k5tls/Makefile.in
+++ b/src/plugins/tls/k5tls/Makefile.in
@@ -8,7 +8,7 @@ LIBMAJOR=0
LIBMINOR=0
RELDIR=../plugins/tls/k5tls
SHLIB_EXPDEPS= $(KRB5_DEPLIB) $(SUPPORT_DEPLIB)
-SHLIB_EXPLIBS= $(KRB5_LIB) $(SUPPORT_LIB) $(TLS_IMPL_LIBS)
+SHLIB_EXPLIBS= $(KRB5_LIB) $(SUPPORT_LIB) $(TLS_IMPL_LIBS) -lz -ldl -lpthread

STLIBOBJS=openssl.o notls.o

7 changes: 7 additions & 0 deletions recipes/krb5/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(test_package C)

find_package(krb5 REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE krb5::krb5)
Loading
Loading