refactor: consolidate duplicated code across build scripts and Makefiles#21
Merged
refactor: consolidate duplicated code across build scripts and Makefiles#21
Conversation
- Create scripts/lib/logging.sh with centralized logging functions - Create scripts/lib/common.sh with shared build utilities (normalize_license, verify_binary_arch, install_cmake_3x) - Create shared/ffmpeg.mk with common FFmpeg codec options (BSD, LGPL, GPL) - Refactor all platform build.sh scripts to use shared libraries - Update docker/build.sh to use shared libraries - Add STRIP variable to darwin config.mk files for consistency with linux - Fix darwin-x64 terminal detection (was missing [[ -t 1 ]] check) - Remove unused variables: CACHE_VERSION, AUTOCONF_DARWIN_ARGS, PARALLEL_CODECS, validate_versions
Replace `A && B && C || D` pattern with proper if-then-else to avoid ambiguous control flow that shellcheck warns about.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
New Shared Libraries
scripts/lib/logging.shscripts/lib/common.shnormalize_license(),verify_binary_arch(),install_cmake_3x()shared/ffmpeg.mkFiles Refactored
platforms/darwin-arm64/build.sh(319 → 179 lines)platforms/darwin-x64/build.sh(267 → 199 lines)platforms/linux-arm64/build.sh(217 → 167 lines)platforms/linux-x64/build.sh(208 → 159 lines)docker/build.sh(233 → 165 lines)shared/ffmpeg.mkFixes
STRIPvariable for consistency with linuxRemoved Unused Code
CACHE_VERSIONfromshared/versions.mkAUTOCONF_DARWIN_ARGSfromshared/codecs/codec.mkPARALLEL_CODECSfromshared/codecs/codec.mkvalidate_versionsmacro fromshared/versions.mkTest plan
mise run lintto verify shell/yaml syntaxshellcheck scripts/lib/*.sh platforms/*/build.sh docker/build.shmake -C platforms/<platform> -n help