Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Build leveldown if ia32
Browse files Browse the repository at this point in the history
Fix #7915

Auditors: @aekeus

leveldown uses prebuild and installs prebuilt binaries.  But it doesn't check the env variable properly, or it was uploaded wrongly.  This forces a rebuild if it is ia32
  • Loading branch information
bbondy committed Mar 28, 2017
1 parent 0e155af commit 3092401
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
8 changes: 3 additions & 5 deletions tools/cibuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import subprocess
import sys
import os.path

MUON_VERSION = '2.57.6'
CHROMEDRIVER_VERSION = '2.27'
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
Expand All @@ -21,7 +20,6 @@ def execute(argv, env=os.environ):
print e.output
raise e


def write_npmrc():
data = 'runtime = node\n' \
'target_arch = %s\n' \
Expand Down Expand Up @@ -72,10 +70,10 @@ def run_script(script, args=[]):
npm = 'npm.cmd' if is_windows else 'npm'
execute([npm, 'install'])

if is_darwin:
execute(['node', './tools/electronBuilderHack.js'])
execute(['node', './tools/electronBuilderHack.js'])

# For whatever reason on linux pstinstall webpack isn't running
elif is_linux:
if is_linux:
execute([npm, 'run', 'webpack'])

execute([npm, 'run', 'build-package'])
Expand Down
44 changes: 30 additions & 14 deletions tools/electronBuilderHack.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,40 @@
var os = require('os')
var path = require('path')
var execute = require('./lib/execute')
const os = require('os')
const path = require('path')
const execute = require('./lib/execute')

console.log('Patching electron-builder native modules, please wait...')

var braveGyp = path.join(os.homedir(), '.brave-gyp')
var env = {
const braveGyp = path.join(os.homedir(), '.brave-gyp')
const env = {
HOME: braveGyp,
APPDATA: braveGyp
}

var rebuildCmd = '"../.bin/node-gyp" rebuild'
const rebuildCmd = '"../.bin/node-gyp" rebuild'

var cmds = [
'cp .npmrc ./node_modules/macos-alias',
'cp .npmrc ./node_modules/fs-xattr',
'cd ./node_modules/macos-alias',
rebuildCmd,
'cd ../fs-xattr',
rebuildCmd
]
const isDarwin = process.platform === 'darwin'

const cmds = []
if (process.env.TARGET_ARCH === 'ia32') {
cmds.push(
'cp .npmrc ./node_modules/leveldown',
'cd ./node_modules/leveldown',
// leveldown prebuild isn't respecting the npm_config_arch env
// for some reason, so always compile it.
'npm run rebuild'
)
}

if (isDarwin) {
cmds.push(
'cd ..',
'cp .npmrc ./node_modules/macos-alias',
'cp .npmrc ./node_modules/fs-xattr',
'cd ./node_modules/macos-alias',
rebuildCmd,
'cd ../fs-xattr',
rebuildCmd
)
}

execute(cmds, env, console.log.bind(null, 'done'))

1 comment on commit 3092401

@aekeus
Copy link
Member

@aekeus aekeus commented on 3092401 Mar 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.