Skip to content

Commit

Permalink
Merge pull request #26 from mpvkit/develop
Browse files Browse the repository at this point in the history
feat: separate libbluray to independent repository
  • Loading branch information
cxfksword authored Nov 5, 2024
2 parents 5a7dcc0 + 2f1d7ca commit 9192079
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 126 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ make help
* [libshaderc-build](https://github.com/mpvkit/libshaderc-build)
* [libluajit-build](https://github.com/mpvkit/libluajit-build)
* [libass-build](https://github.com/mpvkit/libass-build)
* [libbluray-build](https://github.com/mpvkit/libbluray-build)
* [libsmbclient-build](https://github.com/mpvkit/libsmbclient-build)
* [gnutls-build](https://github.com/mpvkit/gnutls-build)
* [openssl-build](https://github.com/mpvkit/openssl-build)
Expand Down
4 changes: 2 additions & 2 deletions Sources/BuildScripts/XCFrameworkBuild/base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ class BaseBuild {

// pull code from git
if pullLatestVersion {
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--depth", "1", library.url, directoryURL.path])
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--recursive", "--depth", "1", library.url, directoryURL.path])
} else {
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--depth", "1", "--branch", library.version, library.url, directoryURL.path])
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--recursive", "--depth", "1", "--branch", library.version, library.url, directoryURL.path])
}

// apply patch
Expand Down
80 changes: 7 additions & 73 deletions Sources/BuildScripts/XCFrameworkBuild/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ do {

// libsmbclient
try BuildSmbclient().buildALL()

// libbluray
try BuildBluray().buildALL()

// ffmpeg
try BuildUavs3d().buildALL()
Expand All @@ -33,7 +36,6 @@ do {
// mpv
try BuildUchardet().buildALL()
try BuildLuaJIT().buildALL()
try BuildBluray().buildALL()
try BuildMPV().buildALL()
} catch {
print(error.localizedDescription)
Expand Down Expand Up @@ -133,7 +135,7 @@ enum Library: String, CaseIterable {
case .libuchardet:
return "https://github.com/mpvkit/libuchardet-build/releases/download/\(self.version)/libuchardet-all.zip"
case .libbluray:
return "https://code.videolan.org/videolan/libbluray.git"
return "https://github.com/mpvkit/libbluray-build/releases/download/\(self.version)/libbluray-all.zip"
case .libluajit:
return "https://github.com/mpvkit/libluajit-build/releases/download/\(self.version)/libluajit-all.zip"
case .libuavs3d:
Expand Down Expand Up @@ -340,8 +342,8 @@ enum Library: String, CaseIterable {
return [
.target(
name: "Libbluray",
url: "https://github.com/mpvkit/MPVKit/releases/download/\(BaseBuild.options.releaseVersion)/Libbluray.xcframework.zip",
checksum: ""
url: "https://github.com/mpvkit/libbluray-build/releases/download/\(self.version)/Libbluray.xcframework.zip",
checksum: "https://github.com/mpvkit/libbluray-build/releases/download/\(self.version)/Libbluray.xcframework.checksum.txt"
),
]
case .libluajit:
Expand Down Expand Up @@ -753,80 +755,12 @@ private class BuildFFMPEG: BaseBuild {



// depend openssl, ffmpeg, freetype
private class BuildBluray: BaseBuild {
private class BuildBluray: ZipBaseBuild {
init() {
super.init(library: .libbluray)
}

override func beforeBuild() throws {
if FileManager.default.fileExists(atPath: directoryURL.path) {
return
}

// pull code from git
let noPatchURL = directoryURL + "nopatch"
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--recursive", "--depth", "1", "--branch", library.version, library.url, noPatchURL.path])

let patchURL = directoryURL + "patch"
try! Utility.launch(path: "/usr/bin/git", arguments: ["-c", "advice.detachedHead=false", "clone", "--recursive", "--depth", "1", "--branch", library.version, library.url, patchURL.path])
// apply patch
let patch = URL.currentDirectory + "../Sources/BuildScripts/patch/\(library.rawValue)"
if FileManager.default.fileExists(atPath: patch.path) {
_ = try? Utility.launch(path: "/usr/bin/git", arguments: ["checkout", "."], currentDirectoryURL: patchURL)
let fileNames = try! FileManager.default.contentsOfDirectory(atPath: patch.path).sorted()
for fileName in fileNames {
try! Utility.launch(path: "/usr/bin/git", arguments: ["apply", "\((patch + fileName).path)"], currentDirectoryURL: patchURL)
}
}
}

override func configure(buildURL: URL, environ: [String: String], platform: PlatformType, arch: ArchType) throws {
// 只能 macos 支持 DiskArbitration 框架,其他平台使用 patch 版本去掉 DiskArbitration 依赖
var workURL = directoryURL + "nopatch"
if platform != .macos && platform != .maccatalyst {
workURL = directoryURL + "patch"
}

let configure = workURL + "configure"
if !FileManager.default.fileExists(atPath: configure.path) {
var bootstrap = workURL + "bootstrap"
if !FileManager.default.fileExists(atPath: bootstrap.path) {
bootstrap = workURL + ".bootstrap"
}
if FileManager.default.fileExists(atPath: bootstrap.path) {
try Utility.launch(executableURL: bootstrap, arguments: [], currentDirectoryURL: workURL, environment: environ)
}
}
var arguments = [
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
arguments.append(contentsOf: self.arguments(platform: platform, arch: arch))
try Utility.launch(executableURL: configure, arguments: arguments, currentDirectoryURL: buildURL, environment: environ)
}

override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--disable-doxygen-doc",
"--disable-doxygen-dot",
"--disable-doxygen-html",
"--disable-doxygen-ps",
"--disable-doxygen-pdf",
"--disable-examples",
"--disable-bdjava-jar",
"--without-fontconfig",
"--with-pic",
"--enable-static",
"--disable-shared",
"--disable-fast-install",
"--disable-dependency-tracking",
"--host=\(platform.host(arch: arch))",
]
}
}



private class BuildUchardet: ZipBaseBuild {
init() {
super.init(library: .libuchardet)
Expand Down
29 changes: 0 additions & 29 deletions Sources/BuildScripts/patch/libbluray/fix-no-dadisk.patch

This file was deleted.

22 changes: 0 additions & 22 deletions Sources/BuildScripts/patch/libbluray/no_fork_and_exec.patch

This file was deleted.

0 comments on commit 9192079

Please sign in to comment.