Skip to content

Commit

Permalink
ci: gnu tar+release+full lto for apple, keep dsym, release for win32
Browse files Browse the repository at this point in the history
gtar results in 1/3 smaller
  • Loading branch information
wang-bin committed Sep 2, 2023
1 parent 4e57c59 commit 044f11c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 23 deletions.
36 changes: 17 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ jobs:
working-directory: mdk
run: |
pwd
cmake -DWITH_X11=1 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -GNinja -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
cmake -DMIN_SIZE=1 -DWITH_X11=1 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -GNinja -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
- name: Configure CMake
if: ${{ startsWith(matrix.arch, 'arm64') }} # arm64, arm64e
shell: bash
working-directory: mdk
run: |
cmake -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
cmake -DMIN_SIZE=1 -DR3DSDK=$PWD/external/R3DSDK -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -GNinja -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }} -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
- name: Build
shell: bash
working-directory: mdk
Expand All @@ -91,7 +91,7 @@ jobs:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.arch}}.tar.xz
- name: Upload to SourceForge
if: ${{ matrix.config == 'MinSizeRel' && matrix.arch == 'x86_64' }}
if: ${{ matrix.config == 'RelWithDebInfo' && matrix.arch == 'x86_64' }}
shell: bash
run: |
sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}-${{ matrix.arch }}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/
Expand Down Expand Up @@ -141,7 +141,7 @@ jobs:
# access regardless of the host operating system
shell: bash
working-directory: mdk
run: cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/macCatalyst.cmake -DUSE_BITCODE=0 -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
run: cmake -GNinja -DMIN_SIZE=1 -DUSE_LTO=0 -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/macCatalyst.cmake -DUSE_BITCODE=0 -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -Bbuild/${TARGET_OS} -DCMAKE_VERBOSE_MAKEFILE=1 -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk # no dSYM for lto, dsymutil: no debug symbols in executable (-arch x86_64)
- name: Build
shell: bash
working-directory: mdk
Expand Down Expand Up @@ -203,7 +203,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: mdk
run: cmake -GNinja -DWITH_DEB_INFO=0 -DUSE_LTO=thin -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/ios.cmake -DIOS_DEPLOYMENT_TARGET=8.0 -DIOS_ARCH="arm64" -DIOS_BITCODE=0 -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=1 # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib
run: cmake -GNinja -DMIN_SIZE=1 -DWITH_DEB_INFO=1 -DCMAKE_TOOLCHAIN_FILE=$PWD/cmake/tools/ios.cmake -DIOS_DEPLOYMENT_TARGET=8.0 -DIOS_ARCH="arm64" -DIOS_BITCODE=0 -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=1 # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib
- name: Build
shell: bash
working-directory: mdk
Expand All @@ -222,15 +222,14 @@ jobs:
if [ -f "$libass" ]; then
lipo -thin arm64 "$libass" -output "$libass"
fi
tar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
gtar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
mv mdk-sdk*.tar.xz ..
- name: Archieve SDK
uses: actions/upload-artifact@v3
with:
name: mdk-sdk-${{ env.TARGET_OS }}-${{ matrix.config }}
path: mdk-sdk-${{ env.TARGET_OS }}.tar.xz
- name: Upload to SourceForge
if: ${{ matrix.config == 'MinSizeRel' }}
shell: bash
run: sshpass -p ${SF_PW} scp -o StrictHostKeyChecking=no mdk-sdk-${TARGET_OS}.tar.xz ${SF_USER}@frs.sourceforge.net:/home/frs/project/mdk-sdk/nightly/

Expand Down Expand Up @@ -274,7 +273,7 @@ jobs:
- name: Configure CMake
shell: bash
working-directory: mdk
run: cmake -GNinja -DUSE_LTO=thin -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=8.0 -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO -DCMAKE_IOS_INSTALL_COMBINED=YES -DCMAKE_OSX_SYSROOT=iphonesimulator -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=1 # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib
run: cmake -GNinja -DMIN_SIZE=1 -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=8.0 -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO -DCMAKE_IOS_INSTALL_COMBINED=YES -DCMAKE_OSX_SYSROOT=iphonesimulator -Bbuild/${TARGET_OS} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=$PWD/mdk-sdk -DCMAKE_VERBOSE_MAKEFILE=1 -DFFMPEG_EMBED=1 # FFMPEG_EMBED=0 to copy libffmpeg.5.dylib
- name: Build
shell: bash
working-directory: mdk
Expand All @@ -293,7 +292,7 @@ jobs:
if [ -f "$libass" ]; then
lipo -thin x86_64 "$libass" -output "$libass"
fi
tar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
gtar Jcfv mdk-sdk-$TARGET_OS.tar.xz mdk-sdk
mv mdk-sdk*.tar.xz ..
- name: Archieve SDK
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -328,11 +327,11 @@ jobs:
name: mdk-sdk-macCatalyst-MinSizeRel
- name: Install tools
shell: bash
run: brew install p7zip hudochenkov/sshpass/sshpass
run: brew install p7zip gnu-tar hudochenkov/sshpass/sshpass
- name: make XCFramework and SDK
shell: bash
run: |
export XZ_OPT="-9e --threads=`getconf _NPROCESSORS_ONLN`"
export XZ_OPT="-9e -T0"
mkdir -p macOS iOS iOSSimulator macCatalyst mdk-sdk/{Frameworks,include,lib} macOS-arm64 macOS-x86_64
tar Jxf mdk-sdk-macOS-x86_64.tar.xz -C macOS-x86_64
tar Jxf mdk-sdk-macOS-arm64.tar.xz -C macOS-arm64
Expand Down Expand Up @@ -368,8 +367,8 @@ jobs:
ln -sf ${mdkfw/mdk-sdk/..}/mdk.framework mdk-sdk/Frameworks
ln -sf ../Frameworks/mdk.framework/Headers mdk-sdk/include/mdk
# pod requires a file in tarball
tar Jcvf mdk-sdk-apple.tar.xz mdk-sdk README.md
tar Jcvf mdk-sdk-macOS.tar.xz -C macOS .
gtar Jcvf mdk-sdk-apple.tar.xz mdk-sdk README.md
gtar Jcvf mdk-sdk-macOS.tar.xz -C macOS .
- name: Archieve XCFramework SDK
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -463,7 +462,7 @@ jobs:
strategy:
fail-fast: false
matrix:
config: [MinSizeRel]
config: [RelWithDebInfo]
steps:
- uses: actions/checkout@v3
- name: Checkout source
Expand Down Expand Up @@ -496,7 +495,7 @@ jobs:
env:
ARCH: arm64
working-directory: mdk
run: cmake -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
run: cmake -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win arm64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-arm64
Expand All @@ -508,7 +507,7 @@ jobs:
ARCH: x86
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x86
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x86
Expand All @@ -520,7 +519,7 @@ jobs:
ARCH: x64
R3DSDK: ${{ github.workspace }}/mdk/external/R3DSDK
working-directory: mdk
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
run: cmake -DR3DSDK=${{ env.R3DSDK }} -DMIN_SIZE=1 -DUSE_LTO=1 -DCMAKE_SYSTEM_PROCESSOR=${{ env.ARCH }} -DCMAKE_SYSTEM_VERSION="6.0" -GNinja -Bbuild/${{ env.TARGET_OS }}-${{ env.ARCH }} -DCMAKE_BUILD_TYPE=${{ matrix.config }} -DCMAKE_INSTALL_PREFIX=mdk-sdk-${{ env.ARCH }} -DCMAKE_VERBOSE_MAKEFILE=1 .
- name: Build for win x64
working-directory: mdk
run: cmake --build build/${{ env.TARGET_OS }}-x64
Expand Down Expand Up @@ -985,7 +984,7 @@ jobs:
- name: Download win32 vs2022 sdk
uses: actions/download-artifact@v3
with:
name: mdk-sdk-vs2022-windows-desktop-MinSizeRel
name: mdk-sdk-vs2022-windows-desktop-RelWithDebInfo
- name: Download win32 vs2022 ltl sdk
uses: actions/download-artifact@v3
with:
Expand All @@ -1003,7 +1002,6 @@ jobs:
7z x mdk-sdk-windows-desktop-vs2022.7z
7z x mdk-sdk-uwp-vs2022.7z -o"uwp"
mkdir mdk-sdk/bin/UAP
cp -af uwp/mdk-sdk/lib/arm mdk-sdk/lib
cp -af uwp/mdk-sdk/bin/* mdk-sdk/bin/UAP
cp nuget/mdk.nuspec mdk-sdk
cp -avf nuget/README.md mdk-sdk
Expand Down
7 changes: 5 additions & 2 deletions ci-after-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,15 @@ find mdk-sdk* -name "*.a" -delete
: ${STRIP:=llvm-strip}
[ "$TARGET_OS" == "macOS" ] && STRIP=strip
which $STRIP && find mdk-sdk*/bin -executable -type f -exec $STRIP {} \;
export XZ_OPT="--threads=`getconf _NPROCESSORS_ONLN`" # -9e. -8/9 will disable mt?
export XZ_OPT="-T0" # -9e. -8/9 will disable mt?
if [[ "$TARGET_OS" == "win"* || "$TARGET_OS" == "uwp"* || "$TARGET_OS" == "android" ]]; then
7z a -ssc -m0=lzma2 -mx=9 -ms=on -mf=off mdk-sdk-${TARGET_OS}.7z mdk-sdk
ls -lh mdk-sdk-${TARGET_OS}.7z
else
tar Jcvf mdk-sdk-${TARGET_OS}.tar.xz mdk-sdk
TAR=tar
# brew install gnu-tar. gtar result is 1/3 much smaller, but 1/2 slower, also no hidden files(GNUSparseFile.0). T0 is 2x faster than bsdtar
which gtar && TAR=gtar
$TAR Jcvf mdk-sdk-${TARGET_OS}.tar.xz mdk-sdk
ls -lh mdk-sdk-${TARGET_OS}.tar.xz
fi
#if [ `which sshpass` ]; then
Expand Down
2 changes: 1 addition & 1 deletion ci-before-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if [ `which dpkg` ]; then # TODO: multi arch
elif [ `which brew` ]; then
#time brew update --preinstall
export HOMEBREW_NO_AUTO_UPDATE=1
pkgs="p7zip ninja vulkan-headers dav1d" #
pkgs="p7zip ninja vulkan-headers dav1d gnu-tar" #
if [[ "$DEVTOOLS_CACHE_HIT" != "true" ]]; then
pkgs+=" hudochenkov/sshpass/sshpass"
fi
Expand Down
2 changes: 1 addition & 1 deletion mksdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if [ -d $SDK_DIR/lib/mdk.framework ]; then
[ -L $SDK_INCLUDE ] && rm -f $SDK_INCLUDE
ln -sfv ../lib/mdk.framework/Headers $SDK_INCLUDE #gln -rsfv $SDK_DIR/lib/mdk.framework/Headers $SDK_INCLUDE
mv $SDK_DIR/lib/mdk.framework/Versions/Current/mdk.dSYM $SDK_DIR/lib/mdk.framework.dSYM
rm -rf $SDK_DIR/lib/mdk.framework/mdk.dSYM # iOS
mv $SDK_DIR/lib/mdk.framework/mdk.dSYM $SDK_DIR/lib/mdk.framework.dSYM
ffdso=(`find $SDK_DIR/lib/mdk.framework -name "libffmpeg.*.dylib"`)
ffdso=${ffdso[$((${#ffdso[@]}-1))]}
ffdso=${ffdso##*lib/}
Expand Down

0 comments on commit 044f11c

Please sign in to comment.