fix(toolchain): expose dlltool on PATH; activate.sh verifies tools + emits recovery guidance
This commit is contained in:
1 parent
f01d0e65ac
commit
111bb3371b
4 files changed
+66
-3
No files matched your search
@@ -15,6 +15,7 @@ node_modules/
|
||||
*.xwb
|
||||
*.xsb
|
||||
toolchain/
|
||||
/bin/
|
||||
*.rep/
|
||||
*.gpr
|
||||
kinect_shim.log
|
||||
+47
-1
@@ -1,5 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
# Source this to put the pinned no-sudo i686-w64-mingw32 cross toolchain + wine on PATH.
|
||||
# See toolchain.lock for exact provenance (nixpkgs rev, package versions, store paths).
|
||||
#
|
||||
# Must be SOURCED, not executed: `source ./activate.sh` or `. ./activate.sh`.
|
||||
# On success it returns 0 with every required tool on PATH. On failure (toolchain
|
||||
# not installed / nix profile not sourced) it prints recovery guidance and
|
||||
# returns/exits non-zero instead of silently succeeding.
|
||||
|
||||
_activate_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
source "$HOME/.nix-profile/etc/profile.d/nix.sh" 2>/dev/null || true
|
||||
export PATH="$HOME/.nix-profile/bin:$PATH"
|
||||
|
||||
# Worktree-local bin/ comes first so the unprefixed `dlltool` (and other
|
||||
# aliases below) resolve even though the nix package only installs the
|
||||
# target-prefixed `i686-w64-mingw32-dlltool`.
|
||||
export PATH="$HOME/.nix-profile/bin:$_activate_dir/bin:$PATH"
|
||||
|
||||
mkdir -p "$_activate_dir/bin" 2>/dev/null || true
|
||||
if command -v i686-w64-mingw32-dlltool >/dev/null 2>&1; then
|
||||
ln -sf "$(command -v i686-w64-mingw32-dlltool)" "$_activate_dir/bin/dlltool" 2>/dev/null || true
|
||||
fi
|
||||
if command -v gendef >/dev/null 2>&1; then
|
||||
ln -sf "$(command -v gendef)" "$_activate_dir/bin/gendef" 2>/dev/null || true
|
||||
fi
|
||||
if command -v i686-w64-mingw32-objdump >/dev/null 2>&1; then
|
||||
ln -sf "$(command -v i686-w64-mingw32-objdump)" "$_activate_dir/bin/objdump" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
_activate_missing=()
|
||||
for _activate_tool in i686-w64-mingw32-gcc i686-w64-mingw32-g++ gendef dlltool wine; do
|
||||
command -v "$_activate_tool" >/dev/null 2>&1 || _activate_missing+=("$_activate_tool")
|
||||
done
|
||||
|
||||
if [ "${#_activate_missing[@]}" -gt 0 ]; then
|
||||
{
|
||||
echo "activate.sh: required toolchain tool(s) not found on PATH: ${_activate_missing[*]}"
|
||||
echo " Recovery:"
|
||||
echo " 1. source ~/.nix-profile/etc/profile.d/nix.sh (user-space nix, no sudo)"
|
||||
echo " 2. install the pinned profile recorded in $_activate_dir/toolchain.lock,"
|
||||
echo " e.g. for nixpkgs rev 619c39f6eac5d1ed6b8f073a9414baf7034b2356:"
|
||||
echo " NIX_CONFIG=\"extra-experimental-features = nix-command flakes\" \\"
|
||||
echo " nix profile install github:NixOS/nixpkgs/619c39f6eac5d1ed6b8f073a9414baf7034b2356#pkgsCross.mingw32.buildPackages.binutils"
|
||||
echo " (see toolchain.lock for the full ordered install command list)"
|
||||
echo " 3. re-source this file: source $_activate_dir/activate.sh"
|
||||
} >&2
|
||||
unset _activate_dir _activate_missing _activate_tool
|
||||
return 1 2>/dev/null || exit 1
|
||||
fi
|
||||
|
||||
unset _activate_dir _activate_missing _activate_tool
|
||||
@@ -8,7 +8,12 @@ ROOT_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
# shellcheck source=/dev/null
|
||||
source "$ROOT_DIR/activate.sh"
|
||||
|
||||
command -v i686-w64-mingw32-gcc >/dev/null || { echo "i686-w64-mingw32-gcc not found on PATH" >&2; exit 1; }
|
||||
command -v i686-w64-mingw32-gcc >/dev/null || {
|
||||
echo "build.sh: i686-w64-mingw32-gcc not found on PATH after sourcing activate.sh." >&2
|
||||
echo " See $ROOT_DIR/activate.sh (and toolchain.lock for the pinned install commands)" >&2
|
||||
echo " to install/activate the no-sudo mingw-w64 cross toolchain." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The pinned i686-w64-mingw32-gcc (16.2.0) links its default startup objects
|
||||
# against mcfgthread; that runtime lib ships as its own nix package
|
||||
|
||||
+12
-1
@@ -60,4 +60,15 @@ compiler = i686-w64-mingw32-gcc / i686-w64-mingw32-g++ (GCC 16.2.0, mingw-w64 14
|
||||
version = 11.0
|
||||
store-path = /nix/store/y952wc8l7vkn3yv9brgg3b3zkcim4541-wine-11.0
|
||||
|
||||
# PATH setup: source ./activate.sh (adds ~/.nix-profile/bin to PATH).
|
||||
# PATH setup: source ./activate.sh. It:
|
||||
# - sources ~/.nix-profile/etc/profile.d/nix.sh and prepends ~/.nix-profile/bin
|
||||
# and this worktree's ./bin to PATH;
|
||||
# - (re)creates ./bin/dlltool, ./bin/gendef, ./bin/objdump as symlinks to the
|
||||
# resolved i686-w64-mingw32-dlltool / gendef / i686-w64-mingw32-objdump
|
||||
# binaries, so the bare `dlltool` command (not just the target-prefixed
|
||||
# one) is callable. ./bin is generated at activation time (gitignored),
|
||||
# not committed, so it is never stale relative to whatever profile is
|
||||
# actually installed;
|
||||
# - verifies i686-w64-mingw32-gcc, i686-w64-mingw32-g++, gendef, dlltool and
|
||||
# wine all resolve; if any is missing it prints this file's recovery
|
||||
# instructions and returns/exits non-zero instead of succeeding silently.
|
||||
Reference in new issue
Block a user