1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
117
tools/port/build_thirdparty.sh
Normal file
117
tools/port/build_thirdparty.sh
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
#!/bin/zsh
|
||||
# Builds the third-party libraries the engine links, from the upstream sources of the same versions:
|
||||
# zlib 1.2.1, libpng 1.2.5, IJG libjpeg 6b, JasPer 1.900.1, Lua 5.0.2 (as the game's LuaPlus build 1084),
|
||||
# libogg 1.0, libvorbis 1.0
|
||||
# -> parity-out/thirdparty/lib/lib{z,png,jpeg,jasper,lua,ogg,vorbis,vorbisfile}.a and include dirs under
|
||||
# parity-out/thirdparty/build/ (Lua) and parity-out/thirdparty/src/ (libogg-1.0/include, libvorbis-1.0/include).
|
||||
#
|
||||
# Upstream archives: parity-out/thirdparty/*.tar.gz / *.zip, unpacked to parity-out/thirdparty/src/ (untouched).
|
||||
# zlib, libpng, libogg and libvorbis are built unchanged (libogg's shipped include/ogg/config_types.h is used;
|
||||
# libvorbis: the library sources of lib/ without the tools barkmel.c, psytune.c, tone.c and the encoder
|
||||
# vorbisenc.c; vorbisfile.c goes to libvorbisfile.a).
|
||||
# libjpeg and JasPer get the Playground changes that the game binary proves
|
||||
# (tools/port/thirdparty/*.patch, see the comments in the patches and docs in the port sources):
|
||||
# jpeg-6b: jmorecfg.h BGRA output (RGB_RED 2, RGB_GREEN 1, RGB_BLUE 0, RGB_PIXELSIZE 4), DCT_ISLOW/IFAST and
|
||||
# QUANT_1PASS/2PASS not compiled, JDCT_DEFAULT/JDCT_FASTEST = JDCT_FLOAT
|
||||
# jdcolor.c, jdmerge.c every RGB converter also stores 0xFF in the alpha byte
|
||||
# memory manager: jmemansi.c (tmpfile backing store, DEFAULT_MAX_MEM 1000000) as in the game
|
||||
# jasper: jas_stream_initbuf, jas_strtoopenmode, jas_stream_destroy are external (static upstream);
|
||||
# only the JP2 and JPC codecs are built (the game's jas_init registers fmt 0 = jp2, 1 = jpc)
|
||||
# lua: the game's embedded LuaPlus build 1084 (docs/port/lua.md): 39 opcodes (bitwise & | << >>, numeric ^ =
|
||||
# XOR), continue / break N, L"..." wstrings, default metatables per type, LuaPlus API additions
|
||||
# (src/LuaPlusAddons.c), pack/unpack/lualex in the string library, files read through pf_* (pflib file
|
||||
# layer, linked from the port). Headers include/lua.h, lauxlib.h, lualib.h, LuaLink.h, luser_number.h
|
||||
# are the port's (port/include/lua) LuaPlus headers. Only the libraries the game links are built:
|
||||
# base, string, table, math (no io, os, debug, loadlib).
|
||||
# Float code is built with -ffp-contract=off so single-precision math rounds like the game's SSE code.
|
||||
set -e
|
||||
R=${0:A:h:h:h}
|
||||
T=$R/parity-out/thirdparty
|
||||
S=$T/src
|
||||
B=$T/build
|
||||
L=$T/lib
|
||||
mkdir -p $S $B $L
|
||||
cd $S
|
||||
[[ -d zlib-1.2.1 ]] || tar xzf ../zlib-1.2.1.tar.gz
|
||||
[[ -d libpng-1.2.5 ]] || tar xzf ../libpng-1.2.5.tar.gz
|
||||
[[ -d jpeg-6b ]] || tar xzf ../jpegsrc.v6b.tar.gz
|
||||
[[ -d jasper-1.900.1 ]] || unzip -q ../jasper-1.900.1.zip
|
||||
[[ -d lua-5.0.2 ]] || tar xzf ../lua-5.0.2.tar.gz
|
||||
[[ -d libogg-1.0 ]] || tar xzf ../libogg-1.0.tar.gz
|
||||
[[ -d libvorbis-1.0 ]] || tar xzf ../libvorbis-1.0.tar.gz
|
||||
|
||||
rm -rf $B/jpeg-6b $B/jasper-1.900.1 $B/lua-5.0.2 $B/obj
|
||||
cp -R $S/jpeg-6b $B/jpeg-6b
|
||||
cp -R $S/jasper-1.900.1 $B/jasper-1.900.1
|
||||
cp -R $S/lua-5.0.2 $B/lua-5.0.2
|
||||
(cd $B && patch -s -p0 < $R/tools/port/thirdparty/jpeg-6b-playground.patch)
|
||||
(cd $B && patch -s -p0 < $R/tools/port/thirdparty/jasper-1.900.1-playground.patch)
|
||||
(cd $B && patch -s -p0 < $R/tools/port/thirdparty/lua-5.0.2-luaplus.patch)
|
||||
|
||||
# jconfig.h: the jconfig.doc defaults for an ANSI compiler with stdlib (no configure run needed)
|
||||
cat > $B/jpeg-6b/jconfig.h <<'EOF'
|
||||
#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
|
||||
EOF
|
||||
|
||||
CC=(clang -O2 -ffp-contract=off -fPIC -w -std=gnu89)
|
||||
O=$B/obj
|
||||
mkdir -p $O/z $O/png $O/jpeg $O/jasper $O/lua $O/ogg $O/vorbis $O/vorbisfile
|
||||
|
||||
build() { # build NAME OBJDIR FLAGS... -- SOURCES...
|
||||
local name=$1 od=$2; shift 2
|
||||
local flags=()
|
||||
while [[ $1 != -- ]]; do flags+=$1; shift; done; shift
|
||||
local objs=()
|
||||
for f in "$@"; do
|
||||
local o=$od/${${f:t}:r}.o
|
||||
$CC $flags -c $f -o $o &
|
||||
objs+=$o
|
||||
done
|
||||
wait
|
||||
rm -f $L/lib$name.a
|
||||
ar rcs $L/lib$name.a $objs
|
||||
}
|
||||
|
||||
Z=$S/zlib-1.2.1
|
||||
build z $O/z -- $Z/{adler32,compress,crc32,deflate,gzio,infback,inffast,inflate,inftrees,trees,uncompr,zutil}.c
|
||||
|
||||
P=$S/libpng-1.2.5
|
||||
# pngconf.h takes <fp.h> for MACOS unless <math.h> is already in: pre-include it (no source change)
|
||||
build png $O/png -I$Z -include math.h -- $P/{png,pngerror,pngget,pngmem,pngpread,pngread,pngrio,pngrtran,pngrutil,pngset,pngtrans,pngwio,pngwrite,pngwtran,pngwutil}.c
|
||||
|
||||
J=$B/jpeg-6b
|
||||
build jpeg $O/jpeg -I$J -- $J/{jcapimin,jcapistd,jccoefct,jccolor,jcdctmgr,jchuff,jcinit,jcmainct,jcmarker,jcmaster,jcomapi,jcparam,jcphuff,jcprepct,jcsample,jctrans,jdapimin,jdapistd,jdatadst,jdatasrc,jdcoefct,jdcolor,jddctmgr,jdhuff,jdinput,jdmainct,jdmarker,jdmaster,jdmerge,jdphuff,jdpostct,jdsample,jdtrans,jerror,jfdctflt,jidctflt,jidctred,jquant1,jquant2,jutils,jmemmgr,jmemansi}.c
|
||||
|
||||
A=$B/jasper-1.900.1/src/libjasper
|
||||
build jasper $O/jasper -I$A/include -DEXCLUDE_MIF_SUPPORT -DEXCLUDE_PNM_SUPPORT -DEXCLUDE_BMP_SUPPORT \
|
||||
-DEXCLUDE_RAS_SUPPORT -DEXCLUDE_JPG_SUPPORT -DEXCLUDE_PGX_SUPPORT -- \
|
||||
$A/base/{jas_cm,jas_debug,jas_getopt,jas_icc,jas_iccdata,jas_image,jas_init,jas_malloc,jas_seq,jas_stream,jas_string,jas_tmr,jas_tvp,jas_version}.c \
|
||||
$A/jp2/{jp2_cod,jp2_dec,jp2_enc}.c \
|
||||
$A/jpc/{jpc_bs,jpc_cs,jpc_dec,jpc_enc,jpc_math,jpc_mct,jpc_mqcod,jpc_mqdec,jpc_mqenc,jpc_qmfb,jpc_t1cod,jpc_t1dec,jpc_t1enc,jpc_t2cod,jpc_t2dec,jpc_t2enc,jpc_tagtree,jpc_tsfb,jpc_util}.c
|
||||
|
||||
U=$B/lua-5.0.2
|
||||
build lua $O/lua -I$U/include -I$U/src -- \
|
||||
$U/src/{lapi,lcode,ldebug,ldo,ldump,lfunc,lgc,llex,lmem,lobject,lopcodes,lparser,lstate,lstring,ltable,ltm,lundump,lvm,lzio,LuaPlusAddons}.c \
|
||||
$U/src/lib/{lauxlib,lbaselib,lstrlib,ltablib,lmathlib}.c
|
||||
|
||||
G=$S/libogg-1.0
|
||||
build ogg $O/ogg -I$G/include -- $G/src/{bitwise,framing}.c
|
||||
|
||||
V=$S/libvorbis-1.0
|
||||
build vorbis $O/vorbis -I$G/include -I$V/include -I$V/lib -- \
|
||||
$V/lib/{analysis,bitrate,block,codebook,envelope,floor0,floor1,info,lookup,lpc,lsp,mapping0,mdct,psy,registry,res0,sharedbook,smallft,synthesis,window}.c
|
||||
build vorbisfile $O/vorbisfile -I$G/include -I$V/include -- $V/lib/vorbisfile.c
|
||||
|
||||
ls -la $L
|
||||
Loading…
Add table
Add a link
Reference in a new issue