diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 14:36:22 +0200 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2014-06-26 15:32:53 +0200 |
commit | f4cf9fe05bb3f32fabea4e54dd92d368967a80da (patch) | |
tree | 487180fa9866985ea7b28e625651765d86f515c3 /meta/recipes-devtools/icecc-create-env | |
download | poky-f4cf9fe05bb3f32fabea4e54dd92d368967a80da.tar.gz |
initial commit for Enea Linux 4.0
Migrated from the internal git server on the daisy-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'meta/recipes-devtools/icecc-create-env')
-rw-r--r-- | meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb | 36 | ||||
-rwxr-xr-x | meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env | 192 |
2 files changed, 228 insertions, 0 deletions
diff --git a/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb b/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb new file mode 100644 index 0000000000..f8f4aef392 --- /dev/null +++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb | |||
@@ -0,0 +1,36 @@ | |||
1 | SUMMARY = "icecc environment setup script" | ||
2 | DESCRIPTION = "This is a version of the icecc-create-env script that has \ | ||
3 | been modified in order to make it work with OE." | ||
4 | SECTION = "base" | ||
5 | # source file has just a "GPL" word, but upstream is GPLv2+. | ||
6 | # most probably just GPL would be a mistake | ||
7 | LICENSE = "GPLv2+" | ||
8 | LIC_FILES_CHKSUM = "file://icecc-create-env;beginline=2;endline=5;md5=ae1df3d6a058bfda40b66094c5f6065f" | ||
9 | |||
10 | PR = "r2" | ||
11 | |||
12 | DEPENDS = "" | ||
13 | INHIBIT_DEFAULT_DEPS = "1" | ||
14 | |||
15 | inherit native | ||
16 | |||
17 | # This is needed, because otherwise there is dependency loop from quilt-native | ||
18 | # Dependency loop #1 found: | ||
19 | # Task 10907 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_install) (dependent Tasks ['quilt-native, do_compile']) | ||
20 | # Task 10908 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_populate_sysroot) (dependent Tasks ['quilt-native, do_install']) | ||
21 | # Task 10997 (meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb, do_patch) (dependent Tasks ['icecc-create-env-native, do_unpack', 'quilt-native, do_populate_sysroot']) | ||
22 | # Task 11001 (meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb, do_configure) (dependent Tasks ['icecc-create-env-native, do_patch']) | ||
23 | # Task 11002 (meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb, do_compile) (dependent Tasks ['icecc-create-env-native, do_configure']) | ||
24 | # Task 10998 (meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb, do_install) (dependent Tasks ['icecc-create-env-native, do_compile']) | ||
25 | # Task 10999 (meta/recipes-devtools/icecc-create-env/icecc-create-env-native_0.1.bb, do_populate_sysroot) (dependent Tasks ['icecc-create-env-native, do_install']) | ||
26 | # Task 10910 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_configure) (dependent Tasks ['quilt-native, do_patch', 'icecc-create-env-native, do_populate_sysroot']) | ||
27 | # Task 10911 (meta/recipes-devtools/quilt/quilt-native_0.60.bb, do_compile) (dependent Tasks ['quilt-native, do_configure']) | ||
28 | PATCHTOOL = "patch" | ||
29 | SRC_URI = "file://icecc-create-env" | ||
30 | |||
31 | S = "${WORKDIR}" | ||
32 | |||
33 | do_install() { | ||
34 | install -d ${D}/${bindir} | ||
35 | install -m 0755 ${WORKDIR}/icecc-create-env ${D}/${bindir} | ||
36 | } | ||
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 new file mode 100755 index 0000000000..7e4dbc414e --- /dev/null +++ b/meta/recipes-devtools/icecc-create-env/icecc-create-env/icecc-create-env | |||
@@ -0,0 +1,192 @@ | |||
1 | #! /usr/bin/env bash | ||
2 | # icecc -- A simple distributed compiler system | ||
3 | # | ||
4 | # Copyright (C) 2004 by the Icecream Authors | ||
5 | # GPL | ||
6 | |||
7 | target_files= | ||
8 | |||
9 | is_contained () | ||
10 | { | ||
11 | case " $target_files " in | ||
12 | *" $1 "* ) return 0 ;; | ||
13 | *"=$1 "* ) return 0;; | ||
14 | * ) return 1 ;; | ||
15 | esac | ||
16 | } | ||
17 | |||
18 | add_file () | ||
19 | { | ||
20 | local name="$1" | ||
21 | local path="$1"; | ||
22 | if test -n "$2"; then | ||
23 | name="$2" | ||
24 | fi | ||
25 | test -z "$name" && return | ||
26 | # ls -H isn't really the same as readlink, but | ||
27 | # readlink is not portable enough. | ||
28 | path=`ls -H $path` | ||
29 | toadd="$name=$path" | ||
30 | is_contained "$toadd" && return | ||
31 | if test -z "$silent"; then | ||
32 | echo "adding file $toadd" | ||
33 | fi | ||
34 | target_files="$target_files $toadd" | ||
35 | if test -x "$path"; then | ||
36 | # Only call ldd when it makes sense | ||
37 | if file -L "$path" | grep 'ELF' > /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 | ||
40 | # this regexp parse the outputs like: | ||
41 | # ldd /usr/bin/gcc | ||
42 | # linux-gate.so.1 => (0xffffe000) | ||
43 | # libc.so.6 => /lib/tls/libc.so.6 (0xb7e81000) | ||
44 | # /lib/ld-linux.so.2 (0xb7fe8000) | ||
45 | # covering both situations ( with => and without ) | ||
46 | for lib in `ldd "$path" | sed -n 's,^[^/]*\(/[^ ]*\).*,\1,p'`; do | ||
47 | test -f "$lib" || continue | ||
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. | ||
50 | local baselib=`echo "$lib" | sed 's,\(/[^/]*\)/.*\(/[^/]*\)$,\1\2,'` | ||
51 | test -f "$baselib" && lib=$baselib | ||
52 | add_file "$lib" | ||
53 | done | ||
54 | fi | ||
55 | fi | ||
56 | fi | ||
57 | } | ||
58 | |||
59 | # backward compat | ||
60 | if test "$1" = "--respect-path"; then | ||
61 | shift | ||
62 | fi | ||
63 | |||
64 | #add a --silent switch to avoid "broken pipe" errors when calling this scipt from within OE | ||
65 | if test "$1" = "--silent"; then | ||
66 | silent=1 | ||
67 | shift | ||
68 | fi | ||
69 | |||
70 | |||
71 | added_gcc=$1 | ||
72 | shift | ||
73 | added_gxx=$1 | ||
74 | shift | ||
75 | added_as=$1 | ||
76 | shift | ||
77 | archive_name=$1 | ||
78 | |||
79 | if test -z "$added_gcc" || test -z "$added_gxx" ; then | ||
80 | echo "usage: $0 <gcc_path> <g++_path>" | ||
81 | exit 1 | ||
82 | fi | ||
83 | |||
84 | if ! test -x "$added_gcc" ; then | ||
85 | echo "'$added_gcc' is no executable." | ||
86 | exit 1 | ||
87 | fi | ||
88 | |||
89 | if ! test -x "$added_gxx" ; then | ||
90 | echo "'$added_gcc' is no executable." | ||
91 | exit 1 | ||
92 | fi | ||
93 | |||
94 | |||
95 | |||
96 | add_file $added_gcc /usr/bin/gcc | ||
97 | add_file $added_gxx /usr/bin/g++ | ||
98 | |||
99 | if test -z "$added_as" ; then | ||
100 | add_file /usr/bin/as /usr/bin/as | ||
101 | else | ||
102 | if ! test -x "$added_as" ; then | ||
103 | echo "'$added_as' is no executable." | ||
104 | exit 1 | ||
105 | fi | ||
106 | |||
107 | add_file $added_as /usr/bin/as | ||
108 | fi | ||
109 | |||
110 | add_file `$added_gcc -print-prog-name=cc1` /usr/bin/cc1 | ||
111 | add_file `$added_gxx -print-prog-name=cc1plus` /usr/bin/cc1plus | ||
112 | specfile=`$added_gcc -print-file-name=specs` | ||
113 | if test -n "$specfile" && test -e "$specfile"; then | ||
114 | add_file "$specfile" | ||
115 | fi | ||
116 | |||
117 | ltofile=`$added_gcc -print-prog-name=lto1` | ||
118 | pluginfile="${ltofile%lto1}liblto_plugin.so" | ||
119 | if test -r "$pluginfile" | ||
120 | then | ||
121 | add_file $pluginfile ${pluginfile#*usr} | ||
122 | add_file $pluginfile /usr${pluginfile#*usr} | ||
123 | fi | ||
124 | |||
125 | tempdir=`mktemp -d /tmp/iceccenvXXXXXX` | ||
126 | new_target_files= | ||
127 | for i in $target_files; do | ||
128 | case $i in | ||
129 | *=/*) | ||
130 | target=`echo $i | cut -d= -f1` | ||
131 | path=`echo $i | cut -d= -f2` | ||
132 | ;; | ||
133 | *) | ||
134 | path=$i | ||
135 | target=$i | ||
136 | ;; | ||
137 | esac | ||
138 | mkdir -p $tempdir/`dirname $target` | ||
139 | cp -p $path $tempdir/$target | ||
140 | if test -f $tempdir/$target -a -x $tempdir/$target; then | ||
141 | strip -s $tempdir/$target 2>/dev/null | ||
142 | fi | ||
143 | target=`echo $target | cut -b2-` | ||
144 | new_target_files="$new_target_files $target" | ||
145 | done | ||
146 | |||
147 | #sort the files | ||
148 | target_files=`for i in $new_target_files; do echo $i; done | sort` | ||
149 | |||
150 | #test if an archive name was supplied | ||
151 | #if not use the md5 of all files as the archive name | ||
152 | if test -z "$archive_name"; then | ||
153 | md5sum=NONE | ||
154 | for file in /usr/bin/md5sum /bin/md5 /usr/bin/md5; do | ||
155 | if test -x $file; then | ||
156 | md5sum=$file | ||
157 | break | ||
158 | fi | ||
159 | done | ||
160 | |||
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 || { | ||
163 | if test -z "$silent"; then | ||
164 | echo "Couldn't compute MD5 sum." | ||
165 | fi | ||
166 | exit 2 | ||
167 | } | ||
168 | mydir=`pwd` | ||
169 | else | ||
170 | mydir="`dirname "$archive_name"`" | ||
171 | |||
172 | #check if we have a full path or only a filename | ||
173 | if test "$mydir" = "." ; then | ||
174 | mydir=`pwd` | ||
175 | else | ||
176 | mydir="" | ||
177 | fi | ||
178 | fi | ||
179 | |||
180 | if test -z "$silent"; then | ||
181 | echo "creating $archive_name" | ||
182 | fi | ||
183 | |||
184 | cd $tempdir | ||
185 | tar -czhf "$mydir/$archive_name" $target_files || { | ||
186 | if test -z "$silent"; then | ||
187 | echo "Couldn't create archive" | ||
188 | fi | ||
189 | exit 3 | ||
190 | } | ||
191 | cd .. | ||
192 | rm -rf $tempdir | ||