summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env')
-rwxr-xr-xmeta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env208
1 files changed, 104 insertions, 104 deletions
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
index 7e4dbc414e..723f1f9bd9 100755
--- a/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
+++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env
@@ -8,63 +8,63 @@ target_files=
8 8
9is_contained () 9is_contained ()
10{ 10{
11 case " $target_files " in 11 case " $target_files " in
12 *" $1 "* ) return 0 ;; 12 *" $1 "* ) return 0 ;;
13 *"=$1 "* ) return 0;; 13 *"=$1 "* ) return 0;;
14 * ) return 1 ;; 14 * ) return 1 ;;
15 esac 15 esac
16} 16}
17 17
18add_file () 18add_file ()
19{ 19{
20 local name="$1" 20 local name="$1"
21 local path="$1"; 21 local path="$1";
22 if test -n "$2"; then 22 if test -n "$2"; then
23 name="$2" 23 name="$2"
24 fi 24 fi
25 test -z "$name" && return 25 test -z "$name" && return
26 # ls -H isn't really the same as readlink, but 26 # ls -H isn't really the same as readlink, but
27 # readlink is not portable enough. 27 # readlink is not portable enough.
28 path=`ls -H $path` 28 path=`ls -H $path`
29 toadd="$name=$path" 29 toadd="$name=$path"
30 is_contained "$toadd" && return 30 is_contained "$toadd" && return
31 if test -z "$silent"; then 31 if test -z "$silent"; then
32 echo "adding file $toadd" 32 echo "adding file $toadd"
33 fi 33 fi
34 target_files="$target_files $toadd" 34 target_files="$target_files $toadd"
35 if test -x "$path"; then 35 if test -x "$path"; then
36 # Only call ldd when it makes sense 36 # Only call ldd when it makes sense
37 if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then 37 if file -L "$path" | grep 'ELF' > /dev/null 2>&1; then
38 if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then 38 if ! file -L "$path" | grep 'static' > /dev/null 2>&1; then
39 # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc 39 # ldd now outputs ld as /lib/ld-linux.so.xx on current nptl based glibc
40 # this regexp parse the outputs like: 40 # this regexp parse the outputs like:
41 # ldd /usr/bin/gcc 41 # ldd /usr/bin/gcc
42 # linux-gate.so.1 => (0xffffe000) 42 # linux-gate.so.1 => (0xffffe000)
43 # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000) 43 # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000)
44 # /lib/ld-linux.so.2 (0xb7fe8000) 44 # /lib/ld-linux.so.2 (0xb7fe8000)
45 # covering both situations ( with => and without ) 45 # covering both situations ( with => and without )
46 for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do 46 for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do
47 test -f "$lib" || continue 47 test -f "$lib" || continue
48 # Check wether the same library also exists in the parent directory, 48 # Check wether the same library also exists in the parent directory,
49 # and prefer that on the assumption that it is a more generic one. 49 # and prefer that on the assumption that it is a more generic one.
50 local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'` 50 local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'`
51 test -f "$baselib" && lib=$baselib 51 test -f "$baselib" && lib=$baselib
52 add_file "$lib" 52 add_file "$lib"
53 done 53 done
54 fi 54 fi
55 fi
55 fi 56 fi
56 fi
57} 57}
58 58
59# backward compat 59# backward compat
60if test "$1" = "--respect-path"; then 60if test "$1" = "--respect-path"; then
61 shift 61 shift
62fi 62fi
63 63
64#add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE 64#add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE
65if test "$1" = "--silent"; then 65if test "$1" = "--silent"; then
66 silent=1 66 silent=1
67 shift 67 shift
68fi 68fi
69 69
70 70
@@ -77,18 +77,18 @@ shift
77archive_name=$1 77archive_name=$1
78 78
79if test -z "$added_gcc" || test -z "$added_gxx" ; then 79if test -z "$added_gcc" || test -z "$added_gxx" ; then
80 echo "usage: $0 <gcc_path> <g++_path>" 80 echo "usage: $0 <gcc_path> <g++_path>"
81 exit 1 81 exit 1
82fi 82fi
83 83
84if ! test -x "$added_gcc" ; then 84if ! test -x "$added_gcc" ; then
85 echo "'$added_gcc' is no executable." 85 echo "'$added_gcc' is no executable."
86 exit 1 86 exit 1
87fi 87fi
88 88
89if ! test -x "$added_gxx" ; then 89if ! test -x "$added_gxx" ; then
90 echo "'$added_gcc' is no executable." 90 echo "'$added_gcc' is no executable."
91 exit 1 91 exit 1
92fi 92fi
93 93
94 94
@@ -97,51 +97,51 @@ add_file $added_gcc /usr/bin/gcc
97add_file $added_gxx /usr/bin/g++ 97add_file $added_gxx /usr/bin/g++
98 98
99if test -z "$added_as" ; then 99if test -z "$added_as" ; then
100 add_file /usr/bin/as /usr/bin/as 100 add_file /usr/bin/as /usr/bin/as
101else 101else
102 if ! test -x "$added_as" ; then 102 if ! test -x "$added_as" ; then
103 echo "'$added_as' is no executable." 103 echo "'$added_as' is no executable."
104 exit 1 104 exit 1
105 fi 105 fi
106 106
107 add_file $added_as /usr/bin/as 107 add_file $added_as /usr/bin/as
108fi 108fi
109 109
110add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1 110add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1
111add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus 111add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus
112specfile=`$added_gcc -print-file-name=specs` 112specfile=`$added_gcc -print-file-name=specs`
113if test -n "$specfile" && test -e "$specfile"; then 113if test -n "$specfile" && test -e "$specfile"; then
114 add_file "$specfile" 114 add_file "$specfile"
115fi 115fi
116 116
117ltofile=`$added_gcc -print-prog-name=lto1` 117ltofile=`$added_gcc -print-prog-name=lto1`
118pluginfile="${ltofile%lto1}liblto_plugin.so" 118pluginfile="${ltofile%lto1}liblto_plugin.so"
119if test -r "$pluginfile" 119if test -r "$pluginfile"
120then 120then
121 add_file $pluginfile ${pluginfile#*usr} 121 add_file $pluginfile ${pluginfile#*usr}
122 add_file $pluginfile /usr${pluginfile#*usr} 122 add_file $pluginfile /usr${pluginfile#*usr}
123fi 123fi
124 124
125tempdir=`mktemp -d /tmp/iceccenvXXXXXX` 125tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
126new_target_files= 126new_target_files=
127for i in $target_files; do 127for i in $target_files; do
128 case $i in 128 case $i in
129 *=/*) 129 *=/*)
130 target=`echo $i | cut -d= -f1` 130 target=`echo $i | cut -d= -f1`
131 path=`echo $i | cut -d= -f2` 131 path=`echo $i | cut -d= -f2`
132 ;; 132 ;;
133 *) 133 *)
134 path=$i 134 path=$i
135 target=$i 135 target=$i
136 ;; 136 ;;
137 esac 137 esac
138 mkdir -p $tempdir/`dirname $target` 138 mkdir -p $tempdir/`dirname $target`
139 cp -p $path $tempdir/$target 139 cp -p $path $tempdir/$target
140 if test -f $tempdir/$target -a -x $tempdir/$target; then 140 if test -f $tempdir/$target -a -x $tempdir/$target; then
141 strip -s $tempdir/$target 2>/dev/null 141 strip -s $tempdir/$target 2>/dev/null
142 fi 142 fi
143 target=`echo $target | cut -b2-` 143 target=`echo $target | cut -b2-`
144 new_target_files="$new_target_files $target" 144 new_target_files="$new_target_files $target"
145done 145done
146 146
147#sort the files 147#sort the files
@@ -150,43 +150,43 @@ target_files=`for i in $new_target_files; do echo $i; done | sort`
150#test if an archive name was supplied 150#test if an archive name was supplied
151#if not use the md5 of all files as the archive name 151#if not use the md5 of all files as the archive name
152if test -z "$archive_name"; then 152if test -z "$archive_name"; then
153 md5sum=NONE 153 md5sum=NONE
154 for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do 154 for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do
155 if test -x $file; then 155 if test -x $file; then
156 md5sum=$file 156 md5sum=$file
157 break 157 break
158 fi 158 fi
159 done 159 done
160 160
161 #calculate md5 and use it as the archive name 161 #calculate md5 and use it as the archive name
162 archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || { 162 archive_name=`for i in $target_files; do test -f $tempdir/$i && $md5sum $tempdir/$i; done | sed -e 's/ .*$//' | $md5sum | sed -e 's/ .*$//'`.tar.gz || {
163 if test -z "$silent"; then 163 if test -z "$silent"; then
164 echo "Couldn't compute MD5 sum." 164 echo "Couldn't compute MD5 sum."
165 fi 165 fi
166 exit 2 166 exit 2
167 } 167 }
168 mydir=`pwd` 168 mydir=`pwd`
169else 169else
170 mydir="`dirname "$archive_name"`" 170 mydir="`dirname "$archive_name"`"
171 171
172 #check if we have a full path or only a filename 172 #check if we have a full path or only a filename
173 if test "$mydir" = "." ; then 173 if test "$mydir" = "." ; then
174 mydir=`pwd` 174 mydir=`pwd`
175 else 175 else
176 mydir="" 176 mydir=""
177 fi 177 fi
178fi 178fi
179 179
180if test -z "$silent"; then 180if test -z "$silent"; then
181echo "creating $archive_name" 181 echo "creating $archive_name"
182fi 182fi
183 183
184cd $tempdir 184cd $tempdir
185tar -czhf "$mydir/$archive_name" $target_files || { 185tar -czhf "$mydir/$archive_name" $target_files || {
186 if test -z "$silent"; then 186 if test -z "$silent"; then
187 echo "Couldn't create archive" 187 echo "Couldn't create archive"
188 fi 188 fi
189 exit 3 189 exit 3
190} 190}
191cd .. 191cd ..
192rm -rf $tempdir 192rm -rf $tempdir