added changes to environment for unloze build and added README with rough instructions on how to build manually without having to use CI

This commit is contained in:
Your Name 2023-10-09 22:42:06 +02:00
parent ab34d8a17b
commit 083abd125e
4 changed files with 151 additions and 89 deletions

View File

@ -81,9 +81,9 @@ class SM:
self.compiler.AddToListVar('CFLAGS', '-Wno-unused')
self.compiler.AddToListVar('CFLAGS', '-Wno-switch')
self.compiler.AddToListVar('CFLAGS', '-Wno-implicit-exception-spec-mismatch')
self.compiler.AddToListVar('CFLAGS', '-Wno-builtin-declaration-mismatch')
#self.compiler.AddToListVar('CFLAGS', '-Wno-builtin-declaration-mismatch')
self.compiler.AddToListVar('CFLAGS', '-Wno-unused-result')
self.compiler.AddToListVar('CFLAGS', '-Wno-stringop-truncation')
#self.compiler.AddToListVar('CFLAGS', '-Wno-stringop-truncation')
self.compiler.AddToListVar('CFLAGS', '-msse')
self.compiler.AddToListVar('CFLAGS', '-g3')
self.compiler.AddToListVar('CFLAGS', '-m32')

62
README.md Normal file
View File

@ -0,0 +1,62 @@
There are no real changes to this compared to the version from boss over at https://github.com/srcdslab/sm-ext-accelerator/tree/master
The difference just being some basic environment settings for different paths and disabling some CFLAGS probably not available in clang14.
Unlike boss i prefer building this without having to rely on docker and an entire continous integration workflow.
The following is a rough list of steps to reproduce the build manually. I build it some hours ago so i probably forgot some commands by now. Basically you just have to replicate some build steps from https://github.com/srcdslab/sm-ext-accelerator/blob/master/.github/workflows/ci.yml
echo $SOURCEMOD
this has to return the path to the folder where your intended sourcemod installation is.
export SOURCEMOD=/home/gameservers/automate/sourcemod\_2023\_accelerator
export CC=clang
export CXX=clang++
export PATH="/usr/lib/jvm/jdk-17/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11/bin:/home/gameservers/.local/bin":/sbin:/bin:
the path is not exactly required like this, generally you just want /home/gameservers/.local/bin: because its where ambuild is installed atm on the OVH machine.
step 1:
directory: /home/gameservers/automate/sourcemod\_2023\_accelerator/extensions/sm-ext-accelerator/extension
mkdir breakpad && cd breakpad
git clone --recursive --branch=main https://chromium.googlesource.com/chromium/tools/depot_tools.git depot_tools
cd depot_tools
git checkout 08bb5c487f80147a236360ea50f4544890530779
step 2:
directory: /home/gameservers/automate/sourcemod_2023_accelerator/extensions/sm-ext-accelerator/extension/breakpad
cp depot_tools/.vpython3 .
PYTHONDONTWRITEBYTECODE=1 ./depot_tools/vpython3 ./depot_tools/fetch.py --nohooks breakpad
cd src
git config user.name patches
git config user.email patches@localhost
git checkout e3af4457b8355fcf1814e6dfb6073a848b44a282
git am -3 --keep-cr ../../patches/*.patch
cd ..
mkdir build && cd build
env ac_cv_header_a_out_h=yes ../src/configure --enable-m32 CFLAGS="-Wno-error=deprecated" CXXFLAGS="-Wno-error=deprecated -g -O2 -D_GLIBCXX_USE_CXX11_ABI=0" CPPFLAGS=-m32
make src/tools/linux/dump_syms/dump_syms
make src/client/linux/libbreakpad_client.a
make src/libbreakpad.a src/third_party/libdisasm/libdisasm.a
the make commands just have to point towards /home/gameservers/automate/sourcemod_2023_accelerator/extensions/sm-ext-accelerator/extension/breakpad/src/src directory
step 3:
directory: /home/gameservers/automate/sourcemod_2023_accelerator/extensions/sm-ext-accelerator/extension
export PATH=$PATH:$PWD/breakpad/build/src/tools/linux/dump_syms/
mkdir build && cd build
python ../../configure.py --enable-optimize
python ./build.py
The only 3 files where you might have to edit environment variables should be:
AMBuildScript
extension/AMBuilder
test/AMBuilder

View File

@ -6,102 +6,102 @@ from ambuild.command import ShellCommand
from ambuild.command import DirectCommand
def BuildEverything():
if AMBuild.target['platform'] not in ['linux', 'windows']:
return
if AMBuild.target['platform'] not in ['linux', 'windows']:
return
compiler = SM.DefaultCompiler()
compiler = SM.DefaultCompiler()
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'extensions'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'amtl', 'amtl'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'amtl'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'sourcepawn', 'include'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'extensions'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'amtl', 'amtl'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'public', 'amtl'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.cache['SOURCEMOD'], 'sourcepawn', 'include'))
if AMBuild.target['platform'] in ['linux']:
compiler['POSTLINKFLAGS'].append('-lm')
compiler['POSTLINKFLAGS'].append('-lstdc++')
compiler['POSTLINKFLAGS'].append('-pthread')
if AMBuild.target['platform'] in ['linux']:
compiler['POSTLINKFLAGS'].append('-lm')
compiler['POSTLINKFLAGS'].append('-lstdc++')
compiler['POSTLINKFLAGS'].append('-pthread')
compiler['CDEFINES'].append('HAVE_CONFIG_H')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'build', 'src'))
compiler['CDEFINES'].append('HAVE_CONFIG_H')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'breakpad', 'build', 'src'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'breakpad', 'src', 'src'))
name = 'accelerator.ext'
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
name = 'accelerator.ext'
extension = AMBuild.AddJob(name)
binary = Cpp.LibraryBuilder(name, AMBuild, extension, compiler)
binary.AddSourceFiles('extension', [
'extension.cpp',
'MemoryDownloader.cpp',
])
binary.AddSourceFiles('extension', [
'extension.cpp',
'MemoryDownloader.cpp',
])
binary.AddSourceFiles(AMBuild.cache['SOURCEMOD'], [
'public/smsdk_ext.cpp',
# 'public/libudis86/decode.c',
# 'public/libudis86/itab.c',
# 'public/libudis86/syn-att.c',
# 'public/libudis86/syn-intel.c',
# 'public/libudis86/syn.c',
# 'public/libudis86/udis86.c',
])
binary.AddSourceFiles(AMBuild.cache['SOURCEMOD'], [
'public/smsdk_ext.cpp',
# 'public/libudis86/decode.c',
# 'public/libudis86/itab.c',
# 'public/libudis86/syn-att.c',
# 'public/libudis86/syn-intel.c',
# 'public/libudis86/syn.c',
# 'public/libudis86/udis86.c',
])
if AMBuild.target['platform'] in ['linux']:
binary.AddSourceFiles(os.path.join('breakpad', 'src', 'src', 'common'), [
'dwarf_cfi_to_module.cc',
'dwarf_cu_to_module.cc',
'dwarf_line_to_module.cc',
'dwarf_range_list_handler.cc',
'language.cc',
'module.cc',
'path_helper.cc',
'stabs_reader.cc',
'stabs_to_module.cc',
'dwarf/bytereader.cc',
'dwarf/dwarf2diehandler.cc',
'dwarf/dwarf2reader.cc',
'dwarf/elf_reader.cc',
'linux/crc32.cc',
'linux/dump_symbols.cc',
'linux/elf_symbols_to_module.cc',
'linux/breakpad_getcontext.S',
])
if AMBuild.target['platform'] in ['linux']:
binary.AddSourceFiles(os.path.join('extension', 'breakpad', 'src', 'src', 'common'), [
'dwarf_cfi_to_module.cc',
'dwarf_cu_to_module.cc',
'dwarf_line_to_module.cc',
'dwarf_range_list_handler.cc',
'language.cc',
'module.cc',
'path_helper.cc',
'stabs_reader.cc',
'stabs_to_module.cc',
'dwarf/bytereader.cc',
'dwarf/dwarf2diehandler.cc',
'dwarf/dwarf2reader.cc',
'dwarf/elf_reader.cc',
'linux/crc32.cc',
'linux/dump_symbols.cc',
'linux/elf_symbols_to_module.cc',
'linux/breakpad_getcontext.S',
])
if AMBuild.target['platform'] in ['linux']:
libs = [
('libbreakpad_client.a', os.path.join('breakpad', 'build', 'src', 'client', 'linux', 'libbreakpad_client.a')),
('libbreakpad.a', os.path.join('breakpad', 'build', 'src', 'libbreakpad.a')),
('libdisasm.a', os.path.join('breakpad', 'build', 'src', 'third_party', 'libdisasm', 'libdisasm.a')),
]
if AMBuild.target['platform'] in ['linux']:
libs = [
('libbreakpad_client.a', os.path.join('extension', 'breakpad', 'build', 'src', 'client', 'linux', 'libbreakpad_client.a')),
('libbreakpad.a', os.path.join('extension', 'breakpad', 'build', 'src', 'libbreakpad.a')),
('libdisasm.a', os.path.join('extension', 'breakpad', 'build', 'src', 'third_party', 'libdisasm', 'libdisasm.a')),
]
for lib, target in libs:
link = os.path.join(AMBuild.outputFolder, extension.workFolder, lib)
target = os.path.join(AMBuild.sourceFolder, target)
try:
os.lstat(link)
except:
extension.AddCommand(SymlinkCommand(link, target))
binary.AddObjectFiles([lib])
for lib, target in libs:
link = os.path.join(AMBuild.outputFolder, extension.workFolder, lib)
target = os.path.join(AMBuild.sourceFolder, target)
try:
os.lstat(link)
except:
extension.AddCommand(SymlinkCommand(link, target))
binary.AddObjectFiles([lib])
elif AMBuild.target['platform'] in ['windows']:
libs = [
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'common.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'exception_handler.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'crash_generation', 'Release', 'lib', 'crash_generation_client.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'third_party', 'libdisasm', 'Release', 'lib', 'libdisasm.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'processor', 'Release', 'lib', 'processor.lib'),
]
elif AMBuild.target['platform'] in ['windows']:
libs = [
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'common.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'handler', 'Release', 'lib', 'exception_handler.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'client', 'windows', 'crash_generation', 'Release', 'lib', 'crash_generation_client.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'third_party', 'libdisasm', 'Release', 'lib', 'libdisasm.lib'),
os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src', 'processor', 'Release', 'lib', 'processor.lib'),
]
for path in libs:
if os.path.isfile(path):
binary.RelinkIfNewer(path)
binary['POSTLINKFLAGS'].extend([path])
for path in libs:
if os.path.isfile(path):
binary.RelinkIfNewer(path)
binary['POSTLINKFLAGS'].extend([path])
SM.AutoVersion('extension', binary)
SM.ExtractDebugInfo(extension, binary)
SM.AutoVersion('extension', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary.SendToJob()
BuildEverything()

View File

@ -17,12 +17,12 @@ def BuildEverything():
compiler['POSTLINKFLAGS'].append('-pthread')
compiler['CDEFINES'].append('HAVE_CONFIG_H')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'build', 'src'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'breakpad', 'build', 'src'))
elif compiler.cc.name == 'msvc':
compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS')
compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE')
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'breakpad', 'src', 'src'))
compiler['CXXINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'extension', 'breakpad', 'src', 'src'))
name = 'test-crash-dump-generation'
extension = AMBuild.AddJob(name)
@ -33,7 +33,7 @@ def BuildEverything():
]);
if AMBuild.target['platform'] in ['linux']:
binary.AddSourceFiles(os.path.join('breakpad', 'src', 'src', 'common'), [
binary.AddSourceFiles(os.path.join('extension', 'breakpad', 'src', 'src', 'common'), [
'dwarf_cfi_to_module.cc',
'dwarf_cu_to_module.cc',
'dwarf_line_to_module.cc',
@ -55,9 +55,9 @@ def BuildEverything():
if AMBuild.target['platform'] in ['linux']:
libs = [
('libbreakpad_client.a', os.path.join('breakpad', 'build', 'src', 'client', 'linux', 'libbreakpad_client.a')),
('libbreakpad.a', os.path.join('breakpad', 'build', 'src', 'libbreakpad.a')),
('libdisasm.a', os.path.join('breakpad', 'build', 'src', 'third_party', 'libdisasm', 'libdisasm.a')),
('libbreakpad_client.a', os.path.join('extension', 'breakpad', 'build', 'src', 'client', 'linux', 'libbreakpad_client.a')),
('libbreakpad.a', os.path.join('extension', 'breakpad', 'build', 'src', 'libbreakpad.a')),
('libdisasm.a', os.path.join('extension', 'breakpad', 'build', 'src', 'third_party', 'libdisasm', 'libdisasm.a')),
]
for lib, target in libs: