mirror of
https://github.com/nillerusr/source-engine.git
synced 2025-04-30 01:08:08 +00:00
Use strip to reduce artifacts size
This commit is contained in:
parent
383d2e5ca7
commit
c7895b28ed
38
.github/workflows/build.yml
vendored
38
.github/workflows/build.yml
vendored
@ -2,7 +2,7 @@ name: Build
|
|||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
env:
|
env:
|
||||||
WAF_FLAGS: -T release --disable-warns --prefix=build_hl2
|
WAF_FLAGS: -T debug --disable-warns --prefix=build_hl2
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-linux:
|
build-linux:
|
||||||
@ -52,14 +52,20 @@ jobs:
|
|||||||
- name: Configure
|
- name: Configure
|
||||||
run: ./waf configure ${{ matrix.bits }} ${{ matrix.android }} ${{ matrix.flags }} $WAF_FLAGS
|
run: ./waf configure ${{ matrix.bits }} ${{ matrix.android }} ${{ matrix.flags }} $WAF_FLAGS
|
||||||
- name: Build ${{ matrix.os }}
|
- name: Build ${{ matrix.os }}
|
||||||
run: ./waf install
|
run: ./waf install --strip-to-file
|
||||||
- name: Tar binaries
|
- name: Upload build
|
||||||
run: tar cvf build.tar build_hl2
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Linux${{matrix.bits}}${{matrix.flags}}${{matrix.android}}.tar
|
name: linux${{matrix.bits}}${{matrix.flags}}${{matrix.android}}
|
||||||
path: build.tar
|
path: |
|
||||||
|
build_hl2
|
||||||
|
!build_hl2/**/*.debug
|
||||||
|
- name: Upload debug symbols
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: debug-Linux${{matrix.bits}}${{matrix.flags}}${{matrix.android}}
|
||||||
|
path: |
|
||||||
|
build_hl2/**/*.debug
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
strategy:
|
strategy:
|
||||||
@ -78,14 +84,20 @@ jobs:
|
|||||||
- name: Configure
|
- name: Configure
|
||||||
run: ./waf configure --64bits ${{ matrix.flags }} $WAF_FLAGS
|
run: ./waf configure --64bits ${{ matrix.flags }} $WAF_FLAGS
|
||||||
- name: Build macos-amd64
|
- name: Build macos-amd64
|
||||||
run: ./waf install
|
run: ./waf install --strip-to-file
|
||||||
- name: Tar binaries
|
- name: Upload build
|
||||||
run: tar cvf build.tar build_hl2
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: macOS--64bits${{matrix.flags}}.tar
|
name: macOS--64bits${{matrix.flags}}${{matrix.android}}
|
||||||
path: build.tar
|
path: |
|
||||||
|
build_hl2
|
||||||
|
!build_hl2/**/*.dSYM
|
||||||
|
- name: Upload debug symbols
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: debug-macOS--64bits${{matrix.flags}}${{matrix.android}}
|
||||||
|
path: |
|
||||||
|
build_hl2/**/*.dSYM
|
||||||
|
|
||||||
build-windows:
|
build-windows:
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -25,6 +25,8 @@ def configure(conf):
|
|||||||
|
|
||||||
if conf.env.DEST_BINFMT == 'mac-o':
|
if conf.env.DEST_BINFMT == 'mac-o':
|
||||||
conf.env.STRIPFLAGS += ['-x']
|
conf.env.STRIPFLAGS += ['-x']
|
||||||
|
conf.find_program('dsymutil', var='DSYMUTIL')
|
||||||
|
conf.env.STRIPFLAGS += ['-S'] # we will use .dSYM instead
|
||||||
return # macOS don't have objcopy
|
return # macOS don't have objcopy
|
||||||
|
|
||||||
# a1ba: I am lazy to add `export OBJCOPY=` everywhere in my scripts
|
# a1ba: I am lazy to add `export OBJCOPY=` everywhere in my scripts
|
||||||
@ -56,12 +58,19 @@ def copy_fun(self, src, tgt):
|
|||||||
c3 = Logs.colors.YELLOW
|
c3 = Logs.colors.YELLOW
|
||||||
c4 = Logs.colors.BLUE
|
c4 = Logs.colors.BLUE
|
||||||
try:
|
try:
|
||||||
if self.generator.bld.options.strip_to_file and self.env.DEST_BINFMT == 'elf':
|
if self.generator.bld.options.strip_to_file:
|
||||||
ocopy_cmd = self.env.OBJCOPY + ['--only-keep-debug', tgt, tgt_debug]
|
if self.env.DEST_BINFMT == 'elf':
|
||||||
self.generator.bld.cmd_and_log(ocopy_cmd, output=Context.BOTH, quiet=Context.BOTH)
|
ocopy_cmd = self.env.OBJCOPY + ['--only-keep-debug', tgt, tgt_debug]
|
||||||
if not self.generator.bld.progress_bar:
|
self.generator.bld.cmd_and_log(ocopy_cmd, output=Context.BOTH, quiet=Context.BOTH)
|
||||||
Logs.info('%s+ objcopy --only-keep-debug %s%s%s %s%s%s', c1, c4, tgt, c1, c3, tgt_debug, c1)
|
if not self.generator.bld.progress_bar:
|
||||||
|
Logs.info('%s+ objcopy --only-keep-debug %s%s%s %s%s%s', c1, c4, tgt, c1, c3, tgt_debug, c1)
|
||||||
|
elif self.env.DEST_BINFMT == 'mac-o':
|
||||||
|
tgt_debug = os.path.splitext(tgt)[0] + '.dSYM'
|
||||||
|
dsymutil_cmd = self.env.DSYMUTIL + [tgt, '-o', tgt_debug]
|
||||||
|
self.generator.bld.cmd_and_log(dsymutil_cmd, output=Context.BOTH, quiet=Context.BOTH)
|
||||||
|
if not self.generator.bld.progress_bar:
|
||||||
|
Logs.info('%s+ dsymutil %s%s%s -o %s%s%s', c1, c4, tgt, c1, c3, tgt_debug, c1)
|
||||||
|
|
||||||
strip_cmd = self.env.STRIP + self.env.STRIPFLAGS + [tgt]
|
strip_cmd = self.env.STRIP + self.env.STRIPFLAGS + [tgt]
|
||||||
self.generator.bld.cmd_and_log(strip_cmd, output=Context.BOTH, quiet=Context.BOTH)
|
self.generator.bld.cmd_and_log(strip_cmd, output=Context.BOTH, quiet=Context.BOTH)
|
||||||
if not self.generator.bld.progress_bar:
|
if not self.generator.bld.progress_bar:
|
||||||
|
Loading…
Reference in New Issue
Block a user