feat: update to SRT lib version 1.4.4 (#43)

Including:
- Updated SRT lib version to 1.4.4
- Building on Darwin arm64
- Obtain OPENSSL root using brew --prefix openssl
- Updated to latest node-addon-api and node-gyp
This commit is contained in:
Jonas Birmé 2022-11-10 16:50:48 +01:00 committed by GitHub
parent d9fd701dd9
commit 3ecb83ba6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1155 additions and 1394 deletions

View file

@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
node-version: [14.x, 16.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test

2504
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -44,8 +44,8 @@
"debug": "^4.1.1",
"del": "^5.1.0",
"git-clone": "^0.1.0",
"node-addon-api": "^3.0.0",
"node-gyp": "^7.0.0"
"node-addon-api": "^5.0.0",
"node-gyp": "^9.3.0"
},
"bugs": {
"url": "https://github.com/Eyevinn/node-srt/issues"

View file

@ -7,12 +7,12 @@ const fs = require('fs');
const process = require('process');
const clone = require('git-clone');
const del = require('del');
const { spawnSync } = require('child_process');
const { spawnSync, execSync } = require('child_process');
const os = require('os');
const env = process.env;
const SRT_REPO = env.NODE_SRT_REPO || "https://github.com/Haivision/srt.git";
const SRT_CHECKOUT = "v1.4.2";
const SRT_CHECKOUT = "v1.4.4";
const srtRepoPath = env.NODE_SRT_LOCAL_REPO ? `file://${path.join(__dirname, env.NODE_SRT_LOCAL_REPO)}` : SRT_REPO;
const srtCheckout = env.NODE_SRT_CHECKOUT || SRT_CHECKOUT;
@ -23,7 +23,7 @@ const buildDir = path.join(depsPath, 'build'); // FIXME: name this srt-build (in
const numCpus = os.cpus().length; // NOTE: not the actual physical cores amount btw, see https://www.npmjs.com/package/physical-cpu-count
if (!fs.existsSync(depsPath)) {
console.log('Creating dir:', depsPath)
console.log('Creating dir:', depsPath);
fs.mkdirSync(depsPath);
}
@ -36,6 +36,12 @@ if (!fs.existsSync(srtSourcePath)) {
if (fs.existsSync(srtSourcePath)) del.sync(srtSourcePath);
process.exit(1);
}
console.log("Patch build script");
const patch = spawnSync('patch', [ 'configure-data.tcl', '<', '../../scripts/configure-data.tcl.patch' ], { cwd: srtSourcePath, shell: true, stdio: 'inherit' });
if (patch.status) {
process.exit(patch.status);
}
build();
});
@ -45,10 +51,16 @@ if (!fs.existsSync(srtSourcePath)) {
function build() {
console.log('Building SRT SDK and prerequisites for current platform:', process.platform);
let opensslRoot;
switch (process.platform) {
case "win32":
buildWin32();
break;
case "darwin":
opensslRoot = execSync('brew --prefix openssl').toString().trim();
process.env.OPENSSL_ROOT_DIR = opensslRoot;
buildNx();
break;
default:
buildNx();
}

View file

@ -0,0 +1,17 @@
diff --git a/configure-data.tcl b/configure-data.tcl
index 5c0ee2e..ebca78e 100644
--- a/configure-data.tcl
+++ b/configure-data.tcl
@@ -372,9 +372,10 @@ proc postprocess {} {
if { $er } {
error "You must have OpenSSL installed from 'brew' tool. The standard Mac version is inappropriate."
}
+ set prefix [exec brew --prefix openssl]
- lappend ::cmakeopt "-DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include"
- lappend ::cmakeopt "-DOPENSSL_LIBRARIES=/usr/local/opt/openssl/lib/libcrypto.a"
+ lappend ::cmakeopt "-DOPENSSL_INCLUDE_DIR=$prefix/include"
+ lappend ::cmakeopt "-DOPENSSL_LIBRARIES=$prefix/lib/libcrypto.a"
}
}
}