mirror of
https://github.com/encounter/winedll.git
synced 2026-03-30 11:42:33 -07:00
97 lines
3.1 KiB
Bash
Executable File
97 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
# Diff msvcrt source and include files against the original Wine tree.
|
|
#
|
|
# Usage:
|
|
# ./tools/diff-wine.sh [WINE_DIR]
|
|
#
|
|
# Defaults to ~/Development/wine if WINE_DIR is not provided.
|
|
# Pass --stat for a summary-only view, or --name-only for just filenames.
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
WINE_DIR="${1:-$HOME/Development/wine}"
|
|
shift 2>/dev/null || true
|
|
DIFF_ARGS="${*:---unified=5 --color=auto}"
|
|
|
|
if [ ! -d "$WINE_DIR" ]; then
|
|
echo "Error: Wine directory not found at $WINE_DIR" >&2
|
|
exit 1
|
|
fi
|
|
|
|
found=0
|
|
missing_wine=0
|
|
missing_repo=0
|
|
|
|
diff_tree() {
|
|
local repo_subdir="$1"
|
|
local wine_subdir="$2"
|
|
local label="$3"
|
|
|
|
local repo_path="$REPO_DIR/$repo_subdir"
|
|
local wine_path="$WINE_DIR/$wine_subdir"
|
|
|
|
if [ ! -d "$wine_path" ]; then
|
|
echo "# WARNING: Wine path not found: $wine_path" >&2
|
|
return
|
|
fi
|
|
|
|
echo "############################################################"
|
|
echo "# $label"
|
|
echo "# repo: $repo_subdir"
|
|
echo "# wine: $wine_subdir"
|
|
echo "############################################################"
|
|
echo
|
|
|
|
# Files present in both trees
|
|
if [ -d "$repo_path" ]; then
|
|
while IFS= read -r -d '' rel; do
|
|
local wine_file="$wine_path/$rel"
|
|
local repo_file="$repo_path/$rel"
|
|
if [ -f "$wine_file" ]; then
|
|
if ! diff -q "$wine_file" "$repo_file" >/dev/null 2>&1; then
|
|
echo "=== MODIFIED: $rel ==="
|
|
colordiff $DIFF_ARGS "$wine_file" "$repo_file" || true
|
|
echo
|
|
((found++)) || true
|
|
fi
|
|
else
|
|
echo "=== REPO-ONLY (not in Wine): $rel ==="
|
|
((missing_wine++)) || true
|
|
fi
|
|
done < <(find "$repo_path" -type f \( -name '*.c' -o -name '*.h' -o -name '*.spec' \) -printf '%P\0' | sort -z)
|
|
fi
|
|
|
|
# Files in Wine but missing from repo
|
|
if [ -d "$repo_path" ]; then
|
|
while IFS= read -r -d '' rel; do
|
|
local repo_file="$repo_path/$rel"
|
|
if [ ! -f "$repo_file" ]; then
|
|
echo "=== WINE-ONLY (not in repo): $rel ==="
|
|
((missing_repo++)) || true
|
|
fi
|
|
done < <(find "$wine_path" -type f \( -name '*.c' -o -name '*.h' -o -name '*.spec' \) -printf '%P\0' | sort -z)
|
|
fi
|
|
}
|
|
|
|
# Include headers: include/msvcrt/
|
|
diff_tree "include/msvcrt" "include/msvcrt" "msvcrt public headers (include/msvcrt/)"
|
|
|
|
# msvcrt dll source
|
|
diff_tree "dlls/msvcrt" "dlls/msvcrt" "msvcrt dll source (dlls/msvcrt/)"
|
|
|
|
# Versioned CRT dlls that exist in both trees
|
|
for dll in "$REPO_DIR"/dlls/msvcr* "$REPO_DIR"/dlls/ucrtbase; do
|
|
name="$(basename "$dll")"
|
|
if [ -d "$WINE_DIR/dlls/$name" ]; then
|
|
diff_tree "dlls/$name" "dlls/$name" "$name dll source (dlls/$name/)"
|
|
fi
|
|
done
|
|
|
|
echo "############################################################"
|
|
echo "# Summary"
|
|
echo "# Modified files: $found"
|
|
echo "# Repo-only files: $missing_wine"
|
|
echo "# Wine-only files: $missing_repo"
|
|
echo "############################################################"
|