Skip to content

Commit 12f4726

Browse files
authored
Merge pull request #458 from n-riesco/fix-build-from-source
2 parents 39230da + f7a437b commit 12f4726

File tree

2 files changed

+18
-24
lines changed

2 files changed

+18
-24
lines changed

scripts/build_libzmq.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
if [ "$1" != "" ]; then
55
ZMQ=$1
66
else
7-
echo "No ZMQ version given"
7+
echo "build_libzmq.sh: No ZMQ version given"
88
exit 1
99
fi
1010

@@ -16,11 +16,14 @@ else
1616
export CXXFLAGS=-fPIC
1717
fi
1818

19+
echo "build_libzmq.sh: Building version $1 for architecture $2"
20+
1921
export MACOSX_DEPLOYMENT_TARGET=10.9
2022
export BASE=$(dirname "$0")
21-
export ZMQ_PREFIX="${BASE}/../zmq"
23+
24+
cd "${BASE}/../zmq"
25+
export ZMQ_PREFIX=$(pwd -P)
2226
export ZMQ_SRC_DIR=zeromq-$ZMQ
23-
cd "${ZMQ_PREFIX}"
2427

2528
export PKG_CONFIG_PATH="${ZMQ_PREFIX}/lib/pkgconfig"
2629

scripts/prepare.js

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,15 @@ if (process.env.npm_config_zmq_external == "true") {
1414

1515
function buildZMQ(scriptPath, zmqDir) {
1616
console.log("Building libzmq for " + process.platform);
17-
try {
18-
const child = spawnSync(scriptPath, [ZMQ, ARCH], {
19-
cwd: process.cwd(),
20-
env: process.env,
21-
stdio: ['inherit', 'inherit', 'pipe'],
22-
encoding: 'utf-8',
23-
});
24-
if (child.stderr) {
25-
return console.log(Error(child.stderr))
26-
}
27-
if (child.status !== 0) {
28-
return console.error("child process exited with code " + child.status);
29-
}
30-
} catch(e) {
31-
return console.error(e)
17+
const child = spawnSync("/bin/sh", [scriptPath, ZMQ, ARCH], {
18+
stdio: ['inherit', 'inherit', 'inherit'],
19+
});
20+
if (!child.status) {
21+
return console.error("child process exited with code " + child.status);
3222
}
23+
3324
const message = "Succesfully build libzmq on " + Date();
34-
try {
35-
fs.writeFileSync(path.join(zmqDir, "BUILD_SUCCESS"), message)
36-
} catch(err) {
37-
console.error(err.message);
38-
};
25+
fs.writeFileSync(path.join(zmqDir, "BUILD_SUCCESS"), message)
3926
}
4027

4128
function handleError(err) {
@@ -106,6 +93,10 @@ if (process.platform === "win32") {
10693
if (err) {
10794
handleError(err);
10895
}
109-
buildZMQ(SCRIPT_PATH, DIR_NAME);
96+
try {
97+
buildZMQ(SCRIPT_PATH, DIR_NAME);
98+
} catch (err) {
99+
handleError(err);
100+
}
110101
});
111102
}

0 commit comments

Comments
 (0)