mirror of
https://github.com/smogon/sprites.git
synced 2026-07-10 14:33:35 -05:00
Remove deflopt
This commit is contained in:
parent
472e6f4fd4
commit
fa162dc60c
|
|
@ -73,7 +73,6 @@ Build settings are configurable in `tup.config`.
|
|||
- `CONFIG_DEFAULT_OPTIPNG`: Command line to pass to `optipng`.
|
||||
- `CONFIG_DEFAULT_ADVPNG`: Command line to pass to `advpng`.
|
||||
- `CONFIG_DEFAULT_PNGQUANT`: Command line to pass to `pngquant`.
|
||||
- `CONFIG_DEFAULT_DEFLOPT`: `true`, `false`, or blank
|
||||
|
||||
There are src-specific versions of these settings:
|
||||
|
||||
|
|
@ -87,17 +86,12 @@ For example, these settings reflect the compression settings for the files chaos
|
|||
```
|
||||
CONFIG_DEFAULT_OPTIPNG=-o7
|
||||
CONFIG_DEFAULT_ADVPNG=-z4 -i5000
|
||||
CONFIG_DEFAULT_DEFLOPT=true
|
||||
```
|
||||
|
||||
## Gotchas
|
||||
|
||||
- Tup, like Git, tracks files, not directories. If you `readdir()` and forget to declare a dependency it won't catch it, like it would for `read()`. You can work around this by having build tools `stat()` any filenames they acquire.
|
||||
|
||||
- Using DeflOpt requires a custom build of tup. Checkout the repo and `git am vendor/tup-remove-fuse-context-check.patch`, and run with environment variable `TUP_NO_NAMESPACING=1`.
|
||||
|
||||
- DeflOpt performance can suffer under Wine due to repeatedly starting/shutting down `wineserver`. You can specify the server timeout with `wineserver -p<n>`, where `n` is the # of seconds (default 3). If you don't specify `n` it never shuts down. Sometimes wine will hang so you may want to instead pick something high like 30 seconds.
|
||||
|
||||
## License
|
||||
|
||||
All code in this repository is licensed under the [MIT License](https://opensource.org/licenses/MIT).
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ local function compressopts(program, copts)
|
|||
copts.pngquant = getconfig(program .. "_PNGQUANT") or copts.pngquant
|
||||
copts.optipng = getconfig(program .. "_OPTIPNG") or copts.optipng
|
||||
copts.advpng = getconfig(program .. "_ADVPNG") or copts.advpng
|
||||
copts.deflopt = booleanconfig(program .. "_DEFLOPT") or copts.deflopt
|
||||
end
|
||||
|
||||
function compresspng(opts)
|
||||
|
|
@ -49,11 +48,6 @@ function compresspng(opts)
|
|||
if copts.advpng then
|
||||
cmds += rep{"advpng -q ${opts} ${output}", opts=copts.advpng, output=output}
|
||||
end
|
||||
if copts.deflopt then
|
||||
cmds += rep{"node ${root}/tools/deflopt ${output}",
|
||||
root=ROOTDIR,
|
||||
output=output}
|
||||
end
|
||||
|
||||
return cmds
|
||||
end
|
||||
|
|
|
|||
|
|
@ -27,12 +27,6 @@ importers:
|
|||
dependencies:
|
||||
'@types/node': 14.10.1
|
||||
|
||||
tools/deflopt:
|
||||
specifiers:
|
||||
commander: ^6.1.0
|
||||
dependencies:
|
||||
commander: 6.1.0
|
||||
|
||||
tools/deploy:
|
||||
specifiers:
|
||||
commander: ^5.1.0
|
||||
|
|
@ -461,11 +455,6 @@ packages:
|
|||
engines: {node: '>= 6'}
|
||||
dev: false
|
||||
|
||||
/commander/6.1.0:
|
||||
resolution: {integrity: sha512-wl7PNrYWd2y5mp1OK/LhTlv8Ff4kQJQRXXAvF+uU/TPNiVJUxZLRYGj/B0y/lPGAVcSbJqH2Za/cvHmrPMC8mA==}
|
||||
engines: {node: '>= 6'}
|
||||
dev: false
|
||||
|
||||
/concat-map/0.0.1:
|
||||
resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=}
|
||||
dev: true
|
||||
|
|
|
|||
|
|
@ -1,53 +0,0 @@
|
|||
|
||||
import cp from 'child_process';
|
||||
import root from '@smogon/sprite-root';
|
||||
|
||||
/*
|
||||
Output looks something like:
|
||||
|
||||
*** DeflOpt V2.07 ***
|
||||
*** Built on Wed Sep 5 18:56:30 2007 ***
|
||||
*** Copyright (C) 2003-2007 by Ben Jos Walbeehm ***
|
||||
|
||||
|
||||
|
||||
|
||||
Number of files processed : 0
|
||||
Number of files rewritten : 0
|
||||
Total number of bytes saved: 0
|
||||
2,097,357 cycles.
|
||||
*/
|
||||
|
||||
const PROCESSED_RE = /Number of files processed : *([0-9]+)/;
|
||||
const REWRITTEN_RE = /Number of files rewritten : *([0-9]+)/;
|
||||
|
||||
function parse(re : RegExp, output : string) {
|
||||
const m = output.match(re);
|
||||
if (!m) {
|
||||
throw new Error(`Can't match output: ` + output);
|
||||
}
|
||||
const num = parseInt(m[1], 10);
|
||||
return num;
|
||||
}
|
||||
|
||||
const DEFLOPT_EXE = `${root}/vendor/DeflOpt.exe`;
|
||||
|
||||
export function deflopt(file : string) {
|
||||
file = file.replace(/\//g, "\\");
|
||||
|
||||
let cmd, args;
|
||||
if (process.platform === 'win32') {
|
||||
cmd = DEFLOPT_EXE;
|
||||
args = [file];
|
||||
} else {
|
||||
cmd = "wine";
|
||||
// DeflOpt doesn't like absolute paths, it thinks they are Windows-style
|
||||
// command line switches.
|
||||
args = [DEFLOPT_EXE, file];
|
||||
}
|
||||
|
||||
const output = cp.execFileSync(cmd, args, {encoding: 'utf8'});
|
||||
const processed = parse(PROCESSED_RE, output);
|
||||
const rewritten = parse(REWRITTEN_RE, output);
|
||||
return {processed, rewritten};
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
import program from 'commander';
|
||||
|
||||
import {deflopt} from './deflopt.js';
|
||||
|
||||
program
|
||||
.arguments('<file>')
|
||||
.action((file : string) => {
|
||||
const {processed, rewritten} = deflopt(file);
|
||||
if (processed !== 1) {
|
||||
console.error(`Didn't process any files.`);
|
||||
process.exit(1);
|
||||
}
|
||||
}).parse(process.argv);
|
||||
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"commander": "^6.1.0"
|
||||
},
|
||||
"main": "./dist/index.js"
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"extends": "../../tsconfig-base",
|
||||
"compilerOptions": {
|
||||
"outDir": "dist"
|
||||
},
|
||||
"references": [
|
||||
{"path": "../../lib/root"}
|
||||
]
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
"references": [
|
||||
{"path": "tools/tupctime"},
|
||||
{"path": "tools/deploy"},
|
||||
{"path": "tools/deflopt"},
|
||||
{"path": "tools/sheet"},
|
||||
{"path": "tools/trim"},
|
||||
{"path": "lib/root"},
|
||||
|
|
|
|||
BIN
vendor/DeflOpt.exe
vendored
BIN
vendor/DeflOpt.exe
vendored
Binary file not shown.
31
vendor/tup-remove-fuse-context-check.patch
vendored
31
vendor/tup-remove-fuse-context-check.patch
vendored
|
|
@ -1,31 +0,0 @@
|
|||
From aa0d590380db26d1669fb6368328c71cd9f389d1 Mon Sep 17 00:00:00 2001
|
||||
From: Christopher Monsanto <chris@monsan.to>
|
||||
Date: Tue, 15 Sep 2020 06:05:50 -0400
|
||||
Subject: [PATCH] Remove fuse context check
|
||||
|
||||
This allows using wine in build rules.
|
||||
---
|
||||
src/tup/server/fuse_fs.c | 7 -------
|
||||
1 file changed, 7 deletions(-)
|
||||
|
||||
diff --git a/src/tup/server/fuse_fs.c b/src/tup/server/fuse_fs.c
|
||||
index b8ff82c0..7867b18b 100644
|
||||
--- a/src/tup/server/fuse_fs.c
|
||||
+++ b/src/tup/server/fuse_fs.c
|
||||
@@ -290,13 +290,6 @@ static int context_check(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if(ourpgid != pgid) {
|
||||
- if(server_debug_enabled()) {
|
||||
- fprintf(stderr, "[33mtup fuse warning: Process pid=%i, uid=%i, gid=%i is trying to access the tup server's fuse filesystem.[0m\n",
|
||||
- fuse_get_context()->pid, fuse_get_context()->uid, fuse_get_context()->gid);
|
||||
- }
|
||||
- return -1;
|
||||
- }
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user