-
Notifications
You must be signed in to change notification settings - Fork 52
/
install.js
36 lines (31 loc) · 935 Bytes
/
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
import process from 'node:process';
import {fileURLToPath} from 'node:url';
import binBuild from 'bin-build';
import bin from './index.js';
(async () => {
try {
await bin.run(['--version']);
console.log('gifsicle pre-build test passed successfully');
} catch (error) {
console.warn(error.message);
console.warn('gifsicle pre-build test failed');
console.info('compiling from source');
const config = [
'./configure --disable-gifview --disable-gifdiff',
`--prefix="${bin.dest()}" --bindir="${bin.dest()}"`,
].join(' ');
try {
const source = fileURLToPath(new URL('../vendor/source/gifsicle-1.93.tar.gz', import.meta.url));
await binBuild.file(source, [
'autoreconf -ivf',
config,
'make install',
]);
console.log('gifsicle built successfully');
} catch (error) {
console.error(error.stack);
// eslint-disable-next-line unicorn/no-process-exit
process.exit(1);
}
}
})();