1#!/bin/sh
2# Usage: framework-header-fix.sh <source header dir> <LLDB Version>
3for file in `find $1 -name "*.h"`
4do
5  sed -i '' 's/\(#include\)[ ]*"lldb\/\(API\/\)\{0,1\}\(.*\)"/\1 <LLDB\/\3>/1' "$file"
6  sed -i '' 's|<LLDB/Utility|<LLDB|' "$file"
7  LLDB_VERSION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\1/g'`
8  LLDB_REVISION=`echo $2 | /usr/bin/sed -E 's/^([0-9]+).([0-9]+).([0-9]+)(.[0-9]+)?$/\\3/g'`
9  LLDB_VERSION_STRING=`echo $2`
10  sed -i '' "s|//#define LLDB_VERSION$|#define LLDB_VERSION $LLDB_VERSION |" "$file"
11  sed -i '' "s|//#define LLDB_REVISION|#define LLDB_REVISION $LLDB_REVISION |" "$file"
12  sed -i '' "s|//#define LLDB_VERSION_STRING|#define LLDB_VERSION_STRING \"$LLDB_VERSION_STRING\" |" "$file"
13done
14