mono_configure.py 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. import os
  2. import os.path
  3. import sys
  4. import subprocess
  5. from SCons.Script import Dir, Environment
  6. if os.name == "nt":
  7. from . import mono_reg_utils as monoreg
  8. android_arch_dirs = {"armv7": "armeabi-v7a", "arm64v8": "arm64-v8a", "x86": "x86", "x86_64": "x86_64"}
  9. def get_android_out_dir(env):
  10. return os.path.join(
  11. Dir("#platform/android/java/lib/libs").abspath,
  12. "release" if env["target"] == "release" else "debug",
  13. android_arch_dirs[env["android_arch"]],
  14. )
  15. def find_name_in_dir_files(directory, names, prefixes=[""], extensions=[""]):
  16. for extension in extensions:
  17. if extension and not extension.startswith("."):
  18. extension = "." + extension
  19. for prefix in prefixes:
  20. for curname in names:
  21. if os.path.isfile(os.path.join(directory, prefix + curname + extension)):
  22. return curname
  23. return ""
  24. def find_file_in_dir(directory, names, prefixes=[""], extensions=[""]):
  25. for extension in extensions:
  26. if extension and not extension.startswith("."):
  27. extension = "." + extension
  28. for prefix in prefixes:
  29. for curname in names:
  30. filename = prefix + curname + extension
  31. if os.path.isfile(os.path.join(directory, filename)):
  32. return filename
  33. return ""
  34. def copy_file(src_dir, dst_dir, src_name, dst_name=""):
  35. from shutil import copy
  36. src_path = os.path.join(Dir(src_dir).abspath, src_name)
  37. dst_dir = Dir(dst_dir).abspath
  38. if not os.path.isdir(dst_dir):
  39. os.makedirs(dst_dir)
  40. if dst_name:
  41. copy(src_path, os.path.join(dst_dir, dst_name))
  42. else:
  43. copy(src_path, dst_dir)
  44. def is_desktop(platform):
  45. return platform in ["windows", "osx", "x11", "server", "uwp", "haiku"]
  46. def is_unix_like(platform):
  47. return platform in ["osx", "x11", "server", "android", "haiku", "iphone"]
  48. def module_supports_tools_on(platform):
  49. return platform not in ["android", "javascript", "iphone"]
  50. def find_wasm_src_dir(mono_root):
  51. hint_dirs = [
  52. os.path.join(mono_root, "src"),
  53. os.path.join(mono_root, "../src"),
  54. ]
  55. for hint_dir in hint_dirs:
  56. if os.path.isfile(os.path.join(hint_dir, "driver.c")):
  57. return hint_dir
  58. return ""
  59. def configure(env, env_mono):
  60. bits = env["bits"]
  61. is_android = env["platform"] == "android"
  62. is_javascript = env["platform"] == "javascript"
  63. is_ios = env["platform"] == "iphone"
  64. is_ios_sim = is_ios and env["ios_simulator"]
  65. tools_enabled = env["tools"]
  66. mono_static = env["mono_static"]
  67. copy_mono_root = env["copy_mono_root"]
  68. mono_prefix = env["mono_prefix"]
  69. mono_bcl = env["mono_bcl"]
  70. mono_lib_names = ["mono-2.0-sgen", "monosgen-2.0"]
  71. if is_android and not env["android_arch"] in android_arch_dirs:
  72. raise RuntimeError("This module does not support the specified 'android_arch': " + env["android_arch"])
  73. if tools_enabled and not module_supports_tools_on(env["platform"]):
  74. # TODO:
  75. # Android: We have to add the data directory to the apk, concretely the Api and Tools folders.
  76. raise RuntimeError("This module does not currently support building for this platform with tools enabled")
  77. if is_android and mono_static:
  78. # FIXME: When static linking and doing something that requires libmono-native, we get a dlopen error as 'libmono-native'
  79. # seems to depend on 'libmonosgen-2.0'. Could be fixed by re-directing to '__Internal' with a dllmap or in the dlopen hook.
  80. raise RuntimeError("Statically linking Mono is not currently supported for this platform")
  81. if not mono_static and (is_javascript or is_ios):
  82. raise RuntimeError("Dynamically linking Mono is not currently supported for this platform")
  83. if not mono_prefix and (os.getenv("MONO32_PREFIX") or os.getenv("MONO64_PREFIX")):
  84. print(
  85. "WARNING: The environment variables 'MONO32_PREFIX' and 'MONO64_PREFIX' are deprecated; use the 'mono_prefix' SCons parameter instead"
  86. )
  87. # Although we don't support building with tools for any platform where we currently use static AOT,
  88. # if these are supported in the future, we won't be using static AOT for them as that would be
  89. # too restrictive for the editor. These builds would probably be made to only use the interpreter.
  90. mono_aot_static = (is_ios and not is_ios_sim) and not env["tools"]
  91. # Static AOT is only supported on the root domain
  92. mono_single_appdomain = mono_aot_static
  93. if mono_single_appdomain:
  94. env_mono.Append(CPPDEFINES=["GD_MONO_SINGLE_APPDOMAIN"])
  95. if (env["tools"] or env["target"] != "release") and not mono_single_appdomain:
  96. env_mono.Append(CPPDEFINES=["GD_MONO_HOT_RELOAD"])
  97. if env["platform"] == "windows":
  98. mono_root = mono_prefix
  99. if not mono_root and os.name == "nt":
  100. mono_root = monoreg.find_mono_root_dir(bits)
  101. if not mono_root:
  102. raise RuntimeError(
  103. "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"
  104. )
  105. print("Found Mono root directory: " + mono_root)
  106. mono_lib_path = os.path.join(mono_root, "lib")
  107. env.Append(LIBPATH=mono_lib_path)
  108. env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))
  109. lib_suffixes = [".lib"]
  110. if not env.msvc:
  111. # MingW supports both '.a' and '.lib'
  112. lib_suffixes.insert(0, ".a")
  113. if mono_static:
  114. if env.msvc:
  115. mono_static_lib_name = "libmono-static-sgen"
  116. else:
  117. mono_static_lib_name = "libmonosgen-2.0"
  118. mono_static_lib_file = find_file_in_dir(mono_lib_path, [mono_static_lib_name], extensions=lib_suffixes)
  119. if not mono_static_lib_file:
  120. raise RuntimeError("Could not find static mono library in: " + mono_lib_path)
  121. if env.msvc:
  122. env.Append(LINKFLAGS=mono_static_lib_file)
  123. env.Append(LINKFLAGS="Mincore.lib")
  124. env.Append(LINKFLAGS="msvcrt.lib")
  125. env.Append(LINKFLAGS="LIBCMT.lib")
  126. env.Append(LINKFLAGS="Psapi.lib")
  127. else:
  128. mono_static_lib_file_path = os.path.join(mono_lib_path, mono_static_lib_file)
  129. env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_static_lib_file_path, "-Wl,-no-whole-archive"])
  130. env.Append(LIBS=["psapi"])
  131. env.Append(LIBS=["version"])
  132. else:
  133. mono_lib_name = find_name_in_dir_files(
  134. mono_lib_path, mono_lib_names, prefixes=["", "lib"], extensions=lib_suffixes
  135. )
  136. if not mono_lib_name:
  137. raise RuntimeError("Could not find mono library in: " + mono_lib_path)
  138. if env.msvc:
  139. env.Append(LINKFLAGS=mono_lib_name + ".lib")
  140. else:
  141. env.Append(LIBS=[mono_lib_name])
  142. mono_bin_path = os.path.join(mono_root, "bin")
  143. mono_dll_file = find_file_in_dir(mono_bin_path, mono_lib_names, prefixes=["", "lib"], extensions=[".dll"])
  144. if not mono_dll_file:
  145. raise RuntimeError("Could not find mono shared library in: " + mono_bin_path)
  146. copy_file(mono_bin_path, "#bin", mono_dll_file)
  147. else:
  148. is_apple = env["platform"] in ["osx", "iphone"]
  149. is_macos = is_apple and not is_ios
  150. sharedlib_ext = ".dylib" if is_apple else ".so"
  151. mono_root = mono_prefix
  152. mono_lib_path = ""
  153. mono_so_file = ""
  154. if not mono_root and (is_android or is_javascript or is_ios):
  155. raise RuntimeError(
  156. "Mono installation directory not found; specify one manually with the 'mono_prefix' SCons parameter"
  157. )
  158. if not mono_root and is_macos:
  159. # Try with some known directories under OSX
  160. hint_dirs = ["/Library/Frameworks/Mono.framework/Versions/Current", "/usr/local/var/homebrew/linked/mono"]
  161. for hint_dir in hint_dirs:
  162. if os.path.isdir(hint_dir):
  163. mono_root = hint_dir
  164. break
  165. # We can't use pkg-config to link mono statically,
  166. # but we can still use it to find the mono root directory
  167. if not mono_root and mono_static:
  168. mono_root = pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext)
  169. if not mono_root:
  170. raise RuntimeError(
  171. "Building with mono_static=yes, but failed to find the mono prefix with pkg-config; "
  172. + "specify one manually with the 'mono_prefix' SCons parameter"
  173. )
  174. if is_ios and not is_ios_sim:
  175. env_mono.Append(CPPDEFINES=["IOS_DEVICE"])
  176. if mono_root:
  177. print("Found Mono root directory: " + mono_root)
  178. mono_lib_path = os.path.join(mono_root, "lib")
  179. env.Append(LIBPATH=[mono_lib_path])
  180. env_mono.Prepend(CPPPATH=os.path.join(mono_root, "include", "mono-2.0"))
  181. mono_lib = find_name_in_dir_files(mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[".a"])
  182. if not mono_lib:
  183. raise RuntimeError("Could not find mono library in: " + mono_lib_path)
  184. env_mono.Append(CPPDEFINES=["_REENTRANT"])
  185. if mono_static:
  186. if not is_javascript:
  187. env.Append(LINKFLAGS=["-rdynamic"])
  188. mono_lib_file = os.path.join(mono_lib_path, "lib" + mono_lib + ".a")
  189. if is_apple:
  190. if is_macos:
  191. env.Append(LINKFLAGS=["-Wl,-force_load," + mono_lib_file])
  192. else:
  193. arch = env["arch"]
  194. def copy_mono_lib(libname_wo_ext):
  195. if is_ios_sim:
  196. copy_file(
  197. mono_lib_path,
  198. "#bin",
  199. libname_wo_ext + ".a",
  200. "%s.iphone.%s.simulator.a" % (libname_wo_ext, arch),
  201. )
  202. else:
  203. copy_file(
  204. mono_lib_path,
  205. "#bin",
  206. libname_wo_ext + ".a",
  207. "%s.iphone.%s.a" % (libname_wo_ext, arch),
  208. )
  209. # Copy Mono libraries to the output folder. These are meant to be bundled with
  210. # the export templates and added to the Xcode project when exporting a game.
  211. copy_mono_lib("lib" + mono_lib)
  212. copy_mono_lib("libmono-native")
  213. copy_mono_lib("libmono-profiler-log")
  214. if not is_ios_sim:
  215. copy_mono_lib("libmono-ee-interp")
  216. copy_mono_lib("libmono-icall-table")
  217. copy_mono_lib("libmono-ilgen")
  218. else:
  219. assert is_desktop(env["platform"]) or is_android or is_javascript
  220. env.Append(LINKFLAGS=["-Wl,-whole-archive", mono_lib_file, "-Wl,-no-whole-archive"])
  221. if is_javascript:
  222. env.Append(LIBS=["mono-icall-table", "mono-native", "mono-ilgen", "mono-ee-interp"])
  223. wasm_src_dir = os.path.join(mono_root, "src")
  224. if not os.path.isdir(wasm_src_dir):
  225. raise RuntimeError("Could not find mono wasm src directory")
  226. # Ideally this should be defined only for 'driver.c', but I can't fight scons for another 2 hours
  227. env_mono.Append(CPPDEFINES=["CORE_BINDINGS"])
  228. env_mono.add_source_files(
  229. env.modules_sources,
  230. [
  231. os.path.join(wasm_src_dir, "driver.c"),
  232. os.path.join(wasm_src_dir, "zlib-helper.c"),
  233. os.path.join(wasm_src_dir, "corebindings.c"),
  234. ],
  235. )
  236. env.Append(
  237. LINKFLAGS=[
  238. "--js-library",
  239. os.path.join(wasm_src_dir, "library_mono.js"),
  240. "--js-library",
  241. os.path.join(wasm_src_dir, "binding_support.js"),
  242. "--js-library",
  243. os.path.join(wasm_src_dir, "dotnet_support.js"),
  244. ]
  245. )
  246. else:
  247. env.Append(LIBS=[mono_lib])
  248. if is_macos:
  249. env.Append(LIBS=["iconv", "pthread"])
  250. elif is_android:
  251. pass # Nothing
  252. elif is_ios:
  253. pass # Nothing, linking is delegated to the exported Xcode project
  254. elif is_javascript:
  255. env.Append(LIBS=["m", "rt", "dl", "pthread"])
  256. else:
  257. env.Append(LIBS=["m", "rt", "dl", "pthread"])
  258. if not mono_static:
  259. mono_so_file = find_file_in_dir(
  260. mono_lib_path, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext]
  261. )
  262. if not mono_so_file:
  263. raise RuntimeError("Could not find mono shared library in: " + mono_lib_path)
  264. else:
  265. assert not mono_static
  266. # TODO: Add option to force using pkg-config
  267. print("Mono root directory not found. Using pkg-config instead")
  268. env.ParseConfig("pkg-config monosgen-2 --libs")
  269. env_mono.ParseConfig("pkg-config monosgen-2 --cflags")
  270. tmpenv = Environment()
  271. tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
  272. tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L")
  273. for hint_dir in tmpenv["LIBPATH"]:
  274. file_found = find_file_in_dir(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext])
  275. if file_found:
  276. mono_lib_path = hint_dir
  277. mono_so_file = file_found
  278. break
  279. if not mono_so_file:
  280. raise RuntimeError("Could not find mono shared library in: " + str(tmpenv["LIBPATH"]))
  281. if not mono_static:
  282. libs_output_dir = get_android_out_dir(env) if is_android else "#bin"
  283. copy_file(mono_lib_path, libs_output_dir, mono_so_file)
  284. if not tools_enabled:
  285. if is_desktop(env["platform"]):
  286. if not mono_root:
  287. mono_root = (
  288. subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
  289. )
  290. make_template_dir(env, mono_root)
  291. elif is_android:
  292. # Compress Android Mono Config
  293. from . import make_android_mono_config
  294. module_dir = os.getcwd()
  295. config_file_path = os.path.join(module_dir, "build_scripts", "mono_android_config.xml")
  296. make_android_mono_config.generate_compressed_config(config_file_path, "mono_gd/")
  297. # Copy the required shared libraries
  298. copy_mono_shared_libs(env, mono_root, None)
  299. elif is_javascript:
  300. pass # No data directory for this platform
  301. elif is_ios:
  302. pass # No data directory for this platform
  303. if copy_mono_root:
  304. if not mono_root:
  305. mono_root = subprocess.check_output(["pkg-config", "mono-2", "--variable=prefix"]).decode("utf8").strip()
  306. if tools_enabled:
  307. # Only supported for editor builds.
  308. copy_mono_root_files(env, mono_root, mono_bcl)
  309. def make_template_dir(env, mono_root):
  310. from shutil import rmtree
  311. platform = env["platform"]
  312. target = env["target"]
  313. template_dir_name = ""
  314. assert is_desktop(platform)
  315. template_dir_name = "data.mono.%s.%s.%s" % (platform, env["bits"], target)
  316. output_dir = Dir("#bin").abspath
  317. template_dir = os.path.join(output_dir, template_dir_name)
  318. template_mono_root_dir = os.path.join(template_dir, "Mono")
  319. if os.path.isdir(template_mono_root_dir):
  320. rmtree(template_mono_root_dir) # Clean first
  321. # Copy etc/mono/
  322. template_mono_config_dir = os.path.join(template_mono_root_dir, "etc", "mono")
  323. copy_mono_etc_dir(mono_root, template_mono_config_dir, platform)
  324. # Copy the required shared libraries
  325. copy_mono_shared_libs(env, mono_root, template_mono_root_dir)
  326. def copy_mono_root_files(env, mono_root, mono_bcl):
  327. from glob import glob
  328. from shutil import copy
  329. from shutil import rmtree
  330. if not mono_root:
  331. raise RuntimeError("Mono installation directory not found")
  332. output_dir = Dir("#bin").abspath
  333. editor_mono_root_dir = os.path.join(output_dir, "GodotSharp", "Mono")
  334. if os.path.isdir(editor_mono_root_dir):
  335. rmtree(editor_mono_root_dir) # Clean first
  336. # Copy etc/mono/
  337. editor_mono_config_dir = os.path.join(editor_mono_root_dir, "etc", "mono")
  338. copy_mono_etc_dir(mono_root, editor_mono_config_dir, env["platform"])
  339. # Copy the required shared libraries
  340. copy_mono_shared_libs(env, mono_root, editor_mono_root_dir)
  341. # Copy framework assemblies
  342. mono_framework_dir = mono_bcl or os.path.join(mono_root, "lib", "mono", "4.5")
  343. mono_framework_facades_dir = os.path.join(mono_framework_dir, "Facades")
  344. editor_mono_framework_dir = os.path.join(editor_mono_root_dir, "lib", "mono", "4.5")
  345. editor_mono_framework_facades_dir = os.path.join(editor_mono_framework_dir, "Facades")
  346. if not os.path.isdir(editor_mono_framework_dir):
  347. os.makedirs(editor_mono_framework_dir)
  348. if not os.path.isdir(editor_mono_framework_facades_dir):
  349. os.makedirs(editor_mono_framework_facades_dir)
  350. for assembly in glob(os.path.join(mono_framework_dir, "*.dll")):
  351. copy(assembly, editor_mono_framework_dir)
  352. for assembly in glob(os.path.join(mono_framework_facades_dir, "*.dll")):
  353. copy(assembly, editor_mono_framework_facades_dir)
  354. def copy_mono_etc_dir(mono_root, target_mono_config_dir, platform):
  355. from glob import glob
  356. from shutil import copy, copytree
  357. if not os.path.isdir(target_mono_config_dir):
  358. os.makedirs(target_mono_config_dir)
  359. mono_etc_dir = os.path.join(mono_root, "etc", "mono")
  360. if not os.path.isdir(mono_etc_dir):
  361. mono_etc_dir = ""
  362. etc_hint_dirs = []
  363. if platform != "windows":
  364. etc_hint_dirs += ["/etc/mono", "/usr/local/etc/mono"]
  365. if "MONO_CFG_DIR" in os.environ:
  366. etc_hint_dirs += [os.path.join(os.environ["MONO_CFG_DIR"], "mono")]
  367. for etc_hint_dir in etc_hint_dirs:
  368. if os.path.isdir(etc_hint_dir):
  369. mono_etc_dir = etc_hint_dir
  370. break
  371. if not mono_etc_dir:
  372. raise RuntimeError("Mono installation etc directory not found")
  373. copytree(os.path.join(mono_etc_dir, "2.0"), os.path.join(target_mono_config_dir, "2.0"))
  374. copytree(os.path.join(mono_etc_dir, "4.0"), os.path.join(target_mono_config_dir, "4.0"))
  375. copytree(os.path.join(mono_etc_dir, "4.5"), os.path.join(target_mono_config_dir, "4.5"))
  376. if os.path.isdir(os.path.join(mono_etc_dir, "mconfig")):
  377. copytree(os.path.join(mono_etc_dir, "mconfig"), os.path.join(target_mono_config_dir, "mconfig"))
  378. for file in glob(os.path.join(mono_etc_dir, "*")):
  379. if os.path.isfile(file):
  380. copy(file, target_mono_config_dir)
  381. def copy_mono_shared_libs(env, mono_root, target_mono_root_dir):
  382. from shutil import copy
  383. def copy_if_exists(src, dst):
  384. if os.path.isfile(src):
  385. copy(src, dst)
  386. platform = env["platform"]
  387. if platform == "windows":
  388. src_mono_bin_dir = os.path.join(mono_root, "bin")
  389. target_mono_bin_dir = os.path.join(target_mono_root_dir, "bin")
  390. if not os.path.isdir(target_mono_bin_dir):
  391. os.makedirs(target_mono_bin_dir)
  392. mono_posix_helper_file = find_file_in_dir(
  393. src_mono_bin_dir, ["MonoPosixHelper"], prefixes=["", "lib"], extensions=[".dll"]
  394. )
  395. copy(
  396. os.path.join(src_mono_bin_dir, mono_posix_helper_file),
  397. os.path.join(target_mono_bin_dir, "MonoPosixHelper.dll"),
  398. )
  399. # For newer versions
  400. btls_dll_path = os.path.join(src_mono_bin_dir, "libmono-btls-shared.dll")
  401. if os.path.isfile(btls_dll_path):
  402. copy(btls_dll_path, target_mono_bin_dir)
  403. else:
  404. target_mono_lib_dir = (
  405. get_android_out_dir(env) if platform == "android" else os.path.join(target_mono_root_dir, "lib")
  406. )
  407. if not os.path.isdir(target_mono_lib_dir):
  408. os.makedirs(target_mono_lib_dir)
  409. src_mono_lib_dir = os.path.join(mono_root, "lib")
  410. lib_file_names = []
  411. if platform == "osx":
  412. lib_file_names = [lib_name + ".dylib" for lib_name in ["libmono-btls-shared", "libMonoPosixHelper"]]
  413. if os.path.isfile(os.path.join(src_mono_lib_dir, "libmono-native-compat.dylib")):
  414. lib_file_names += ["libmono-native-compat.dylib"]
  415. else:
  416. lib_file_names += ["libmono-native.dylib"]
  417. elif is_unix_like(platform):
  418. lib_file_names = [
  419. lib_name + ".so"
  420. for lib_name in [
  421. "libmono-btls-shared",
  422. "libmono-ee-interp",
  423. "libmono-native",
  424. "libMonoPosixHelper",
  425. "libmono-profiler-aot",
  426. "libmono-profiler-coverage",
  427. "libmono-profiler-log",
  428. "libMonoSupportW",
  429. ]
  430. ]
  431. for lib_file_name in lib_file_names:
  432. copy_if_exists(os.path.join(src_mono_lib_dir, lib_file_name), target_mono_lib_dir)
  433. def pkgconfig_try_find_mono_root(mono_lib_names, sharedlib_ext):
  434. tmpenv = Environment()
  435. tmpenv.AppendENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
  436. tmpenv.ParseConfig("pkg-config monosgen-2 --libs-only-L")
  437. for hint_dir in tmpenv["LIBPATH"]:
  438. name_found = find_name_in_dir_files(hint_dir, mono_lib_names, prefixes=["lib"], extensions=[sharedlib_ext])
  439. if name_found and os.path.isdir(os.path.join(hint_dir, "..", "include", "mono-2.0")):
  440. return os.path.join(hint_dir, "..")
  441. return ""