From: Ian Jackson Date: Thu, 13 May 2021 00:50:37 +0000 (+0100) Subject: config: Provide libexec_dir and usvg_bin X-Git-Tag: otter-0.6.0~316 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=26d5bb3ca090e6eade1649f2d32b7032f13fb4c1;p=otter.git config: Provide libexec_dir and usvg_bin Signed-off-by: Ian Jackson --- diff --git a/Makefile b/Makefile index 9461ac4e..3fba3625 100644 --- a/Makefile +++ b/Makefile @@ -390,6 +390,7 @@ DEPLOY_FINISH=/home/Otter/etc/deploy-finish for-deploy: stamp/cargo.deploy-build deploy: for-deploy bundled-sources assets libraries rsync -zv --progress $(addprefix $(DEPLOY_TARGET_DIR)/,$(PROGRAMS)) $(DEPLOY_BASE)/bin/ + rsync -zv --progress $(TARGET_DIR)/release/usvg $(DEPLOY_BASE)/libexec/ rsync -rv --progress $(TARGET_DIR)/bundled-sources/. $(DEPLOY_BASE)/bundled-sources rsync -r README.md $(DEPLOY_BASE)/. rsync -r --delete --exclude=\*~ library specs $(DEPLOY_BASE)/. diff --git a/apitest/apitest.rs b/apitest/apitest.rs index c5fd1da9..7fa9474b 100644 --- a/apitest/apitest.rs +++ b/apitest/apitest.rs @@ -609,6 +609,8 @@ nwtemplate_dir = "@src@/nwtemplates" bundled_sources = "@target@/bundled-sources" wasm_dir = "@target@/packed-wasm" shapelibs = [ "@src@/library/*.toml" ] +libexec_dir = "@target@/debug" +usvg_bin = "@target@/release/usvg" debug_js_inject_file = "@src@/templates/log-save.js" check_bundled_sources = false # For testing only! see LICENCE! diff --git a/server-test-zealot.toml b/server-test-zealot.toml index aa232bba..e78230f6 100644 --- a/server-test-zealot.toml +++ b/server-test-zealot.toml @@ -14,6 +14,8 @@ template_dir = "/home/ian/Rustup/Game/server/templates" nwtemplate_dir = "/home/ian/Rustup/Game/server/nwtemplates" bundled_sources = "/home/rustcargo/Rustup/Game/server/target/bundled-sources" wasm_dir = "/home/rustcargo/Rustup/Game/server/target/packed-wasm" +libexec_dir = "/home/rustcargo/Rustup/Game/server/target/debug" +usvg_bin = "/home/rustcargo/Rustup/Game/server/target/release/usvg" shapelibs = [ "/home/ian/Rustup/Game/server/library/*.toml" ] diff --git a/server-test.toml b/server-test.toml index 7f387bf4..f4233c1c 100644 --- a/server-test.toml +++ b/server-test.toml @@ -11,6 +11,8 @@ bundled_sources = "target/bundled-sources" save_dir = "." template_dir = "templates" wasm_dir = "target/packed-wasm" +libexec_dir = "target/debug" +usvg_bin = "target/release/usvg" #save_dir = "/home/rustcargo/Rustup/Game/server" diff --git a/src/config.rs b/src/config.rs index f4fae7b4..b8041ab2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -22,6 +22,8 @@ pub struct ServerConfigSpec { pub change_directory: Option, pub base_dir: Option, pub save_dir: Option, + pub libexec_dir: Option, + pub usvg_bin: Option, pub command_socket: Option, pub debug: Option, pub http_port: Option, @@ -59,6 +61,8 @@ pub struct ServerConfig { pub template_dir: String, pub nwtemplate_dir: String, pub wasm_dir: String, + pub libexec_dir: String, + pub usvg_bin: String, pub bundled_sources: String, pub shapelibs: Vec, pub sendmail: String, @@ -111,7 +115,7 @@ impl ServerConfigSpec { let ServerConfigSpec { change_directory, base_dir, save_dir, command_socket, debug, http_port, public_url, sse_wildcard_url, rocket_workers, - template_dir, nwtemplate_dir, wasm_dir, + template_dir, nwtemplate_dir, wasm_dir, libexec_dir, usvg_bin, log, bundled_sources, shapelibs, sendmail, debug_js_inject_file, check_bundled_sources, fake_rng, } = self; @@ -139,9 +143,13 @@ impl ServerConfigSpec { let template_dir = defpath(template_dir, "assets" ); let wasm_dir = defpath(wasm_dir, "assets" ); let nwtemplate_dir = defpath(nwtemplate_dir, "nwtemplates" ); + let libexec_dir = defpath(libexec_dir, "libexec" ); let bundled_sources = defpath(bundled_sources, "bundled-sources" ); const DEFAULT_LIBRARY_GLOB: &str = "library/*.toml"; + let usvg_bin = usvg_bin.unwrap_or_else( + || format!("{}/usvg", &libexec_dir)); + let shapelibs = shapelibs.unwrap_or_else(||{ let glob = defpath(None, DEFAULT_LIBRARY_GLOB); vec![ shapelib::Config1::PathGlob(glob) ] @@ -220,8 +228,8 @@ impl ServerConfigSpec { let server = ServerConfig { save_dir, command_socket, debug, http_port, public_url, sse_wildcard_url, rocket_workers, - template_dir, nwtemplate_dir, wasm_dir, - bundled_sources, shapelibs, sendmail, + template_dir, nwtemplate_dir, wasm_dir, libexec_dir, + bundled_sources, shapelibs, sendmail, usvg_bin, debug_js_inject, check_bundled_sources, game_rng, prctx, }; trace_dbg!("config resolved", &server);