CMaps binary packing

This commit is contained in:
Yury Delendik 2014-03-14 13:22:02 -05:00
parent e5cd75083f
commit 69efd9cb96
13 changed files with 1156 additions and 35 deletions

42
make.js
View file

@ -90,6 +90,7 @@ var COMMON_WEB_FILES =
target.generic = function() {
target.bundle({});
target.locale();
target.cmaps();
cd(ROOT_DIR);
echo();
@ -107,10 +108,10 @@ target.generic = function() {
copy: [
[COMMON_WEB_FILES, GENERIC_DIR + '/web'],
['external/webL10n/l10n.js', GENERIC_DIR + '/web'],
['external/cmaps/', GENERIC_DIR + '/web/cmaps'],
['web/viewer.css', GENERIC_DIR + '/web'],
['web/compatibility.js', GENERIC_DIR + '/web'],
['web/compressed.tracemonkey-pldi-09.pdf', GENERIC_DIR + '/web'],
['web/cmaps', GENERIC_DIR + '/web'],
['web/locale', GENERIC_DIR + '/web']
],
preprocess: [
@ -228,6 +229,25 @@ target.locale = function() {
chromeManifestContent.to(CHROME_MANIFEST_OUTPUT);
};
//
// make cmaps
// Compresses cmap files
//
target.cmaps = function (args) {
var CMAP_INPUT = 'external/cmaps';
var VIEWER_CMAP_OUTPUT = 'web/cmaps';
cd(ROOT_DIR);
echo();
echo('### Building cmaps');
rm('-rf', VIEWER_CMAP_OUTPUT);
mkdir('-p', VIEWER_CMAP_OUTPUT);
var compressCmaps =
require('./external/cmapscompress/compress.js').compressCmaps;
compressCmaps(CMAP_INPUT, VIEWER_CMAP_OUTPUT, true);
};
//
// make bundle
// Bundles all source files into one wrapper 'pdf.js' file, in the given order.
@ -410,6 +430,7 @@ target.minified = function() {
target.bundle({});
target.locale();
target.cmaps();
cd(ROOT_DIR);
echo();
@ -428,6 +449,7 @@ target.minified = function() {
[COMMON_WEB_FILES, MINIFIED_DIR + '/web'],
['web/viewer.css', MINIFIED_DIR + '/web'],
['web/compressed.tracemonkey-pldi-09.pdf', MINIFIED_DIR + '/web'],
['web/cmaps', MINIFIED_DIR + '/web'],
['web/locale', MINIFIED_DIR + '/web']
],
preprocess: [
@ -492,6 +514,7 @@ target.extension = function() {
echo('### Building extensions');
target.locale();
target.cmaps();
target.firefox();
target.chromium();
};
@ -544,6 +567,7 @@ target.firefox = function() {
FIREFOX_AMO_EXTENSION_NAME = 'pdf.js.amo.xpi';
target.locale();
target.cmaps();
target.bundle({ excludes: ['core/network.js'], defines: defines });
cd(ROOT_DIR);
@ -574,7 +598,7 @@ target.firefox = function() {
defines: defines,
copy: [
[COMMON_WEB_FILES, FIREFOX_BUILD_CONTENT_DIR + '/web'],
['external/cmaps/', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps'],
['web/cmaps/', FIREFOX_BUILD_CONTENT_DIR + '/web/cmaps'],
[FIREFOX_EXTENSION_DIR + 'tools/l10n.js',
FIREFOX_BUILD_CONTENT_DIR + '/web'],
['web/default_preferences.js', FIREFOX_BUILD_CONTENT_DIR]
@ -691,7 +715,7 @@ target.mozcentral = function() {
defines: defines,
copy: [
[COMMON_WEB_FILES, MOZCENTRAL_CONTENT_DIR + '/web'],
['external/cmaps/', MOZCENTRAL_CONTENT_DIR + '/web/cmaps'],
['web/cmaps/', MOZCENTRAL_CONTENT_DIR + '/web/cmaps'],
['extensions/firefox/tools/l10n.js', MOZCENTRAL_CONTENT_DIR + '/web'],
['web/default_preferences.js', MOZCENTRAL_CONTENT_DIR]
],
@ -746,6 +770,7 @@ target.mozcentral = function() {
target.b2g = function() {
target.locale();
target.cmaps();
echo();
echo('### Building B2G (Firefox OS App)');
@ -763,10 +788,10 @@ target.b2g = function() {
var setup = {
defines: defines,
copy: [
['external/cmaps/', B2G_BUILD_CONTENT_DIR + '/web/cmaps'],
['extensions/b2g/images', B2G_BUILD_CONTENT_DIR + '/web'],
['extensions/b2g/viewer.html', B2G_BUILD_CONTENT_DIR + '/web'],
['extensions/b2g/viewer.css', B2G_BUILD_CONTENT_DIR + '/web'],
['web/cmaps/', B2G_BUILD_CONTENT_DIR + '/web/cmaps'],
['web/locale', B2G_BUILD_CONTENT_DIR + '/web'],
['external/webL10n/l10n.js', B2G_BUILD_CONTENT_DIR + '/web']
],
@ -784,6 +809,9 @@ target.b2g = function() {
// make chrome
//
target.chromium = function() {
target.locale();
target.cmaps();
cd(ROOT_DIR);
echo();
echo('### Building Chromium extension');
@ -804,7 +832,6 @@ target.chromium = function() {
var setup = {
defines: defines,
copy: [
['external/cmaps/', CHROME_BUILD_CONTENT_DIR + '/web/cmaps'],
[COMMON_WEB_FILES, CHROME_BUILD_CONTENT_DIR + '/web'],
[['extensions/chromium/*.json',
'extensions/chromium/*.html',
@ -814,6 +841,7 @@ target.chromium = function() {
CHROME_BUILD_DIR],
['external/webL10n/l10n.js', CHROME_BUILD_CONTENT_DIR + '/web'],
['web/viewer.css', CHROME_BUILD_CONTENT_DIR + '/web'],
['web/cmaps/', CHROME_BUILD_CONTENT_DIR + '/web/cmaps'],
['web/locale', CHROME_BUILD_CONTENT_DIR + '/web']
],
preprocess: [
@ -931,6 +959,8 @@ target.test = function() {
// (Special tests for the Github bot)
//
target.bottest = function() {
target.cmaps();
target.unittest({}, function() {
target.fonttest({}, function() {
target.browsertest({noreftest: true});
@ -1011,6 +1041,8 @@ target.fonttest = function(options, callback) {
// make botmakeref
//
target.botmakeref = function() {
target.cmaps();
cd(ROOT_DIR);
echo();
echo('### Creating reference images');