summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/icecc-create-env
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-02-12 10:52:02 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-02-15 13:28:54 +0000
commit832934efd633de3fa0051bfb30e94b64c885f542 (patch)
tree039f17ed744021f591dfa882c4495ebbe93d2a1d /meta/recipes-devtools/icecc-create-env
parent3e10060c99d6752236317c7590a0aa7563193346 (diff)
downloadpoky-832934efd633de3fa0051bfb30e94b64c885f542.tar.gz
icecc-create-env: Symlink alternate names
Instead of renaming files to a new path in the toolchain archive, keep the files with their original paths and create a relative symbolic link from the new path to the original file. (From OE-Core rev: 256f8f6cc5b520b59cfdc44aa076f71990e18e2c) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/icecc-create-env')
-rwxr-xr-xmeta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env64
1 files changed, 57 insertions, 7 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 7636d090a4..0791bd54b2 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
@@ -21,10 +21,28 @@ is_contained ()
21 esac 21 esac
22} 22}
23 23
24normalize_path ()
25{
26 # Normalizes the path to a file or directory, removing all "." and ".."
27 # entries. Use pwd -L to explicitly prevent symlink expansion
28 local path=$1
29 if test -f "$path"; then
30 pushd $(dirname $path) > /dev/null 2>&1
31 dir_path=$(pwd -L)
32 path=$dir_path/$(basename $path)
33 popd > /dev/null 2>&1
34 elif test -d "$path"; then
35 pushd $path > /dev/null 2>&1
36 path=$(pwd -L)
37 popd > /dev/null 2>&1
38 fi
39 echo $path
40}
41
24add_file () 42add_file ()
25{ 43{
26 local name="$1" 44 local path=`normalize_path $1`
27 local path="$1"; 45 local name="$path"
28 if test -n "$2"; then 46 if test -n "$2"; then
29 name="$2" 47 name="$2"
30 fi 48 fi
@@ -129,7 +147,7 @@ if test -n "$specfile" && test -e "$specfile"; then
129fi 147fi
130 148
131ltofile=`$added_gcc -print-prog-name=lto1` 149ltofile=`$added_gcc -print-prog-name=lto1`
132pluginfile="${ltofile%lto1}liblto_plugin.so" 150pluginfile=`normalize_path "${ltofile%lto1}liblto_plugin.so"`
133if test -r "$pluginfile" 151if test -r "$pluginfile"
134then 152then
135 add_file $pluginfile ${pluginfile#*usr} 153 add_file $pluginfile ${pluginfile#*usr}
@@ -146,6 +164,19 @@ else
146 exit 1 164 exit 1
147fi 165fi
148 166
167link_rel ()
168{
169 local target="$1"
170 local name="$2"
171 local base="$3"
172
173 local prefix=`dirname $name`
174
175 prefix=`echo $prefix | sed 's,[^/]\+,..,g' | sed 's,^/*,,g'`
176
177 ln -s $prefix/$target $base/$name
178}
179
149tempdir=`mktemp -d /tmp/iceccenvXXXXXX` 180tempdir=`mktemp -d /tmp/iceccenvXXXXXX`
150new_target_files= 181new_target_files=
151for i in $target_files; do 182for i in $target_files; do
@@ -159,11 +190,30 @@ for i in $target_files; do
159 target=$i 190 target=$i
160 ;; 191 ;;
161 esac 192 esac
162 mkdir -p $tempdir/`dirname $target` 193 if test "$target" == "$path"; then
163 cp -p $path $tempdir/$target 194 mkdir -p $tempdir/`dirname $target`
164 if test -f $tempdir/$target -a -x $tempdir/$target; then 195 cp -pH $target $tempdir/$target
165 strip -s $tempdir/$target 2>/dev/null 196
197 if test -f $tempdir/$target -a -x $tempdir/$target; then
198 strip -s $tempdir/$target 2>/dev/null
199 fi
200 else
201 mkdir -p $tempdir/`dirname $path`
202 cp -pH $path $tempdir/$path
203
204 mkdir -p $tempdir/`dirname $target`
205 # Relative links are used because the files are checked for being
206 # executable outside the chroot
207 link_rel $path $target $tempdir
208
209 if test -f $tempdir/$path -a -x $tempdir/$path; then
210 strip -s $tempdir/$path 2>/dev/null
211 fi
212
213 path=`echo $path | cut -b2-`
214 new_target_files="$new_target_files $path"
166 fi 215 fi
216
167 target=`echo $target | cut -b2-` 217 target=`echo $target | cut -b2-`
168 new_target_files="$new_target_files $target" 218 new_target_files="$new_target_files $target"
169done 219done