summaryrefslogtreecommitdiffstats
path: root/mkmultiarch
diff options
context:
space:
mode:
authorGwenolé Beauchesne <gbeauchesne@mandriva.org>2005-01-31 22:59:19 +0000
committerGwenolé Beauchesne <gbeauchesne@mandriva.org>2005-01-31 22:59:19 +0000
commitcf462649e3ac7c5d5f92a791707c231ea8d107b4 (patch)
treeed990d9c60703fc77b8c9bf97153b53b9c685ce0 /mkmultiarch
parent5458c7a74c0f3606e30190e88955f7f23e51ba07 (diff)
downloadmultiarch-utils-cf462649e3ac7c5d5f92a791707c231ea8d107b4.tar
multiarch-utils-cf462649e3ac7c5d5f92a791707c231ea8d107b4.tar.gz
multiarch-utils-cf462649e3ac7c5d5f92a791707c231ea8d107b4.tar.bz2
multiarch-utils-cf462649e3ac7c5d5f92a791707c231ea8d107b4.tar.xz
multiarch-utils-cf462649e3ac7c5d5f92a791707c231ea8d107b4.zip
handle ciruclar inclusions (e.g. gd.h)
Diffstat (limited to 'mkmultiarch')
-rwxr-xr-xmkmultiarch12
1 files changed, 12 insertions, 0 deletions
diff --git a/mkmultiarch b/mkmultiarch
index ec657c6..502884f 100755
--- a/mkmultiarch
+++ b/mkmultiarch
@@ -53,16 +53,25 @@ function dispatch_binaries() {
function dispatch_includes() {
local file=$1
local incdir=`dirname $file`
+
+ # handle circular inclusions
+ local tag=$incdir/.multiarch-processing.${file##*/}
+ [[ -f "$tag" ]] && return
+ touch $tag
+
+ # sanity checks, extract path parts
echo $file | grep -q '/include/' || error "Unsupported includedir $incdir"
local prefix=`echo $incdir | sed -n '/\(.*\/include\)\/.*/s//\1/p'`
[[ -z "$prefix" ]] && prefix="$incdir"
local suffix=`echo $incdir | sed -n '/.*\/include\/\(.*\)/s//\1/p'`
[[ -n "$suffix" ]] && suffix="$suffix/"
+
# dispatch nested includes expected in local directory
sed -n '/^#[ \t]*include[ \t]*"\([^"][^"]*\)".*/s//\1/p' $file | \
while read localfile; do
[[ -f "$incdir/$localfile" ]] && dispatch_includes $incdir/$localfile
done
+
# dispatch selected include file, provided it's not already dispatched
grep -q _MULTIARCH_HEADER $file || {
local archincdir=$prefix/$mplat/$suffix
@@ -73,6 +82,9 @@ function dispatch_includes() {
#include <multiarch-dispatch.h>
EOF
}
+
+ # done with this file
+ rm -f $tag
}
while [[ $# -gt 0 ]]; do