On Thu, Aug 15 2019, Charlene Wendling <juliana...@posteo.jp> wrote:
> Hi,
>
> That newer version of flac makes use of getauxval(3) on powerpc, that
> apparently we don't implement, so the builds fails while not finding
> sys/auxv.h.

Bleh, this implements just the right amount of autoconf tests so that it
*looks* portable.

To be truly portable tests for sys/auxv.h and getauxval should be added
and used properly.

> The below diff allows to build flac on macppc, where tests are passing
> [1]. I've not bumped revision, the change impacts powerpc where it has
> never been built.

Good enough for ports, ok jca@

If we want this fixed upstream, someone (tm) should write better tests.
naddy, cwen, are you interested, or shall I give it a try?

> Comments/feedback are welcome,
>
> Charlène. 
>
>
> [0] http://man7.org/linux/man-pages/man3/getauxval.3.html
> [1] https://bin.charlenew.xyz/flac.log
>
>
> Index: patches/patch-src_libFLAC_cpu_c
> ===================================================================
> RCS file: patches/patch-src_libFLAC_cpu_c
> diff -N patches/patch-src_libFLAC_cpu_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_libFLAC_cpu_c   15 Aug 2019 09:43:18 -0000
> @@ -0,0 +1,43 @@
> +$OpenBSD$
> +
> +Remove getauxval(3) code for ppc because we don't implement this
> +
> +Index: src/libFLAC/cpu.c
> +--- src/libFLAC/cpu.c.orig
> ++++ src/libFLAC/cpu.c
> +@@ -53,10 +53,6 @@
> + #define dfprintf(file, format, ...)
> + #endif
> + 
> +-#if defined FLAC__CPU_PPC
> +-#include <sys/auxv.h>
> +-#endif
> +-
> + #if (defined FLAC__CPU_IA32 || defined FLAC__CPU_X86_64) && (defined 
> FLAC__HAS_NASM || FLAC__HAS_X86INTRIN) && !defined FLAC__NO_ASM
> + 
> + /* these are flags in EDX of CPUID AX=00000001 */
> +@@ -236,24 +232,8 @@ x86_cpu_info (FLAC__CPUInfo *info)
> + static void
> + ppc_cpu_info (FLAC__CPUInfo *info)
> + {
> +-#if defined FLAC__CPU_PPC
> +-#ifndef PPC_FEATURE2_ARCH_3_00
> +-#define PPC_FEATURE2_ARCH_3_00              0x00800000
> +-#endif
> +-
> +-#ifndef PPC_FEATURE2_ARCH_2_07
> +-#define PPC_FEATURE2_ARCH_2_07              0x80000000
> +-#endif
> +-
> +-    if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_3_00) {
> +-            info->ppc.arch_3_00 = true;
> +-    } else if (getauxval(AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) {
> +-            info->ppc.arch_2_07 = true;
> +-    }
> +-#else
> +     info->ppc.arch_2_07 = false;
> +     info->ppc.arch_3_00 = false;
> +-#endif
> + }
> + 
> + void FLAC__cpu_info (FLAC__CPUInfo *info)
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to