]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | # Copyright (c) 2010 Vladimir Prus. |
2 | # Copyright (c) 2013 Steven Watanabe | |
3 | # | |
4 | # Use, modification and distribution is subject to the Boost Software | |
5 | # License Version 1.0. (See accompanying file LICENSE_1_0.txt or | |
6 | # http://www.boost.org/LICENSE_1_0.txt) | |
7 | ||
8 | # Supports the lzma library | |
9 | # | |
10 | # After 'using lzma', the following targets are available: | |
11 | # | |
11fdf7f2 | 12 | # /lzma//lzma -- The lzma library |
b32b8144 FG |
13 | |
14 | import project ; | |
15 | import ac ; | |
16 | import errors ; | |
11fdf7f2 | 17 | import feature ; |
b32b8144 FG |
18 | import "class" : new ; |
19 | import targets ; | |
20 | import path ; | |
21 | import modules ; | |
b32b8144 FG |
22 | import indirect ; |
23 | import property ; | |
24 | import property-set ; | |
25 | ||
26 | header = lzma.h ; | |
92f5a8d4 TL |
27 | # liblzma only needed for VisualC++ builds |
28 | names = lzma liblzma ; | |
b32b8144 FG |
29 | |
30 | library-id = 0 ; | |
31 | ||
32 | if --debug-configuration in [ modules.peek : ARGV ] | |
33 | { | |
34 | .debug = true ; | |
35 | } | |
36 | ||
11fdf7f2 TL |
37 | # Initializes the lzma library. |
38 | # | |
39 | # Options for configuring lzma:: | |
40 | # | |
41 | # <search> | |
42 | # The directory containing the lzma binaries. | |
43 | # <name> | |
44 | # Overrides the default library name. | |
45 | # <include> | |
46 | # The directory containing the lzma headers. | |
47 | # | |
48 | # If none of these options is specified, then the environmental | |
49 | # variables LZMA_LIBRARY_PATH, LZMA_NAME, and LZMA_INCLUDE will | |
50 | # be used instead. | |
51 | # | |
52 | # Examples:: | |
53 | # | |
54 | # # Find lzma in the default system location | |
55 | # using lzma ; | |
56 | # # Find lzma in /usr/local | |
57 | # using lzma : 1.2.7 | |
58 | # : <include>/usr/local/include <search>/usr/local/lib ; | |
59 | # | |
b32b8144 FG |
60 | rule init ( |
61 | version ? | |
62 | # (currently ignored) | |
63 | ||
64 | : options * | |
65 | # A list of the options to use | |
66 | ||
67 | : requirements * | |
68 | # The requirements for the target | |
69 | ||
70 | : is-default ? | |
71 | # Default configurations are only used when | |
72 | # not yet configured. This option is | |
73 | # deprecated. A configuration will be treated | |
74 | # as a default when none of <include>, <search>, | |
75 | # <name>, and <source> are present. | |
76 | ) | |
77 | { | |
78 | local caller = [ project.current ] ; | |
79 | ||
80 | if ! $(.initialized) | |
81 | { | |
82 | .initialized = true ; | |
83 | ||
84 | project.initialize $(__name__) ; | |
85 | .project = [ project.current ] ; | |
86 | project lzma ; | |
87 | } | |
88 | ||
11fdf7f2 TL |
89 | local library-path = [ feature.get-values <search> : $(options) ] ; |
90 | local include-path = [ feature.get-values <include> : $(options) ] ; | |
91 | local library-name = [ feature.get-values <name> : $(options) ] ; | |
b32b8144 FG |
92 | |
93 | if ! $(options) | |
94 | { | |
95 | is-default = true ; | |
96 | } | |
97 | ||
98 | condition = [ property-set.create $(requirements) ] ; | |
99 | condition = [ property-set.create [ $(condition).base ] ] ; | |
100 | ||
101 | if $(.configured.$(condition)) | |
102 | { | |
103 | if $(is-default) | |
104 | { | |
105 | if $(.debug) | |
106 | { | |
107 | ECHO "notice: [lzma] lzma is already configured" ; | |
108 | } | |
109 | } | |
110 | else | |
111 | { | |
112 | errors.user-error "lzma is already configured" ; | |
113 | } | |
114 | return ; | |
115 | } | |
116 | else | |
117 | { | |
118 | if $(.debug) | |
119 | { | |
120 | ECHO "notice: [lzma] Using pre-installed library" ; | |
121 | if $(condition) | |
122 | { | |
123 | ECHO "notice: [lzma] Condition" [ $(condition).raw ] ; | |
124 | } | |
125 | } | |
126 | ||
127 | local mt = [ new ac-library lzma : $(.project) : $(condition) : | |
128 | $(include-path) : $(library-path) : $(library-name) ] ; | |
129 | $(mt).set-header $(header) ; | |
130 | $(mt).set-default-names $(names) ; | |
131 | targets.main-target-alternative $(mt) ; | |
132 | } | |
133 | .configured.$(condition) = true ; | |
134 | } |