> Date: Sat, 22 Apr 2023 12:40:35 +0200
> From: Antoine Jacoutot <[email protected]>
> 
> On Thu, Apr 20, 2023 at 10:26:24PM +0200, Mark Kettenis wrote:
> > So libnettle is interesting.  I already has support for the x86
> > variant.  This is done through defining some variables based on
> > autoconf checks.  We can add similar checks and defines for arm64.
> > Maybe the names of the defines don't make sense, but that is something
> > to discuss with upstream I guess?
> > 
> > This diff modifies both configure.ac and configure.  In fact the
> > configure patch is generated by just running the right version of
> > autoconf.  However, this leads to errors in the "fake" install phase
> > because it tries to run autoheader.  I worked around this by dropping
> > the configure.ac patch.  But you folks probably know better what to do
> > here.
> > 
> > Would be nice if one of you could take it from here.
> 
> This packages fine for me on amd64.

And on arm64 as well.

Thanks!

ok kettenis@

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/security/libnettle/Makefile,v
> retrieving revision 1.39
> diff -u -p -r1.39 Makefile
> --- Makefile  19 Jan 2023 12:23:58 -0000      1.39
> +++ Makefile  22 Apr 2023 10:39:44 -0000
> @@ -2,7 +2,7 @@ COMMENT=              cryptographic library
>  
>  DISTNAME=            nettle-3.8.1
>  PKGNAME=             lib${DISTNAME}
> -REVISION=            1
> +REVISION=            2
>  
>  SHARED_LIBS +=  hogweed                   3.0 # 6.3
>  SHARED_LIBS +=  nettle                    7.1 # 8.3
> @@ -24,7 +24,10 @@ LIB_DEPENDS=               devel/gmp
>  
>  USE_GMAKE=           Yes
>  
> -CONFIGURE_STYLE=     gnu
> +AUTOCONF_VERSION=    2.69
> +AUTOMAKE_VERSION=    1.16
> +
> +CONFIGURE_STYLE=     autoconf
>  CONFIGURE_ENV=               CPPFLAGS="-I${LOCALBASE}/include" \
>                       LDFLAGS="-L${LOCALBASE}/lib"
>  
> Index: patches/patch-configure_ac
> ===================================================================
> RCS file: patches/patch-configure_ac
> diff -N patches/patch-configure_ac
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-configure_ac        22 Apr 2023 10:39:44 -0000
> @@ -0,0 +1,58 @@
> +Index: configure.ac
> +--- configure.ac.orig
> ++++ configure.ac
> +@@ -1047,6 +1047,54 @@ if test "$nettle_cv_asm_x86_gnu_property" = yes; then
> +     .popsection'
> + fi
> + 
> ++dnl  Define
> ++dnl  1. ASM_X86_ENDBR for bti.
> ++dnl  2. ASM_X86_MARK_CET to add a .note.gnu.property section to mark
> ++dnl  Arm BTI support if needed.
> ++AC_CACHE_CHECK([if Arm BTI is enabled],
> ++  [nettle_cv_asm_arm_bti],
> ++  [AC_TRY_COMPILE([
> ++#ifndef __ARM_FEATURE_BTI_DEFAULT
> ++#error Arm BTI is not enabled
> ++#endif
> ++  ], [],
> ++  [nettle_cv_asm_arm_bti=yes],
> ++  [nettle_cv_asm_arm_bti=no])])
> ++if test "$nettle_cv_asm_arm_bti" = yes; then
> ++  ASM_X86_ENDBR="bti c"
> ++  AC_CACHE_CHECK([if .note.gnu.property section is needed],
> ++    [nettle_cv_asm_arm_gnu_property],
> ++    [AC_TRY_COMPILE([
> ++#if !defined __ELF__ || !defined __ARM_FEATURE_BTI_DEFAULT
> ++#error GNU property is not needed
> ++#endif
> ++    ], [],
> ++    [nettle_cv_asm_arm_gnu_property=yes],
> ++    [nettle_cv_asm_arm_gnu_property=no])])
> ++else
> ++  nettle_cv_asm_arm_gnu_property=no
> ++fi
> ++if test "$nettle_cv_asm_arm_gnu_property" = yes; then
> ++  ASM_X86_MARK_CET='
> ++    .pushsection ".note.gnu.property", "a"
> ++    .p2align 3
> ++    .long 1f - 0f
> ++    .long 4f - 1f
> ++    .long 5
> ++0:
> ++    .asciz "GNU"
> ++1:
> ++    .p2align 3
> ++    .long 0xc0000000
> ++    .long 3f - 2f
> ++2:
> ++    .long 1
> ++3:
> ++    .p2align 3
> ++4:
> ++    .popsection'
> ++fi
> ++
> + AC_SUBST(ASM_SYMBOL_PREFIX)
> + AC_SUBST(ASM_ELF_STYLE)
> + AC_SUBST(ASM_COFF_STYLE)
> 
> 
> 

Reply via email to