Skip to content

Commit

Permalink
Merge pull request #197 from EA31337/dev
Browse files Browse the repository at this point in the history
Cross-platform compilation fixes
  • Loading branch information
kenorb authored Jun 9, 2020
2 parents a792f86 + 5820035 commit 4b66e6c
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/tests-mql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ jobs:
- name: Run ScriptDummy
working-directory: tests
run: docker-compose run ScriptDummy
# @fixme
if: false
- name: Run ScriptPrintPaths
working-directory: tests
run: docker-compose run ScriptPrintPaths
Expand Down
24 changes: 15 additions & 9 deletions scripts/.funcs.cmds.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ compile() {
local log_file=${2:-${name##*/}.log}
type iconv >/dev/null

local mt_ver=${MT_VER:-4}
local rel_path=$name
local target=$rel_path
mt_ver=${mt_ver:0:1}
if [ -d "$rel_path" ]; then
# If folder, enter it.
cd "$rel_path"
Expand All @@ -344,8 +346,8 @@ compile() {
elif [ ! -s "$rel_path" ]; then
# If file does not exist, find in the current folder.
name=${name##*/} # Drop the path.
local exact=$(find -L . -maxdepth 4 -type f -name "${name%.*}.mq?" -print -quit)
local match=$(find -L . -maxdepth 4 -type f -name "*${name%.*}*.mq?" -print -quit)
local exact=$(find -L . -maxdepth 4 -type f -name "${name%.*}.mq${mt_ver}" -print -quit)
local match=$(find -L . -maxdepth 4 -type f -name "*${name%.*}*.mq${mt_ver}" -print -quit)
target=$(echo ${exact#./} || echo ${match#./})
log_file=${log_file:-${name}.log}
else
Expand Down Expand Up @@ -462,6 +464,8 @@ ini_copy() {
ea_find() {
local file="${1:-$EA_FILE}"
local dir="${2:-$EXPERTS_DIR}"
local mt_ver=${MT_VER:-4}
mt_ver=${mt_ver:0:1}
[ -d "$EXPERTS_DIR" ] || mkdir -p $VFLAG "$EXPERTS_DIR"
cd "$dir"
if [[ "$file" =~ :// ]]; then
Expand All @@ -474,10 +478,10 @@ ea_find() {
echo "$file"
return
} ||
result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq?" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex?" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq?" -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex?" -print -quit)
result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq${mt_ver}" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex${mt_ver}" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq${mt_ver}" -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex${mt_ver}" -print -quit)
echo ${result#./}
cd - &>/dev/null
}
Expand All @@ -488,6 +492,8 @@ ea_find() {
script_find() {
local file="$1"
local dir="${2:-$SCRIPTS_DIR}"
local mt_ver=${MT_VER:-4}
mt_ver=${mt_ver:0:1}
[ -d "$SCRIPTS_DIR" ] || mkdir -p $VFLAG "$SCRIPTS_DIR"
cd "$dir"
if [[ "$file" =~ :// ]]; then
Expand All @@ -500,10 +506,10 @@ script_find() {
echo "$file"
return
} ||
result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq?" ')' -print -quit)
result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -iname "${file%.*}.mq${mt_ver}" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f '(' -iname "$file" -o -name "${file%.*}.ex?" ')' -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq?" -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex?" -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.mq${mt_ver}" -print -quit)
[ -z "$result" ] && result=$(find -L . "$WORKDIR" "$ROOT" ~ -maxdepth 4 -type f -iname "*${file%.*}*.ex${mt_ver}" -print -quit)
echo ${result#./}
cd - &>/dev/null
}
Expand Down
23 changes: 22 additions & 1 deletion scripts/.funcs.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,23 @@ function conv() {
iconv -f "$from" -t "$to" | tr -d \\r
}

# Print last return code.
get_return() {
printf "%d" $?
}

# Print last negated return code.
get_return_neg() {
printf "%d" $(( 1-$? ))
}

# Checks if process is running.
is_process_up() {
local process=${1:-terminal}
WINEDEBUG=-all winedbg --command 'info proc' | grep -q "$process"
get_return_neg
}

# Restore IFS.
restore_ifs() {
IFS=$' \t\n'
Expand Down Expand Up @@ -319,7 +336,11 @@ kill_wine() {
true
return
}
wineserver -k || true
wineserver -k -w || true
sleep 2
if [ $(is_process_up terminal) -eq 1 ]; then
wineserver -k9
fi
}

# Kill display.
Expand Down

0 comments on commit 4b66e6c

Please sign in to comment.