13
0

Bootstrap libAAF support

This commit is contained in:
Robin Gareus 2023-06-26 14:27:23 +02:00
parent 3355e753bf
commit 47e437c2aa
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 156 additions and 0 deletions

65
libs/aaf/wscript Normal file
View File

@ -0,0 +1,65 @@
#!/usr/bin/env python
from waflib.extras import autowaf as autowaf
import os
# Version of this package (even if built as a child)
LIBAAF_VERSION = '0.0.0'
LIBAAF_LIB_VERSION = '0.0.0'
# Variables for 'waf dist'
APPNAME = 'libaaf'
VERSION = LIBAAF_VERSION
I18N_PACKAGE = 'libaaf'
# Mandatory variables
top = '.'
out = 'build'
libaaf_sources = [
'AAFClass.c',
'AAFCore.c',
'AAFDump.c',
'AAFIAudioFiles.c',
'AAFIface.c',
'AAFIParser.c',
'AAFToText.c',
'CFBDump.c',
'LibCFB.c',
'ProTools.c',
'Resolve.c',
'RIFFParser.c',
'URIParser.c',
'utils.c',
'debug.c',
]
def options(opt):
autowaf.set_options(opt)
def configure(conf):
if conf.is_defined('USE_EXTERNAL_LIBS'):
autowaf.check_pkg(conf, 'aaf', uselib_store='LIBAAF', mandatory=True)
def build(bld):
if bld.is_defined('USE_EXTERNAL_LIBS'):
return
if bld.is_defined ('INTERNAL_SHARED_LIBS'):
obj = bld.shlib(features = 'c cshlib', source=libaaf_sources)
obj.defines = [ 'LIBAAF_DLL_EXPORTS=1' ]
else:
obj = bld.stlib(features = 'c cshlib', source=libaaf_sources)
obj.cflags = [ bld.env['compiler_flags_dict']['pic'] ]
obj.defines = []
obj.export_includes = ['.']
obj.includes = ['.']
obj.name = 'libaaf'
obj.target = 'aaf'
#obj.uselib = 'GLIB'
obj.vnum = LIBAAF_LIB_VERSION
obj.install_path = bld.env['LIBDIR']
obj.defines += [ 'PACKAGE="' + I18N_PACKAGE + '"' ]
def shutdown():
autowaf.shutdown()

91
tools/update_libaaf.sh Executable file
View File

@ -0,0 +1,91 @@
#!/bin/sh
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"
TMP=`mktemp -d`
test -d "$TMP"
echo $TMP
trap "rm -rf $TMP" EXIT
cd $TMP
git clone https://github.com/agfline/LibAAF.git aaf
cd aaf
git describe --tags
LIBAAF_VERSION=$(git describe --tags --dirty --match "v*")
cd $TMP
AAF=aaf/
rsync -auc --info=progress2 \
${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 \
${AAF}src/AAFIface/AAFIAudioFiles.c \
${AAF}src/AAFIface/RIFFParser.c \
${AAF}src/AAFIface/URIParser.c \
${AAF}src/AAFIface/ProTools.c \
${AAF}src/AAFIface/Resolve.c \
${AAF}src/common/utils.c \
${AAF}src/debug.c \
\
"$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 \
${AAF}include/libaaf/debug.h \
${AAF}include/libaaf/AAFIAudioFiles.h \
${AAF}include/libaaf/ProTools.h \
${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 \
\
${AAF}src/AAFCore/AAFClass.h \
${AAF}src/AAFIface/RIFFParser.h \
${AAF}src/AAFIface/URIParser.h \
${AAF}src/common/utils.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