Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ Options can be provided via (in order of precedence) the programmatic API, the C
| `--uv` | `PREBUILD_UV` | From `process.versions.uv` | Major libuv version\*\*\*
| `--armv` | `PREBUILD_ARMV` | Auto-detected on ARM machines | Numeric ARM version (e.g. 7)\*\*\*
| `--libc` | `PREBUILD_LIBC` | `glibc`, `musl` on Alpine | libc flavor\*\*\*
| `--tag-uv` | - | `false` | Tag prebuild with `uv`\*\*\*
| `--tag-armv` | - | `false` | Tag prebuild with `armv`\*\*\*
| `--tag-libc` | - | `false` | Tag prebuild with `libc`\*\*\*
| `--tag-uv` | `PREBUILD_TAG_UV` | `false` | Tag prebuild with `uv`\*\*\*
| `--tag-armv` | `PREBUILD_TAG_ARMV` | `false` | Tag prebuild with `armv`\*\*\*
| `--tag-libc` | `PREBUILD_TAG_LIBC` | `false` | Tag prebuild with `libc`\*\*\*
| `--preinstall` | - | - | Command to run before build
| `--postinstall` | - | - | Command to run after build
| `--shell` | `PREBUILD_SHELL` | `'sh'` on Android | Shell to spawn commands in
Expand Down
8 changes: 7 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ function prebuildify (opts, cb) {
stripBin: process.env.PREBUILD_STRIP_BIN || 'strip',
nodeGyp: process.env.PREBUILD_NODE_GYP || npmbin('node-gyp'),
shell: process.env.PREBUILD_SHELL || shell(),
tagUv: process.env.PREBUILD_TAG_UV === '1' ? true : process.env.PREBUILD_TAG_UV,
tagArmv: process.env.PREBUILD_TAG_ARMV === '1' ? true : process.env.PREBUILD_TAG_ARMV,
tagLibc: process.env.PREBUILD_TAG_LIBC === '1' ? true : process.env.PREBUILD_TAG_LIBC,
cwd: '.',
targets: []
}, opts)
Expand Down Expand Up @@ -53,7 +56,10 @@ function prebuildify (opts, cb) {
PREBUILD_STRIP: opts.strip ? '1' : '0',
PREBUILD_STRIP_BIN: opts.stripBin,
PREBUILD_NODE_GYP: opts.nodeGyp,
PREBUILD_SHELL: opts.shell
PREBUILD_SHELL: opts.shell,
PREBUILD_TAG_UV: opts.tagUv,
PREBUILD_TAG_ARMV: opts.tagArmv,
PREBUILD_TAG_LIBC: opts.tagLibc
}),
builds: path.join(opts.out, 'prebuilds', opts.platform + '-' + opts.arch),
output: path.join(opts.cwd, 'build', opts.debug ? 'Debug' : 'Release')
Expand Down
25 changes: 25 additions & 0 deletions test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,31 @@ test('uv, armv and libc tags', function (t) {
})
})

test('uv, armv and libc tags from env var', function (t) {
process.env.PREBUILD_TAG_UV = '321'
process.env.PREBUILD_TAG_ARMV = '1' // Should be excluded (unless you run these tests on ARM)
process.env.PREBUILD_TAG_LIBC = '1' // Should be glibc (unless you run these tests on Alpine)
prebuildify({
cwd: path.join(__dirname, 'package'),
targets: [{ runtime: 'node', target: process.version }]
}, function (err) {
t.ifError(err)
t.doesNotThrow(function () {
var folder = os.platform() + '-' + os.arch()
var name = [
'node',
'abi' + process.versions.modules,
'uv321',
'glibc',
'node'
].join('.')
var addon = require(path.join(__dirname, 'package', 'prebuilds', folder, name))
t.equal(addon.check(), 'prebuildify')
})
t.end()
})
})

gt8 && test('prefers locally installed node-gyp bin', function (t) {
prebuildify({
cwd: path.join(__dirname, 'mock-gyp'),
Expand Down