Contents of /branches/R11-stable/include/libtool.sminc
Parent Directory | Revision Log
Revision 2 -
(show annotations)
(download)
Fri Oct 10 13:29:42 2008 UTC (16 years ago) by niro
Original Path: trunk/core/include/libtool.sminc
File size: 1716 byte(s)
Fri Oct 10 13:29:42 2008 UTC (16 years ago) by niro
Original Path: trunk/core/include/libtool.sminc
File size: 1716 byte(s)
import repo
1 | # $Header: /magellan-cvs/smage/include/libtool.sminc,v 1.3 2008/04/02 16:30:00 niro Exp $ |
2 | # libtool related functions |
3 | |
4 | # fixes broken dependencies in *.la files |
5 | # broken: dependency_libs=' -L/var/tmp/magebuild/gcc-4.2.3/build/i686-pc-linux-gnu/libstdc++-v3/src -L/var/tmp/magebuild/gcc-4.2.3/build/i686-pc-linux-gnu/libstdc++-v3/src/.libs -lm -lm -lm -L/var/tmp/magebuild/gcc-4.2.3/build/./gcc -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.3 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/../../.. -lgcc_s -lc -lgcc_s -lm -lgcc_s -lc -lgcc_s' |
6 | # fixed: dependency_libs=' -lm -lm -lm -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.3 -L/usr/lib/gcc/i686-pc-linux-gnu/4.2.3/../../.. -lgcc_s -lc -lgcc_s -lm -lgcc_s -lc -lgcc_s' |
7 | fix_la_file() |
8 | { |
9 | local file="$@" |
10 | local dependency_libs |
11 | local new_dependency_libs |
12 | local dep |
13 | |
14 | if [[ -f ${file} ]] |
15 | then |
16 | echo "Processing file '${file}' ..." |
17 | dependency_libs=$(egrep '^dependency_libs=' ${file} | sed -e "s:dependency_libs=::" -e "s:'::g" ) |
18 | |
19 | for dep in ${dependency_libs} |
20 | do |
21 | # check for ${BINDIR} |
22 | [[ ${dep/${BINDIR}/} != ${dep} ]] && continue |
23 | |
24 | # check for ${BUILDDIR} |
25 | [[ ${dep/${BUILDDIR}/} != ${dep} ]] && continue |
26 | |
27 | # do not add any duplicates |
28 | check_dupes new_dependency_libs ${dep} || continue |
29 | |
30 | new_dependency_libs="${new_dependency_libs} ${dep}" |
31 | done |
32 | |
33 | echo "new deps: ${new_dependency_libs}" |
34 | sed -i "s:^\(dependency_libs=\).*:\1'${new_dependency_libs}':" ${file} |
35 | fi |
36 | } |
37 | |
38 | # checks a variable if it contains a given item |
39 | # check_dupes variablename item |
40 | check_dupes() |
41 | { |
42 | local variable="$1" |
43 | local item="$2" |
44 | local i |
45 | |
46 | for i in $(eval echo \$${variable}) |
47 | do |
48 | # found so abort |
49 | [[ ${i} = ${item} ]] && return 1 |
50 | done |
51 | |
52 | # if we get here, nothing was found |
53 | return 0 |
54 | } |