diff --git a/README.md b/README.md index 31741110..621946df 100644 --- a/README.md +++ b/README.md @@ -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`, 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). diff --git a/Tuprules.lua b/Tuprules.lua index 1704dcd7..34bc98e9 100644 --- a/Tuprules.lua +++ b/Tuprules.lua @@ -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 diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a4e41152..dbf40b8a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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 diff --git a/tools/deflopt/deflopt.ts b/tools/deflopt/deflopt.ts deleted file mode 100644 index f9dde8d3..00000000 --- a/tools/deflopt/deflopt.ts +++ /dev/null @@ -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}; -} diff --git a/tools/deflopt/index.ts b/tools/deflopt/index.ts deleted file mode 100644 index 2b5c3f06..00000000 --- a/tools/deflopt/index.ts +++ /dev/null @@ -1,15 +0,0 @@ - -import program from 'commander'; - -import {deflopt} from './deflopt.js'; - -program - .arguments('') - .action((file : string) => { - const {processed, rewritten} = deflopt(file); - if (processed !== 1) { - console.error(`Didn't process any files.`); - process.exit(1); - } - }).parse(process.argv); - diff --git a/tools/deflopt/package.json b/tools/deflopt/package.json deleted file mode 100644 index 00f1ae3b..00000000 --- a/tools/deflopt/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "module", - "dependencies": { - "commander": "^6.1.0" - }, - "main": "./dist/index.js" -} diff --git a/tools/deflopt/tsconfig.json b/tools/deflopt/tsconfig.json deleted file mode 100644 index 3ab3b81b..00000000 --- a/tools/deflopt/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig-base", - "compilerOptions": { - "outDir": "dist" - }, - "references": [ - {"path": "../../lib/root"} - ] -} diff --git a/tsconfig-workspace.json b/tsconfig-workspace.json index ff801c21..e4d2de53 100644 --- a/tsconfig-workspace.json +++ b/tsconfig-workspace.json @@ -3,7 +3,6 @@ "references": [ {"path": "tools/tupctime"}, {"path": "tools/deploy"}, - {"path": "tools/deflopt"}, {"path": "tools/sheet"}, {"path": "tools/trim"}, {"path": "lib/root"}, diff --git a/vendor/DeflOpt.exe b/vendor/DeflOpt.exe deleted file mode 100644 index 7f0cd4ca..00000000 Binary files a/vendor/DeflOpt.exe and /dev/null differ diff --git a/vendor/tup-remove-fuse-context-check.patch b/vendor/tup-remove-fuse-context-check.patch deleted file mode 100644 index 1a5275a9..00000000 --- a/vendor/tup-remove-fuse-context-check.patch +++ /dev/null @@ -1,31 +0,0 @@ -From aa0d590380db26d1669fb6368328c71cd9f389d1 Mon Sep 17 00:00:00 2001 -From: Christopher Monsanto -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, "tup fuse warning: Process pid=%i, uid=%i, gid=%i is trying to access the tup server's fuse filesystem.\n", -- fuse_get_context()->pid, fuse_get_context()->uid, fuse_get_context()->gid); -- } -- return -1; -- } - return 0; - } - --- -2.25.1 -