diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4eda98d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,159 @@ +name: CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-20.04] + sourcemod-version: [1.11-dev] + chromium-depot-tools-version: [08bb5c487f80147a236360ea50f4544890530779] + chromium-breakpad-version: [e3af4457b8355fcf1814e6dfb6073a848b44a282] + ambuild-version: [master] + include: + - os: ubuntu-20.04 + target-archs: x86,x86_64 + sdks: sdk2013 + + steps: + - name: Install Linux packages + if: runner.os == 'Linux' + run: | + sudo apt update + sudo apt install -yq --no-install-recommends g++-multilib + + - name: Set up Python + uses: actions/setup-python@v2 + + - name: Checkout + uses: actions/checkout@v2 + with: + path: extension + + - name: Checkout SourceMod + uses: actions/checkout@v2 + with: + repository: alliedmodders/sourcemod + ref: ${{ matrix.sourcemod-version }} + path: sourcemod + submodules: recursive + + - name: Checkout sm-ext-common + uses: actions/checkout@v2 + with: + repository: srcdslab/sm-ext-common + path: sourcemod/extensions/sm-ext-common + + - name: Checkout chromium depot_tools + working-directory: extension + run: | + 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 ${{ matrix.chromium-depot-tools-version }} + + - name: Install sourcemod dependencies + run: | + bash sourcemod/tools/checkout-deps.sh -m -s ${{ matrix.sdks }} + pip uninstall ambuild -y + rm -rf ambuild + + - name: Checkout AMBuild + uses: actions/checkout@v2 + with: + repository: alliedmodders/ambuild + path: ambuild + ref: ${{ matrix.ambuild-version }} + + - name: Install AMBuild + uses: BSFishy/pip-action@v1 + with: + packages: ./ambuild + + - name: Install Linux breakpad + working-directory: extension/breakpad + if: runner.os == 'Linux' + run: | + 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 ${{ matrix.chromium-breakpad-version }} + 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 + + - name: Install Windows breakpad + working-directory: extension + if: runner.os == 'Windows' + run: | + breakpad.bat + + - name: Build + working-directory: extension + shell: bash + # env: + # BREAKPAD_SYMBOL_SERVER: ${{ secrets.BREAKPAD_SYMBOL_SERVER }} + run: | + export PATH=$PATH:$PWD/breakpad/build/src/tools/linux/dump_syms/ + mkdir build && cd build + python ../configure.py --enable-optimize + python ./build.py + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ runner.os }} + path: extension/build/package + + + release: + name: Release + if: startsWith(github.ref, 'refs/tags/') + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + + - name: Package + run: | + version=`echo $GITHUB_REF | sed "s/refs\/tags\///"` + ls -Rall + if [ -d "./Linux/" ]; then + cd ./Linux/ + tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz -T <(\ls -1) + cd - + fi + if [ -d "./macOS/" ]; then + cd ./macOS/ + tar -czf ../${{ github.event.repository.name }}-${version}-mac.tar.gz -T <(\ls -1) + cd - + fi + if [ -d "./Windows/" ]; then + cd ./Windows/ + tar -czf ../${{ github.event.repository.name }}-${version}-windows.tar.gz -T <(\ls -1) + cd - + fi + + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: '*.tar.gz' + tag: ${{ github.ref }} + file_glob: true diff --git a/.gitignore b/.gitignore index 0860212..6334976 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /build /extension/version_auto.h /breakpad + +# Virtual env +.venv +venv diff --git a/AMBuildScript b/AMBuildScript index e92c894..011e363 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -32,7 +32,7 @@ class SM: self.compiler.DetectAll(AMBuild) #Detect variables - envvars = { 'SOURCEMOD': 'sourcemod-1.8' } + envvars = { 'SOURCEMOD': 'sourcemod' } # Finds if a dict with `key` set to `value` is present on the dict of dicts `dictionary` def findDictByKey(dictionary, key, value): @@ -81,12 +81,15 @@ 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-unused-result') + self.compiler.AddToListVar('CFLAGS', '-Wno-stringop-truncation') self.compiler.AddToListVar('CFLAGS', '-msse') self.compiler.AddToListVar('CFLAGS', '-g3') self.compiler.AddToListVar('CFLAGS', '-m32') self.compiler.AddToListVar('POSTLINKFLAGS', '-m32') self.compiler.AddToListVar('POSTLINKFLAGS', '-Wl,-z,defs') - self.compiler.AddToListVar('CXXFLAGS', '-std=c++11') + self.compiler.AddToListVar('CXXFLAGS', '-std=c++14') self.compiler.AddToListVar('CXXFLAGS', '-fno-threadsafe-statics') self.compiler.AddToListVar('CXXFLAGS', '-Wno-non-virtual-dtor') self.compiler.AddToListVar('CXXFLAGS', '-Wno-overloaded-virtual') diff --git a/breakpad.sh b/breakpad.sh index a9d1e28..89d929a 100755 --- a/breakpad.sh +++ b/breakpad.sh @@ -12,11 +12,11 @@ if [ ! -d "depot_tools" ]; then fi if [ ! -d "src" ]; then - PYTHONDONTWRITEBYTECODE=1 python2.7 ./depot_tools/fetch.py --nohooks breakpad + PYTHONDONTWRITEBYTECODE=1 python3 ./depot_tools/fetch.py --nohooks breakpad else git -C src fetch git -C src reset --hard origin/master - PYTHONDONTWRITEBYTECODE=1 python2.7 ./depot_tools/gclient.py sync --nohooks + PYTHONDONTWRITEBYTECODE=1 python3 ./depot_tools/gclient.py sync --nohooks fi cd src diff --git a/buildbot/PackageScript b/buildbot/PackageScript index ab241b3..1b212eb 100644 --- a/buildbot/PackageScript +++ b/buildbot/PackageScript @@ -85,7 +85,7 @@ bincopies = [] def AddNormalLibrary(name, dest): dest = os.path.join('addons', 'sourcemod', dest) bincopies.append(CopyFile(os.path.join('..', name, name + osutil.SharedLibSuffix()), dest)) - + # Each platform's version of dump_syms needs the path in a different format. if AMBuild.target['platform'] == 'linux': debug_info.append(name + '/' + name + '.so') @@ -124,4 +124,3 @@ pdblog = open(os.path.join(AMBuild.outputFolder, 'pdblog.txt'), 'wt') for pdb in debug_info: pdblog.write(pdb + '\n') pdblog.close() - diff --git a/extension/AMBuilder b/extension/AMBuilder index 09ceefe..270e27e 100644 --- a/extension/AMBuilder +++ b/extension/AMBuilder @@ -15,6 +15,8 @@ def BuildEverything(): 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']: @@ -36,7 +38,15 @@ def BuildEverything(): 'MemoryDownloader.cpp', ]) - binary.AddSourceFiles(AMBuild.cache['SOURCEMOD'], ['public/smsdk_ext.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', + ]) if AMBuild.target['platform'] in ['linux']: binary.AddSourceFiles(os.path.join('breakpad', 'src', 'src', 'common'), [ diff --git a/patches/0001-Ignore-invalid-modules-rather-than-bailing-on-the-en.patch b/patches/0001-Ignore-invalid-modules-rather-than-bailing-on-the-en.patch index d47f76a..b521c6d 100644 --- a/patches/0001-Ignore-invalid-modules-rather-than-bailing-on-the-en.patch +++ b/patches/0001-Ignore-invalid-modules-rather-than-bailing-on-the-en.patch @@ -1,7 +1,7 @@ From 1f35257db226d6d0189cff0832a97cccc639c91a Mon Sep 17 00:00:00 2001 From: Asher Baker Date: Sun, 13 Jan 2019 12:34:45 +0000 -Subject: [PATCH 1/4] Ignore invalid modules rather than bailing on the entire +Subject: [PATCH 1/5] Ignore invalid modules rather than bailing on the entire module list --- diff --git a/patches/0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch b/patches/0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch index a5fc147..4092814 100644 --- a/patches/0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch +++ b/patches/0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch @@ -1,22 +1,21 @@ -From 8aaf6e84a6704eb538f68a3e6fb6c3a8c93f1d8d Mon Sep 17 00:00:00 2001 +From b38ee2510107352b73cd02ff66f7bd1c3d1114e6 Mon Sep 17 00:00:00 2001 From: Asher Baker -Date: Sun, 13 Jan 2019 12:35:05 +0000 -Subject: [PATCH 2/4] Write FUNC records instead of PUBLIC for ELF symbols with - sizes +Date: Sun, 25 Sep 2022 15:03:27 +0200 +Subject: [PATCH 2/5] Write FUNC records instead of PUBLIC for ELF symbols with --- src/common/linux/elf_symbols_to_module.cc | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/common/linux/elf_symbols_to_module.cc b/src/common/linux/elf_symbols_to_module.cc -index 562875e1..e11a5265 100644 +index 4aee38d6..5b7991d5 100644 --- a/src/common/linux/elf_symbols_to_module.cc +++ b/src/common/linux/elf_symbols_to_module.cc -@@ -156,19 +156,28 @@ bool ELFSymbolsToModule(const uint8_t *symtab_section, +@@ -156,19 +156,28 @@ bool ELFSymbolsToModule(const uint8_t* symtab_section, while(!iterator->at_end) { if (ELF32_ST_TYPE(iterator->info) == STT_FUNC && iterator->shndx != SHN_UNDEF) { -- Module::Extern *ext = new Module::Extern(iterator->value); +- Module::Extern* ext = new Module::Extern(iterator->value); - ext->name = SymbolString(iterator->name_offset, strings); + string name = SymbolString(iterator->name_offset, strings); #if !defined(__ANDROID__) // Android NDK doesn't provide abi::__cxa_demangle. @@ -46,5 +45,5 @@ index 562875e1..e11a5265 100644 ++iterator; } -- -2.21.0 +2.25.1 diff --git a/patches/0003-Avoid-using-_ZNSsC1ERKSsjRKSaIcE-GLIBCXX-symbol-due-.patch b/patches/0003-Avoid-using-_ZNSsC1ERKSsjRKSaIcE-GLIBCXX-symbol-due-.patch index 8a613b7..fcc8b87 100644 --- a/patches/0003-Avoid-using-_ZNSsC1ERKSsjRKSaIcE-GLIBCXX-symbol-due-.patch +++ b/patches/0003-Avoid-using-_ZNSsC1ERKSsjRKSaIcE-GLIBCXX-symbol-due-.patch @@ -1,7 +1,7 @@ From 21dfe5a22da02ed8bcd9fa1cca7c18c8c5310172 Mon Sep 17 00:00:00 2001 -From: patches +From: Asher Baker Date: Sun, 28 Apr 2019 18:45:57 +0000 -Subject: [PATCH 3/4] Avoid using _ZNSsC1ERKSsjRKSaIcE GLIBCXX symbol due to +Subject: [PATCH 3/5] Avoid using _ZNSsC1ERKSsjRKSaIcE GLIBCXX symbol due to version compat issues --- diff --git a/patches/0004-Support-compilation-on-VS-2015.patch b/patches/0004-Support-compilation-on-VS-2015.patch index 5f0e28b..565c922 100644 --- a/patches/0004-Support-compilation-on-VS-2015.patch +++ b/patches/0004-Support-compilation-on-VS-2015.patch @@ -1,51 +1,25 @@ -From 2f217812634d5e6c56f0cf9e7a4c9b7fb390e954 Mon Sep 17 00:00:00 2001 -From: patches +From bbae57fd5ddcd65c034ef21586fab29600367f75 Mon Sep 17 00:00:00 2001 +From: Asher Baker Date: Sat, 20 Jul 2019 15:52:37 +0100 -Subject: [PATCH 4/4] Support compilation on VS 2015 +Subject: [PATCH 4/5] Support compilation on VS 2015 --- - src/common/windows/pe_util.cc | 1 + - src/common/windows/pe_util.h | 2 +- - src/tools/windows/dump_syms/dump_syms.cc | 1 + - 3 files changed, 3 insertions(+), 1 deletion(-) + src/common/windows/pe_util.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/src/common/windows/pe_util.cc b/src/common/windows/pe_util.cc -index 6fa63fa3..03dcd142 100644 ---- a/src/common/windows/pe_util.cc -+++ b/src/common/windows/pe_util.cc -@@ -35,6 +35,7 @@ - #include - - #include -+#include - - #include "common/windows/string_utils-inl.h" - #include "common/windows/guid_string.h" diff --git a/src/common/windows/pe_util.h b/src/common/windows/pe_util.h -index 634ba293..3eefa761 100644 +index 6c6b364f..80aba5e5 100644 --- a/src/common/windows/pe_util.h +++ b/src/common/windows/pe_util.h -@@ -60,7 +60,7 @@ wstring GenerateDebugIdentifier(DWORD age, DWORD signature); - - // Converts |machine| enum value to the corresponding string used by Breakpad. - // The enum is IMAGE_FILE_MACHINE_*, contained in winnt.h. --constexpr const wchar_t* FileHeaderMachineToCpuString(WORD machine) { -+static inline const wchar_t* FileHeaderMachineToCpuString(WORD machine) { - switch (machine) { - case IMAGE_FILE_MACHINE_I386: { - return L"x86"; -diff --git a/src/tools/windows/dump_syms/dump_syms.cc b/src/tools/windows/dump_syms/dump_syms.cc -index 5b7d1777..1f22cfc2 100644 ---- a/src/tools/windows/dump_syms/dump_syms.cc -+++ b/src/tools/windows/dump_syms/dump_syms.cc -@@ -33,6 +33,7 @@ - #include - #include +@@ -59,7 +59,7 @@ wstring GenerateDebugIdentifier(DWORD age, DWORD signature); -+#include - #include - - #include "common/windows/pdb_source_line_writer.h" + // Converts |machine| enum value to the corresponding string used by Breakpad. + // The enum is IMAGE_FILE_MACHINE_*, contained in winnt.h. +-constexpr const wchar_t* FileHeaderMachineToCpuString(WORD machine) { ++static inline const wchar_t* FileHeaderMachineToCpuString(WORD machine) { + switch (machine) { + case IMAGE_FILE_MACHINE_I386: { + return L"x86"; -- -2.21.0 +2.25.1 diff --git a/patches/0005-Fix-32-bit-build-on-64-bit-linux-systems.patch b/patches/0005-Fix-32-bit-build-on-64-bit-linux-systems.patch new file mode 100644 index 0000000..26ec3ce --- /dev/null +++ b/patches/0005-Fix-32-bit-build-on-64-bit-linux-systems.patch @@ -0,0 +1,25 @@ +From 02a0fcc0685dc8c4a6c4e1d38f4704b4213ddc34 Mon Sep 17 00:00:00 2001 +From: maxime1907 <19607336+maxime1907@users.noreply.github.com> +Date: Sun, 25 Sep 2022 15:28:26 +0200 +Subject: [PATCH 5/5] Fix 32 bit build on 64 bit linux systems + +--- + src/common/stabs_reader.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/common/stabs_reader.h b/src/common/stabs_reader.h +index 3f5f0a8f..68713503 100644 +--- a/src/common/stabs_reader.h ++++ b/src/common/stabs_reader.h +@@ -56,7 +56,7 @@ + #ifdef HAVE_MACH_O_NLIST_H + #include + #elif defined(HAVE_A_OUT_H) +-#include ++#include + #endif + + #include +-- +2.25.1 +