File: sample_linker

package info (click to toggle)
bazel-rules-cc 0.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,092 kB
  • sloc: python: 3,735; sh: 846; cpp: 827; makefile: 12; ansic: 5
file content (23 lines) | stat: -rwxr-xr-x 783 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
#
# Sample script demonstrating custom C++ toolchain selection: handles
# the command that translates a cc_library's .o (object file) into
# .a (archive).

echo "$0: running sample cc_library linker (produces .a output)."

# https://docs.bazel.build/versions/master/cc-toolchain-config-reference.html
# defines fancier ways to generate custom command lines. This script just shows
# the default, which looks like:
#
# examples/custom_toolchain/sample_linker @bazel-out/x86-fastbuild/bin/examples/custom_toolchain/libbuildme.a-2.params.

# Get "@bazel-out/.../libbuildme.a-2.params".
PARAMS_FILE=${@: -1}
# Remove the "@" prefix.
OUTFILE=${PARAMS_FILE#?}
# Replace "libbuildme.a-2.params" with "libbuildme.a".
OUTFILE=${OUTFILE%-*}

echo "$0: sample output"  >  $OUTFILE