From 78e88b585feff7337221c931698ade3599062da6 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sun, 24 Sep 2023 16:41:33 +0300 Subject: [PATCH 43/43] Meson: Set user data paths in run.sh See osdn #48697 Signed-off-by: Marko Lindqvist --- bootstrap/generate_meson_run.sh | 52 ++++++++++++++++----------------- meson.build | 3 +- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/bootstrap/generate_meson_run.sh b/bootstrap/generate_meson_run.sh index f8e0ceac34..256f55aacd 100644 --- a/bootstrap/generate_meson_run.sh +++ b/bootstrap/generate_meson_run.sh @@ -11,31 +11,31 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -DATADIR="$(cd $(dirname $0)/../data ; pwd)" -SCENDIR="$(cd $(dirname $0)/../data/scenarios ; pwd)" +DATADIR="$(cd $(dirname "$0")/../data ; pwd)" +SCENDIR="$(cd $(dirname "$0")/../data/scenarios ; pwd)" -echo "#!/bin/bash" > $1 -echo "# Generated by $(basename $0)" >> $1 -echo >> $1 -echo "if test \"\$1\" = \"--help\" || test \"\$1\" = \"-h\" ||" >> $1 -echo " test \"\$1\" = \"\" ; then" >> $1 -echo " echo \"Usage: ./run.sh [parameters] ...\"" >> $1 -echo " exit" >> $1 -echo "fi" >> $1 -echo >> $1 -echo "if test \"\$FREECIV_DATA_PATH\" = \"\" ; then" >> $1 -echo " FREECIV_DATA_PATH=\"$DATADIR\"" >> $1 -echo "else" >> $1 -echo " FREECIV_DATA_PATH=\"\$FREECIV_DATA_PATH:$DATADIR\"" >> $1 -echo "fi" >> $1 -echo "export FREECIV_DATA_PATH" >> $1 -echo "if test \"\$FREECIV_SCENARIO_PATH\" = \"\" ; then" >> $1 -echo " FREECIV_SCENARIO_PATH=\"$SCENDIR\"" >> $1 -echo "else" >> $1 -echo " FREECIV_SCENARIO_PATH=\"\$FREECIV_SCENARIO_PATH:$SCENDIR\"" >> $1 -echo "fi" >> $1 -echo "export FREECIV_SCENARIO_PATH" >> $1 -echo >> $1 -echo "./\$@" >> $1 +echo "#!/bin/bash" > "$1" +echo "# Generated by $(basename "$0")" >> "$1" +echo >> "$1" +echo "if test \"\$1\" = \"--help\" || test \"\$1\" = \"-h\" ||" >> "$1" +echo " test \"\$1\" = \"\" ; then" >> "$1" +echo " echo \"Usage: ./run.sh [parameters] ...\"" >> "$1" +echo " exit" >> "$1" +echo "fi" >> "$1" +echo >> "$1" +echo "if test \"\${FREECIV_DATA_PATH}\" = \"\" ; then" >> "$1" +echo " FREECIV_DATA_PATH=\"${2}/${3}:${DATADIR}\"" >> "$1" +echo "else" >> "$1" +echo " FREECIV_DATA_PATH=\"\${FREECIV_DATA_PATH}:${2}/${3}:${DATADIR}\"" >> "$1" +echo "fi" >> "$1" +echo "export FREECIV_DATA_PATH" >> "$1" +echo "if test \"\$FREECIV_SCENARIO_PATH\" = \"\" ; then" >> "$1" +echo " FREECIV_SCENARIO_PATH=\"${2}/${3}/scenarios:${2}/scenarios:${SCENDIR}\"" >> "$1" +echo "else" >> "$1" +echo " FREECIV_SCENARIO_PATH=\"\${FREECIV_SCENARIO_PATH}:${2}/${3}/scenarios:${2}/scenarios:${SCENDIR}\"" >> "$1" +echo "fi" >> "$1" +echo "export FREECIV_SCENARIO_PATH" >> "$1" +echo >> "$1" +echo "./\$@" >> "$1" -chmod +x $1 +chmod +x "$1" diff --git a/meson.build b/meson.build index c35dbdacda..ee8907515f 100644 --- a/meson.build +++ b/meson.build @@ -1000,7 +1000,8 @@ client_inc = [common_inc, include_directories('client', 'client/include', tool_inc = [server_inc, include_directories('tools/ruleutil', 'tools/shared')] runwrap = custom_target('runwrap', output: 'run.sh', - command: [sh_exe, files('bootstrap/generate_meson_run.sh'), '@OUTPUT@'], + command: [sh_exe, files('bootstrap/generate_meson_run.sh'), + '@OUTPUT@', storage_dir, datasubdir], depend_files: files('bootstrap/generate_meson_run.sh'), build_by_default: true) -- 2.40.1