{"name":"buildcheck","version":"0.0.6","author":{"name":"Brian White","email":"mscdex@mscdex.net"},"description":"Build environment checking (a la autoconf) for node.js","main":"./lib/index.js","engines":{"node":">=10.0.0"},"devDependencies":{"@mscdex/eslint-config":"^1.1.0","eslint":"^7.0.0"},"scripts":{"test":"node test/test.js","lint":"eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js lib","lint:fix":"npm run lint -- --fix"},"keywords":["build","autoconf","addons","compiler","environment"],"licenses":[{"type":"MIT","url":"http://github.com/mscdex/buildcheck/raw/master/LICENSE"}],"repository":{"type":"git","url":"git+ssh://git@github.com/mscdex/buildcheck.git"},"bugs":{"url":"https://github.com/mscdex/buildcheck/issues"},"homepage":"https://github.com/mscdex/buildcheck#readme","_id":"buildcheck@0.0.6","_integrity":"sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==","_resolved":"https://github.com/mscdex/buildcheck/tarball/v0.0.6","_from":"https://github.com/mscdex/buildcheck/tarball/v0.0.6","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==","shasum":"89aa6e417cfd1e2196e3f8fe915eb709d2fe4238","tarball":"http://registry-npm.ywwl.com/buildcheck/download/buildcheck-0.0.6.tgz","fileCount":17,"unpackedSize":45299,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDrHchpu1D+Ojdl0ljYCJES7tLr56xGPUl9vSCl8X7TmAIgGRfcLPndqg5107OsvWXTOrT/U/J1UsCyEeyK1oKfyBw="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkQ+UtACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmquVQ//ehkFnsjqEuFyKpHr0vj1OCK/FPw0b6bYuUYk1EVNnWOnC826\r\nf+R/tG0ZNR0GKd3L0q/mOZNs1pK3jUzgdDwLJySsfvXdAA/LodtKSj0WgAa+\r\nYm97MIRCLPWa3kUo7t9bY0NO+G668l7JPgnaPCYtHlXGWZ2fF6VzvFhXQIOG\r\nnW7vq+VB/Ys7BElQM5zDmvxFEGPABuuoRHkLGS1gIpEuNP7yIKWqC0INSg1n\r\nEk9pxVQ+RqVqWiK9R7XzqtpiE2YVknwloikdizcQwWa9O4JkL6uLoW24DEwk\r\n1+vcDlC9r7EaYwbOJyp8fTaS2m+FjOeN5zJxHx9411BbhRBz+r6wQKs3cRnL\r\nFuX5SarrB/Am0zeYg4X8dk/jYGy5YkqVGIAcWxQ4mVyTV/EABwwvxltKrrhp\r\nxWZAdHR/zy+d3p2pVu5wTRRe1BTI9bjsFm9cR7baHaJVnCrWtgmdRRwfvw2r\r\n0if9vM6lEAMsoO3RESXOK/fBZ8iHYLwoAIq/PLsCbVRXJKLA/2M+oHBpFCod\r\nDlRewNem8Z/BvVJNdzxiSQPA7fFznbAgF+s7+DJXCHGWd+soF1uHhDyCQ+td\r\nAT+r+ekJSYPKFfsSy0tSVXK8/ZiIPROo9GsddY9jdkUa6GOAcdOiIj8qTG5x\r\nqXMx4L3mlzWk6ko4XlwnoBaXmYdH/tt2tyw=\r\n=X0oe\r\n-----END PGP SIGNATURE-----\r\n","size":12787,"noattachment":false,"key":"/buildcheck/-/buildcheck-0.0.6.tgz"},"_npmUser":{"name":"mscdex","email":"mscdex@mscdex.net"},"directories":{},"maintainers":[{"name":"mscdex","email":"mscdex@mscdex.net"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/buildcheck_0.0.6_1682171181677_0.4308727908755121"},"_hasShrinkwrap":false,"readme":"# Description\n\nBuild environment checking for [node.js](http://nodejs.org/).\n\nThis allows for autoconf-like functionality for node addons/build scripts.\n\n**Note:** Obsolete and/or exotic build environments or platforms not supported\nby node.js are not supported.\n\n## Requirements\n\n* [node.js](http://nodejs.org/) -- v10.0.0 or newer\n* Supported compilers:\n  * gcc\n  * clang\n  * MSVC 2013+ and Windows SDK 8.1+\n\n## Installation\n\n    npm install buildcheck\n\n## Examples\n\n### Check if a C function exists\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\nconsole.log(buildEnv.checkFunction('c', 'preadv2'));\n```\n\n### Check if a C header is usable\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\nconsole.log(buildEnv.checkHeader('c', 'linux/io_uring.h'));\n```\n\n### Try to compile some C code\n\n```js\n'use strict';\n\nconst BuildEnvironment = require('buildcheck');\n\nconst buildEnv = new BuildEnvironment();\n\n// Should be a successful compile\nconsole.log(buildEnv.tryCompile('c', 'int main() { return 0; }'));\n\n// Should be a failed compile\nconsole.log(buildEnv.tryCompile('c', 'int main() { return z; }'));\n```\n\n## API\n\n### Exports\n\nThe exported value is `BuildEnvironment`, the main class for dealing with a build environment.\n\n### BuildEnvironment\n\n#### Methods\n\n* **(constructor)**([< _object_ >config]) - Creates and returns a new BuildEnvironment instance. `config` may contain:\n\n  * **compilerC** - _string_ - C compiler command to use. *Note: this is ignored on Windows.* **Default:** `process.env.CC` or `'cc'`\n\n  * **compilerCXX** - _string_ - C++ compiler command to use. *Note: this is ignored on Windows.* **Default:** `process.env.CXX` or `'c++'`\n\n  * **msvs_version** - _mixed_ - A string or number containing the year of the Visual Studio compiler to use. *Note: this is for Windows only.* **Default:** newest version installed\n\n* **checkDeclared**(< _string_ >lang, < _string_ >symbolName[, < _object_ >options]) - _boolean_ - Checks if a symbol `symbolName` is declared where `lang` is either `'c'` or `'c++'`. Returns `true` if symbol exists, `false` otherwise. `options` may contain:\n\n  * **headers** - _array_ - A list of headers to try when checking if the symbol is declared. `checkFunction()` will always first try without a library. If not supplied, a default list of common (platform-specific) headers will be used.\n\n  * **searchLibs** - _array_ - A list of library names (without the `'-l'` prefix) to try when checking if the symbol is declared. `checkDeclared()` will always first try without a library.\n\n* **checkFunction**(< _string_ >lang, < _string_ >functionName[, < _object_ >options]) - _boolean_ - Checks if a function `functionName` exists and is linkable where `lang` is either `'c'` or `'c++'`. Returns `true` if function exists, `false` otherwise. `options` may contain:\n\n  * **searchLibs** - _array_ - A list of library names (without the `'-l'` prefix) to try when checking for this function. `checkFunction()` will always first try without a library.\n\n* **checkFeature**(< _string_ >featureName) - _mixed_ - Executes a special test for a \"feature\" and returns the result. Supported values for `featureName`:\n\n  * `'strerror_r'` - Returns an object containing:\n\n    * `declared` - _boolean_ - Whether `strerror_r()` is declared\n\n    * `returnsCharPtr` - _boolean_ - If `strerror_r()` is declared, whether it returns `char*` (a GNU extension) or not.\n\n* **checkHeader**(< _string_ >lang, < _string_ >headerName) - _boolean_ - Checks if the header `headerName` exists and is usable where `lang` is either `'c'` or `'c++'`. Returns `true` if the header exists and is usable, `false` otherwise.\n\n* **defines**([< _string_ >lang[, < _boolean_ >rendered]]) - _array_ - Returns a list of features, functions, headers, and symbols known to be defined by this build environment instance. `lang` is either `'c'` or `'c++'` If `lang` is not set, defines for both `'c'` and `'c++'` will be returned. If `rendered` is `true` (defaults to `false`), autoconf-style defines (e.g. \"HAVE_FOO=1\") will be returned instead. Defines coming from features utilize base strings/names from autoconf for better compatibility.\n\n* **libs**([< _string_ >lang]) - _array_ - Returns a list of (`'-l'`-prefixed) libraries known to be required for features and functions defined by this build environment instance. `lang` is either `'c'` or `'c++'` If `lang` is not set, defines for both `'c'` and `'c++'` will be returned.\n\n* **tryCompile**(< _string_ >lang, < _string_ >code[, < _array_ >compilerParams]) - _mixed_ - Attempts to compile `code` where `lang` is either `'c'` or `'c++'`. `compilerParams` is an optional array of compiler/linker flags to include. Returns `true` on successful compilation, or an _Error_ instance with an `output` property containing the compiler error output.\n","publish_time":1682171181873,"_cnpm_publish_time":1682171181873,"dist-tags":{"latest":"0.0.7"}}