File: gcc-wrapper

package info (click to toggle)
rlinetd 0.9.3-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 2,992 kB
  • sloc: sh: 5,173; ansic: 3,212; yacc: 1,585; makefile: 174; lex: 131; sed: 16; perl: 4
file content (39 lines) | stat: -rwxr-xr-x 723 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# vim:ts=4:sts=4:fdm=marker:cms=\ #\ %s
# Simple wrapper around gcc. Removes any -soname option passed to gcc while linking libparse.so
#
set -e 

new_args=""
skip_next_arg=0
use_new_args=0

if [ -z "$1" ] ; then
	echo "gcc-wrapper: usage $0 compiler-name compiler-options" >&2
	exit 1
fi

if [ "$2" = "-shared" ]; then
	for arg in "$@"; do
		[ "$skip_next_arg" = 0 ] || { skip_next_arg=0 ; continue ; }
		case $arg in 
			*parse.so)
				new_args="$new_args $arg"
				use_new_args=1
				;;
			*soname)
				skip_next_arg=1
				;;
			*)
				new_args="$new_args $arg"
				;;
		esac;				
	done		
fi		

if [ "$use_new_args" = 1 ] ; then
	echo "gcc-wrapper: executing $new_args" >&2
	exec $new_args
else
	exec "$@"
fi