From fc37e9609909d5b56d1c00d5e7f54159adc392d7 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Sun, 26 Jun 2022 20:11:52 -0700 Subject: [PATCH] Automatically unpack libraries before building This required adding the included script in every project that links to one of the bundled libraries. The script is designed to sleep for a while if another thread is already extracting the libraries. The script uses a temporary file as an extraction step lock, so other instances sleep, and then detect the libraries.updated file, which is created before the lock is removed. Signed-off-by: Christopher Snowhill --- .gitignore | 8 +- .../xcshareddata/xcschemes/Cog.xcscheme | 20 ++++- .../xcshareddata/xcschemes/vgmstream.xcscheme | 20 ++++- .../xcschemes/FFMPEG Plugin.xcscheme | 20 ++++- .../xcschemes/Flac Plugin.xcscheme | 20 ++++- .../xcshareddata/xcschemes/MAD.xcscheme | 85 +++++++++++++++++++ .../xcshareddata/xcschemes/MIDI.xcscheme | 20 ++++- .../xcschemes/OpenMPTOld.xcscheme | 85 +++++++++++++++++++ .../xcshareddata/xcschemes/OpenMPT.xcscheme | 85 +++++++++++++++++++ .../xcshareddata/xcschemes/Opus.xcscheme | 20 ++++- .../xcschemes/Vorbis Plugin.xcscheme | 20 ++++- .../xcschemes/libvgmPlayer Plugin.xcscheme | 85 +++++++++++++++++++ Scripts/extract_libraries.sh | 16 ++++ 13 files changed, 496 insertions(+), 8 deletions(-) create mode 100644 Plugins/MAD/MAD.xcodeproj/xcshareddata/xcschemes/MAD.xcscheme create mode 100644 Plugins/OpenMPT.old/OpenMPTOld.xcodeproj/xcshareddata/xcschemes/OpenMPTOld.xcscheme create mode 100644 Plugins/OpenMPT/OpenMPT.xcodeproj/xcshareddata/xcschemes/OpenMPT.xcscheme create mode 100644 Plugins/libvgmPlayer/libvgmPlayer.xcodeproj/xcshareddata/xcschemes/libvgmPlayer Plugin.xcscheme create mode 100755 Scripts/extract_libraries.sh diff --git a/.gitignore b/.gitignore index db5edc49f..d7d9bc3ac 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,13 @@ Xcode-config/DEVELOPMENT_TEAM.xcconfig Cog.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved -# Unpack these before building +# This indicates the libraries are up to date +/ThirdParty/libraries.updated + +# Temporary file to indicate libraries are being extracted by one process +/ThirdParty/libraries.extracting + +# The project will unpack these before building, if necessary /ThirdParty/BASS/libbass.dylib /ThirdParty/BASS/libbassflac.dylib /ThirdParty/BASS/libbassmidi.dylib diff --git a/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme b/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme index 5bec9c87b..4d5511bdd 100644 --- a/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme +++ b/Cog.xcodeproj/xcshareddata/xcschemes/Cog.xcscheme @@ -1,10 +1,28 @@ + version = "1.7"> + + + + + + + + + + + version = "1.7"> + + + + + + + + + + + version = "1.7"> + + + + + + + + + + + version = "1.7"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/MIDI/MIDI.xcodeproj/xcshareddata/xcschemes/MIDI.xcscheme b/Plugins/MIDI/MIDI.xcodeproj/xcshareddata/xcschemes/MIDI.xcscheme index 65473fbd9..da9ea69f6 100644 --- a/Plugins/MIDI/MIDI.xcodeproj/xcshareddata/xcschemes/MIDI.xcscheme +++ b/Plugins/MIDI/MIDI.xcodeproj/xcshareddata/xcschemes/MIDI.xcscheme @@ -1,10 +1,28 @@ + version = "1.7"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/OpenMPT/OpenMPT.xcodeproj/xcshareddata/xcschemes/OpenMPT.xcscheme b/Plugins/OpenMPT/OpenMPT.xcodeproj/xcshareddata/xcschemes/OpenMPT.xcscheme new file mode 100644 index 000000000..73176a2f9 --- /dev/null +++ b/Plugins/OpenMPT/OpenMPT.xcodeproj/xcshareddata/xcschemes/OpenMPT.xcscheme @@ -0,0 +1,85 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Plugins/Opus/OpusPlugin.xcodeproj/xcshareddata/xcschemes/Opus.xcscheme b/Plugins/Opus/OpusPlugin.xcodeproj/xcshareddata/xcschemes/Opus.xcscheme index 97eae050c..59818bdcc 100644 --- a/Plugins/Opus/OpusPlugin.xcodeproj/xcshareddata/xcschemes/Opus.xcscheme +++ b/Plugins/Opus/OpusPlugin.xcodeproj/xcshareddata/xcschemes/Opus.xcscheme @@ -1,10 +1,28 @@ + version = "1.7"> + + + + + + + + + + + version = "1.7"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Scripts/extract_libraries.sh b/Scripts/extract_libraries.sh new file mode 100755 index 000000000..e8257f3f9 --- /dev/null +++ b/Scripts/extract_libraries.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +BASEDIR=$(dirname "$0") + +until [ ! -f "${BASEDIR}/../ThirdParty/libraries.extracting" ] +do + sleep 5 +done + +if [ \( ! -f "${BASEDIR}/../ThirdParty/libraries.updated" \) -o \( "${BASEDIR}/../ThirdParty/libraries.updated" -ot "${BASEDIR}/../ThirdParty/libraries.tar.xz" \) ]; then + touch "${BASEDIR}/../ThirdParty/libraries.extracting" + tar -C "${BASEDIR}/../ThirdParty" -xvf "${BASEDIR}/../ThirdParty/libraries.tar.xz" + touch "${BASEDIR}/../ThirdParty/libraries.updated" + rm -f "${BASEDIR}/../ThirdParty/libraries.extracting" +fi +