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