Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCHv4 1/1] package/heimdal: upgrade package and add target support
@ 2025-04-28 15:40 Guillaume Chaye
  2025-05-18 16:47 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Guillaume Chaye @ 2025-04-28 15:40 UTC (permalink / raw)
  To: buildroot; +Cc: Thomas Petazzoni, Guillaume Chaye

This patch does several things, so I will try to explain clearly what has been modified.

First, it bumps Heimdal to the latest commit (16/04/2025).
The current version was more than 3 years old and had known CVEs (see CVE-2023-36328).
This upgrade allows the removal of the two patches currently applied:
- The commit 1b57b62, which fixes the build with autoconf 2.72, is already included upstream.
- We no longer need to use the JSON-PP module, as it is now optional (commit 13d3bcf).

Heimdal was previously a host-only package. This patch adds target support.
This requires cross-compiling the project, which was not possible without additional patches.
After some research, I found this pull request (https://github.com/heimdal/heimdal/pull/1174)
created by a well-known Heimdal contributor (Nico Williams).
This pull request contains 29 commits, which is quite large, so I have tried to keep things simple
by selecting only the minimal set of changes required for cross-compilation.

After extensive testing, I have successfully built the target version of Heimdal by applying 3 commits
picked from the pull request:
- The first one adds the AX_PROG_CC_FOR_BUILD macro to the project.
  This macro, from the GNU project (https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html),
  allows detecting a C compiler that produces native executables.
- The second commit integrates the AX_PROG_CC_FOR_BUILD macro into Heimdal's autoconf scripts,
  enabling proper compiler selection during the build.
- Finally, a patch was needed to fix header errors when cross-compiling libroken.

Additionally, I have added two patches I wrote and submitted upstream:
- The first removes a hardcoded path from a script.
- The second fixes an error generated by the 'ar' utility during the build process.

Finally, since the latest version of Heimdal no longer depends on e2fsprogs,
the host-e2fsprogs dependency has been removed.

Signed-off-by: Guillaume Chaye <guillaume.chaye@zeetim.com>
---
 package/Config.in                             |   1 +
 ...01-Import-AX_PROG_CC_FOR_BUILD-macro.patch | 176 ++++++++++++++++++
 ...JSON-PP-part-of-core-instead-of-JSON.patch |  57 ------
 .../0002-Use-AX_PROG_CC_FOR_BUILD.patch       |  23 +++
 ...file.m4-Fix-build-with-autoconf-2.72.patch |  27 ---
 ...lace-make-roken-with-roken-h-process.patch |  57 ++++++
 ...0004-cf-remove-comm_err-header-check.patch |  51 +++++
 package/heimdal/0005-Fix-ar-warnings.patch    |  43 +++++
 package/heimdal/Config.in                     |  11 ++
 package/heimdal/heimdal.hash                  |   2 +-
 package/heimdal/heimdal.mk                    |  41 ++--
 11 files changed, 386 insertions(+), 103 deletions(-)
 create mode 100644 package/heimdal/0001-Import-AX_PROG_CC_FOR_BUILD-macro.patch
 delete mode 100644 package/heimdal/0001-Use-perl-module-JSON-PP-part-of-core-instead-of-JSON.patch
 create mode 100644 package/heimdal/0002-Use-AX_PROG_CC_FOR_BUILD.patch
 delete mode 100644 package/heimdal/0002-cf-largefile.m4-Fix-build-with-autoconf-2.72.patch
 create mode 100644 package/heimdal/0003-Replace-make-roken-with-roken-h-process.patch
 create mode 100644 package/heimdal/0004-cf-remove-comm_err-header-check.patch
 create mode 100644 package/heimdal/0005-Fix-ar-warnings.patch
 create mode 100644 package/heimdal/Config.in

diff --git a/package/Config.in b/package/Config.in
index 167965d64b..438679c7a0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2035,6 +2035,7 @@ menu "Networking"
 	source "package/gupnp/Config.in"
 	source "package/gupnp-av/Config.in"
 	source "package/gupnp-dlna/Config.in"
+	source "package/heimdal/Config.in"
 	source "package/ibrcommon/Config.in"
 	source "package/ibrdtn/Config.in"
 	source "package/libcgi/Config.in"
diff --git a/package/heimdal/0001-Import-AX_PROG_CC_FOR_BUILD-macro.patch b/package/heimdal/0001-Import-AX_PROG_CC_FOR_BUILD-macro.patch
new file mode 100644
index 0000000000..b39dc1cfd6
--- /dev/null
+++ b/package/heimdal/0001-Import-AX_PROG_CC_FOR_BUILD-macro.patch
@@ -0,0 +1,176 @@
+From 4d0d834f96cfab796fdb4653b3646feb0d306c95 Mon Sep 17 00:00:00 2001
+From: Nicolas Williams <nico@twosigma.com>
+Date: Sat, 24 Jun 2023 00:12:20 -0500
+Subject: [PATCH] cf: Import AX_PROG_CC_FOR_BUILD macro
+
+Some versions of autoconf-archive have a broken AX_PROG_CC_FOR_BUILD.
+
+Signed-off-by: Nicolas Williams <nico@twosigma.com>
+Upstream: https://github.com/heimdal/heimdal/pull/1174/commits/4d0d834f96cfab796fdb4653b3646feb0d306c95
+---
+ cf/ax_prog_cc_for_build.m4 | 156 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 156 insertions(+)
+ create mode 100644 cf/ax_prog_cc_for_build.m4
+
+diff --git a/cf/ax_prog_cc_for_build.m4 b/cf/ax_prog_cc_for_build.m4
+new file mode 100644
+index 0000000000..fb986652f6
+--- /dev/null
++++ b/cf/ax_prog_cc_for_build.m4
+@@ -0,0 +1,156 @@
++# ===========================================================================
++#   https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html
++# ===========================================================================
++#
++# SYNOPSIS
++#
++#   AX_PROG_CC_FOR_BUILD
++#
++# DESCRIPTION
++#
++#   This macro searches for a C compiler that generates native executables,
++#   that is a C compiler that surely is not a cross-compiler. This can be
++#   useful if you have to generate source code at compile-time like for
++#   example GCC does.
++#
++#   The macro sets the CC_FOR_BUILD and CPP_FOR_BUILD macros to anything
++#   needed to compile or link (CC_FOR_BUILD) and preprocess (CPP_FOR_BUILD).
++#   The value of these variables can be overridden by the user by specifying
++#   a compiler with an environment variable (like you do for standard CC).
++#
++#   It also sets BUILD_EXEEXT and BUILD_OBJEXT to the executable and object
++#   file extensions for the build platform, and GCC_FOR_BUILD to `yes' if
++#   the compiler we found is GCC. All these variables but GCC_FOR_BUILD are
++#   substituted in the Makefile.
++#
++# LICENSE
++#
++#   Copyright (c) 2008 Paolo Bonzini <bonzini@gnu.org>
++#
++#   Copying and distribution of this file, with or without modification, are
++#   permitted in any medium without royalty provided the copyright notice
++#   and this notice are preserved. This file is offered as-is, without any
++#   warranty.
++
++#serial 21
++
++AU_ALIAS([AC_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
++AU_ALIAS([AC_HEIM_PROG_CC_FOR_BUILD], [AX_PROG_CC_FOR_BUILD])
++AC_DEFUN([AX_PROG_CC_FOR_BUILD], [dnl
++AC_REQUIRE([AC_PROG_CC])dnl
++AC_REQUIRE([AC_PROG_CPP])dnl
++AC_REQUIRE([AC_CANONICAL_BUILD])dnl
++
++dnl Use the standard macros, but make them use other variable names
++dnl
++pushdef([ac_cv_prog_CPP], ac_cv_build_prog_CPP)dnl
++pushdef([ac_cv_prog_cc_c89], ac_cv_build_prog_cc_c89)dnl
++pushdef([ac_cv_prog_cc_c99], ac_cv_build_prog_cc_c99)dnl
++pushdef([ac_cv_prog_cc_c11], ac_cv_build_prog_cc_c11)dnl
++pushdef([ac_cv_prog_gcc], ac_cv_build_prog_gcc)dnl
++pushdef([ac_cv_prog_cc_works], ac_cv_build_prog_cc_works)dnl
++pushdef([ac_cv_prog_cc_cross], ac_cv_build_prog_cc_cross)dnl
++pushdef([ac_cv_prog_cc_g], ac_cv_build_prog_cc_g)dnl
++pushdef([ac_cv_c_compiler_gnu], ac_cv_build_c_compiler_gnu)dnl
++pushdef([ac_cv_exeext], ac_cv_build_exeext)dnl
++pushdef([ac_cv_objext], ac_cv_build_objext)dnl
++pushdef([ac_exeext], ac_build_exeext)dnl
++pushdef([ac_objext], ac_build_objext)dnl
++pushdef([CC], CC_FOR_BUILD)dnl
++pushdef([CPP], CPP_FOR_BUILD)dnl
++pushdef([GCC], GCC_FOR_BUILD)dnl
++pushdef([CFLAGS], CFLAGS_FOR_BUILD)dnl
++pushdef([CPPFLAGS], CPPFLAGS_FOR_BUILD)dnl
++pushdef([EXEEXT], BUILD_EXEEXT)dnl
++pushdef([LDFLAGS], LDFLAGS_FOR_BUILD)dnl
++pushdef([OBJEXT], BUILD_OBJEXT)dnl
++pushdef([host], build)dnl
++pushdef([host_alias], build_alias)dnl
++pushdef([host_cpu], build_cpu)dnl
++pushdef([host_vendor], build_vendor)dnl
++pushdef([host_os], build_os)dnl
++pushdef([ac_cv_host], ac_cv_build)dnl
++pushdef([ac_cv_host_alias], ac_cv_build_alias)dnl
++pushdef([ac_cv_host_cpu], ac_cv_build_cpu)dnl
++pushdef([ac_cv_host_vendor], ac_cv_build_vendor)dnl
++pushdef([ac_cv_host_os], ac_cv_build_os)dnl
++pushdef([ac_tool_prefix], ac_build_tool_prefix)dnl
++pushdef([am_cv_CC_dependencies_compiler_type], am_cv_build_CC_dependencies_compiler_type)dnl
++pushdef([am_cv_prog_cc_c_o], am_cv_build_prog_cc_c_o)dnl
++pushdef([cross_compiling], cross_compiling_build)dnl
++
++cross_compiling_build=no
++
++ac_build_tool_prefix=
++AS_IF([test -n "$build"],      [ac_build_tool_prefix="$build-"],
++      [test -n "$build_alias"],[ac_build_tool_prefix="$build_alias-"])
++
++AC_LANG_PUSH([C])
++
++dnl The pushdef([ac_cv_c_compiler_gnu], ...) currently does not cover
++dnl the use of this variable in _AC_LANG_COMPILER_GNU called by
++dnl AC_PROG_CC. Unset this cache variable temporarily as a workaround.
++was_set_c_compiler_gnu=${[ac_cv_c_compiler_gnu]+y}
++AS_IF([test ${was_set_c_compiler_gnu}],
++    [saved_c_compiler_gnu=$[ac_cv_c_compiler_gnu]
++    AS_UNSET([[ac_cv_c_compiler_gnu]])])
++
++AC_PROG_CC
++
++dnl Restore ac_cv_c_compiler_gnu
++AS_IF([test ${was_set_c_compiler_gnu}],
++  [[ac_cv_c_compiler_gnu]=$[saved_c_compiler_gnu]])
++
++_AC_COMPILER_EXEEXT
++_AC_COMPILER_OBJEXT
++AC_PROG_CPP
++
++dnl Restore the old definitions
++dnl
++popdef([cross_compiling])dnl
++popdef([am_cv_prog_cc_c_o])dnl
++popdef([am_cv_CC_dependencies_compiler_type])dnl
++popdef([ac_tool_prefix])dnl
++popdef([ac_cv_host_os])dnl
++popdef([ac_cv_host_vendor])dnl
++popdef([ac_cv_host_cpu])dnl
++popdef([ac_cv_host_alias])dnl
++popdef([ac_cv_host])dnl
++popdef([host_os])dnl
++popdef([host_vendor])dnl
++popdef([host_cpu])dnl
++popdef([host_alias])dnl
++popdef([host])dnl
++popdef([OBJEXT])dnl
++popdef([LDFLAGS])dnl
++popdef([EXEEXT])dnl
++popdef([CPPFLAGS])dnl
++popdef([CFLAGS])dnl
++popdef([GCC])dnl
++popdef([CPP])dnl
++popdef([CC])dnl
++popdef([ac_objext])dnl
++popdef([ac_exeext])dnl
++popdef([ac_cv_objext])dnl
++popdef([ac_cv_exeext])dnl
++popdef([ac_cv_c_compiler_gnu])dnl
++popdef([ac_cv_prog_cc_g])dnl
++popdef([ac_cv_prog_cc_cross])dnl
++popdef([ac_cv_prog_cc_works])dnl
++popdef([ac_cv_prog_cc_c89])dnl
++popdef([ac_cv_prog_gcc])dnl
++popdef([ac_cv_prog_CPP])dnl
++
++dnl restore global variables ac_ext, ac_cpp, ac_compile,
++dnl ac_link, ac_compiler_gnu (dependant on the current
++dnl language after popping):
++AC_LANG_POP([C])
++
++dnl Finally, set Makefile variables
++dnl
++AC_SUBST(BUILD_EXEEXT)dnl
++AC_SUBST(BUILD_OBJEXT)dnl
++AC_SUBST([CFLAGS_FOR_BUILD])dnl
++AC_SUBST([CPPFLAGS_FOR_BUILD])dnl
++AC_SUBST([LDFLAGS_FOR_BUILD])dnl
++])
diff --git a/package/heimdal/0001-Use-perl-module-JSON-PP-part-of-core-instead-of-JSON.patch b/package/heimdal/0001-Use-perl-module-JSON-PP-part-of-core-instead-of-JSON.patch
deleted file mode 100644
index 7323ac70df..0000000000
--- a/package/heimdal/0001-Use-perl-module-JSON-PP-part-of-core-instead-of-JSON.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From f6fdb0a28e3bfcb3fd0aa1c81ad59c5411c0d660 Mon Sep 17 00:00:00 2001
-From: Andrew Sim <andrewsimz@gmail.com>
-Date: Sat, 10 Jun 2023 09:00:24 +0200
-Subject: [PATCH] Use perl module JSON:PP, part of core, instead of JSON
- package
-
-This patch removes the need for an external package.
-
-Ported from
-https://github.com/openwrt/packages/blob/master/net/samba4/patches/105-perl-json-pp.patch
-https://github.com/openwrt/packages/commit/402f4ba4eff65b80a9deaa6085256112bec4d67b#diff-208d4e0345c9d29fbec23d6f655ba794afd3052f5cb8dd73944db72ce81b847b
-
-Upstream: https://github.com/heimdal/heimdal/pull/1176
-
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
----
- cf/make-proto.pl | 4 ++--
- configure.ac     | 1 -
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/cf/make-proto.pl b/cf/make-proto.pl
-index 36a040ce6..4af21916b 100644
---- a/cf/make-proto.pl
-+++ b/cf/make-proto.pl
-@@ -4,7 +4,7 @@
- use Getopt::Std;
- use File::Compare;
- 
--use JSON;
-+use JSON::PP
- 
- my $comment = 0;
- my $doxygen = 0;
-@@ -70,7 +70,7 @@ if($opt_x) {
-     my $EXP;
-     local $/;
-     open(EXP, '<', $opt_x) || die "open ${opt_x}";
--    my $obj = JSON->new->utf8->decode(<EXP>);
-+    my $obj = JSON::PP->new->utf8->decode(<EXP>);
-     close $EXP;
- 
-     foreach my $x (keys %$obj) {
-diff --git a/configure.ac b/configure.ac
-index cedb4c01f..cecd030e6 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -56,7 +56,6 @@ if ! test -f "$srcdir/lib/asn1/der-protos.h" ||
-     AC_KRB_PROG_PERL
-     AC_KRB_PERL_MOD(Getopt::Std)
-     AC_KRB_PERL_MOD(File::Compare)
--    AC_KRB_PERL_MOD(JSON)
- fi
- 
- AC_KRB_PROG_YACC
--- 
-2.39.2
-
diff --git a/package/heimdal/0002-Use-AX_PROG_CC_FOR_BUILD.patch b/package/heimdal/0002-Use-AX_PROG_CC_FOR_BUILD.patch
new file mode 100644
index 0000000000..27ec78587f
--- /dev/null
+++ b/package/heimdal/0002-Use-AX_PROG_CC_FOR_BUILD.patch
@@ -0,0 +1,23 @@
+From f6769797507d73d05e6a2ac2f54ff9f8f49b377c Mon Sep 17 00:00:00 2001
+From: Nicolas Williams <nico@twosigma.com>
+Date: Sat, 24 Jun 2023 00:15:31 -0500
+Subject: [PATCH] cf: Use AX_PROG_CC_FOR_BUILD
+
+Signed-off-by: Nicolas Williams <nico@twosigma.com>
+Upstream: https://github.com/heimdal/heimdal/pull/1174/commits/f6769797507d73d05e6a2ac2f54ff9f8f49b377c
+---
+ configure.ac | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/configure.ac b/configure.ac
+index 86aed5e9eb..2b02dec450 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -18,6 +18,7 @@ dnl Checks for programs.
+ AC_PROG_CC
+ AM_PROG_CC_C_O
+ AC_PROG_CPP
++AC_HEIM_PROG_CC_FOR_BUILD
+ AM_PATH_PYTHON
+ AC_CHECK_PROG(CLANG_FORMAT, clang-format, [clang-format], [no])
+ test "$CLANG_FORMAT" = no && CLANG_FORMAT=true
diff --git a/package/heimdal/0002-cf-largefile.m4-Fix-build-with-autoconf-2.72.patch b/package/heimdal/0002-cf-largefile.m4-Fix-build-with-autoconf-2.72.patch
deleted file mode 100644
index 5b36c5a784..0000000000
--- a/package/heimdal/0002-cf-largefile.m4-Fix-build-with-autoconf-2.72.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 1b57b62d82a478c1fade350f0fb1d57031a8734e Mon Sep 17 00:00:00 2001
-From: Bernd Kuhls <bernd@kuhls.net>
-Date: Sat, 10 Feb 2024 09:33:48 +0100
-Subject: [PATCH] cf/largefile.m4: Fix build with autoconf-2.72
-
-Fixes https://github.com/heimdal/heimdal/issues/1201
-
-Upstream: https://github.com/heimdal/heimdal/commit/1b57b62d82a478c1fade350f0fb1d57031a8734e
-
-Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
----
- cf/largefile.m4 | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/cf/largefile.m4 b/cf/largefile.m4
-index 5c54897be4..cdbbc55431 100644
---- a/cf/largefile.m4
-+++ b/cf/largefile.m4
-@@ -10,7 +10,7 @@ dnl with generated code, such as lex
- if test "$enable_largefile" != no -a "$ac_cv_sys_large_files" != no; then
- 	CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files"
- fi
--if test "$enable_largefile" != no -a "$ac_cv_sys_file_offset_bits" != no; then
-+if test "$enable_largefile" != no -a "$ac_cv_sys_file_offset_bits" != no && test -n "$ac_cv_sys_file_offset_bits"; then
- 	CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
- fi
- ])
diff --git a/package/heimdal/0003-Replace-make-roken-with-roken-h-process.patch b/package/heimdal/0003-Replace-make-roken-with-roken-h-process.patch
new file mode 100644
index 0000000000..f2bd959211
--- /dev/null
+++ b/package/heimdal/0003-Replace-make-roken-with-roken-h-process.patch
@@ -0,0 +1,57 @@
+From 28df1d8a8b5ce2a35214faad3254649a0a470bfe Mon Sep 17 00:00:00 2001
+From: Nicolas Williams <nico@twosigma.com>
+Date: Sat, 24 Jun 2023 22:25:00 -0500
+Subject: [PATCH] roken: Replace make-roken with cf/roken-h-process.pl
+
+Signed-off-by: Nicolas Williams <nico@twosigma.com>
+Upstream: https://github.com/heimdal/heimdal/pull/1174/commits/28df1d8a8b5ce2a35214faad3254649a0a470bfe
+---
+ lib/roken/Makefile.am | 21 +++++++++------------
+ lib/roken/roken.awk   | 10 +++++++---
+ lib/roken/roken.h.in  | 19 +++++++++++++------
+ 3 files changed, 29 insertions(+), 21 deletions(-)
+
+diff --git a/lib/roken/Makefile.am b/lib/roken/Makefile.am
+index 1f530c7aee..1bdb809b64 100644
+--- a/lib/roken/Makefile.am
++++ b/lib/roken/Makefile.am
+@@ -241,30 +241,27 @@ SUFFIXES += .hin
+ .hin.h:
+ 	cp $< $@
+ 
+-# Make make-roken deprecated in 1.4 when we know that roken-h-process.pl works
+-if !CROSS_COMPILE
+-
++# Replace make-roken with cf/roken-h-process.pl some day?
+ noinst_PROGRAMS += make-roken
+ BUILT_SOURCES += make-roken.c
+ 
+ nodist_make_roken_SOURCES = make-roken.c
+ 
+-roken.h: make-roken$(EXEEXT)
+-	@./make-roken$(EXEEXT) > tmp.h ;\
++roken.h: make-roken$(BUILD_EXEEXT)
++	./make-roken$(BUILD_EXEEXT) > tmp.h ;\
+ 	if [ -f roken.h ] && cmp -s tmp.h roken.h ; then rm -f tmp.h ; \
+ 	else rm -f roken.h; mv tmp.h roken.h; fi
+ 
+ make-roken.c: roken.h.in roken.awk
+ 	$(AWK) -f $(srcdir)/roken.awk $(srcdir)/roken.h.in > make-roken.c
+ 
+-else
+-
+-roken.h: $(top_srcdir)/cf/roken-h-process.pl roken.h.in
+-	perl $(top_srcdir)/cf/roken-h-process.pl \
+-	-c $(top_builddir)/include/config.h  \
+-	-p $(srcdir)/roken.h.in -o roken.h
++make-roken: make-roken.c
++	$(CC_FOR_BUILD) -o $@ -DHAVE_CONFIG_H -I$(top_builddir)/include $<
+ 
+-endif
++#roken.h: $(top_srcdir)/cf/roken-h-process.pl roken.h.in
++#	perl $(top_srcdir)/cf/roken-h-process.pl \
++#	-c $(top_builddir)/include/config.h  \
++#	-p $(srcdir)/roken.h.in -o roken.h
+ 
+ 
+ EXTRA_DIST = \
diff --git a/package/heimdal/0004-cf-remove-comm_err-header-check.patch b/package/heimdal/0004-cf-remove-comm_err-header-check.patch
new file mode 100644
index 0000000000..7b3cb009e1
--- /dev/null
+++ b/package/heimdal/0004-cf-remove-comm_err-header-check.patch
@@ -0,0 +1,51 @@
+From 5ac961ae663058bce2903a72428694cd13f72623 Mon Sep 17 00:00:00 2001
+From: Guillaume Chaye <guillaume.chaye@zeetim.com>
+Date: Fri, 24 Jan 2025 16:10:14 +0100
+Subject: [PATCH] cf: remove comm_err header check to cross-compile heimdal
+
+Currently, cf/check-compile-et.m4 is checking for a header file with hard coded path which make cross compilation unsafe.
+This commit allows to skip the test in the script.
+
+Signed-off-by: Guillaume Chaye <guillaume.chaye@zeetim.com>
+Upstream: https://github.com/heimdal/heimdal/pull/1278/commits/6bd61997056aa443e057f7663147876a8f44f5b5
+---
+ cf/check-compile-et.m4 | 9 ++-------
+ 1 file changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/cf/check-compile-et.m4 b/cf/check-compile-et.m4
+index e580cbb49..49870e575 100644
+--- a/cf/check-compile-et.m4
++++ b/cf/check-compile-et.m4
+@@ -22,11 +22,6 @@ error_code CODE2, "CODE2"
+ end
+ EOF
+ if ${COMPILE_ET} conftest_et.et >/dev/null 2>&1; then
+-  dnl XXX Some systems have <et/com_err.h>.
+-  save_CPPFLAGS="${CPPFLAGS}"
+-  if test -d "/usr/include/et"; then
+-    CPPFLAGS="-I/usr/include/et ${CPPFLAGS}"
+-  fi
+   dnl Check that the `prefix' and `index' directives were honored.
+   AC_LANG(C)
+   AC_RUN_IFELSE([AC_LANG_SOURCE([
+@@ -38,7 +33,7 @@ int main(int argc, char **argv){
+ #error compile_et does not handle error_table N M
+ #endif
+ return (CONFTEST_CODE2 - CONFTEST_CODE1) != 127;}
+-  ])], [krb_cv_compile_et="yes"],[CPPFLAGS="${save_CPPFLAGS}"],
++  ])], [krb_cv_compile_et="yes"],[CPPFLAGS="${CPPFLAGS}"],
+   [krb_cv_compile_et="yes" krb_cv_compile_et_cross=yes] )
+ fi
+ AC_MSG_RESULT(${krb_cv_compile_et})
+@@ -69,7 +64,7 @@ elif test "${krb_cv_compile_et}" = "yes"; then
+     p = error_message(0);
+     initialize_error_table_r(0,0,0,0);
+     com_right_r(0, 0, 0, 0);
+-  ]])],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${save_CPPFLAGS}"])
++  ]])],[krb_cv_com_err="yes"],[krb_cv_com_err="no"; CPPFLAGS="${CPPFLAGS}"])
+   AC_MSG_RESULT(${krb_cv_com_err})
+   LIBS="${krb_cv_save_LIBS}"
+ else
+-- 
+2.39.5
+
diff --git a/package/heimdal/0005-Fix-ar-warnings.patch b/package/heimdal/0005-Fix-ar-warnings.patch
new file mode 100644
index 0000000000..1d4336abb2
--- /dev/null
+++ b/package/heimdal/0005-Fix-ar-warnings.patch
@@ -0,0 +1,43 @@
+From 3b64e38690eabd6bd84dde189964a68b6770a76e Mon Sep 17 00:00:00 2001
+From: Guillaume Chaye <guillaume.chaye@zeetim.com>
+Date: Wed, 12 Feb 2025 11:04:56 -0500
+Subject: [PATCH] heimdal: Fix "ar: `u' modifier ignored since `D' is the
+ default (see `U')" warnings.
+
+Signed-off-by: Guillaume Chaye <guillaume.chaye@zeetim.com>
+Upstream: https://github.com/heimdal/heimdal/pull/1279/commits/a280439a8976061e956cfb2a49c41780ff29e26e
+---
+ Makefile.am  | 2 +-
+ configure.ac | 3 +++
+ 2 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile.am b/Makefile.am
+index b9bdcf499..970dc413b 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -13,7 +13,7 @@ if HEIMDAL_DOCUMENTATION
+ SUBDIRS+= doc
+ endif
+ 
+-
++ARFLAGS = cr
+ 
+ ## ACLOCAL = @ACLOCAL@ -I cf
+ ACLOCAL_AMFLAGS = -I cf
+diff --git a/configure.ac b/configure.ac
+index ef9010abf..276859edf 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -23,6 +23,9 @@ AM_PATH_PYTHON
+ AC_CHECK_PROG(CLANG_FORMAT, clang-format, [clang-format], [no])
+ test "$CLANG_FORMAT" = no && CLANG_FORMAT=true
+ 
++AR_FLAGS="cr"
++AC_SUBST(AR_FLAGS)
++
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+ 
+ AC_PREFIX_DEFAULT(/usr/heimdal)
+-- 
+2.39.5
+
diff --git a/package/heimdal/Config.in b/package/heimdal/Config.in
new file mode 100644
index 0000000000..2ce00be428
--- /dev/null
+++ b/package/heimdal/Config.in
@@ -0,0 +1,11 @@
+config BR2_PACKAGE_HEIMDAL
+	bool "heimdal"
+	select BR2_PACKAGE_NCURSES
+	select BR2_PACKAGE_LIBXCRYPT
+	help
+	  Heimdal is an implementation of:
+	  - ASN.1/DER
+	  - PKIX
+	  - Kerberos
+
+	  https://github.com/heimdal/heimdal.git
diff --git a/package/heimdal/heimdal.hash b/package/heimdal/heimdal.hash
index 250ddbbd4d..5575b52f86 100644
--- a/package/heimdal/heimdal.hash
+++ b/package/heimdal/heimdal.hash
@@ -1,3 +1,3 @@
 # Locally computed
-sha256  2576c5e2d793db53c86e108fd117b278437bb02d6c6db2bec4d1b86958f1980a  heimdal-f4faaeaba371fff3f8d1bc14389f5e6d70ca8e17.tar.gz
+sha256  aa679a6ad0349e266ec8a886b6be8085564f959183e948551a8e7d782ffaf623  heimdal-8c3c97bdf6c06200418f1a85aa22beaa441c6b23.tar.gz
 sha256  0c4b07bf5b98f7a1d01f8e60722d6c6747ef052c2aa6d2043daf690d4e1b0a7f  LICENSE
diff --git a/package/heimdal/heimdal.mk b/package/heimdal/heimdal.mk
index f6c52f63aa..adf3651a3a 100644
--- a/package/heimdal/heimdal.mk
+++ b/package/heimdal/heimdal.mk
@@ -4,15 +4,20 @@
 #
 ################################################################################
 
-HEIMDAL_VERSION = f4faaeaba371fff3f8d1bc14389f5e6d70ca8e17
+HEIMDAL_VERSION = 8c3c97bdf6c06200418f1a85aa22beaa441c6b23
 HEIMDAL_SITE = $(call github,heimdal,heimdal,$(HEIMDAL_VERSION))
-HOST_HEIMDAL_DEPENDENCIES = host-e2fsprogs host-ncurses host-pkgconf host-libxcrypt host-flex host-bison
-HOST_HEIMDAL_AUTORECONF = YES
+HEIMDAL_DEPENDENCIES=  ncurses libxcrypt host-heimdal
+HOST_HEIMDAL_DEPENDENCIES = host-ncurses host-pkgconf host-libxcrypt host-flex host-bison
+HEIMDAL_AUTORECONF= YES
 HEIMDAL_INSTALL_STAGING = YES
-# static because of -fPIC issues with e2fsprogs on x86_64 host
+HEIMDAL_LICENSE = BSD-3-Clause
+HEIMDAL_LICENSE_FILES = LICENSE
+HEIMDAL_CPE_ID_VALID = YES
+
+HEIMDAL_CONF_ENV = MAKEINFO=true
+HOST_HEIMDAL_CONF_ENV = $(HEIMDAL_CONF_ENV) ac_cv_prog_COMPILE_ET=no
+
 HOST_HEIMDAL_CONF_OPTS = \
-	--disable-shared \
-	--enable-static \
 	--without-openldap \
 	--without-capng \
 	--with-db-type-preference= \
@@ -28,19 +33,19 @@ HOST_HEIMDAL_CONF_OPTS = \
 	--disable-ndbm-db \
 	--disable-heimdal-documentation
 
-# Don't use compile_et from e2fsprogs as it raises a build failure with samba4
-HOST_HEIMDAL_CONF_ENV = ac_cv_prog_COMPILE_ET=no MAKEINFO=true LIBS=-lcrypt
-HEIMDAL_LICENSE = BSD-3-Clause
-HEIMDAL_LICENSE_FILES = LICENSE
-HEIMDAL_CPE_ID_VALID = YES
-
-# We need compile_et for samba4
-define HOST_HEIMDAL_INSTALL_COMPILE_ET
-	$(INSTALL) -m 0755 $(@D)/lib/com_err/compile_et \
-		$(HOST_DIR)/bin/compile_et
+# We need compile_et for samba4 and slc for target version of heimdal
+# By default compile_et is not installed so we install it to bin
+# By default slc is installed in libexec directory so we just link it
+define HOST_HEIMDAL_INSTALL_BINARIES
+	$(INSTALL) -m 0755 $(@D)/lib/com_err/compile_et $(HOST_DIR)/bin/compile_et
+	ln -sf $(HOST_DIR)/libexec/heimdal/slc $(HOST_DIR)/bin/slc
 endef
 
-HOST_HEIMDAL_POST_INSTALL_HOOKS += \
-	HOST_HEIMDAL_INSTALL_COMPILE_ET
+HOST_HEIMDAL_POST_INSTALL_HOOKS += HOST_HEIMDAL_INSTALL_BINARIES
+
+HEIMDAL_CONF_OPTS=$(HOST_HEIMDAL_CONF_OPTS) \
+	--host=$(GNU_TARGET_NAME) \
+	--with-cross-tools="$(HOST_DIR)/bin"
 
+$(eval $(autotools-package))
 $(eval $(host-autotools-package))
-- 
2.39.5

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCHv4 1/1] package/heimdal: upgrade package and add target support
  2025-04-28 15:40 [Buildroot] [PATCHv4 1/1] package/heimdal: upgrade package and add target support Guillaume Chaye
@ 2025-05-18 16:47 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-05-18 16:47 UTC (permalink / raw)
  To: Guillaume Chaye; +Cc: buildroot

Hello Guillaume,

On Mon, 28 Apr 2025 11:40:55 -0400
Guillaume Chaye <guillaume.chaye@zeetim.com> wrote:

> This patch does several things, so I will try to explain clearly what has been modified.
> 
> First, it bumps Heimdal to the latest commit (16/04/2025).
> The current version was more than 3 years old and had known CVEs (see CVE-2023-36328).
> This upgrade allows the removal of the two patches currently applied:
> - The commit 1b57b62, which fixes the build with autoconf 2.72, is already included upstream.
> - We no longer need to use the JSON-PP module, as it is now optional (commit 13d3bcf).
> 
> Heimdal was previously a host-only package. This patch adds target support.
> This requires cross-compiling the project, which was not possible without additional patches.
> After some research, I found this pull request (https://github.com/heimdal/heimdal/pull/1174)
> created by a well-known Heimdal contributor (Nico Williams).
> This pull request contains 29 commits, which is quite large, so I have tried to keep things simple
> by selecting only the minimal set of changes required for cross-compilation.
> 
> After extensive testing, I have successfully built the target version of Heimdal by applying 3 commits
> picked from the pull request:
> - The first one adds the AX_PROG_CC_FOR_BUILD macro to the project.
>   This macro, from the GNU project (https://www.gnu.org/software/autoconf-archive/ax_prog_cc_for_build.html),
>   allows detecting a C compiler that produces native executables.
> - The second commit integrates the AX_PROG_CC_FOR_BUILD macro into Heimdal's autoconf scripts,
>   enabling proper compiler selection during the build.
> - Finally, a patch was needed to fix header errors when cross-compiling libroken.
> 
> Additionally, I have added two patches I wrote and submitted upstream:
> - The first removes a hardcoded path from a script.
> - The second fixes an error generated by the 'ar' utility during the build process.
> 
> Finally, since the latest version of Heimdal no longer depends on e2fsprogs,
> the host-e2fsprogs dependency has been removed.
> 
> Signed-off-by: Guillaume Chaye <guillaume.chaye@zeetim.com>

Thanks for this new iteration. There is still too much in there, mixing
the bump and the addition of the target package.

Since the version bump made sense on its own, I extracted just this
aspect from your patch, and merged it:

  https://gitlab.com/buildroot.org/buildroot/-/commit/573ecbd44cd16b2ca4ce71b40459bcecf8c8e98c

For the rest, could you please:

- Provide a new patch with a commit message that's wrapped at 80
  columns and doesn't use first person sentence like "I have..."

- Justify why heimdal for the target is useful, i.e what will use it.

- Double check that the AX_PROG_CC_FOR_BUILD function in
  autoconf-archive really doesn't work? This would allow to avoid
  having another copy of it.

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-18 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-28 15:40 [Buildroot] [PATCHv4 1/1] package/heimdal: upgrade package and add target support Guillaume Chaye
2025-05-18 16:47 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox