├── README.md ├── .github └── workflows │ ├── publish.yml │ └── tests.yml ├── LICENSE.txt └── Formula ├── qhttpengine.rb └── kikoplay.rb /README.md: -------------------------------------------------------------------------------- 1 | # KikoPlay Homebrew Tap 2 | 3 | Currently supporting macOS only. 4 | 5 | ## How do I install? 6 | `brew install kikoplayproject/kikoplay/kikoplay` 7 | 8 | Or `brew tap kikoplayproject/kikoplay` and then `brew install kikoplay`. 9 | 10 | ## Documentation 11 | `brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh). 12 | 13 | 14 | # KikoPlay Homebrew 软件源 15 | 16 | 目前仅支持 macOS。 17 | 18 | ## 如何安装 19 | `brew install kikoplayproject/kikoplay/kikoplay` 20 | 21 | 或先执行 `brew tap kikoplayproject/kikoplay` 导入源,然后执行 `brew install kikoplay` 安装。 22 | 23 | ## 包管理器使用指南 24 | `brew help`, `man brew` 或查阅 [Homebrew 官方文档(英文)](https://docs.brew.sh). 25 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: brew pr-pull 2 | on: 3 | pull_request_target: 4 | types: 5 | - labeled 6 | jobs: 7 | pr-pull: 8 | if: contains(github.event.pull_request.labels.*.name, 'pr-pull') 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Set up Homebrew 12 | uses: Homebrew/actions/setup-homebrew@master 13 | 14 | - name: Set up git 15 | uses: Homebrew/actions/git-user-config@master 16 | 17 | - name: Pull bottles 18 | env: 19 | HOMEBREW_GITHUB_API_TOKEN: ${{ github.token }} 20 | PULL_REQUEST: ${{ github.event.pull_request.number }} 21 | run: brew pr-pull --debug --tap=$GITHUB_REPOSITORY $PULL_REQUEST 22 | 23 | - name: Push commits 24 | uses: Homebrew/actions/git-try-push@master 25 | with: 26 | token: ${{ github.token }} 27 | branch: main 28 | 29 | - name: Delete branch 30 | if: github.event.pull_request.head.repo.fork == false 31 | env: 32 | BRANCH: ${{ github.event.pull_request.head.ref }} 33 | run: git push --delete origin $BRANCH 34 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: brew test-bot 2 | on: 3 | push: 4 | branches: main 5 | pull_request: 6 | jobs: 7 | test-bot: 8 | strategy: 9 | matrix: 10 | os: [ubuntu-latest, macOS-latest] 11 | runs-on: ${{ matrix.os }} 12 | steps: 13 | - name: Set up Homebrew 14 | id: set-up-homebrew 15 | uses: Homebrew/actions/setup-homebrew@master 16 | 17 | - name: Cache Homebrew Bundler RubyGems 18 | id: cache 19 | uses: actions/cache@v1 20 | with: 21 | path: ${{ steps.set-up-homebrew.outputs.gems-path }} 22 | key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} 23 | restore-keys: ${{ runner.os }}-rubygems- 24 | 25 | - name: Install Homebrew Bundler RubyGems 26 | if: steps.cache.outputs.cache-hit != 'true' 27 | run: brew install-bundler-gems 28 | 29 | - run: brew test-bot --only-cleanup-before 30 | 31 | - run: brew test-bot --only-setup 32 | 33 | - run: brew test-bot --only-tap-syntax 34 | 35 | - run: brew test-bot --only-formulae 36 | if: github.event_name == 'pull_request' 37 | 38 | - name: Upload bottles as artifact 39 | if: always() && github.event_name == 'pull_request' 40 | uses: actions/upload-artifact@main 41 | with: 42 | name: bottles 43 | path: '*.bottle.*' 44 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2009-present, Homebrew contributors 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | -------------------------------------------------------------------------------- /Formula/qhttpengine.rb: -------------------------------------------------------------------------------- 1 | class Qhttpengine < Formula 2 | desc "Simple set of classes for developing HTTP server applications in Qt" 3 | homepage "https://github.com/nitroshare/qhttpengine" 4 | url "https://github.com/nitroshare/qhttpengine/archive/1.0.1.tar.gz" 5 | sha256 "6505cf889909dc29bab4069116656e7ca5a9e879f04935139439c5691a76c55e" 6 | license "MIT" 7 | revision 1 8 | head "https://github.com/nitroshare/qhttpengine.git" 9 | 10 | bottle do 11 | rebuild 1 12 | root_url "https://github.com/KikoPlayProject/Homebrew-KikoPlay/releases/download/qhttpengine-v1.0.1" 13 | sha256 cellar: :any, high_sierra: "df19a03f735553f1e6783dbee313c954b28b4bcf10dd9f6439531e826fd11656" 14 | end 15 | 16 | depends_on "cmake" => :build 17 | depends_on "qt@5" 18 | 19 | def install 20 | system "cmake", ".", *std_cmake_args 21 | system "make", "install" 22 | end 23 | 24 | test do 25 | (testpath/"test.pro").write <<~EOS 26 | TEMPLATE = app 27 | CONFIG += console 28 | CONFIG -= app_bundle 29 | TARGET = test 30 | QT += network 31 | SOURCES += test.cpp 32 | INCLUDEPATH += #{include} 33 | LIBPATH += #{lib} 34 | LIBS += -lqhttpengine 35 | EOS 36 | 37 | (testpath/"test.cpp").write <<~EOS 38 | #define QT_NO_SSL 39 | #include 40 | #include 41 | int main() { 42 | QHttpEngine::Server server; 43 | if (!server.listen(QHostAddress::LocalHost, 18000)) { 44 | return 1; 45 | } 46 | QTcpSocket socket; 47 | socket.connectToHost(server.serverAddress(), server.serverPort()); 48 | if (socket.waitForConnected(500)) { 49 | return 0; 50 | } 51 | return 1; 52 | } 53 | EOS 54 | 55 | system "#{Formula["qt@5"].bin}/qmake", "test.pro" 56 | system "make" 57 | assert_predicate testpath/"test", :exist?, "test output file does not exist!" 58 | system "./test" 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /Formula/kikoplay.rb: -------------------------------------------------------------------------------- 1 | class Kikoplay < Formula 2 | desc "NOT ONLY A Full-Featured Danmu Player" 3 | homepage "https://github.com/KikoPlayProject/KikoPlay" 4 | license "GPL-3.0" 5 | 6 | stable do 7 | url "https://github.com/KikoPlayProject/KikoPlay/archive/0.8.2.tar.gz" 8 | sha256 "dc42b74eb616286910e028ceaa6753db803d553fc37347756df68f882d1f3d6a" 9 | 10 | resource "script" do 11 | url "https://github.com/KikoPlayProject/KikoPlayScript.git", 12 | revision: "438248101f04b9fd0af29313c78b001a110cf219" 13 | end 14 | end 15 | 16 | head do 17 | url "https://github.com/KikoPlayProject/KikoPlay.git" 18 | 19 | resource "script" do 20 | url "https://github.com/KikoPlayProject/KikoPlayScript.git" 21 | end 22 | end 23 | 24 | bottle do 25 | rebuild 1 26 | root_url "https://github.com/KikoPlayProject/Homebrew-KikoPlay/releases/download/kikoplay-v0.8.2" 27 | sha256 cellar: :any, high_sierra: "af8f77463ed27a7de937714087c26069e0fdab171d402bfdf82d2b8eb6a12c7a" 28 | end 29 | 30 | depends_on "aria2" 31 | depends_on "lua@5.3" 32 | depends_on "mpv" 33 | depends_on "kikoplayproject/kikoplay/qhttpengine" 34 | depends_on "qt@5" 35 | 36 | def install 37 | # Enable test 38 | if build.head? 39 | system "git", "fetch", "--tags" 40 | version_str = Utils.safe_popen_read("git", "describe", "--tags") 41 | inreplace "res/version.json", /(?<="Version":).*/, %Q("#{version_str}") 42 | end 43 | 44 | inreplace "main.cpp", "args.pop_front();", <<~EOS 45 | args.pop_front(); 46 | if(args.at(0) == "-V") 47 | { 48 | QFile version(":/res/version.json"); 49 | version.open(QIODevice::ReadOnly); 50 | QJsonObject curVersionObj = QJsonDocument::fromJson(version.readAll()).object(); 51 | QTextStream(stderr) << qUtf8Printable(curVersionObj.value("Version").toString()); 52 | exit(0); 53 | } 54 | EOS 55 | 56 | # Use relative path ($prefix/bin/..) for instead of /usr 57 | inreplace %W[ 58 | LANServer/httpserver.cpp 59 | Script/scriptmanager.cpp 60 | ] do |s| 61 | s.gsub! '"/usr/share', 'QCoreApplication::applicationDirPath()+"/../Resources' 62 | end 63 | 64 | # Force create ~/.config/kikoplay 65 | inreplace "globalobjects.cpp", "if (fileinfoConfig", "if (1 || fileinfoConfig" 66 | 67 | # Support native application menu 68 | inreplace "UI/mainwindow.cpp" do |s| 69 | s.gsub! /(#include )/, 70 | "#include \n\\1" 71 | s.gsub! /(.*QAction \*act_Settingse.*)/, 72 | "\\1 act_Settingse->setMenuRole(QAction::PreferencesRole);" 73 | s.gsub! /(.*QAction \*act_about.*)/, 74 | "\\1 act_about->setMenuRole(QAction::AboutRole);" 75 | s.gsub! /(.*QAction \*act_exit.*)/, <<~EOS 76 | \\1 act_exit->setMenuRole(QAction::QuitRole); 77 | auto *menuBar = new QMenuBar(nullptr); 78 | auto *appMenu = new QMenu(nullptr); 79 | menuBar->addMenu(appMenu); 80 | appMenu->addAction(act_Settingse); 81 | appMenu->addAction(act_about); 82 | appMenu->addAction(act_exit); 83 | setMenuBar(menuBar); 84 | EOS 85 | end 86 | 87 | # Create icon 88 | mkdir "KikoPlay.iconset" 89 | system "sips", "-p", "128", "128", 90 | "kikoplay.png", "--out", "KikoPlay_Square.png" 91 | [16, 32, 128, 256, 512].each do |s| 92 | system "sips", "-z", s, s, "KikoPlay_Square.png", 93 | "--out", "KikoPlay.iconset/icon_#{s}x#{s}.png" 94 | system "sips", "-z", s * 2, s * 2, "KikoPlay_Square.png", 95 | "--out", "KikoPlay.iconset/icon_#{s}x#{s}@2x.png" 96 | end 97 | system "iconutil", "-c", "icns", "KikoPlay.iconset" 98 | 99 | libs = %W[ 100 | -L#{Formula["lua@5.3"].lib} 101 | -L#{Formula["mpv"].lib} 102 | -L#{Formula["kikoplayproject/kikoplay/qhttpengine"].lib} 103 | ] 104 | system "#{Formula["qt@5"].bin}/qmake", 105 | "LIBS += #{libs * " "}", 106 | "ICON = KikoPlay.icns" 107 | 108 | # Use packaged Lua headers 109 | ln_sf Dir[Formula["lua@5.3"].opt_include/"lua/*"], "Script/lua/" 110 | 111 | # Strip leading /usr during installation 112 | ln_s prefix, "usr" 113 | ENV["INSTALL_ROOT"] = "." 114 | system "make", "install" 115 | 116 | # Move app bundle and create command line shortcut 117 | mkdir "usr/libexec" 118 | mv "usr/bin/KikoPlay.app", "usr/libexec" 119 | bin.install_symlink libexec/"KikoPlay.app/Contents/MacOS/KikoPlay" 120 | (libexec/"KikoPlay.app/Contents/Resources").install_symlink share/"kikoplay" 121 | 122 | resource("script").stage do 123 | (share/"kikoplay/script").install Dir["*"] 124 | end 125 | 126 | doc.install Dir["KikoPlay*.pdf"] 127 | end 128 | 129 | def caveats 130 | <<~EOS 131 | After installation, link KikoPlay app to /Applications by running: 132 | ln -sf #{opt_libexec}/KikoPlay.app /Applications/ 133 | EOS 134 | end 135 | 136 | test do 137 | version_str = shell_output("#{bin}/KikoPlay -V 2>&1").lines.last.chomp 138 | assert_equal version.to_s, version_str.sub(/^.*-\d+-g/, "HEAD-") 139 | end 140 | end 141 | --------------------------------------------------------------------------------