3rdparty: bzip2: add wscript for bzip2, check for system-wide bzip2, add readme note

This commit is contained in:
Alibek Omarov 2024-10-07 18:11:29 +03:00
parent 43299f6747
commit 057b47555d
4 changed files with 46 additions and 3 deletions

35
3rdparty/bzip2/wscript vendored Normal file
View File

@ -0,0 +1,35 @@
#! /usr/bin/env python
# encoding: utf-8
BZIP_CHECK='''#include <bzlib.h>
int main(void) { return BZ2_bzlibVersion() != NULL; }
'''
def options(opt):
pass
def configure(conf):
conf.define('_GNU_SOURCE', 1)
if conf.env.DEST_OS == 'win32':
conf.define('BZ_LCCWIN32', 1)
else:
conf.define('BZ_UNIX', 1)
def build(bld):
bld(
features = 'subst',
source = 'bzip2/bz_version.h.in',
target = 'bz_version.h',
BZ_VERSION='1.1.0-fwgs'
)
bld.stlib(
source = bld.path.ant_glob(['bzip2/*.c']),
target = 'bzip2',
use = 'bz_version.h',
features = 'c',
includes = ['bzip2/', '.'],
subsystem = bld.env.MSVC_SUBSYSTEM,
export_includes = ['bzip2/']
)

View File

@ -67,9 +67,9 @@ This repository contains our fork of HLSDK and restored source code for Half-Lif
`$ sudo dpkg --add-architecture i386`
* Install development tools
* For 32-bit engine on amd64: \
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386 libopus-dev:i386`
`$ sudo apt install build-essential gcc-multilib g++-multilib python libsdl2-dev:i386 libfontconfig-dev:i386 libfreetype6-dev:i386 libopus-dev:i386 libbz2-dev:i386`
* For everything else: \
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev libopus-dev`
`$ sudo apt install build-essential python libsdl2-dev libfontconfig-dev libfreetype6-dev libopus-dev libbz2-dev`
* Clone this repostory:
`$ git clone --recursive https://github.com/FWGS/xash3d-fwgs`

View File

@ -222,7 +222,7 @@ def build(bld):
'client/*.c',
'client/vgui/*.c',
'client/avi/*.c'])
libs += ['opus']
libs += ['opus', 'bzip2']
includes = ['server', 'client', 'client/vgui' ]

View File

@ -79,6 +79,7 @@ SUBDIRS = [
Subproject('ref/gl', lambda x: not x.env.DEDICATED and (x.env.GL or x.env.NANOGL or x.env.GLWES or x.env.GL4ES)),
Subproject('ref/soft', lambda x: not x.env.DEDICATED and not x.env.SUPPORT_BSP2_FORMAT and x.env.SOFT),
Subproject('ref/null', lambda x: not x.env.DEDICATED and x.env.NULL),
Subproject('3rdparty/bzip2', lambda x: not x.env.DEDICATED and not x.env.HAVE_SYSTEM_BZ2),
Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED),
Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED),
# Subproject('3rdparty/freevgui', lambda x: not x.env.DEDICATED),
@ -459,6 +460,13 @@ int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const
if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus werror', fragment=frag, mandatory=False):
conf.env.HAVE_SYSTEM_OPUS = True
# search for bzip2
BZIP2_CHECK='''#include <bzlib.h>
int main(void) { return (int)BZ2_bzlibVersion(); }'''
if conf.check_cc(lib='bz2', fragment=BZIP2_CHECK, uselib_store='bzip2', mandatory=False):
conf.env.HAVE_SYSTEM_BZ2 = True
conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)
for i in SUBDIRS: