mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Jake: Add jake files and package.json
This commit is contained in:
parent
80a824bf14
commit
dc8485bd17
6 changed files with 226 additions and 0 deletions
4
Jakefile
Normal file
4
Jakefile
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
'use strict';
|
||||
|
||||
desc('Default task');
|
||||
task('default', ['fetch:precompiled'], function () {});
|
||||
65
jakelib/build.jake
Normal file
65
jakelib/build.jake
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
var fs = require('fs-extra');
|
||||
|
||||
namespace('build', function () {
|
||||
task('generate', {async: true}, function () {
|
||||
var opts = 'use_gold=false is_debug=false rtc_include_tests=false';
|
||||
|
||||
process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH;
|
||||
process.chdir('src');
|
||||
jake.exec('gn gen out/Default --args=\'' + opts + '\'', function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('ninja', ['build:generate'], {async: true}, function () {
|
||||
var packages = 'libjingle_peerconnection field_trial_default metrics_default';
|
||||
|
||||
console.log('Building WebRTC...');
|
||||
jake.exec('ninja -C out/Default ' + packages, { printStdout: true }, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('merge', ['build:ninja'], {async: true}, function () {
|
||||
var prefix = os.platform() !== 'windows' ? 'lib' : '';
|
||||
var suffix = os.platform() === 'windows' ? '.lib' : '.a';
|
||||
var path = '../lib/' + prefix + 'webrtc' + suffix;
|
||||
|
||||
console.log('Merging libraries...');
|
||||
|
||||
if (!fs.existsSync('../lib')) {
|
||||
fs.mkdir('../lib');
|
||||
}
|
||||
|
||||
jake.exec('python webrtc/build/merge_libs.py out/Default ' + path, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('include', ['build:merge'], function () {
|
||||
var fileList = new jake.FileList();
|
||||
var files;
|
||||
|
||||
console.log('Copying include files...');
|
||||
if (!fs.existsSync('../include')) {
|
||||
fs.mkdir('../include');
|
||||
}
|
||||
|
||||
fileList.include('webrtc/**/*.h');
|
||||
files = fileList.toArray();
|
||||
|
||||
for (var file in files) {
|
||||
fs.copySync(files[file], '../include/' + files[file]);
|
||||
}
|
||||
});
|
||||
|
||||
task('default', [
|
||||
'generate',
|
||||
'ninja',
|
||||
'merge',
|
||||
'include'
|
||||
], function () {});
|
||||
});
|
||||
22
jakelib/common.js
Normal file
22
jakelib/common.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
var pkg = require('../package.json');
|
||||
|
||||
function getPackageName() {
|
||||
var version = pkg.version;
|
||||
var platform = os.platform();
|
||||
var arch = os.arch();
|
||||
var nodever = process.version;
|
||||
var suffix = (platform === 'windows') ? '.zip' : '.tar.gz';
|
||||
|
||||
return pkg.config.filename
|
||||
.replace('{VERSION}', version)
|
||||
.replace('{PLATFORM}', platform)
|
||||
.replace('{ARCH}', arch)
|
||||
.replace('{NODEVER}', nodever) + suffix;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getPackageName: getPackageName
|
||||
};
|
||||
87
jakelib/fetch.jake
Normal file
87
jakelib/fetch.jake
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
'use strict';
|
||||
|
||||
var download = require('download');
|
||||
var getPackageName = require('./common').getPackageName;
|
||||
var os = require('os');
|
||||
var pkg = require('../package.json');
|
||||
|
||||
var WebRTCUrl = pkg.config.webrtc.url;
|
||||
var WebRTCRev = pkg.config.webrtc.revision;
|
||||
var ChromiumUrl = pkg.config.chromium.url;
|
||||
|
||||
namespace('fetch', function () {
|
||||
task('precompiled', {async: true}, function () {
|
||||
var packageName = getPackageName();
|
||||
var url = pkg.config.url + '/' + pkg.version + '/' + packageName;
|
||||
|
||||
console.log('Downloading', url);
|
||||
download(url, '.')
|
||||
.then(function () {
|
||||
console.log('Extracting', packageName);
|
||||
jake.exec('tar xf ' + packageName, function () {
|
||||
console.log('Done');
|
||||
complete();
|
||||
});
|
||||
})
|
||||
.catch(function (err) {
|
||||
var task = jake.Task['fetch:source'];
|
||||
|
||||
console.log('Failed, building libwebrtc from source.');
|
||||
task.addListener('complete', function () {
|
||||
console.log('Build done.');
|
||||
complete();
|
||||
});
|
||||
|
||||
task.invoke();
|
||||
});
|
||||
});
|
||||
|
||||
task('gclient', {async: true}, function () {
|
||||
console.log('Updating submodules...');
|
||||
jake.exec(['git submodule init', 'git submodule update'], {printStdout: true}, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('configure', ['fetch:gclient'], {async: true}, function () {
|
||||
console.log('Configuring gclient to fetch WebRTC code');
|
||||
process.env.PATH = process.cwd() + '/Dependencies/depot_tools:' + process.env.PATH;
|
||||
jake.exec('gclient config --name src ' + WebRTCUrl, {printStdout: true}, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('sync', ['fetch:configure'], {async: true}, function () {
|
||||
console.log('Retrieving WebRTC source code');
|
||||
jake.exec('gclient sync --revision ' + WebRTCRev + ' -n -D', {printStdout: true}, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('chromium', ['fetch:sync'], {async: true}, function () {
|
||||
console.log('Retrieving Chromium dependencies');
|
||||
jake.exec('git clone ' + ChromiumUrl + ' src/chromium/src', { breakOnError: false, printStdout: true }, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('clang', ['fetch:chromium'], {async: true}, function () {
|
||||
console.log('Updating clang');
|
||||
jake.exec('python src/chromium/src/tools/clang/scripts/update.py', {printStdout: true}, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('links', ['fetch:clang'], {async: true}, function () {
|
||||
console.log('Creating symbolic links');
|
||||
jake.exec('python src/setup_links.py', {printStdout: true}, function () {
|
||||
complete();
|
||||
});
|
||||
});
|
||||
|
||||
task('source', [
|
||||
'links',
|
||||
'build:default'
|
||||
], function () {
|
||||
});
|
||||
});
|
||||
15
jakelib/package.jake
Normal file
15
jakelib/package.jake
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
var os = require('os');
|
||||
var getPackageName = require('./common').getPackageName;
|
||||
|
||||
task('package', {async: true}, function () {
|
||||
var packageName = getPackageName();
|
||||
|
||||
console.log('Creating ' + packageName + '...');
|
||||
if (os.platform() !== 'windows') {
|
||||
jake.exec('tar cfz ' + packageName + ' include lib', function () {
|
||||
complete();
|
||||
});
|
||||
}
|
||||
});
|
||||
33
package.json
Normal file
33
package.json
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "libwebrtc-src",
|
||||
"version": "0.0.1-rc.1",
|
||||
"description": "libwebrtc source code",
|
||||
"main": "index.js",
|
||||
"config": {
|
||||
"filename": "libwebrtc-{VERSION}-{PLATFORM}-{ARCH}",
|
||||
"url": "https://github.com/aisouard/libwebrtc/releases/download",
|
||||
"webrtc": {
|
||||
"url": "https://chromium.googlesource.com/external/webrtc.git",
|
||||
"revision": "7502401788fcba5c9f81a9e4701e2f0831e78698"
|
||||
},
|
||||
"chromium": {
|
||||
"url": "https://github.com/aisouard/libwebrtc-chromium-deps.git"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"install": "jake",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com//aisouard/libwebrtc"
|
||||
},
|
||||
"author": "Axel Isouard <axel@isouard.fr>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"download": "^5.0.2",
|
||||
"fs-extra": "^0.30.0",
|
||||
"jake": "^8.0.14",
|
||||
"npm": "^3.10.8"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue