From 6a3d49b613deaa1bd8d004fd3fa13513ca0e5f02 Mon Sep 17 00:00:00 2001 From: complexlogic Date: Sat, 7 Oct 2023 08:23:35 -0700 Subject: [PATCH] Support static builds --- .github/workflows/build.yml | 22 ++++++++++++++++++- CMakeLists.txt | 2 ++ config/vcpkg.cmake | 3 +++ vcpkg.json | 44 +++++++++++++++++++------------------ 4 files changed, 49 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a3ec681..881900e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,6 +97,7 @@ jobs: run: cmake -S . -B build -G "${{env.CMAKE_GENERATOR}}" -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" + -DVCPKG_MANIFEST_FEATURES="ffmpeg;libebur128;inih;" -DVCPKG_OVERLAY_PORTS=build/overlays/ports -DVCPKG_OVERLAY_TRIPLETS=config/vcpkg_triplets -DVCPKG_TARGET_TRIPLET=${{env.VCPKG_TRIPLET}} @@ -134,11 +135,19 @@ jobs: docker_image: debian:bookworm package_type: DEB package_ext: .deb + vcpkg_features: fmt; - name: Fedora docker_image: fedora:38 package_type: RPM package_ext: .rpm + vcpkg_features: fmt; + + - name: Static + docker_image: debian:bullseye + package_type: TXZ + package_ext: .tar.xz + vcpkg_features: fmt;ffmpeg;libebur128;inih; container: image: ${{matrix.config.docker_image}} @@ -162,6 +171,9 @@ jobs: if [[ "${{matrix.config.name}}" == "Fedora" ]]; then dnf install -y curl zip unzip tar git make pkg-config gcc-c++ fedora-packager rpmdevtools cmake libavcodec-free-devel libavformat-free-devel libswresample-free-devel libavutil-free-devel libebur128-devel inih-devel fi + if [[ "${{matrix.config.name}}" == "Static" ]]; then + apt update && apt install -y curl zip unzip tar build-essential git cmake pkg-config python3 nasm + fi - name: Setup vcpkg uses: friendlyanon/setup-vcpkg@v1 @@ -170,11 +182,19 @@ jobs: cache-key: vcpkg-${{matrix.config.name}}-${{env.VCPKG_COMMITISH}} cache-restore-keys: vcpkg-${{matrix.config.name}}-${{env.VCPKG_COMMITISH}} + - name: Setup Overlays + uses: actions/checkout@v3 + with: + repository: complexlogic/vcpkg + ref: refs/heads/rsgain + path: build/overlays + - name: Configure run: cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{env.VCPKG_TRIPLET}} - -DVCPKG_MANIFEST_FEATURES="external-fmt;" + -DVCPKG_MANIFEST_FEATURES="${{matrix.config.vcpkg_features}}" + -DVCPKG_OVERLAY_PORTS=build/overlays/ports -DCMAKE_BUILD_TYPE=${{env.CMAKE_BUILD_TYPE}} -DCMAKE_INSTALL_PREFIX=/usr -DPACKAGE=${{matrix.config.package_type}} diff --git a/CMakeLists.txt b/CMakeLists.txt index a7a3206..c84ca32 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -202,6 +202,8 @@ elseif (UNIX) set(CPACK_RPM_PACKAGE_GROUP "Applications/Multimedia") set(CPACK_RPM_PACKAGE_AUTOREQPROV 0) set(CPACK_RPM_PACKAGE_REQUIRES "libavcodec-free >= 6, libavformat-free >= 6, libswresample-free >= 6, libavutil-free >= 6, libebur128, zlib, inih") + elseif (PACKAGE STREQUAL "TXZ") + set(CPACK_ARCHIVE_FILE_EXTENSION ".tar.xz") endif () if (PACKAGE) set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${PROJECT_DESCRIPTION}) diff --git a/config/vcpkg.cmake b/config/vcpkg.cmake index dd30c4e..1f1f90b 100644 --- a/config/vcpkg.cmake +++ b/config/vcpkg.cmake @@ -17,6 +17,9 @@ FetchContent_MakeAvailable(vcpkg vcpkg_overlay) set(VCPKG_OVERLAY_PORTS "${CMAKE_BINARY_DIR}/_deps/vcpkg_overlay-src/ports") if (WIN32) + if (NOT VCPKG_MANIFEST_FEATURES) + set(VCPKG_MANIFEST_FEATURES ffmpeg libebur128 inih) + endif () if (NOT VCPKG_OVERLAY_TRIPLETS) list(APPEND VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/config/vcpkg_triplets") endif () diff --git a/vcpkg.json b/vcpkg.json index 3b02491..6468d54 100755 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,35 +1,37 @@ { "dependencies": [ - { - "name": "libebur128", - "platform": "windows" - }, "taglib", - { - "name": "ffmpeg", - "platform": "windows", - "default-features": false, - "features": ["avcodec", "avformat", "swresample", "fdk-aac"] - }, - { - "name": "fdk-aac", - "platform": "windows", - "features": ["he-aac"] - }, - { - "name": "inih", - "platform": "windows" - }, { "name": "getopt", "platform": "windows" } ], "features": { - "external-fmt": { + "fmt": { "description": "Use the fmtlib library for formatting", "dependencies": ["fmt"] + }, + "ffmpeg": { + "description": "Build FFmpeg", + "dependencies": [ + { + "name": "ffmpeg", + "default-features": false, + "features": ["avcodec", "avformat", "swresample", "fdk-aac"] + }, + { + "name": "fdk-aac", + "features": ["he-aac"] + } + ] + }, + "libebur128": { + "description": "Build libebur128", + "dependencies": ["libebur128"] + }, + "inih": { + "description": "Build inih", + "dependencies": ["inih"] } - } }