-
Notifications
You must be signed in to change notification settings - Fork 46
/
install.js
42 lines (35 loc) · 1.02 KB
/
install.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
const path = require('path');
const BinBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
const args = [
'-copy', 'none',
'-optimize',
'-outfile', path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
path.join(__dirname, '../test/fixtures/test.jpg')
];
bin.run(args, err => {
if (err) {
log.warn(err.message);
log.warn('jpegtran pre-build test failed');
log.info('compiling from source');
const cfg = [
'./configure --disable-shared',
`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`
].join(' ');
const builder = new BinBuild()
.cmd('touch configure.ac aclocal.m4 configure Makefile.am Makefile.in')
.src('https://downloads.sourceforge.net/project/libjpeg-turbo/1.5.1/libjpeg-turbo-1.5.1.tar.gz')
.cmd(cfg)
.cmd('make install');
return builder.run(err => {
if (err) {
log.error(err.stack);
return;
}
log.success('jpegtran built successfully');
});
}
log.success('jpegtran pre-build test passed successfully');
});