You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install.js 843B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const path = require('path');
  3. const binBuild = require('bin-build');
  4. const log = require('logalot');
  5. const bin = require('.');
  6. (async () => {
  7. try {
  8. await bin.run(['--version']);
  9. log.success('optipng pre-build test passed successfully');
  10. } catch (error) {
  11. log.warn(error.message);
  12. log.warn('optipng pre-build test failed');
  13. log.info('compiling from source');
  14. try {
  15. // From https://sourceforge.net/projects/optipng/files/OptiPNG/
  16. await binBuild.file(path.resolve(__dirname, '../vendor/source/optipng.tar.gz'), [
  17. `./configure --with-system-zlib --prefix="${bin.dest()}" --bindir="${bin.dest()}"`,
  18. 'make install'
  19. ]);
  20. log.success('optipng built successfully');
  21. } catch (error) {
  22. log.error(error.stack);
  23. // eslint-disable-next-line unicorn/no-process-exit
  24. process.exit(1);
  25. }
  26. }
  27. })();