cyphesis/scripts/import_bullet

78 lines
2 KiB
Text
Raw Permalink Normal View History

#!/bin/bash
EXCLUSIONS="--exclude=ibmsdk --exclude=Jamfile --exclude=Makefile.am --exclude=CMakeLists.txt --exclude=Doxyfile"
pushd libraries/bullet
if [ "$#" -ne "1" ]
then
echo usage: $0 \<bullet_source_tarball\> >&2
exit 1
fi
tar xvzf "$1" ${EXCLUSIONS} bullet-2.??/src
rsync -av bullet-2.??/src/* .
rm -rf bullet-2.??
DIRS=`find . -type d ! -name CVS ! -name .deps`
MAKEFILES=""
for dir in ${DIRS}
do
SUBDIRS=""
SOURCES=""
MAKEFILE="${dir}/Makefile.am"
# Build a list of subdirectories and sources
for entry in $dir/*
do
filename=`basename ${entry}`
2008-05-09 15:35:53 +00:00
if [ -d ${entry} ] && [ ${filename} != "CVS" ]
then
SUBDIRS="${SUBDIRS} ${filename}"
fi
if [ -f ${entry} ] && [ ${filename: -4:4} == ".cpp" -o ${filename: -2:2} == ".h" ]
then
SOURCES="${SOURCES} ${filename}"
fi
done
# Create a temporary file to contain the new Makefile.am
echo > ${MAKEFILE}_tmp
# Add the subdirectories to the new Makefile.am
if [ -n "${SUBDIRS}" ]
then
echo -e "SUBDIRS = ${SUBDIRS}\n" >> ${MAKEFILE}_tmp
fi
# Add the sources to the new Makefile.am
if [ -n "${SOURCES}" ]
then
# The top level directory of bullet has only headers.
2008-05-09 15:35:53 +00:00
if [ ${dir} = "." ]
then
echo -e "noinst_HEADERS = ${SOURCES}\n" >> ${MAKEFILE}_tmp
2008-05-09 15:35:53 +00:00
else
libname="lib`basename ${dir}`"
echo -e "noinst_LIBRARIES = ${libname}.a\n" >> ${MAKEFILE}_tmp
echo -e "INCLUDES = -I\$(top_srcdir)/libraries/bullet\n" >> ${MAKEFILE}_tmp
echo -e "${libname}_a_SOURCES = ${SOURCES}\n" >> ${MAKEFILE}_tmp
2008-05-09 15:35:53 +00:00
fi
fi
# If Makefile.am is new or changed, move it to the right name.
if [ ! -f ${MAKEFILE} ] || ! cmp ${MAKEFILE}_tmp ${MAKEFILE}
then
mv -f ${MAKEFILE}_tmp ${MAKEFILE}
else
echo ${MAKEFILE} unchanged.
rm -f ${MAKEFILE}_tmp
fi
# Strip off the leading ./ and add the filename to the list to
# be checked against the contents of configure.ac
if [ ${MAKEFILE:0:2} = "./" ]
then
MAKEFILE=${MAKEFILE:2}
fi
MAKEFILES="${MAKEFILES}\tlibraries/bullet/${MAKEFILE%%.*}\n"
done
echo Check the following files are in configure.ac:
echo -e ${MAKEFILES}