Skip to content

Commit

Permalink
Merge pull request #55 from lovell/detect-libc
Browse files Browse the repository at this point in the history
Add detection for non-glibc libc on Linux
  • Loading branch information
ralphtheninja committed Jan 23, 2018
2 parents 28c600e + 311d1ac commit 80b330b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -19,6 +19,7 @@
"devops"
],
"dependencies": {
"detect-libc": "^1.0.3",
"expand-template": "^1.0.2",
"github-from-package": "0.0.0",
"minimist": "^1.2.0",
Expand Down
5 changes: 4 additions & 1 deletion rc.js
@@ -1,8 +1,11 @@
var minimist = require('minimist')
var getAbi = require('node-abi').getAbi
var detectLibc = require('detect-libc')

var env = process.env

var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''

// Get `prebuild-install` arguments that were passed to the `npm` command
if (env.npm_config_argv) {
var npmargs = ['prebuild', 'compile', 'build-from-source', 'debug']
Expand All @@ -29,7 +32,7 @@ module.exports = function (pkg) {
target: pkgConf.target || env.npm_config_target || process.versions.node,
runtime: pkgConf.runtime || env.npm_config_runtime || 'node',
arch: pkgConf.arch || env.npm_config_arch || process.arch,
libc: env.LIBC,
libc: libc,
platform: env.npm_config_platform || process.platform,
debug: false,
force: false,
Expand Down
4 changes: 3 additions & 1 deletion test/rc-test.js
Expand Up @@ -13,7 +13,8 @@ test('custom config and aliases', function (t) {
'--help',
'--path ../some/other/path',
'--target 1.4.10',
'--runtime electron'
'--runtime electron',
'--libc testlibc'
]
runRc(t, args.join(' '), {}, function (rc) {
t.equal(rc.arch, 'ARCH', 'correct arch')
Expand All @@ -32,6 +33,7 @@ test('custom config and aliases', function (t) {
t.equal(rc.target, rc.t, 'target alias')
t.equal(rc.runtime, 'electron', 'correct runtime')
t.equal(rc.runtime, rc.r, 'runtime alias')
t.equal(rc.libc, 'testlibc', 'libc family')
t.equal(rc.abi, '50', 'correct ABI')
t.end()
})
Expand Down

0 comments on commit 80b330b

Please sign in to comment.