| 1 | import feature : feature ; |
|---|
| 2 | import modules ; |
|---|
| 3 | import os ; |
|---|
| 4 | import errors ; |
|---|
| 5 | import stage ; |
|---|
| 6 | import common ; |
|---|
| 7 | import option ; |
|---|
| 8 | |
|---|
| 9 | include user-config.jam ; |
|---|
| 10 | |
|---|
| 11 | feature character-set : unicode ansi multibyte : composite ; |
|---|
| 12 | feature.compose <character-set>unicode : <define>_UNICODE <define>UNICODE ; |
|---|
| 13 | feature.compose <character-set>multibyte : <define>_MBCS ; |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | local toolset = [ MATCH "^--toolset=(.*)" : [ modules.peek : ARGV ] ] ; |
|---|
| 17 | toolset ?= msvc ; |
|---|
| 18 | if $(toolset) = "msvc" { |
|---|
| 19 | import bjam/lua ; |
|---|
| 20 | import bjam/openssl ; |
|---|
| 21 | import bjam/boost ; |
|---|
| 22 | import bjam/cryptopp ; |
|---|
| 23 | import bjam/psdk ; |
|---|
| 24 | } |
|---|
| 25 | import toolset : flags ; |
|---|
| 26 | import notfile ; |
|---|
| 27 | import bjam/zip ; |
|---|
| 28 | |
|---|
| 29 | local target = NSClient++ ; |
|---|
| 30 | local target-config = nsc.ini ; |
|---|
| 31 | local target-readme = readme.txt ; |
|---|
| 32 | local target-guide = "Nagios Usage Guide.pdf" ; |
|---|
| 33 | local target-refman = "NSClient++ Reference Manual.pdf" ; |
|---|
| 34 | local target-changelog = changelog.txt ; |
|---|
| 35 | local target-license = license.txt ; |
|---|
| 36 | local target-counters = counters.defs ; |
|---|
| 37 | |
|---|
| 38 | ECHO "OS =" [ os.name ] ; |
|---|
| 39 | ECHO "name =" $(__name__) ; |
|---|
| 40 | |
|---|
| 41 | # what kind of layout are we doing? |
|---|
| 42 | layout = [ MATCH "^--layout=(.*)" : [ modules.peek : ARGV ] ] ; |
|---|
| 43 | layout ?= versioned ; |
|---|
| 44 | layout-$(layout) = true ; |
|---|
| 45 | |
|---|
| 46 | path-constant TOP : . ; |
|---|
| 47 | |
|---|
| 48 | # possible stage only location |
|---|
| 49 | local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ; |
|---|
| 50 | stage-locate ?= stage ; |
|---|
| 51 | path-constant BOOST_STAGE_LOCATE : $(stage-locate) ; |
|---|
| 52 | |
|---|
| 53 | if $(toolset) = "msvc" { |
|---|
| 54 | using bjam/openssl : : $(TOP)/lib-source/openssl-0.9.8g/include $(TOP)/lib ; |
|---|
| 55 | using bjam/boost : : $(TOP)/lib-source/boost_1_35_0 $(TOP)/lib ; |
|---|
| 56 | using bjam/lua : : $(TOP)/lib-source/lua-5.1.2 ; |
|---|
| 57 | using bjam/cryptopp : : $(TOP)/lib-source/"Crypto++"/src ; |
|---|
| 58 | using bjam/psdk : : /foo ; |
|---|
| 59 | |
|---|
| 60 | if [ bjam/lua.isEnabled ] = true { |
|---|
| 61 | echo "LUA support enabled (disable with --without-lua)" ; |
|---|
| 62 | bjam/lua.printEnv ; |
|---|
| 63 | } else { |
|---|
| 64 | echo "LUA support DISABLED (enable with --with-lua)" ; |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | if [ bjam/openssl.isEnabled ] = true { |
|---|
| 68 | echo "SSL support enabled (disable with --without-openssl)" ; |
|---|
| 69 | bjam/openssl.printEnv ; |
|---|
| 70 | } else { |
|---|
| 71 | echo "SSL support DISABLED (enable with --with-openssl)" ; |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | if [ bjam/boost.isEnabled ] = true { |
|---|
| 75 | echo "boost found (disable with --without-boost)" ; |
|---|
| 76 | bjam/boost.printEnv ; |
|---|
| 77 | } else { |
|---|
| 78 | echo "boost not avaliable! some features DISABLED (for instance regular expressions) (enable with --with-boost)" ; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | if [ bjam/cryptopp.isEnabled ] = true { |
|---|
| 82 | echo "Crypto++ found (disable with --without-cryptopp)" ; |
|---|
| 83 | bjam/cryptopp.printEnv ; |
|---|
| 84 | } else { |
|---|
| 85 | echo "cryptopp not avaliable! encryption (NSCA) DISABLED (enable with --with-cryptopp)" ; |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | if [ bjam/psdk.isEnabled ] = true { |
|---|
| 89 | echo "Platform SDK found (disable with --without-psdk)" ; |
|---|
| 90 | bjam/psdk.printEnv ; |
|---|
| 91 | } else { |
|---|
| 92 | echo "Plattform SDK not avaliable! Various features wont work (enable with --with-psdk)" ; |
|---|
| 93 | } |
|---|
| 94 | |
|---|
| 95 | notfile update_version : @update_version ; |
|---|
| 96 | actions update_version |
|---|
| 97 | { |
|---|
| 98 | XAutobuild.exe -f $(TOP) |
|---|
| 99 | } |
|---|
| 100 | } |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | project master |
|---|
| 105 | : requirements |
|---|
| 106 | <include>include |
|---|
| 107 | <find-static-library>advapi32 |
|---|
| 108 | <find-static-library>user32 |
|---|
| 109 | <find-static-library>shell32 |
|---|
| 110 | <threading>multi |
|---|
| 111 | <link>shared |
|---|
| 112 | $(result) |
|---|
| 113 | |
|---|
| 114 | : default-build debug |
|---|
| 115 | |
|---|
| 116 | : build-dir bjam-tmp-build |
|---|
| 117 | ; |
|---|
| 118 | |
|---|
| 119 | make $(target).exe.manifest : NSClient++.manifest : common.copy ; |
|---|
| 120 | explicit $(target).exe.manifest ; |
|---|
| 121 | |
|---|
| 122 | |
|---|
| 123 | exe $(target) |
|---|
| 124 | |
|---|
| 125 | : # sources |
|---|
| 126 | NSClient++.cpp |
|---|
| 127 | NSCPlugin.cpp |
|---|
| 128 | include/NSCHelper.cpp |
|---|
| 129 | include/arrayBuffer.cpp |
|---|
| 130 | include/ServiceCmd.cpp |
|---|
| 131 | include/Socket.cpp |
|---|
| 132 | include/b64/b64.c |
|---|
| 133 | |
|---|
| 134 | : # requirements |
|---|
| 135 | <dependency>$(target).exe.manifest |
|---|
| 136 | #<runtime-link>static |
|---|
| 137 | <find-static-library>ws2_32 |
|---|
| 138 | <find-static-library>Userenv |
|---|
| 139 | <find-static-library>ole32 |
|---|
| 140 | <variant>release:<dependency>update_version |
|---|
| 141 | : # default build |
|---|
| 142 | |
|---|
| 143 | : # usage requirements |
|---|
| 144 | # depends $(target).manifest |
|---|
| 145 | ; |
|---|
| 146 | explicit $(target) ; |
|---|
| 147 | |
|---|
| 148 | # |
|---|
| 149 | # Copy various files |
|---|
| 150 | # |
|---|
| 151 | make $(target-config) : nsc.dist : common.copy ; |
|---|
| 152 | explicit $(target-config) ; |
|---|
| 153 | |
|---|
| 154 | make $(target-readme) : docs/readme.txt : common.copy ; |
|---|
| 155 | explicit $(target-readme) ; |
|---|
| 156 | make $(target-guide) : "docs/Nagios Usage Guide.pdf" : common.copy ; |
|---|
| 157 | explicit $(target-guide) ; |
|---|
| 158 | make $(target-refman) : "docs/NSClient++ Reference Manual.pdf" : common.copy ; |
|---|
| 159 | explicit $(target-refman) ; |
|---|
| 160 | |
|---|
| 161 | make $(target-license) : files/license.txt : common.copy ; |
|---|
| 162 | explicit $(target-license) ; |
|---|
| 163 | |
|---|
| 164 | make $(target-changelog) : changelog : common.copy ; |
|---|
| 165 | explicit $(target-changelog) ; |
|---|
| 166 | |
|---|
| 167 | make $(target-counters) : files/counters.defs : common.copy ; |
|---|
| 168 | explicit $(target-counters) ; |
|---|
| 169 | |
|---|
| 170 | all-modules = |
|---|
| 171 | [ MATCH .*modules/(.*)/.* : [ glob modules/*/Jamfile ] ] |
|---|
| 172 | ; |
|---|
| 173 | |
|---|
| 174 | # all-modules = NSCAAgent ; |
|---|
| 175 | |
|---|
| 176 | all-scripts = |
|---|
| 177 | [ MATCH .*scripts/(.+\\..*) : [ glob scripts/* ] ] |
|---|
| 178 | ; |
|---|
| 179 | local all-scripts-lst ; |
|---|
| 180 | if $(toolset) = "msvc" { |
|---|
| 181 | if ! ( [ bjam/lua.isEnabled ] = true ) { |
|---|
| 182 | echo "LUA support disabled skipping build of modules..." ; |
|---|
| 183 | local result ; |
|---|
| 184 | for local l in $(all-modules) |
|---|
| 185 | { |
|---|
| 186 | if [ MATCH (.*LUA.*) : $(l) ] |
|---|
| 187 | { |
|---|
| 188 | echo "Not building module: $(l)" ; |
|---|
| 189 | } else { |
|---|
| 190 | result += $(l) ; |
|---|
| 191 | } |
|---|
| 192 | } |
|---|
| 193 | all-modules = $(result) ; |
|---|
| 194 | } |
|---|
| 195 | if ! ( [ bjam/psdk.isEnabled ] = true ) { |
|---|
| 196 | echo "PSDK support disabled skipping build of modules..." ; |
|---|
| 197 | local result ; |
|---|
| 198 | for local l in $(all-modules) |
|---|
| 199 | { |
|---|
| 200 | if [ MATCH (.*CheckTaskSched.*) : $(l) ] { |
|---|
| 201 | echo "Not building module: $(l)" ; |
|---|
| 202 | } else if [ MATCH (.*CheckWMI.*) : $(l) ] { |
|---|
| 203 | echo "Not building module: $(l)" ; |
|---|
| 204 | } else { |
|---|
| 205 | result += $(l) ; |
|---|
| 206 | } |
|---|
| 207 | } |
|---|
| 208 | all-modules = $(result) ; |
|---|
| 209 | } |
|---|
| 210 | all-modules-text = "" ; |
|---|
| 211 | for local l in $(all-modules) { |
|---|
| 212 | alias $(l) |
|---|
| 213 | : # sources |
|---|
| 214 | modules/$(l) |
|---|
| 215 | : # requirements |
|---|
| 216 | : # default build |
|---|
| 217 | : # usage requirements |
|---|
| 218 | <dependency>$(target) |
|---|
| 219 | ; |
|---|
| 220 | explicit $(l) ; |
|---|
| 221 | all-modules-text = "$(all-modules-text) $(l)" ; |
|---|
| 222 | } |
|---|
| 223 | echo "Building modules: $(all-modules-text)" ; |
|---|
| 224 | for local l in $(all-scripts) { |
|---|
| 225 | all-scripts-lst = $(all-scripts-lst) scripts/$(l) ; |
|---|
| 226 | } |
|---|
| 227 | } else { |
|---|
| 228 | all-installers = |
|---|
| 229 | [ MATCH .*helpers/(.*)/.* : [ glob helpers/*installer/Jamfile ] ] |
|---|
| 230 | ; |
|---|
| 231 | all-installers-text = "" ; |
|---|
| 232 | for local l in $(all-installers) |
|---|
| 233 | { |
|---|
| 234 | alias $(l) : helpers/$(l) ; |
|---|
| 235 | explicit $(l) ; |
|---|
| 236 | all-installers-text = "$(all-installers-text) $(l)" ; |
|---|
| 237 | } |
|---|
| 238 | echo "Building installers: $(all-installers-text)" ; |
|---|
| 239 | } |
|---|
| 240 | |
|---|
| 241 | all-archive = |
|---|
| 242 | [ MATCH .*helpers/(.*)/.* : [ glob helpers/*archive/Jamfile ] ] |
|---|
| 243 | ; |
|---|
| 244 | for local l in $(all-archive) |
|---|
| 245 | { |
|---|
| 246 | alias $(l) : helpers/$(l) ; |
|---|
| 247 | echo "Adding archive target for: $(l)" ; |
|---|
| 248 | explicit $(l) ; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | alias cryptopp-headers : helpers/cryptopp-headers ; |
|---|
| 252 | explicit cryptopp-headers ; |
|---|
| 253 | |
|---|
| 254 | alias installer_dll : helpers/installer_dll helpers/installer_dll_fw ; |
|---|
| 255 | explicit installer_dll ; |
|---|
| 256 | |
|---|
| 257 | all-helpers = installer_dll ; |
|---|
| 258 | alias all-helpers-targets : $(all-helpers) ; |
|---|
| 259 | explicit all-helpers-targets ; |
|---|
| 260 | |
|---|
| 261 | alias all-scripts-targets : $(all-scripts-lst) ; |
|---|
| 262 | explicit all-scripts-targets ; |
|---|
| 263 | |
|---|
| 264 | alias all-root-targets : $(target) $(target-config) $(target-readme) $(target-guide) $(target-refman) $(target-license) $(target-changelog) $(target-counters) helpers/systray_helper ; |
|---|
| 265 | explicit all-root-targets ; |
|---|
| 266 | |
|---|
| 267 | alias all-modules-targets : $(all-modules) ; |
|---|
| 268 | explicit all-modules-targets ; |
|---|
| 269 | alias all-installer-targets : $(all-installers) ; |
|---|
| 270 | explicit all-installer-targets ; |
|---|
| 271 | alias all-archive-targets : $(all-archive) ; |
|---|
| 272 | explicit all-archive-targets ; |
|---|
| 273 | |
|---|
| 274 | rule get-root-prefix ( properties * ) |
|---|
| 275 | { |
|---|
| 276 | tag = "UNKNOWN" ; |
|---|
| 277 | if <architecture>ia64 in $(properties) { |
|---|
| 278 | tag = "IA64" ; |
|---|
| 279 | } else { |
|---|
| 280 | if <address-model>64 in $(properties) { |
|---|
| 281 | tag = "x64" ; |
|---|
| 282 | } else { |
|---|
| 283 | tag = "Win32" ; |
|---|
| 284 | } |
|---|
| 285 | } |
|---|
| 286 | if <variant>debug in $(properties) { |
|---|
| 287 | tag = "$(tag)-debug" ; |
|---|
| 288 | } |
|---|
| 289 | return $(tag) ; |
|---|
| 290 | } |
|---|
| 291 | rule generate-binary-location ( properties * ) |
|---|
| 292 | { |
|---|
| 293 | local tag = [ get-root-prefix $(properties) ] ; |
|---|
| 294 | return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries ; |
|---|
| 295 | } |
|---|
| 296 | rule generate-helper-location ( properties * ) |
|---|
| 297 | { |
|---|
| 298 | local tag = [ get-root-prefix $(properties) ] ; |
|---|
| 299 | return <location>$(BOOST_STAGE_LOCATE)/$(tag)/helpers ; |
|---|
| 300 | } |
|---|
| 301 | rule generate-scripts-location ( properties * ) |
|---|
| 302 | { |
|---|
| 303 | local tag = [ get-root-prefix $(properties) ] ; |
|---|
| 304 | return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries/scripts ; |
|---|
| 305 | } |
|---|
| 306 | rule generate-module-location ( properties * ) |
|---|
| 307 | { |
|---|
| 308 | local tag = [ get-root-prefix $(properties) ] ; |
|---|
| 309 | return <location>$(BOOST_STAGE_LOCATE)/$(tag)/binaries/modules ; |
|---|
| 310 | } |
|---|
| 311 | |
|---|
| 312 | install dist : all-root-targets : <conditional>@generate-binary-location ; |
|---|
| 313 | explicit dist ; |
|---|
| 314 | |
|---|
| 315 | install dist-modules : all-modules-targets : <conditional>@generate-module-location ; |
|---|
| 316 | explicit dist-modules ; |
|---|
| 317 | |
|---|
| 318 | install dist-helpers : all-helpers-targets : <conditional>@generate-helper-location ; |
|---|
| 319 | explicit dist-helpers ; |
|---|
| 320 | |
|---|
| 321 | install dist-scripts : all-scripts-targets : <conditional>@generate-scripts-location ; |
|---|
| 322 | explicit dist-scripts ; |
|---|
| 323 | |
|---|
| 324 | alias build-binaries : dist dist-modules dist-helpers dist-scripts ; |
|---|
| 325 | explicit build-binaries ; |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | alias build-archives : all-archive-targets : <location>$(BOOST_STAGE_LOCATE)/archive ; |
|---|
| 329 | explicit build-archives ; |
|---|
| 330 | |
|---|
| 331 | alias build-installer : all-installer-targets : <location>$(BOOST_STAGE_LOCATE)/installer ; |
|---|
| 332 | explicit build-installer ; |
|---|
| 333 | |
|---|
| 334 | alias source-archive : helpers/build-source : <location>$(BOOST_STAGE_LOCATE)/archive ; |
|---|
| 335 | explicit source-archive ; |
|---|
| 336 | |
|---|
| 337 | |
|---|