accelerator/third_party/Patch
sappho 1d60f3746a
overhaul -> overhaul (#21)
* overhaul the repository

add protobuf

change repo url

try to restore github python syntax highlighter

move breakpad into third_party, update packagescript

* AMBuildifying

remove unnecessary files

Move the git patching into ambuild

move lss to a patch

Add windows compilation support

remove breakpad.bat

move postlink libs

* Overhaul CI (#4)

* Dockerbuild (#5)

* make cwd_cmd spew stdout and stderr

* add proper docker build support

* Overhaul ci (#6)

* Setup CI

* fix checkout

* fix yaml syntax

* no fail fast

* setup CI cache

* Fix pip install

* remove pip git

* update actions, ditch node 16

* small syntax cleanups

* more CI changes

* github doc lied

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>

* final push for perfect dockerbuilds in every scenario that i have been able to find

* rename cicd->dockerbuild

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>

* Add readme, remode duplicate -fPIC

update names of dockerbuild folder in sh files

* cleanup dockerfile (#7)

* Update 0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch

* Statically link libz, libgcc & libstdc++

* fix submodule path

* Review change + comment patch

---------

Co-authored-by: Kenzzer <kenzzer@users.noreply.github.com>
Co-authored-by: Benoist <14257866+Kenzzer@users.noreply.github.com>
2024-10-10 21:59:28 -04:00

81 lines
2.1 KiB
Python

# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
import re
def Normalize(path):
return os.path.abspath(os.path.normpath(os.path.join(path)))
def AddFilesFromDir(path, files):
list = []
for file in files:
list.append(os.path.join(path, file))
return list
def AddCwdCommand(context, cwd, inputs,
argv,
outputs,
folder = -1,
dep_type = None,
weak_inputs = [],
shared_outputs = [],
env_data = None,
fake_output = None):
base_argv = [
sys.executable,
Normalize(os.path.join(context.currentSourcePath, 'cwd_cmd.py')),
cwd,
os.path.join(context.buildPath, 'third_party', fake_output) if fake_output else '_',
]
if fake_output :
outputs += [fake_output]
return context.AddCommand(inputs=inputs, argv=base_argv + argv, outputs=outputs, folder=folder, dep_type=dep_type, weak_inputs=weak_inputs, shared_outputs=shared_outputs, env_data=env_data)
git_dir = Normalize(os.path.join(builder.currentSourcePath, 'breakpad'))
patches = AddFilesFromDir(os.path.join(builder.currentSourcePath, '..', 'patches'), [
"0001-Ignore-invalid-modules-rather-than-bailing-on-the-en.patch",
"0002-Write-FUNC-records-instead-of-PUBLIC-for-ELF-symbols.patch",
"0003-Support-compilation-on-VS-2015.patch",
"0004-Fix-Linux-a-out-include.patch",
"0005-Add-LSS.patch"
])
# Reset the breakpad directory before applying patches
argv = [
'git',
'clean',
'-fdx',
'&&',
'git',
'reset',
'--hard'
]
git_reset = AddCwdCommand(builder, git_dir,
inputs=patches, # We want the reset to happen again if we modify the patch files
outputs=[],
fake_output='git_clean.txt',
argv=argv)
# Apply each of the patch available to the breakpad repository
argv = [
'git',
'apply',
'--reject'
]
git_patches = []
num = 0
for patch in patches:
patch_argv = argv + [patch]
git_patches += AddCwdCommand(builder, git_dir,
inputs=patches, # Redo the command if the patches changed
outputs=[],
fake_output=str(num) + '_patch.txt',
argv=patch_argv,
weak_inputs=git_reset if num == 0 else [git_patches[-1]] + git_reset # We need to for the git reset to be performed
)
num = num + 1
Accelerator.breakpad_patch = git_reset + git_patches