File: Jamroot

package info (click to toggle)
luabind 0.9.1%2Bdfsg-11
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 1,844 kB
  • ctags: 2,833
  • sloc: cpp: 13,796; makefile: 126; sh: 24; ansic: 11
file content (249 lines) | stat: -rwxr-xr-x 5,743 bytes parent folder | download | duplicates (2)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
import docutils ;
import os ;
import errors ;
import notfile ;
import package ;
import path ;
import virtual-target ;

VERSION = 0.9.1 ;
BOOST_ROOT = [ os.environ BOOST_ROOT ] ;

rule debug-message ( txt * )
{
    if --debug-build in [ modules.peek : ARGV ]
    {
        echo [luabind DEBUG] $(txt) ;
    }
}

debug-message figuring out which libraries to link to... ;
debug-message os.name is [ os.name ] ;

if [ os.name ] = NT
{
    if ! $(BOOST_ROOT)
    {
        errors.user-error "*** BOOST_ROOT must be set to a Boost installation." ;
    }

    LUA_PATH = [ os.environ LUA_PATH ] ;

    if ! $(LUA_PATH)
    {
        errors.user-error "*** LUA_PATH must be set." ;
    }

    local includes = [ GLOB $(LUA_PATH)/include $(LUA_PATH)/src : lua.h ] ;

    if ! $(includes)
    {
        errors.user-error "*** Unable to determine Lua include directory." ;
    }

    includes = $(includes:D) ;

    debug-message found include directory in $(includes) ;

    if [ GLOB $(LUA_PATH) : lib ]
    {
        lib lua : : <link>static <name>lua5.2 <search>$(LUA_PATH)/lib/static : : <include>$(includes) ;
        lib lua : : <link>shared <name>lua5.2 <search>$(LUA_PATH)/lib : : <include>$(includes) ;
    }
    else if [ GLOB $(LUA_PATH) : lua5.2.dll ]
    {
        lib lua : : <name>lua5.2 <search>$(LUA_PATH) : : <include>$(includes) ;
    }
}
else if [ os.name ] in LINUX MACOSX FREEBSD KFREEBSD
{
    LUA_PATH = [ os.environ LUA_PATH ] ;
    HOME = [ os.environ HOME ] ;
    MULTIARCH = [ os.environ DEB_HOST_MULTIARCH ] ;

    local possible-prefixes =
        $(LUA_PATH) $(HOME)/Library/Frameworks /Library/Frameworks /usr /usr/local /opt/local /opt ;

    local possible-suffixes =
        include/lua5.2 include/lua52 include/lua include ;

    local includes = [ GLOB $(possible-prefixes)/$(possible-suffixes) : lua.h ] ;

    if ! $(includes)
    {
        errors.user-error "*** Unable to determine Lua include directory." ;
    }

    local includes = $(includes[1]:D) ;
    local prefix = $(includes:D) ;

    if $(prefix:B) = "include"
    {
        prefix = $(prefix:D) ;
    }

    local lib = $(prefix)/lib/$(MULTIARCH) ;

    local names = liblua5.2 liblua52 liblua ;
    local extensions = .a .so ;

    library = [ GLOB $(lib)/lua52 $(lib)/lua5.2 $(lib)/lua $(lib) :
        $(names)$(extensions) ] ;
    lib-name = [ MATCH "lib(.*)" : $(library[1]:B) ] ;

    debug-message prefix: $(prefix) ;
    debug-message includes: $(includes) ;
    debug-message lib: $(library:D) ;
    debug-message candidates: $(library) ;
    debug-message linking to: $(lib-name) ;

    if ! $(lib-name)
    {
        errors.user-error "*** Unable to find Lua library." ;
    }

    lib m : : <link>shared ;
    if [ os.name ] in LINUX KFREEBSD
    {
        lib dl : : <link>shared ;
    }
    else
    {
        alias dl ;
    }
    lib lua : m dl : <name>$(lib-name) <search>$(library:D) : : <include>$(includes) ;
}

rule tag-names ( name : type ? : property-set )
{
    if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB &&
        [ $(property-set).get <variant> ] = debug
    {
        name = $(name)d ;
    }

    local result = [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ;

    if $(type) = SHARED_LIB &&
        ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
          ! ( [ $(property-set).get <toolset> ] in pgi ) )
    {
        result = $(result).$(VERSION) ;
    }

    return $(result) ;
}

SOURCES =
    class.cpp
    class_info.cpp
    class_registry.cpp
    class_rep.cpp
    create_class.cpp
    error.cpp
    exception_handler.cpp
    function.cpp
    inheritance.cpp
    link_compatibility.cpp
    object_rep.cpp
    open.cpp
    pcall.cpp
    scope.cpp
    stack_content_by_name.cpp
    weak_ref.cpp
    wrapper_base.cpp ;

usage-requirements =
    <library>lua
    <toolset>msvc,<link>shared:<cxxflags>/wd4251
    <link>shared:<define>LUABIND_DYNAMIC_LINK
    <tag>@tag-names ;

lib luabind
    : src/$(SOURCES)
    # requirements
    : <include>. <include>$(BOOST_ROOT)
      $(usage-requirements)
    # default-build
    :
    # usage-requirements
    : <include>. <include>$(BOOST_ROOT)
      $(usage-requirements)
    ;

alias test
  : test//test
  # requirements
  :
  # default-build
  : <link>static <link>shared release debug ;

explicit test ;

rule git-describe ( )
{
    local result = [ SHELL "git describe HEAD 2>&1" : exit-status ] ;

    if $(result[2]) = 0
    {
        return [ MATCH "^v([a-zA-Z.0-9\\-]+)" : $(result[1]) ] ;
    }
}

version-tag = [ git-describe ] ;

if $(version-tag)
{
    actions make-version-file
    {
        echo ".. |version| replace:: $(version-tag)" > doc/version.rst
    }

    notfile make-version-file : @make-version-file ;
}
else
{
    alias make-version-file ;
}

if docs in [ modules.peek : ARGV ] 
{
    local result = [ SHELL "rst2html.py --version 2>&1" : exit-status ] ;
    if $(result[2]) = 0
    {
        found-rst2html = rst2html.py ;
    }
}

html docs.html
  : doc/docs.rst
  : <dependency>make-version-file
    <docutils-cmd>$(found-rst2html)
    <docutils-html>"--traceback -gdt --stylesheet=style.css --link-stylesheet" ;

stage docs : docs.html : <location>doc ;
explicit docs docs.html make-version-file ;

headers = [ path.glob-tree luabind : *.hpp ] ;

package.install install
  : <install-header-subdir>luabind
    <install-source-root>luabind
    <install-no-version-symlinks>on
  :
  : luabind
  : $(headers)
  ;

local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
stage-locate ?= stage ;

install stage
  : luabind
  : <location>$(stage-locate)
    <install-no-version-symlinks>on
    <install-dependencies>on
    <install-type>LIB
  ;

explicit stage ;