$OpenBSD: patch-SConstruct,v 1.1.1.1 2021/10/19 03:54:58 kevlo Exp $

Index: SConstruct
--- SConstruct.orig
+++ SConstruct
@@ -48,7 +48,7 @@ vars.AddVariables(
                   allowed_values=("armv7a", "armv7a-hf", "arm64-v8a", "arm64-v8.2-a", "arm64-v8.2-a-sve", "arm64-v8.2-a-sve2", "x86_32", "x86_64",
                                   "armv8a", "armv8.2-a", "armv8.2-a-sve", "armv8.6-a", "armv8.6-a-sve", "armv8.6-a-sve2", "armv8r64", "x86")),
     EnumVariable("estate", "Execution State", "auto", allowed_values=("auto", "32", "64")),
-    EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "tizen", "macos", "bare_metal")),
+    EnumVariable("os", "Target OS", "linux", allowed_values=("linux", "android", "tizen", "macos", "bare_metal", "openbsd")),
     EnumVariable("build", "Build type", "cross_compile", allowed_values=("native", "cross_compile", "embed_only")),
     BoolVariable("examples", "Build example programs", True),
     BoolVariable("gemm_tuner", "Build gemm_tuner programs", True),
@@ -167,17 +167,8 @@ c_compiler = os.environ.get('CC', default_c_compiler)
 if env['os'] == 'android' and ( 'clang++' not in cpp_compiler or 'clang' not in c_compiler ):
     print( "WARNING: Only clang is officially supported to build the Compute Library for Android")
 
-if 'clang++' in cpp_compiler:
-    env.Append(CXXFLAGS = ['-Wno-vla-extension'])
-elif 'armclang' in cpp_compiler:
-    pass
-else:
-    env.Append(CXXFLAGS = ['-Wlogical-op','-Wnoexcept','-Wstrict-null-sentinel'])
+env.Append(CXXFLAGS = ['-Wno-vla-extension'])
 
-if cpp_compiler == 'g++':
-    # Don't strip comments that could include markers
-    env.Append(CXXFLAGS = ['-C'])
-
 if env['cppthreads']:
     env.Append(CPPDEFINES = [('ARM_COMPUTE_CPP_SCHEDULER', 1)])
 
@@ -289,25 +280,6 @@ if not GetOption("help"):
         print("ERROR: Compiler '%s' not found" % env['CXX'])
         Exit(1)
 
-    if 'armclang' in cpp_compiler:
-        pass
-    elif 'clang++' not in cpp_compiler:
-        if env['arch'] == 'arm64-v8.2-a' and not version_at_least(compiler_ver, '6.2.1'):
-            print("GCC 6.2.1 or newer is required to compile armv8.2-a code")
-            Exit(1)
-        elif env['arch'] == 'arm64-v8a' and not version_at_least(compiler_ver, '4.9'):
-            print("GCC 4.9 or newer is required to compile Arm® Neon™ code for AArch64")
-            Exit(1)
-
-        if version_at_least(compiler_ver, '6.1'):
-            env.Append(CXXFLAGS = ['-Wno-ignored-attributes'])
-
-        if compiler_ver == '4.8.3':
-            env.Append(CXXFLAGS = ['-Wno-array-bounds'])
-
-        if not version_at_least(compiler_ver, '7.0.0') and env['os'] == 'bare_metal':
-            env.Append(LINKFLAGS = ['-fstack-protector-strong'])
-
 if env['fat_binary']:
     if env['arch'] != 'armv8.2-a':
         print("Currently fat binary is only supported with armv8.2-a")
@@ -371,6 +343,9 @@ if env['opencl']:
 
 if env["os"] not in ["android", "bare_metal"] and (env['opencl'] or env['cppthreads']):
     env.Append(LIBS = ['pthread'])
+
+if env['os'] == 'openbsd':
+    env.Append(LIBS = ['c'])
 
 if env['opencl']:
     if env['embed_kernels']:
