{"name":"buildcheck","version":"0.0.5","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.5","_integrity":"sha512-jYWpRy8eedl/JZqkOeq0X0bNcaK04hXKhIi4gYsDKZUJWRjJJWViYfsMXO0BJQ40zSLcdLoa+iqe48Kz2PtQag==","_resolved":"https://github.com/mscdex/buildcheck/tarball/v0.0.5","_from":"https://github.com/mscdex/buildcheck/tarball/v0.0.5","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-jYWpRy8eedl/JZqkOeq0X0bNcaK04hXKhIi4gYsDKZUJWRjJJWViYfsMXO0BJQ40zSLcdLoa+iqe48Kz2PtQag==","shasum":"5b7c0830b25dc61422032eeb5c18bfcaa9eebb8d","tarball":"http://registry-npm.ywwl.com/buildcheck/download/buildcheck-0.0.5.tgz","fileCount":17,"unpackedSize":44886,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1ljJiGx1K4Ar/cB6LCsHMWJi9AM2Zfu+3mMp/XA2VPwIgS82qmrtHgC1z9/BJxRN7Ip0dynKmtKc5/r2NmR1fR4E="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkNUFcACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoEbA//RO4ae4JLB3aTpU5QADlYChO/uIoLu1Ylit0DWPYMmIpPce3s\r\nim1O5UZ3sI+sZj+S0UCK6eCrcUAMsah0bP1WKEWmrnh4PYds9GLWv+C3z05a\r\nNnllZLQz631uh1zkYCnEtEhANqZcAalbsFQ+CU4b8D97MaUWrXth90oGOPFH\r\nzCrwzgd6fZcIgp+4Qrxofj138FdC5Q4Z4IVqKJIoOSlynSDODM3PmfiRRQDN\r\nz6SRmzBLqh+6PUX9RZmNwmEka4wGfVBulNO47REmhf/k+KlJWwpv3cDztzeX\r\n19WmF2+reCeKSK2qC5Zyu6Mb7bhxQf1uAOaPkTU+l+ypeYmnxnSTWKwPPr5T\r\nr+yH9WXLG00Qxx326dCvTasvO1elOjolGM83KB+PKTbNFNtf2e6/RH2huDUS\r\nlp6hC1mkmDnEtKxswaO3rANzVXbeNQjjNLJaPWgD+zTcxvmghSX1mrdlvrb4\r\nWtBhwD8/whxoK/dEDNWiTnfAmzBiK3ljmzAIx+j0zc0LWxs9m8vpwHNrrgcO\r\nlt2yDGfnKS64Kmg8Lgs6wa8jTh9wZdTZiCMTpGhzZpe4f0RAJWnHdVBr0a8r\r\nCgeY7obAy9Ujo1GjAT2GOSYf8+xqPrkF3BAK7o+WPmhwy8+cMyJnwUwqpUu0\r\nM/GFlLKFWu/sxlVPw8E5UTXby53TOILlJOU=\r\n=Cp7u\r\n-----END PGP SIGNATURE-----\r\n","size":12690,"noattachment":false,"key":"/buildcheck/-/buildcheck-0.0.5.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.5_1681211740366_0.12050911821167953"},"_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":1681211740558,"_cnpm_publish_time":1681211740558,"dist-tags":{"latest":"0.0.7"}}