13
0
livetrax/tools/update_libaaf.sh

107 lines
2.6 KiB
Bash
Raw Normal View History

2023-06-26 08:27:23 -04:00
#!/bin/sh
LOCAL_AAF_PROJECT="$1"
2023-06-26 08:27:23 -04:00
if ! test -f wscript || ! test -d gtk2_ardour; then
echo "This script needs to run from ardour's top-level src tree"
exit 1
fi
if test -z "`which rsync`" -o -z "`which git`"; then
echo "this script needs rsync and git"
exit 1
fi
ASRC=`pwd`
set -e
mkdir -p "$ASRC/libs/aaf/aaf"
if [ -z "${LOCAL_AAF_PROJECT}" ]; then
# Using git repos
TMP=`mktemp -d`
test -d "$TMP"
echo $TMP
2023-06-26 08:27:23 -04:00
trap "rm -rf $TMP" EXIT
2023-06-26 08:27:23 -04:00
cd $TMP
git clone https://github.com/agfline/LibAAF.git aaf
2023-06-26 08:27:23 -04:00
cd aaf
git describe --tags
LIBAAF_VERSION=$(git describe --tags --dirty --match "v*")
cd $TMP
2023-06-26 08:27:23 -04:00
AAF=aaf/
RSYNC_OPT="-auc --info=progress2"
else
# Using local project
LIBAAF_VERSION="v0-local"
cd "${LOCAL_AAF_PROJECT}"
echo $PWD
AAF="./"
2024-03-10 12:51:10 -04:00
RSYNC_OPT="-aI --size-only --info=progress2"
fi
2023-06-26 08:27:23 -04:00
rsync $RSYNC_OPT \
2023-06-26 08:27:23 -04:00
${AAF}src/LibCFB/LibCFB.c \
${AAF}src/LibCFB/CFBDump.c \
${AAF}src/AAFCore/AAFCore.c \
${AAF}src/AAFCore/AAFClass.c \
${AAF}src/AAFCore/AAFToText.c \
${AAF}src/AAFCore/AAFDump.c \
${AAF}src/AAFIface/AAFIface.c \
${AAF}src/AAFIface/AAFIParser.c \
2024-03-10 12:51:10 -04:00
${AAF}src/AAFIface/AAFIEssenceFile.c \
2023-06-26 08:27:23 -04:00
${AAF}src/AAFIface/RIFFParser.c \
${AAF}src/AAFIface/URIParser.c \
2024-03-10 12:51:10 -04:00
${AAF}src/AAFIface/ProTools.c \
${AAF}src/AAFIface/MediaComposer.c \
2023-06-26 08:27:23 -04:00
${AAF}src/AAFIface/Resolve.c \
${AAF}src/common/utils.c \
2024-03-10 12:51:10 -04:00
${AAF}src/common/log.c \
2023-06-26 08:27:23 -04:00
\
"$ASRC/libs/aaf"
rsync -auc --info=progress2 \
${AAF}include/libaaf.h \
${AAF}include/libaaf/Resolve.h \
${AAF}include/libaaf/AAFIParser.h \
${AAF}include/libaaf/AAFCore.h \
2024-03-10 12:51:10 -04:00
${AAF}include/libaaf/log.h \
${AAF}include/libaaf/AAFIEssenceFile.h \
2023-06-26 08:27:23 -04:00
${AAF}include/libaaf/ProTools.h \
2024-03-10 12:51:10 -04:00
${AAF}include/libaaf/MediaComposer.h \
2023-06-26 08:27:23 -04:00
${AAF}include/libaaf/AAFToText.h \
${AAF}include/libaaf/AAFIface.h \
${AAF}include/libaaf/CFBDump.h \
${AAF}include/libaaf/AAFDump.h \
${AAF}include/libaaf/AAFTypes.h \
${AAF}include/libaaf/LibCFB.h \
2023-12-22 11:44:11 -05:00
${AAF}include/libaaf/utils.h \
2023-06-26 08:27:23 -04:00
\
${AAF}src/AAFCore/AAFClass.h \
${AAF}src/AAFIface/RIFFParser.h \
${AAF}src/AAFIface/URIParser.h \
\
${AAF}include/libaaf/AAFDefs \
\
"$ASRC/libs/aaf/aaf/"
cat > "$ASRC/libs/aaf/aaf/version.h" << EOF
#pragma once
#define LIBAAF_VERSION "${LIBAAF_VERSION}"
EOF
cd "$ASRC/libs/aaf"
for file in $(find . -type f); do
sed -i 's%#include *<libaaf/\([^>]*\)>%#include "aaf/\1"%; s%#include *<libaaf.h>%#include "aaf/libaaf.h"%;s%#include.*utils.h"%#include "aaf/utils.h"%' $file
sed -i 's%#include *"\(AAFClass.h\)"%#include "aaf/\1"%' $file
sed -i 's%#include *"\(\w*Parser.h\)"%#include "aaf/\1"%' $file
done
clang-format -i $ASRC/libs/aaf/*.c $ASRC/libs/aaf/aaf/*.h
#cd "$ASRC"
#patch -p1 < tools/aaf-patches/ardour_libaaf.diff