Blame 0002-Changes-to-meson-project-files.patch

afb4207
From b3a1fa7b884ea8f1ba63a55237c8c773050a185e Mon Sep 17 00:00:00 2001
afb4207
From: angelcode <angelcode@404ce1b2-830e-0410-a2e2-b09542c77caf>
afb4207
Date: Mon, 21 Nov 2016 23:28:50 +0000
afb4207
Subject: [PATCH 2/3] Changes to meson project files
afb4207
afb4207
git-svn-id: http://svn.code.sf.net/p/angelscript/code/trunk@2361 404ce1b2-830e-0410-a2e2-b09542c77caf
afb4207
(cherry picked from commit 602584f835ef007463bb7d798cf4baeee4d37f2b)
afb4207
---
afb4207
 sdk/angelscript/projects/meson/detect_ver.py | 31 ++++++++++++++++++++++----
afb4207
 sdk/angelscript/projects/meson/meson.build   | 33 ++++++++++++++++++----------
afb4207
 2 files changed, 48 insertions(+), 16 deletions(-)
afb4207
afb4207
diff --git a/sdk/angelscript/projects/meson/detect_ver.py b/sdk/angelscript/projects/meson/detect_ver.py
afb4207
index d7ae8a5..2e05ddf 100644
afb4207
--- a/sdk/angelscript/projects/meson/detect_ver.py
afb4207
+++ b/sdk/angelscript/projects/meson/detect_ver.py
afb4207
@@ -1,5 +1,28 @@
afb4207
+import argparse
afb4207
+import os
afb4207
 import re
afb4207
-with open('../../include/angelscript.h') as f:
afb4207
-    for l in f.readlines():
afb4207
-        if l.startswith('#define ANGELSCRIPT_VERSION_STRING'):
afb4207
-            print(re.search('[\d]+\.[\d]+\.[\d]+', l).group(0))
afb4207
+
afb4207
+HEADER = os.path.join(os.path.dirname(os.path.abspath(__file__)),
afb4207
+                      "..", "..", "include", "angelscript.h")
afb4207
+
afb4207
+def main():
afb4207
+    parser = argparse.ArgumentParser()
afb4207
+    parser.add_argument("--num", action="store_true", help="Print numeric version")
afb4207
+    args = parser.parse_args()
afb4207
+
afb4207
+    if args.num:
afb4207
+        regex = re.compile(r'^#define ANGELSCRIPT_VERSION\s+(\d+)')
afb4207
+    else:
afb4207
+        regex = re.compile(r'^#define ANGELSCRIPT_VERSION_STRING\s+"(\d+\.\d+\.\d+.*)"')
afb4207
+
afb4207
+    with open(HEADER, "r") as fobj:
afb4207
+        for l in fobj:
afb4207
+            match = re.match(regex, l)
afb4207
+            if match is not None:
afb4207
+                print(match.group(1))
afb4207
+                return
afb4207
+
afb4207
+    assert False, "Can't find version"
afb4207
+
afb4207
+if __name__ == "__main__":
afb4207
+    main()
afb4207
\ No newline at end of file
afb4207
diff --git a/sdk/angelscript/projects/meson/meson.build b/sdk/angelscript/projects/meson/meson.build
afb4207
index 891e8c2..9dea003 100644
afb4207
--- a/sdk/angelscript/projects/meson/meson.build
afb4207
+++ b/sdk/angelscript/projects/meson/meson.build
afb4207
@@ -1,14 +1,15 @@
afb4207
-project('angelscript', 'cpp', 'c')
afb4207
+project('angelscript', 'cpp',
afb4207
+        version : run_command(find_program('python3'), 'detect_ver.py').stdout().strip(),
afb4207
+        meson_version : '>=0.28.0',
afb4207
+        license : 'zlib')
afb4207
 
afb4207
-arch = run_command('uname', '-p').stdout().strip()
afb4207
-version = run_command(find_program('python3'), 'detect_ver.py').stdout().strip()
afb4207
+threads = dependency('threads')
afb4207
 
afb4207
-srcs = [
afb4207
+angel_srcs = [
afb4207
   '../../source/as_atomic.cpp',
afb4207
   '../../source/as_builder.cpp',
afb4207
   '../../source/as_bytecode.cpp',
afb4207
   '../../source/as_callfunc.cpp',
afb4207
-  '../../source/as_callfunc_arm.cpp',
afb4207
   '../../source/as_callfunc_mips.cpp',
afb4207
   '../../source/as_callfunc_ppc.cpp',
afb4207
   '../../source/as_callfunc_ppc_64.cpp',
afb4207
@@ -41,19 +42,27 @@ srcs = [
afb4207
   '../../source/as_typeinfo.cpp',
afb4207
   '../../source/as_variablescope.cpp',
afb4207
 ]
afb4207
-if arch == 'armv7l'
afb4207
-  srcs = srcs + [
afb4207
+if host_machine.cpu_family() == 'arm'
afb4207
+  add_languages('c')
afb4207
+  angel_srcs += [
afb4207
     '../../source/as_callfunc_arm.cpp',
afb4207
-    '../../source/as_callfunc_arm_gcc.S'
afb4207
+    '../../source/as_callfunc_arm_gcc.S',
afb4207
   ]
afb4207
 endif
afb4207
 
afb4207
-shared_library(
afb4207
+angelscript_version_num = run_command(find_program('python3'), 'detect_ver.py', '--num').stdout().strip()
afb4207
+angelscript_lib = library(
afb4207
   'angelscript',
afb4207
-  sources : srcs,
afb4207
+  sources : angel_srcs,
afb4207
+  dependencies : threads,
afb4207
+  version : angelscript_version_num,
afb4207
   install : true,
afb4207
-  soversion : '0',
afb4207
-  version : version,
afb4207
+)
afb4207
+angelscript_inc = include_directories('../../include')
afb4207
+angelscript_dep  = declare_dependency(
afb4207
+  link_with : angelscript_lib,
afb4207
+  include_directories : angelscript_inc,
afb4207
+  version : meson.project_version(),
afb4207
 )
afb4207
 
afb4207
 install_headers('../../include/angelscript.h')
afb4207
-- 
afb4207
2.10.2
afb4207