#!/usr/bin/env bash # Windows system layer (task 9), not 1:1: prepares the third-party source trees the Windows CMake build # (port/CMakeLists.txt) compiles, the same trees tools/port/build_thirdparty.sh makes for the Mac, WITHOUT compiling: # parity-out/thirdparty/src/ upstream sources (zlib, libpng, libogg, libvorbis, jpeg, jasper, lua) + OpenAL Soft # parity-out/thirdparty/build/{jpeg-6b,jasper-1.900.1,lua-5.0.2} patched copies (tools/port/thirdparty/*.patch) # Idempotent: existing trees are kept (delete a tree to rebuild it). Needs bash, tar, unzip, patch, git. set -e R="$(cd "$(dirname "$0")/../.." && pwd)" T=$R/parity-out/thirdparty S=$T/src B=$T/build mkdir -p "$S" "$B" cd "$S" # tar on Windows cannot create the symlinks of lua-5.0.2/test/ (unused): ignore its exit status, check the tree instead untar() { [ -d "$2" ] || { tar xzf "$1" 2>/dev/null || true; }; [ -d "$2" ] || { echo "extract failed: $1"; exit 1; }; } untar ../zlib-1.2.1.tar.gz zlib-1.2.1 untar ../libpng-1.2.5.tar.gz libpng-1.2.5 untar ../jpegsrc.v6b.tar.gz jpeg-6b [ -d jasper-1.900.1 ] || unzip -q ../jasper-1.900.1.zip untar ../lua-5.0.2.tar.gz lua-5.0.2 untar ../libogg-1.0.tar.gz libogg-1.0 untar ../libvorbis-1.0.tar.gz libvorbis-1.0 [ -d openal-soft ] || timeout 300 git clone --depth 1 --branch 1.24.3 https://github.com/kcat/openal-soft.git openal-soft cd "$B" if [ ! -d jpeg-6b ]; then cp -R "$S/jpeg-6b" jpeg-6b patch -s -p0 < "$R/tools/port/thirdparty/jpeg-6b-playground.patch" # jconfig.h: the jconfig.doc defaults for an ANSI compiler with stdlib (as build_thirdparty.sh) cat > jpeg-6b/jconfig.h <<'CONF' #define HAVE_PROTOTYPES #define HAVE_UNSIGNED_CHAR #define HAVE_UNSIGNED_SHORT #define HAVE_STDDEF_H #define HAVE_STDLIB_H #undef NEED_BSD_STRINGS #undef NEED_SYS_TYPES_H #undef NEED_FAR_POINTERS #undef NEED_SHORT_EXTERNAL_NAMES #undef INCOMPLETE_TYPES_BROKEN #ifdef JPEG_INTERNALS #undef RIGHT_SHIFT_IS_UNSIGNED #endif CONF fi if [ ! -d jasper-1.900.1 ]; then cp -R "$S/jasper-1.900.1" jasper-1.900.1 patch -s -p0 < "$R/tools/port/thirdparty/jasper-1.900.1-playground.patch" fi if [ ! -d lua-5.0.2 ]; then cp -R "$S/lua-5.0.2" lua-5.0.2 patch -s -p0 < "$R/tools/port/thirdparty/lua-5.0.2-luaplus.patch" fi echo "third-party trees ready in $T"