1#!/bin/bash
2# Copyright (c) 2011 The Native Client Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6set -Ceu
7
8
9prefix="$1"
10
11if [[ ! -d "$prefix" ]]; then
12  echo "Usage: $0 toolchain-prefix"
13  exit 1
14fi
15
16
17# Redirectors on *nix:
18#   The purpose of redirectors on *nix is to provide convenience wrappers, for
19#   example to emulate 32-bit compiler by calling 64-bit compiler with -m32.
20#   Another purpose of redirectors is to save space by replacing duplicate
21#   binaries with wrappers or links.
22#
23# Symbolic links vs. hard links:
24#   On windows/cygwin, hard links are needed to run linked programs outside of
25#   the cygwin shell. On *nix, there is no usage difference.
26#   Here we handle only the *nix case and use the symbolic links.
27
28
29while read src dst arg; do
30  if [[ -e "$prefix/$(dirname "$src")/$dst" ]]; then
31    ./create_redirector.sh "$prefix/$src" "$dst" "$arg"
32  fi
33done < redirect_table.txt
34