mirror of
https://github.com/pret/pokeplatinum.git
synced 2024-11-23 05:49:44 +00:00
Initial implementation of metrowerks wrapper
This commit is contained in:
parent
040fa22df8
commit
9581ed2178
5
build.sh
5
build.sh
@ -1,8 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set up env variable pointing to CodeWarrior license file
|
||||
export LM_LICENSE_FILE=$(pwd)/tools/cw/license.dat
|
||||
|
||||
# Set up env variable to show % of completion during ninja build
|
||||
export NINJA_STATUS="[%p %f/%t] "
|
||||
|
||||
@ -15,7 +12,7 @@ export NINJA_STATUS="
|
||||
"
|
||||
|
||||
# Fix dependency paths on non-Windows platforms
|
||||
ninja fixdep
|
||||
#ninja fixdep
|
||||
|
||||
export NINJA_STATUS=""
|
||||
|
||||
|
12
config.sh
12
config.sh
@ -10,9 +10,6 @@ is_wsl_accessing_windows() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Set up env variable pointing to CodeWarrior license file
|
||||
export LM_LICENSE_FILE=$(pwd)/tools/cw/license.dat
|
||||
|
||||
# Bootstrap machine file pointing to the repo
|
||||
echo "[constants]" > meson/root.ini
|
||||
echo "root = '$(pwd)'" | sed s#\'/c#\'C:#g >> meson/root.ini
|
||||
@ -32,4 +29,11 @@ else
|
||||
fi
|
||||
|
||||
# Launch meson
|
||||
meson setup build --native-file=meson/"$native_file" --native-file=meson/root.ini --cross-file=meson/"$cross_file" --cross-file=meson/root.ini
|
||||
"${MESON:-meson}" setup build --native-file=meson/"$native_file" --native-file=meson/root.ini --cross-file=meson/"$cross_file" --cross-file=meson/root.ini
|
||||
|
||||
if [ "$native_file" = "native_wine.ini" ]; then
|
||||
cat > build/.mwconfig << EOF
|
||||
path_unix="$PWD"
|
||||
path_win="$(winepath -w "$PWD")"
|
||||
EOF
|
||||
fi
|
||||
|
1
lib/external/NitroSDK/meson.build
vendored
1
lib/external/NitroSDK/meson.build
vendored
@ -2,6 +2,7 @@ project('NitroSDK', ['c', 'nasm'])
|
||||
|
||||
# Compiler flags
|
||||
c_args = [
|
||||
'-wrap:ver', '2.0/sp2',
|
||||
'-O4,p',
|
||||
'-proc', 'arm946e',
|
||||
'-enum', 'int',
|
||||
|
@ -1,8 +1,8 @@
|
||||
[binaries]
|
||||
c = root + '/tools/cw/2.0/sp2p2/mwccarm.exe'
|
||||
c_ld = root + '/tools/cw/2.0/sp2p2/mwldarm.exe'
|
||||
nasm = root + '/tools/cw/2.0/sp2p2/mwasmarm.exe'
|
||||
ar = root + '/tools/cw/2.0/sp2p2/mwldarm.exe'
|
||||
c = [root + '/tools/cw/wrapper.sh', 'mwccarm']
|
||||
c_ld = [root + '/tools/cw/wrapper.sh', 'mwldarm']
|
||||
nasm = [root + '/tools/cw/wrapper.sh', 'mwasmarm']
|
||||
ar = [root + '/tools/cw/wrapper.sh', 'mwldarm']
|
||||
strip = ['false']
|
||||
|
||||
[host_machine]
|
||||
|
@ -1,8 +1,8 @@
|
||||
[binaries]
|
||||
c = ['wine', root + '/tools/cw/2.0/sp2p2/mwccarm.exe']
|
||||
c_ld = ['wine', root + '/tools/cw/2.0/sp2p2/mwldarm.exe']
|
||||
nasm = ['wine', root + '/tools/cw/2.0/sp2p2/mwasmarm.exe']
|
||||
ar = ['wine', root + '/tools/cw/2.0/sp2p2/mwldarm.exe']
|
||||
c = [root + '/tools/cw/wrapper.sh', 'mwccarm', '-wrap:wine']
|
||||
c_ld = [root + '/tools/cw/wrapper.sh', 'mwldarm', '-wrap:wine']
|
||||
nasm = [root + '/tools/cw/wrapper.sh', 'mwasmarm', '-wrap:wine']
|
||||
ar = [root + '/tools/cw/wrapper.sh', 'mwldarm', '-wrap:wine']
|
||||
strip = ['false']
|
||||
|
||||
[host_machine]
|
||||
|
73
tools/cw/wrapper.sh
Executable file
73
tools/cw/wrapper.sh
Executable file
@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
tool_bin="$(basename "$1")"; shift
|
||||
tool_dir="$(dirname "$0")"
|
||||
tool_ver="2.0/sp2p2"
|
||||
|
||||
wine=
|
||||
path_unix=
|
||||
path_win=
|
||||
|
||||
test -f .mwconfig && . ./.mwconfig
|
||||
|
||||
opt_o=
|
||||
opt_precompile=
|
||||
opt_M=false
|
||||
opt_MD=false
|
||||
opt_config=false
|
||||
|
||||
# Parse/filter the arguments
|
||||
n="$#"
|
||||
while [ "$n" -gt 0 ]; do
|
||||
skip=0
|
||||
copy=0
|
||||
case "$1" in
|
||||
-o) opt_o="$2"; copy=2 ;;
|
||||
-precompile) opt_precompile="$2"; copy=2 ;;
|
||||
-MD) opt_MD=true; copy=1 ;;
|
||||
-M) opt_M=true; copy=1 ;;
|
||||
-wrap:config) opt_config=true; skip=1 ;;
|
||||
-wrap:wine) wine="${WINE:-wine}"; skip=1 ;;
|
||||
-wrap:ver) tool_ver="$2"; skip=2 ;;
|
||||
*) copy=1 ;;
|
||||
esac
|
||||
shift $skip
|
||||
for x in $(seq $copy); do set -- "$@" "$1"; shift 1; done
|
||||
: $((n-=$skip)) $((n-=$copy))
|
||||
done
|
||||
|
||||
# Set environment variables
|
||||
export MWLibraries=";"
|
||||
export LM_LICENSE_FILE="$tool_dir/license.dat"
|
||||
|
||||
# Run the tool
|
||||
set -- "$tool_dir/$tool_ver/$tool_bin.exe" "$@"
|
||||
test -n "$wine" && set -- "$wine" "$@"
|
||||
"$@"
|
||||
|
||||
# Process the dependency file
|
||||
if [ -n "$path_unix" -a -n "$path_win" ]; then
|
||||
depfile=
|
||||
if $opt_M; then
|
||||
depfile="$opt_o"
|
||||
elif $opt_MD; then
|
||||
# Automatically generate the filename
|
||||
out=
|
||||
test -n "$opt_o" && out="$opt_o"
|
||||
test -n "$opt_precompile" && out="$opt_precompile"
|
||||
depfile="$(printf '%s' "$out" | sed 's/[^\.]*$/d/')"
|
||||
fi
|
||||
|
||||
if [ -n "$depfile" ]; then
|
||||
sedescape_regex() {
|
||||
printf '%s' "$@" | sed -e 's/[^^]/[&]/g; s/\^/\\^/g'
|
||||
}
|
||||
sedescape_subst() {
|
||||
printf '%s' "$@" | sed 's/[&/\]/\\&/g'
|
||||
}
|
||||
sed -e "s/\<$(sedescape_regex "$path_win")/$(sedescape_subst "$path_unix")/g" \
|
||||
-e 's/\r//g' -e 's/\\/\//g' -e 's/\/$/\\/g' \
|
||||
-i "$depfile"
|
||||
cp "$depfile" "$depfile.new"
|
||||
fi
|
||||
fi
|
Loading…
Reference in New Issue
Block a user