diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 58a0f3fac..f2aef2a4f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -34,7 +34,10 @@ jobs: DIST_EXE: ${{ steps.info.outputs.DIST_EXE }} DIST_UWP: ${{ steps.info.outputs.DIST_UWP }} DIST_NRO: ${{ steps.info.outputs.DIST_NRO }} + DIST_DMG_PREFIX: ${{ steps.info.outputs.DIST_DMG_PREFIX }} DIST_INTEL_DMG: ${{ steps.info.outputs.DIST_INTEL_DMG }} + DIST_ARM_DMG: ${{ steps.info.outputs.DIST_ARM_DMG }} + DIST_UNIVERSAL_DMG: ${{ steps.info.outputs.DIST_UNIVERSAL_DMG }} DIST_FLATPAK_X86_64: ${{ steps.info.outputs.DIST_FLATPAK_X86_64 }} DIST_FLATPAK_AARCH64: ${{ steps.info.outputs.DIST_FLATPAK_AARCH64 }} steps: @@ -63,7 +66,10 @@ jobs: echo "DIST_EXE=wiliwili-Windows-x64-${VERSION}" >> $GITHUB_OUTPUT echo "DIST_UWP=wiliwili-windows-x64-uwp-${VERSION}" >> $GITHUB_OUTPUT echo "DIST_NRO=wiliwili-NintendoSwitch-${VERSION}" >> $GITHUB_OUTPUT + echo "DIST_DMG_PREFIX=wiliwili-macOS" >> $GITHUB_OUTPUT echo "DIST_INTEL_DMG=wiliwili-macOS-IntelChip-${VERSION}" >> $GITHUB_OUTPUT + echo "DIST_ARM_DMG=wiliwili-macOS-AppleSilicon-${VERSION}" >> $GITHUB_OUTPUT + echo "DIST_UNIVERSAL_DMG=wiliwili-macOS-Universal-${VERSION}" >> $GITHUB_OUTPUT echo "DIST_FLATPAK_X86_64=wiliwili-Linux-${VERSION}-x86_64" >> $GITHUB_OUTPUT echo "DIST_FLATPAK_AARCH64=wiliwili-Linux-${VERSION}-aarch64" >> $GITHUB_OUTPUT echo $VERSION @@ -71,7 +77,7 @@ jobs: release: - needs: [ build-win-x64, build-switch, build-macos-intel, build-flatpak, version ] + needs: [ build-win-x64, build-switch, build-macos, build-flatpak, version ] runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v3 @@ -95,35 +101,10 @@ jobs: ${{ needs.version.outputs.DIST_EXE }}/${{ needs.version.outputs.DIST_EXE }}.tar.gz ${{ needs.version.outputs.DIST_NRO }}/${{ needs.version.outputs.DIST_NRO }}.tar.gz ${{ needs.version.outputs.DIST_INTEL_DMG }}/${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg + ${{ needs.version.outputs.DIST_ARM_DMG }}/${{ needs.version.outputs.DIST_ARM_DMG }}.dmg + ${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}/${{ needs.version.outputs.DIST_UNIVERSAL_DMG }}.dmg ${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak - ## WeTransfer 暂时不可用,可以使用 CatBox 代替,但是后者貌似是非盈利组织维护的,所以还是不要滥用了,先注释掉 - # - name: Upload WeTransfer - # if: github.event.inputs.release != 'true' && !cancelled() - # continue-on-error: true - # run: | - # tree - # curl -fsSL git.io/file-transfer | sh - # ./transfer wet -s -p 16 --no-progress \ - # ${{ needs.version.outputs.DIST_EXE }}/${{ needs.version.outputs.DIST_EXE }}.tar.gz \ - # ${{ needs.version.outputs.DIST_NRO }}/${{ needs.version.outputs.DIST_NRO }}.tar.gz \ - # ${{ needs.version.outputs.DIST_INTEL_DMG }}/${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg \ - # ${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak 2>&1 | tee transfer.log - # echo "::warning title=访问下方链接免登录下载测试版 (有效期至:`date -u +"%FT%TZ" -d "7day"`)::$(cat transfer.log | grep https | cut -f3 -d" ")" - # - # - name: Upload CatBox - # if: github.event.inputs.release != 'true' && !cancelled() - # continue-on-error: true - # run: | - # tree - # curl -fsSL git.io/file-transfer | sh - # ./transfer wet -s -p 16 --no-progress \ - # ${{ needs.version.outputs.DIST_EXE }}/${{ needs.version.outputs.DIST_EXE }}.tar.gz \ - # ${{ needs.version.outputs.DIST_NRO }}/${{ needs.version.outputs.DIST_NRO }}.tar.gz \ - # ${{ needs.version.outputs.DIST_INTEL_DMG }}/${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg \ - # ${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}/${{ needs.version.outputs.DIST_FLATPAK_X86_64 }}.flatpak 2>&1 | tee transfer.log - # echo "::warning title=访问下方链接免登录下载测试版::$(cat transfer.log)" - build-win-x64: needs: [ version ] runs-on: windows-2022 @@ -168,11 +149,9 @@ jobs: 7z e mpv.7z -ompv cp mpv/mpv-2.dll wiliwili/libmpv-2.dll tar -czvf ../${{ needs.version.outputs.DIST_EXE }}.tar.gz wiliwili - echo "status=success" >> $GITHUB_OUTPUT - name: Upload dist uses: actions/upload-artifact@v3 - if: steps.compile.outputs.status == 'success' with: name: ${{ needs.version.outputs.DIST_EXE }} path: "${{ needs.version.outputs.DIST_EXE }}.tar.gz" @@ -239,18 +218,21 @@ jobs: docker run --rm -v $(pwd):/data devkitpro/devkita64:20230622 sh -c "/data/scripts/build_switch.sh" cd cmake-build-switch tar -czvf ../${{ needs.version.outputs.DIST_NRO }}.tar.gz wiliwili.nro - echo "status=success" >> $GITHUB_OUTPUT - name: Upload dist uses: actions/upload-artifact@v3 - if: steps.compile.outputs.status == 'success' with: name: ${{ needs.version.outputs.DIST_NRO }} path: "${{ needs.version.outputs.DIST_NRO }}.tar.gz" - build-macos-intel: + build-macos: needs: [ version ] runs-on: macos-11 + strategy: + matrix: + arch: [ IntelChip, AppleSilicon, Universal ] + # Don't fail the whole workflow if one architecture fails + fail-fast: false steps: - name: Checkout uses: actions/checkout@v3 @@ -261,22 +243,10 @@ jobs: - name: install deps run: | - brew install create-dmg dylibbundler webp + brew install create-dmg dylibbundler webp boost brew tap xfangfang/wiliwili brew install -v mpv-wiliwili - - name: Readme - run: | - mkdir -p dist - echo "wiliwili" > dist/readme.txt - echo "" >> dist/readme.txt - echo "if you see any of these after open this application:" >> dist/readme.txt - echo "1: wiliwili.app is damaged and can't be opened. You should move it to he Trash." >> dist/readme.txt - echo "2: wiliwili.app can't be opened because it is from an unidentified developer." >> dist/readme.txt - echo "" >> dist/readme.txt - echo "Please run this command in your terminal:" >> dist/readme.txt - echo "sudo xattr -rd com.apple.quarantine /Applications/wiliwili.app" >> dist/readme.txt - - name: SSH connection to Actions uses: P3TERX/ssh2actions@v1.0.0 if: (github.event.inputs.ssh_darwin == 'true' && github.event.inputs.ssh_darwin != 'false') || contains(github.event.action, 'ssh_darwin') @@ -284,28 +254,40 @@ jobs: TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} - - name: Build - id: compile + - name: Update gamepad mappings + id: gamepad run: | BRLS_GLFW="library/borealis/library/lib/extern/glfw/" cmake -P ${BRLS_GLFW}/CMake/GenerateMappings.cmake ${BRLS_GLFW}/src/mappings.h.in ${BRLS_GLFW}/src/mappings.h - cmake -B build -DPLATFORM_DESKTOP=ON -DCMAKE_BUILD_TYPE=Release + - name: Build + id: compile + run: | + cmake -B build -DPLATFORM_DESKTOP=ON -DCMAKE_BUILD_TYPE=Release -DMAC_${{ matrix.arch }}=ON -DMAC_DOWNLOAD_DYLIB=ON make -C build wiliwili.app -j$(sysctl -n hw.ncpu) + + - name: Name + id: name + run: | + echo "DMG=${{ needs.version.outputs.DIST_DMG_PREFIX }}-${{ matrix.arch }}-${{ needs.version.outputs.version }}" >> $GITHUB_OUTPUT + + - name: Bundle + id: bundle + run: | + mkdir -p dist mv build/wiliwili.app dist/ + cp ./scripts/mac/readme.txt dist/readme.txt create-dmg --window-pos 200 120 --window-size 800 400 \ --icon-size 100 --icon "wiliwili.app" 200 190 \ --icon "readme.txt" 400 100 --hide-extension "wiliwili.app" \ --app-drop-link 600 185 --volicon ./scripts/mac/dmg.icns \ - --volname "wiliwili (${{ needs.version.outputs.version }})" ${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg "dist/" - echo "status=success" >> $GITHUB_OUTPUT + --volname "wiliwili (${{ needs.version.outputs.version }})" ${{ steps.name.outputs.DMG }}.dmg "dist/" - name: Upload dist uses: actions/upload-artifact@v3 - if: steps.compile.outputs.status == 'success' with: - name: ${{ needs.version.outputs.DIST_INTEL_DMG }} - path: "${{ needs.version.outputs.DIST_INTEL_DMG }}.dmg" + name: ${{ steps.name.outputs.DMG }} + path: "${{ steps.name.outputs.DMG }}.dmg" build-flatpak: needs: [ version ] diff --git a/CMakeLists.txt b/CMakeLists.txt index b0a075221..3282d4126 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ set(PLATFORM_DESKTOP ) set(BUILTIN_NSP OFF - CACHE BOOL "Built in NSP forwarder" + CACHE BOOL "Built in NSP forwarder (only for NintendoSwitch)" ) set(WIN32_TERMINAL ON @@ -25,6 +25,10 @@ set(USE_SHARED_LIB OFF CACHE BOOL "Whether to use shared libs provided by system" ) +set(DEBUG_SANITIZER + OFF + CACHE BOOL "Turn on sanitizers (only available in debug build)" +) # analytics set(ANALYTICS @@ -40,15 +44,24 @@ set(ANALYTICS_KEY CACHE STRING "Google Analytics key" ) -# Strongly depends on the environment, these options may lead to build errors -set(MAC_10_15 +# These four options are only for macOS app bundling usage. +# Do not use it until you know what you are doing. +set(MAC_IntelChip + OFF + CACHE BOOL "Set the Minimum OS X deployment version to 10.11 (x86_64)" +) +set(MAC_AppleSilicon OFF - CACHE BOOL "Set the Minimum OS X deployment version to 10.15" + CACHE BOOL "Set the Minimum OS X deployment version to 11.0 (aarch64)" ) -set(MAC_UNIVERSAL +set(MAC_Universal OFF CACHE BOOL "Support x86_64;arm64 at the same time" ) +set(MAC_DOWNLOAD_DYLIB + OFF + CACHE BOOL "Using precompiled dylib instead of system provided" +) # mpv related set(MPV_SW_RENDER @@ -86,12 +99,12 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/extra.cmake) # toolchain if (PLATFORM_DESKTOP) - message("building for Desktop") + message(STATUS "building for Desktop") set(TARGET_PLATFORM desktop CACHE STRING "" ) - message("Build Type: ${CMAKE_BUILD_TYPE}") + message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -Wall") set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall") if (USE_SHARED_LIB) @@ -100,9 +113,9 @@ if (PLATFORM_DESKTOP) set(USE_SYSTEM_CURL ON) endif () else () - message("building for SWITCH") - message("Build Type: ${CMAKE_BUILD_TYPE}") - message("DEVKITPRO: $ENV{DEVKITPRO}") + message(STATUS "building for SWITCH") + message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") + message(STATUS "DEVKITPRO: $ENV{DEVKITPRO}") set(CMAKE_USE_SYSTEM_ENVIRONMENT_PATH OFF) file(TO_CMAKE_PATH "$ENV{DEVKITPRO}" DEVKITPRO) if (NOT IS_DIRECTORY ${DEVKITPRO}) @@ -268,6 +281,9 @@ else () add_executable(${PROJECT_NAME} ${MAIN_SRC}) endif () +# download macos dylib dependencies +include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/macos.cmake) + # set google analytics if (ANALYTICS) if (NOT ANALYTICS_ID OR NOT ANALYTICS_KEY) @@ -325,27 +341,13 @@ if (PLATFORM_DESKTOP) add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}.data) if (APPLE) - if (MAC_10_15) - message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: 10.15") - set(CMAKE_OSX_DEPLOYMENT_TARGET - "10.15" - CACHE STRING "Minimum OS X deployment version" FORCE - ) - endif () - if (MAC_UNIVERSAL) - message(STATUS "CMAKE_OSX_ARCHITECTURES: x86_64;arm64") - set(CMAKE_OSX_ARCHITECTURES - "x86_64;arm64" - CACHE STRING "Architectures" FORCE - ) - set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] - "11.0" - CACHE STRING "arm 64 minimum deployment target" FORCE - ) + if (MAC_DOWNLOAD_DYLIB) + set(bundle_args1 "-nb") + set(bundle_args2 "${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}") endif () add_custom_target( ${PROJECT_NAME}.app - COMMAND "bash" "${CMAKE_BINARY_DIR}/../scripts/build_mac.sh" + COMMAND "bash" "${CMAKE_BINARY_DIR}/../scripts/build_mac.sh" "${bundle_args1}" "${bundle_args2}" ) add_dependencies(${PROJECT_NAME}.app ${PROJECT_NAME}) elseif (UNIX) diff --git a/README.md b/README.md index 2b1e37f22..e91f7ddc1 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ wiliwili 拥有非常接近官方PC客户端的B站浏览体验 无论是电脑还是游戏掌机都能获得全新的使用体验
-[![GitHub release (latest by date)](https://img.shields.io/github/v/release/xfangfang/wiliwili)](https://github.com/xfangfang/wiliwili/releases) ![GitHub All Releases](https://img.shields.io/github/downloads/xfangfang/wiliwili/total) ![GitHub stars](https://img.shields.io/github/stars/xfangfang/wiliwili?style=flat) ![GitHub forks](https://img.shields.io/github/forks/xfangfang/wiliwili) [![Crowdin](https://badges.crowdin.net/wiliwili/localized.svg)](https://crowdin.com/project/wiliwili) ![NS](https://img.shields.io/badge/-Nintendo%20Switch-e4000f?style=flat&logo=Nintendo%20Switch) ![MS](https://img.shields.io/badge/-Windows%207-357ec7?style=flat&logo=Windows) ![mac](https://img.shields.io/badge/-macOS%2010.15-black?style=flat&logo=Apple) ![Linux](https://img.shields.io/badge/-Linux-lightgrey?style=flat&logo=Linux) +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/xfangfang/wiliwili)](https://github.com/xfangfang/wiliwili/releases) ![GitHub All Releases](https://img.shields.io/github/downloads/xfangfang/wiliwili/total) ![GitHub stars](https://img.shields.io/github/stars/xfangfang/wiliwili?style=flat) ![GitHub forks](https://img.shields.io/github/forks/xfangfang/wiliwili) [![Crowdin](https://badges.crowdin.net/wiliwili/localized.svg)](https://crowdin.com/project/wiliwili) ![NS](https://img.shields.io/badge/-Nintendo%20Switch-e4000f?style=flat&logo=Nintendo%20Switch) ![MS](https://img.shields.io/badge/-Windows%207-357ec7?style=flat&logo=Windows) ![mac](https://img.shields.io/badge/-macOS%2010.11-black?style=flat&logo=Apple) ![Linux](https://img.shields.io/badge/-Linux-lightgrey?style=flat&logo=Linux)
diff --git a/cmake/extra.cmake b/cmake/extra.cmake index 4e715502a..59c63b564 100644 --- a/cmake/extra.cmake +++ b/cmake/extra.cmake @@ -4,12 +4,17 @@ cmake_minimum_required(VERSION 3.15) IF (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) - message("Build Type: ${CMAKE_BUILD_TYPE}") + message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}") ENDIF () if (CMAKE_BUILD_TYPE STREQUAL Debug) add_definitions(-D_DEBUG) add_definitions(-D_GLIBCXX_ASSERTIONS) + if (DEBUG_SANITIZER) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -O0 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address") + endif () endif () # Add git info @@ -27,4 +32,36 @@ execute_process(COMMAND git rev-parse --short HEAD add_definitions(-DBUILD_TAG_VERSION=${GIT_TAG_VERSION} -DBUILD_TAG_SHORT=${GIT_TAG_SHORT}) message(STATUS "building from git tag ${GIT_TAG_VERSION}") -message(STATUS "building from git commit ${GIT_TAG_SHORT}") \ No newline at end of file +message(STATUS "building from git commit ${GIT_TAG_SHORT}") + +if (APPLE) + if (MAC_IntelChip) + message(STATUS "CMAKE_OSX_ARCHITECTURES: x86_64") + message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: 10.11") + set(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE STRING "" FORCE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE) + + set(CPR_USE_BOOST_FILESYSTEM ON) + set(USE_BOOST_FILESYSTEM ON) + add_definitions(-DCPR_USE_BOOST_FILESYSTEM) + add_definitions(-DUSE_BOOST_FILESYSTEM) + endif () + if(MAC_AppleSilicon) + # Build a Universal binary on macOS + message(STATUS "CMAKE_OSX_ARCHITECTURES: arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64" CACHE STRING "" FORCE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "" FORCE) + endif() + if(MAC_Universal) + # Build a Universal binary on macOS + message(STATUS "CMAKE_OSX_ARCHITECTURES: x86_64;arm64") + set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) + set(CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE STRING "" FORCE) + set(CMAKE_XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET[arch=arm64] "11.0" CACHE STRING "" FORCE) + + set(CPR_USE_BOOST_FILESYSTEM ON) + set(USE_BOOST_FILESYSTEM ON) + add_definitions(-DCPR_USE_BOOST_FILESYSTEM) + add_definitions(-DUSE_BOOST_FILESYSTEM) + endif() +endif() diff --git a/cmake/macos.cmake b/cmake/macos.cmake new file mode 100644 index 000000000..c1917528b --- /dev/null +++ b/cmake/macos.cmake @@ -0,0 +1,34 @@ +# Download precompiled dylib dependencies +# arm64: 11.0 +# x86_64: 10.11 +# universal: arm64 + x86_64 + +# header files: `brew tap xfangfang/wiliwili && brew install mpv-wiliwili webp boost` + +if (APPLE) + + if (MAC_IntelChip) + set(MAC_OS_ARCH x86_64) + elseif (MAC_AppleSilicon) + set(MAC_OS_ARCH arm64) + elseif (MAC_Universal) + set(MAC_OS_ARCH universal) + endif () + + if (MAC_DOWNLOAD_DYLIB) + link_libraries( + ${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH} + ) + set(PLATFORM_LIBS + ${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libmpv.2.dylib + ${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libwebp.7.1.6.dylib + ${CMAKE_BINARY_DIR}/deps/${MAC_OS_ARCH}/libboost_filesystem-mt.dylib) + + # download deps + add_custom_target( + ${PROJECT_NAME}.macos_${MAC_OS_ARCH}_deps + COMMAND "bash" "${CMAKE_BINARY_DIR}/../scripts/macos_dylib_downloader.sh" "${MAC_OS_ARCH}" + ) + add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}.macos_${MAC_OS_ARCH}_deps) + endif () +endif () \ No newline at end of file diff --git a/library/borealis b/library/borealis index 4ee1aef3f..30c17eb3b 160000 --- a/library/borealis +++ b/library/borealis @@ -1 +1 @@ -Subproject commit 4ee1aef3f02aac90076ef0b77a3e05699b236c88 +Subproject commit 30c17eb3bd8b614e447be24e8b69a0c6f1dd8882 diff --git a/scripts/build_mac.sh b/scripts/build_mac.sh index 70955111a..f4eced34a 100755 --- a/scripts/build_mac.sh +++ b/scripts/build_mac.sh @@ -42,7 +42,15 @@ if ! command -v dylibbundler >/dev/null 2>&1; then echo -e "\033[31m\"dylibbundler\" is not installed. The application you built can only be used locally\033[0m" echo -e "For more information, please refer to: \033[36mhttps://github.com/xfangfang/wiliwili/issues/83#issuecomment-1415858949\033[0m" else - dylibbundler -cd -b -x "${APP_PATH}"/Contents/MacOS/wiliwili \ + bundle_deps="" + if [[ "$1" != "-nb" ]]; then + echo "bundle deps" + bundle_deps="-b" + else + echo "bundle deps: $2" + cp -r "$2" "${APP_PATH}"/Contents/MacOS/lib + fi + dylibbundler -cd ${bundle_deps} -x "${APP_PATH}"/Contents/MacOS/wiliwili \ -d "${APP_PATH}"/Contents/MacOS/lib/ -p @executable_path/lib/ codesign --sign - --force "${APP_PATH}"/Contents/MacOS/lib/* fi diff --git a/scripts/mac/readme.txt b/scripts/mac/readme.txt new file mode 100644 index 000000000..57ea436e6 --- /dev/null +++ b/scripts/mac/readme.txt @@ -0,0 +1,8 @@ +wiliwili + +if you see any of these after open this application: +1: wiliwili.app is damaged and can't be opened. You should move it to he Trash. +2: wiliwili.app can't be opened because it is from an unidentified developer. + +Please run this command in your terminal: +sudo xattr -rd com.apple.quarantine /Applications/wiliwili.app diff --git a/scripts/macos_dylib_downloader.sh b/scripts/macos_dylib_downloader.sh new file mode 100755 index 000000000..e6f72a5ec --- /dev/null +++ b/scripts/macos_dylib_downloader.sh @@ -0,0 +1,20 @@ +set -e + +# ./macos_dylib_downloader.sh +# arch: arm64, x86_64, universal + +mkdir -p deps + +BASEURL="https://github.com/xfangfang/wiliwili/releases/download/v0.1.0" +PACKAGE="macos_dylib_$1.tar.gz" +DOWNLOAD_FLAG="${PACKAGE}.done" + +if [ ! -f "${DOWNLOAD_FLAG}" ];then + echo "Download ${PACKAGE}" + rm -rf "${PACKAGE}" + wget "${BASEURL}/${PACKAGE}" + tar -xzvf "${PACKAGE}" -C deps + touch "${PACKAGE}.done" +else + echo "Found ${PACKAGE}" +fi diff --git a/scripts/macos_dylib_merge.sh b/scripts/macos_dylib_merge.sh new file mode 100755 index 000000000..40178d298 --- /dev/null +++ b/scripts/macos_dylib_merge.sh @@ -0,0 +1,39 @@ +set -e + +files=(libass.9.dylib + libavcodec.59.37.100.dylib + libavdevice.59.7.100.dylib + libavfilter.8.44.100.dylib + libavformat.59.27.100.dylib + libavutil.57.28.100.dylib + libboost_atomic-mt.dylib + libboost_filesystem-mt.dylib + libdav1d.6.dylib + libfontconfig.1.dylib + libfreetype.6.dylib + libfribidi.0.dylib + libglib-2.0.0.dylib + libgmp.10.dylib + libgnutls.30.dylib + libgraphite2.3.2.1.dylib + libharfbuzz.0.dylib + libhogweed.6.8.dylib + libidn2.0.dylib + libintl.8.dylib + libmpv.2.dylib + libnettle.8.8.dylib + libp11-kit.0.dylib + libpcre2-8.0.dylib + libpng16.16.dylib + libsharpyuv.0.0.0.dylib + libswresample.4.7.100.dylib + libswscale.6.7.100.dylib + libtasn1.6.dylib + libunibreak.5.dylib + libunistring.5.dylib + libwebp.7.1.6.dylib) + +for file in "${files[@]}"; do + echo "$file" + lipo -create -output ./universal/"$file" ./x86_64/"$file" ./arm64/"$file" +done diff --git a/wiliwili/include/utils/config_helper.hpp b/wiliwili/include/utils/config_helper.hpp index 5dd54f946..2fcd9a685 100644 --- a/wiliwili/include/utils/config_helper.hpp +++ b/wiliwili/include/utils/config_helper.hpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "analytics.h" #include "borealis/core/singleton.hpp" diff --git a/wiliwili/include/utils/shader_helper.hpp b/wiliwili/include/utils/shader_helper.hpp index f0a6423a2..3ac16dcc5 100644 --- a/wiliwili/include/utils/shader_helper.hpp +++ b/wiliwili/include/utils/shader_helper.hpp @@ -295,7 +295,8 @@ class ShaderHelper : public brls::Singleton { void save() { const std::string path = ProgramConfig::instance().getConfigDir() + "/pack.json"; - std::filesystem::create_directories( + // fs is defined in cpr/cpr.h + fs::create_directories( ProgramConfig::instance().getConfigDir()); nlohmann::json content(pack); std::ofstream writeFile(path); diff --git a/wiliwili/source/utils/config_helper.cpp b/wiliwili/source/utils/config_helper.cpp index d1228b93d..46b9ec02a 100644 --- a/wiliwili/source/utils/config_helper.cpp +++ b/wiliwili/source/utils/config_helper.cpp @@ -567,7 +567,8 @@ int ProgramConfig::getStringOptionIndex(SettingItem item) { void ProgramConfig::save() { const std::string path = this->getConfigDir() + "/wiliwili_config.json"; - std::filesystem::create_directories(this->getConfigDir()); + // fs is defined in cpr/cpr.h + fs::create_directories(this->getConfigDir()); nlohmann::json content(*this); std::ofstream writeFile(path); if (!writeFile) {