Migrate xmpp-caps.xml to XDG cache dir
[pidgin-git.git] / libpurple / tag.sh
blob91504ceedc877a5337f8d44802516bc9b856f34d
1 #!/bin/bash
2 # Script to silence win32 and perl build by displaying a neat one-line notice
3 # instead of full command contents when executing compilers.
5 # Written by Tomek Wasilczyk <tomkiewicz@cpw.pidgin.im>, licensed under GNU GPL
7 tag=$1
8 found=0
9 object=""
10 file_1=""
11 file_2=""
12 is_final=0
13 for arg in "$@"
15 if [ "$found" == 1 ]; then
16 object="$arg"
17 break
19 if [ "$arg" == "-o" ]; then
20 found=1
22 if [ "$tag" == "auto" ] && [ "$arg" == "-shared" ]; then
23 tag="CCLD"
25 if [ "$tag" == "PERL" ] && [ "${arg%(*}" == "Mkbootstrap" ]; then
26 object="${arg%;}"
27 is_final=1
28 break
30 if [ "$tag" == "PERL" ] && [ "${arg%(*}" == "ExtUtils::ParseXS::process_file" ]; then
31 object="${arg#*output => \"}"
32 object="${object%\", *}"
33 is_final=1
34 break
36 ext_1=${arg#${arg%??}}
37 if [ "${ext_1}" == ".c" ]; then
38 file_1="$arg"
40 ext_2=${arg#${arg%???}}
41 if [ "${ext_2}" == ".xs" ]; then
42 file_2="$arg"
44 ext_3=${arg#${arg%????}}
45 if [ "${ext_3}" == ".3pm" ]; then
46 file_2="$arg"
48 done
50 if [ "$tag" == "auto" ]; then
51 tag="CC"
54 if [ "$tag" == "PERL" ] && [ "$is_final" == 0 ]; then
55 object=`echo "$object" | sed -n 's|.*output *=> *"\([^"]*\)".*|\1|p'`
58 if [ "$object" == "" ] && [ "${file_1}" != "" ]; then
59 object="${file_1}"
61 if [ "$object" == "" ] && [ "${file_2}" != "" ]; then
62 object="${file_2}"
65 shift 1
66 if [ "$object" == "" ]; then
67 echo "$@" >&2
68 else
69 echo -e " $tag\t$object" >&2
71 "$@"