Skip to content

Commit

Permalink
Adding option for smalling build size
Browse files Browse the repository at this point in the history
Was needed as FFmpeg has a massive size for Linux builds. Not certain if
it works but let's see. Also took some time to make the workflow scripts
more organized.
  • Loading branch information
voylin committed Aug 8, 2024
1 parent 20e23a7 commit c0efd2a
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 62 deletions.
28 changes: 16 additions & 12 deletions .github/workflows/build_gdextension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,31 @@ jobs:
run: pip install scons
- name: Install Yasm
run: sudo apt-get update && sudo apt-get install -y yasm

- name: Build Linux Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=yes
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes enable_small=yes
- name: Build Linux Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-debug
path: bin/linux_video_only_template_debug/*
- name: Build Linux Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-release
path: bin/linux_video_only_template_release/*
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes
name: gde_gozen-linux-full-build
path: bin/linux_video_only_full_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-build
path: bin/linux_video_only_full_template_debug/*
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no
name: gde_gozen-linux-release
path: bin/linux_video_only_template_release/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -86,15 +88,17 @@ jobs:
sudo update-alternatives --config x86_64-w64-mingw32-g++ <<< "1"
- name: Install Yasm
run: sudo apt-get install -y yasm

- name: Build Windows Debug
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-windows-build
path: bin/windows_video_only_template_debug/*
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down
80 changes: 44 additions & 36 deletions .github/workflows/build_gdextension_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,57 +35,63 @@ jobs:
run: pip install scons
- name: Install Yasm
run: sudo apt-get update && sudo apt-get install -y yasm

# DEBUG BUILDS
- name: Build Linux Debug video only
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=yes
- name: Build Linux Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=yes include_renderer=yes
- name: Build Linux full Debug video only
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes enable_small=yes
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-debug-video-only
path: bin/linux_video_only_template_debug/*
- name: Build Linux Release video only
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-release-video-only
path: bin/linux_video_only_template_release/*
- name: Build Linux Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=yes include_renderer=yes
name: gde_gozen-linux-debug
path: bin/linux_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-debug
path: bin/linux_template_debug/*
name: gde_gozen-linux-full-build-video-only
path: bin/linux_video_only_full_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-build
path: bin/linux_full_template_debug/*

# RELEASE builds
- name: Build Linux Release video only
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes
- name: Build Linux Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes include_renderer=yes
- name: Build Linux full Release video only
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no enable_small=yes
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-release
path: bin/linux_template_release/*
- name: Build Linux full Debug video only
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes
name: gde_gozen-linux-release-video-only
path: bin/linux_video_only_template_release/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-build-video-only
path: bin/linux_video_only_full_template_debug/*
- name: Build Linux full Release video only
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no
name: gde_gozen-linux-release
path: bin/linux_template_release/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-release-video-only
path: bin/linux_video_only_full_template_release/*
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-build
path: bin/linux_full_template_debug/*
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -114,29 +120,31 @@ jobs:
sudo update-alternatives --config x86_64-w64-mingw32-g++ <<< "1"
- name: Install Yasm
run: sudo apt-get install -y yasm

- name: Build Windows Debug video only
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes enable_small=yes
- name: Build Windows Debug
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes
- name: Build Windows Release video only
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no enable_small=yes
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-windows-build-video_only
path: bin/windows_video_only_template_debug/*
- name: Build Windows Release video only
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-windows-release-video-only
path: bin/windows_video_only_template_release/*
- name: Build Windows Debug
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
name: gde_gozen-windows-build
path: bin/windows_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-windows-build
path: bin/window_template_debug/*
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
name: gde_gozen-windows-release-video-only
path: bin/windows_video_only_template_release/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down
32 changes: 18 additions & 14 deletions .github/workflows/build_gdextension_with_renderer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,31 @@ jobs:
run: pip install scons
- name: Install Yasm
run: sudo apt-get update && sudo apt-get install -y yasm

- name: Build Linux Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=yes include_renderer=yes
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes include_renderer=yes enable_small=yes
- name: Build Linux Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes include_renderer=yes
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-debug
path: bin/linux_template_debug/*
- name: Build Linux Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=yes include_renderer=yes
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-release
path: bin/linux_template_release/*
- name: Build Linux full Debug
run: scons -Q -j4 target=template_debug platform=linux arch=x86_64 use_system=no enable_gpl=yes include_renderer=yes
name: gde_gozen-linux-full-build
path: bin/linux_full_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-linux-full-build
path: bin/linux_full_template_debug/*
- name: Build Linux full Release
run: scons -Q -j4 target=template_release platform=linux arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
name: gde_gozen-linux-release
path: bin/linux_template_release/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -86,15 +88,17 @@ jobs:
sudo update-alternatives --config x86_64-w64-mingw32-g++ <<< "1"
- name: Install Yasm
run: sudo apt-get install -y yasm

- name: Build Windows Debug
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes include_renderer=yes
run: scons -Q -j4 target=template_debug platform=windows arch=x86_64 use_system=no enable_gpl=yes include_renderer=yes enable_small=yes
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes enable_small=yes

- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
name: gde_gozen-windows-build
path: bin/window_template_debug/*
- name: Build Windows Release
run: scons -Q -j4 target=template_release platform=windows arch=x86_64 use_system=no enable_gpl=yes recompile_ffmpeg=no include_renderer=yes
path: bin/windows_template_debug/*
- name: Uploading GDExtension artifact
uses: actions/upload-artifact@v4
with:
Expand Down
3 changes: 3 additions & 0 deletions COMPILE_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Using the command line is pretty straightforward. Use `scons` with any of the st

`recompile_ffmpeg=` is set to yes by default, but when making consequential builds, you probably don't need this to happen so for the second run of the same OS you could set this to `no`. This is helpful when building the template_debug and template_release directly after each other.

### Enable small

`enable_small=` is a command which will make FFmpeg take longer to compile but will save in space as the libraries will be smaller in size. Set this to `yes` to use it.
2 changes: 2 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ if ARGUMENTS.get('include_renderer', 'no') == 'yes':
env.Append(CPPFLAGS=['-DEXPORT_RENDERER'])
else:
platform += '_video_only'
if ARGUMENTS.get('enable_small', 'no') == 'yes':
ffmpeg_build_args += ' --enable-small'


if 'linux' in platform:
Expand Down
8 changes: 8 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
print('2. No.')
match input('> '):
case '2.': ' recompile_ffmpeg=no'

print('Enable small: (takes longer to compile FFmpeg but libs are smaller)')
print('1. No; (default)')
print('2. Yes.')
match input('> '):
case '2.': ' enable_small=yes'


user_input = input('Number of threads/cores for compiling> ')
if user_input.isdigit():
jobs = int(user_input)
Expand Down

0 comments on commit c0efd2a

Please sign in to comment.