-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
81 lines (63 loc) · 3.47 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from conan import ConanFile
from conan.tools.files import copy
from os.path import join
class DuktapeConan(ConanFile):
name = "duktape"
version = "2.7.0-2"
license = "MIT"
author = "Sami Vaarala <[email protected]>"
url = "https://duktape.org"
description = "Duktape is an embeddable Javascript engine, with a focus on portability and compact footprint."
topics = ("javascript", "engine", "embeddable", "compact")
options = {
"with_debugger": [False, True],
"fatal_handler": [None,"ANY"],
"manual_gc": [False, True],
"use_exception": [False, True],
}
default_options = {
"with_debugger": False,
"fatal_handler": None,
"manual_gc": False,
"use_exception" : False,
}
def source(self):
duktape_version = self.version.split('-')[0]
self.run("git clone https://github.com/svaarala/duktape-releases.git")
self.run("cd duktape-releases && git checkout v%s" % duktape_version)
copy(self, "tools/*", self.export_sources_folder, join(self.export_sources_folder, "duktape-releases/"))
copy(self, "custom_config/*", self.export_sources_folder, join(self.export_sources_folder, "duktape-releases/config/helper-snippets/"), keep_path=False)
def export_sources(self):
copy(self, "tools/*", self.recipe_folder, self.export_sources_folder)
copy(self, "custom_config/*", self.recipe_folder, self.export_sources_folder)
def package(self):
configuration_string = ""
if self.options.with_debugger:
configuration_string = configuration_string + (
"-DDUK_USE_DEBUGGER_SUPPORT -DDUK_USE_INTERRUPT_COUNTER " +
"-DDUK_USE_DEBUGGER_DUMPHEAP -DDUK_USE_DEBUGGER_FWD_LOGGING " +
"-DDUK_USE_DEBUGGER_FWD_PRINTALERT -DDUK_USE_DEBUGGER_INSPECT " +
"-DDUK_USE_DEBUGGER_PAUSE_UNCAUGHT -DDUK_USE_DEBUGGER_THROW_NOTIFY ")
if self.options.get_safe("fatal_handler"):
configuration_string = configuration_string + " -DDUK_USE_FATAL_HANDLER=" + str(self.options.fatal_handler)
if self.options.manual_gc:
configuration_string = configuration_string + (
"-DDUK_USE_MARK_AND_SWEEP "
"-DDUK_USE_REFERENCE_COUNTING "
"-UDUK_USE_VOLUNTARY_GC " )
if self.options.use_exception:
configuration_string = configuration_string + "-DDUK_USE_CPP_EXCEPTIONS "
self.run("python3 -Xutf8 duktape-releases/tools/configure.py --output-directory generated/ "
+ " --source-directory duktape-releases/src-input --config-metadata duktape-releases/config "
+ configuration_string)
copy(self, "*.h", join(self.source_folder, "generated"), join(self.package_folder, "include"))
copy(self, "*.c", join(self.source_folder, "generated"), join(self.package_folder, "src"))
copy(self, "*.json", join(self.source_folder, "generated"), join(self.package_folder, "src"))
if self.options.with_debugger:
copy(self, "*.h", join(self.source_folder, "duktape-releases/examples/debug-trans-socket/"), join(self.package_folder, "include"))
copy(self, "*.c", join(self.source_folder, "duktape-releases/examples/debug-trans-socket/"), join(self.package_folder, "src"))
def package_id(self):
self.info.settings.clear()
def package_info(self):
self.cpp_info.includedirs = ['include']
self.cpp_info.srcdirs = ['src']