$OpenBSD: patch-mesonbuild_environment_py,v 1.7 2019/04/02 12:57:23 ajacoutot Exp $

From 663517d23376809fd6bc0b69549ee823a06682d7 Mon Sep 17 00:00:00 2001
From: Janne Grunau <j@jannau.net>
Date: Mon, 1 Apr 2019 21:22:32 +0200
Subject: [PATCH] detect 'arm64' as aarch64 CPU family

From 7bc04996c0d98797be1516643b833f2206e61151 Mon Sep 17 00:00:00 2001
From: Antoine Jacoutot <ajacoutot@openbsd.org>
Date: Mon, 11 Mar 2019 10:26:14 +0100
Subject: [PATCH] environment: support OpenBSD in detect_objc_compiler

Index: mesonbuild/environment.py
--- mesonbuild/environment.py.orig
+++ mesonbuild/environment.py
@@ -204,6 +204,9 @@ def detect_cpu_family(compilers):
         trial = platform.machine().lower()
     if trial.startswith('i') and trial.endswith('86'):
         trial = 'x86'
+    # OpenBSD's 64 bit arm architecute identifies as 'arm64'
+    elif trial == 'arm64':
+        trial = 'aarch64'
     elif trial.startswith('arm'):
         trial = 'arm'
     elif trial.startswith('ppc64'):
@@ -888,7 +891,7 @@ class Environment:
                 return GnuObjCCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines)
             if out.startswith('Apple LLVM'):
                 return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap)
-            if out.startswith('clang'):
+            if out.startswith(('clang', 'OpenBSD clang')):
                 return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap)
         self._handle_exceptions(popen_exceptions, compilers)
 
@@ -915,7 +918,7 @@ class Environment:
                 return GnuObjCPPCompiler(ccache + compiler, version, compiler_type, is_cross, exe_wrap, defines)
             if out.startswith('Apple LLVM'):
                 return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, is_cross, exe_wrap)
-            if out.startswith('clang'):
+            if out.startswith(('clang', 'OpenBSD clang')):
                 return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_STANDARD, is_cross, exe_wrap)
         self._handle_exceptions(popen_exceptions, compilers)
 
