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
|
From 9810816577a18e844fd21eb0f7fa73b1e5e71b8a Mon Sep 17 00:00:00 2001
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sat, 25 Mar 2017 01:10:36 +0100
Subject: [PATCH] Allow to compile against system-provided mtex2MML
I'm writing package for Alpine Linux and want to compile mathematical
against system-provided mtex2MML instead of bundled one.
Upstream-Issue: https://github.com/gjtorikian/mathematical/pull/71
---
ext/mathematical/extconf.rb | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/ext/mathematical/extconf.rb b/ext/mathematical/extconf.rb
index eb6a8d8..04993aa 100644
--- a/ext/mathematical/extconf.rb
+++ b/ext/mathematical/extconf.rb
@@ -21,6 +21,10 @@ def using_system_lasem?
arg_config('--use-system-lasem', !!ENV['MATHEMATICAL_USE_SYSTEM_LASEM'])
end
+def using_system_mtex2mml?
+ arg_config('--use-system-mtex2MML', !!ENV['MATHEMATICAL_USE_SYSTEM_MTEX2MML'])
+end
+
ROOT_TMP = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'tmp'))
LASEM_DIR = File.expand_path(File.join(File.dirname(__FILE__), 'lasem'))
@@ -57,10 +61,16 @@ end
clean_dir(MTEX2MML_BUILD_DIR)
clean_dir(LASEM_BUILD_DIR)
-# build mtex2MML library
-Dir.chdir(MTEX2MML_BUILD_DIR) do
- system 'cmake ..'
- system 'make libmtex2MML_static'
+if !using_system_mtex2mml?
+ # build mtex2MML library
+ Dir.chdir(MTEX2MML_BUILD_DIR) do
+ system 'cmake ..'
+ system 'make libmtex2MML_static'
+ end
+ FileUtils.mkdir_p(MTEX2MML_LIB_DIR)
+ FileUtils.cp_r(File.join(MTEX2MML_BUILD_DIR, 'libmtex2MML.a'), MTEX2MML_LIB_DIR)
+else
+ dir_config('mtex2MML').any? || pkg_config('libmtex2MML') || system('dpkg -s libmtex2MML >/dev/null')
end
if !using_system_lasem?
@@ -76,9 +86,6 @@ else
dir_config('lasem').any? || pkg_config('liblasem') || system('dpkg -s liblasem >/dev/null')
end
-FileUtils.mkdir_p(MTEX2MML_LIB_DIR)
-FileUtils.cp_r(File.join(MTEX2MML_BUILD_DIR, 'libmtex2MML.a'), MTEX2MML_LIB_DIR)
-
LIB_DIRS = [MTEX2MML_LIB_DIR, LASEM_LIB_DIR]
HEADER_DIRS = [MTEX2MML_SRC_DIR, LASEM_SRC_DIR]
|