first commit
Some checks failed
/ buid (push) Has been cancelled

This commit is contained in:
2026-04-16 14:48:09 +07:00
commit 4b968a3347
5625 changed files with 1685474 additions and 0 deletions

View File

@ -0,0 +1,87 @@
//
// BuildASS.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
class BuildFribidi: BaseBuild {
init() {
super.init(library: .libfribidi)
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
[
"-Ddeprecated=false",
"-Ddocs=false",
"-Dtests=false",
]
}
}
class BuildHarfbuzz: BaseBuild {
init() {
super.init(library: .libharfbuzz)
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
[
"-Dglib=disabled",
"-Ddocs=disabled",
]
}
}
class BuildFreetype: BaseBuild {
init() {
super.init(library: .libfreetype)
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
[
"-Dbrotli=disabled",
"-Dharfbuzz=disabled",
"-Dpng=disabled",
]
}
}
class BuildPng: BaseBuild {
init() {
super.init(library: .libpng)
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
["-DPNG_HARDWARE_OPTIMIZATIONS=yes"]
}
}
class BuildASS: BaseBuild {
init() {
super.init(library: .libass)
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
var result =
[
"--disable-libtool-lock",
"--disable-fontconfig",
"--disable-require-system-font-provider",
"--disable-test",
"--disable-profile",
"--with-pic",
"--enable-static",
"--disable-shared",
"--disable-fast-install",
"--disable-dependency-tracking",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
if arch == .x86_64 {
result.append("--enable-asm")
}
return result
}
}

View File

@ -0,0 +1,448 @@
//
// BuildFFMPEG.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
class BuildFFMPEG: BaseBuild {
init() {
super.init(library: .FFmpeg)
if Utility.shell("which nasm") == nil {
Utility.shell("brew install nasm")
}
if Utility.shell("which sdl2-config") == nil {
Utility.shell("brew install sdl2")
}
let lldbFile = URL.currentDirectory + "LLDBInitFile"
try? FileManager.default.removeItem(at: lldbFile)
FileManager.default.createFile(atPath: lldbFile.path, contents: nil, attributes: nil)
let path = directoryURL + "libavcodec/videotoolbox.c"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: "kCVPixelBufferOpenGLESCompatibilityKey", with: "kCVPixelBufferMetalCompatibilityKey")
str = str.replacingOccurrences(of: "kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey", with: "kCVPixelBufferMetalCompatibilityKey")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func flagsDependencelibrarys() -> [Library] {
[.gmp, .nettle, .gnutls, .libsmbclient]
}
override func frameworks() throws -> [String] {
var frameworks: [String] = []
if let platform = platforms().first {
if let arch = platform.architectures.first {
let lib = thinDir(platform: platform, arch: arch) + "lib"
let fileNames = try FileManager.default.contentsOfDirectory(atPath: lib.path)
for fileName in fileNames {
if fileName.hasPrefix("lib"), fileName.hasSuffix(".a") {
// libavformat,lib
frameworks.append("Lib" + fileName.dropFirst(3).dropLast(2))
}
}
}
}
return frameworks
}
override func ldFlags(platform: PlatformType, arch: ArchType) -> [String] {
var ldFlags = super.ldFlags(platform: platform, arch: arch)
ldFlags.append("-lc++")
return ldFlags
}
override func environment(platform: PlatformType, arch: ArchType) -> [String: String] {
var env = super.environment(platform: platform, arch: arch)
env["CPPFLAGS"] = env["CFLAGS"]
return env
}
override func build(platform: PlatformType, arch: ArchType, buildURL: URL) throws {
try super.build(platform: platform, arch: arch, buildURL: buildURL)
let prefix = thinDir(platform: platform, arch: arch)
let lldbFile = URL.currentDirectory + "LLDBInitFile"
if let data = FileManager.default.contents(atPath: lldbFile.path), var str = String(data: data, encoding: .utf8) {
str.append("settings \(str.isEmpty ? "set" : "append") target.source-map \((buildURL + "src").path) \(directoryURL.path)\n")
try str.write(toFile: lldbFile.path, atomically: true, encoding: .utf8)
}
try FileManager.default.copyItem(at: buildURL + "config.h", to: prefix + "include/libavutil/config.h")
try FileManager.default.copyItem(at: buildURL + "config.h", to: prefix + "include/libavcodec/config.h")
try FileManager.default.copyItem(at: buildURL + "config.h", to: prefix + "include/libavformat/config.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/getenv_utf8.h", to: prefix + "include/libavutil/getenv_utf8.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/libm.h", to: prefix + "include/libavutil/libm.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/thread.h", to: prefix + "include/libavutil/thread.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/intmath.h", to: prefix + "include/libavutil/intmath.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/mem_internal.h", to: prefix + "include/libavutil/mem_internal.h")
try FileManager.default.copyItem(at: buildURL + "src/libavutil/attributes_internal.h", to: prefix + "include/libavutil/attributes_internal.h")
try FileManager.default.copyItem(at: buildURL + "src/libavcodec/mathops.h", to: prefix + "include/libavcodec/mathops.h")
try FileManager.default.copyItem(at: buildURL + "src/libavformat/os_support.h", to: prefix + "include/libavformat/os_support.h")
let internalPath = prefix + "include/libavutil/internal.h"
try FileManager.default.copyItem(at: buildURL + "src/libavutil/internal.h", to: internalPath)
if let data = FileManager.default.contents(atPath: internalPath.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: """
#include "timer.h"
""", with: """
// #include "timer.h"
""")
str = str.replacingOccurrences(of: "kCVPixelBufferIOSurfaceOpenGLTextureCompatibilityKey", with: "kCVPixelBufferMetalCompatibilityKey")
try str.write(toFile: internalPath.path, atomically: true, encoding: .utf8)
}
if platform == .macos, arch.executable {
let fftoolsFile = URL.currentDirectory + "../Sources/fftools"
try? FileManager.default.removeItem(at: fftoolsFile)
if !FileManager.default.fileExists(atPath: (fftoolsFile + "include/compat").path) {
try FileManager.default.createDirectory(at: fftoolsFile + "include/compat", withIntermediateDirectories: true)
}
try FileManager.default.copyItem(at: buildURL + "src/compat/va_copy.h", to: fftoolsFile + "include/compat/va_copy.h")
try FileManager.default.copyItem(at: buildURL + "config.h", to: fftoolsFile + "include/config.h")
try FileManager.default.copyItem(at: buildURL + "config_components.h", to: fftoolsFile + "include/config_components.h")
if !FileManager.default.fileExists(atPath: (fftoolsFile + "include/libavdevice").path) {
try FileManager.default.createDirectory(at: fftoolsFile + "include/libavdevice", withIntermediateDirectories: true)
}
try FileManager.default.copyItem(at: buildURL + "src/libavdevice/avdevice.h", to: fftoolsFile + "include/libavdevice/avdevice.h")
try FileManager.default.copyItem(at: buildURL + "src/libavdevice/version_major.h", to: fftoolsFile + "include/libavdevice/version_major.h")
try FileManager.default.copyItem(at: buildURL + "src/libavdevice/version.h", to: fftoolsFile + "include/libavdevice/version.h")
if !FileManager.default.fileExists(atPath: (fftoolsFile + "include/libpostproc").path) {
try FileManager.default.createDirectory(at: fftoolsFile + "include/libpostproc", withIntermediateDirectories: true)
}
try FileManager.default.copyItem(at: buildURL + "src/libpostproc/postprocess_internal.h", to: fftoolsFile + "include/libpostproc/postprocess_internal.h")
try FileManager.default.copyItem(at: buildURL + "src/libpostproc/postprocess.h", to: fftoolsFile + "include/libpostproc/postprocess.h")
try FileManager.default.copyItem(at: buildURL + "src/libpostproc/version_major.h", to: fftoolsFile + "include/libpostproc/version_major.h")
try FileManager.default.copyItem(at: buildURL + "src/libpostproc/version.h", to: fftoolsFile + "include/libpostproc/version.h")
let ffplayFile = URL.currentDirectory + "../Sources/ffplay"
try? FileManager.default.removeItem(at: ffplayFile)
try FileManager.default.createDirectory(at: ffplayFile, withIntermediateDirectories: true)
let ffprobeFile = URL.currentDirectory + "../Sources/ffprobe"
try? FileManager.default.removeItem(at: ffprobeFile)
try FileManager.default.createDirectory(at: ffprobeFile, withIntermediateDirectories: true)
let ffmpegFile = URL.currentDirectory + "../Sources/ffmpeg"
try? FileManager.default.removeItem(at: ffmpegFile)
try FileManager.default.createDirectory(at: ffmpegFile + "include", withIntermediateDirectories: true)
let fftools = buildURL + "src/fftools"
let fileNames = try FileManager.default.contentsOfDirectory(atPath: fftools.path)
for fileName in fileNames {
if fileName.hasPrefix("ffplay") {
try FileManager.default.copyItem(at: fftools + fileName, to: ffplayFile + fileName)
} else if fileName.hasPrefix("ffprobe") {
try FileManager.default.copyItem(at: fftools + fileName, to: ffprobeFile + fileName)
} else if fileName.hasPrefix("ffmpeg") {
if fileName.hasSuffix(".h") {
try FileManager.default.copyItem(at: fftools + fileName, to: ffmpegFile + "include" + fileName)
} else {
try FileManager.default.copyItem(at: fftools + fileName, to: ffmpegFile + fileName)
}
} else if fileName.hasSuffix(".h") {
try FileManager.default.copyItem(at: fftools + fileName, to: fftoolsFile + "include" + fileName)
} else if fileName.hasSuffix(".c") {
try FileManager.default.copyItem(at: fftools + fileName, to: fftoolsFile + fileName)
}
}
let prefix = scratch(platform: platform, arch: arch)
try? FileManager.default.removeItem(at: URL(fileURLWithPath: "/usr/local/bin/ffmpeg"))
try? FileManager.default.copyItem(at: prefix + "ffmpeg", to: URL(fileURLWithPath: "/usr/local/bin/ffmpeg"))
try? FileManager.default.removeItem(at: URL(fileURLWithPath: "/usr/local/bin/ffplay"))
try? FileManager.default.copyItem(at: prefix + "ffplay", to: URL(fileURLWithPath: "/usr/local/bin/ffplay"))
try? FileManager.default.removeItem(at: URL(fileURLWithPath: "/usr/local/bin/ffprobe"))
try? FileManager.default.copyItem(at: prefix + "ffprobe", to: URL(fileURLWithPath: "/usr/local/bin/ffprobe"))
}
}
override func frameworkExcludeHeaders(_ framework: String) -> [String] {
if framework == "Libavcodec" {
return ["xvmc", "vdpau", "qsv", "dxva2", "d3d11va", "mathops", "videotoolbox"]
} else if framework == "Libavutil" {
return ["hwcontext_vulkan", "hwcontext_vdpau", "hwcontext_vaapi", "hwcontext_qsv", "hwcontext_opencl", "hwcontext_dxva2", "hwcontext_d3d11va", "hwcontext_cuda", "hwcontext_videotoolbox", "getenv_utf8", "intmath", "libm", "thread", "mem_internal", "internal", "attributes_internal"]
} else if framework == "Libavformat" {
return ["os_support"]
} else {
return super.frameworkExcludeHeaders(framework)
}
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
var arguments = [
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
arguments += ffmpegConfiguers
arguments += Build.ffmpegConfiguers
arguments.append("--arch=\(arch.cpuFamily)")
if platform == .android {
arguments.append("--target-os=android")
// appleandroid
arguments.append("--cc=\(platform.cc)")
arguments.append("--cxx=\(platform.cc)++")
// arguments.append("--cross-prefix=\(platform.host(arch: arch))-")
// arguments.append("--sysroot=\(platform.isysroot)")
} else {
arguments.append("--target-os=darwin")
arguments.append("--enable-libxml2")
}
// arguments.append(arch.cpu())
/**
aacpsdsp.o), building for Mac Catalyst, but linking in object file built for
x86_64 binaries are built without ASM support, since ASM for x86_64 is actually x86 and that confuses `xcodebuild -create-xcframework` https://stackoverflow.com/questions/58796267/building-for-macos-but-linking-in-object-file-built-for-free-standing/59103419#59103419
*/
if platform == .maccatalyst || arch == .x86_64 {
arguments.append("--disable-neon")
arguments.append("--disable-asm")
} else {
arguments.append("--enable-neon")
arguments.append("--enable-asm")
}
if ![.watchsimulator, .watchos, .android].contains(platform) {
arguments.append("--enable-videotoolbox")
arguments.append("--enable-audiotoolbox")
arguments.append("--enable-filter=yadif_videotoolbox")
arguments.append("--enable-filter=scale_vt")
arguments.append("--enable-filter=transpose_vt")
} else {
arguments.append("--enable-encoder=h264_videotoolbox")
arguments.append("--enable-encoder=hevc_videotoolbox")
arguments.append("--enable-encoder=prores_videotoolbox")
}
if platform == .macos, arch.executable {
arguments.append("--enable-ffplay")
arguments.append("--enable-sdl2")
arguments.append("--enable-decoder=rawvideo")
arguments.append("--enable-filter=color")
arguments.append("--enable-filter=lut")
arguments.append("--enable-filter=testsrc")
// debug
arguments.append("--enable-debug")
arguments.append("--enable-debug=3")
arguments.append("--disable-stripping")
} else {
arguments.append("--disable-programs")
}
if platform == .macos {
arguments.append("--enable-outdev=audiotoolbox")
}
if !([PlatformType.tvos, .tvsimulator, .xros, .xrsimulator].contains(platform)) {
// tvos17AVCaptureDeviceInput
// 'defaultDeviceWithMediaType:' is unavailable: not available on visionOS
arguments.append("--enable-indev=avfoundation")
}
// if platform == .isimulator || platform == .tvsimulator {
// arguments.append("--assert-level=1")
// }
for library in Library.allCases {
let path = URL.currentDirectory + [library.rawValue, platform.rawValue, "thin", arch.rawValue]
if FileManager.default.fileExists(atPath: path.path), library.isFFmpegDependentLibrary {
arguments.append("--enable-\(library.rawValue)")
if library == .libsrt || library == .libsmbclient {
arguments.append("--enable-protocol=\(library.rawValue)")
} else if library == .libdav1d {
arguments.append("--enable-decoder=\(library.rawValue)")
} else if library == .libass {
arguments.append("--enable-filter=ass")
arguments.append("--enable-filter=subtitles")
} else if library == .libzvbi {
arguments.append("--enable-decoder=libzvbi_teletext")
} else if library == .libplacebo {
arguments.append("--enable-filter=libplacebo")
}
}
}
return arguments
}
/*
boxblur_filter_deps="gpl"
delogo_filter_deps="gpl"
*/
private let ffmpegConfiguers = [
// Configuration options:
"--disable-armv5te", "--disable-armv6", "--disable-armv6t2",
"--disable-bzlib", "--disable-gray", "--disable-iconv", "--disable-linux-perf",
"--disable-shared", "--disable-small", "--disable-swscale-alpha", "--disable-symver", "--disable-xlib",
"--enable-cross-compile",
"--enable-optimizations", "--enable-pic", "--enable-runtime-cpudetect", "--enable-static", "--enable-thumb", "--enable-version3",
"--pkg-config-flags=--static",
// Documentation options:
"--disable-doc", "--disable-htmlpages", "--disable-manpages", "--disable-podpages", "--disable-txtpages",
// Component options:
"--enable-avcodec", "--enable-avformat", "--enable-avutil", "--enable-network", "--enable-swresample", "--enable-swscale",
"--disable-devices", "--disable-outdevs", "--disable-indevs", "--disable-postproc",
"--enable-indev=lavfi",
// ,"--disable-pthreads"
// ,"--disable-w32threads"
// ,"--disable-os2threads"
// ,"--disable-dct"
// ,"--disable-dwt"
// ,"--disable-lsp"
// ,"--disable-lzo"
// ,"--disable-mdct"
// ,"--disable-rdft"
// ,"--disable-fft"
// Hardware accelerators:
"--disable-d3d11va", "--disable-dxva2", "--disable-vaapi", "--disable-vdpau",
// todo ffmpeglibavcodec/vulkan_video_codec_av1std.h
"--disable-hwaccel=av1_vulkan,hevc_vulkan,h264_vulkan",
// Individual component options:
// ,"--disable-everything"
// ./configure --list-muxers
"--disable-muxers",
"--enable-muxer=flac", "--enable-muxer=dash", "--enable-muxer=hevc",
"--enable-muxer=m4v", "--enable-muxer=matroska", "--enable-muxer=mov", "--enable-muxer=mp4",
"--enable-muxer=mpegts", "--enable-muxer=webm*",
"--enable-muxer=nut",
// ./configure --list-encoders
"--disable-encoders",
"--enable-encoder=aac", "--enable-encoder=alac", "--enable-encoder=flac", "--enable-encoder=pcm*",
"--enable-encoder=movtext", "--enable-encoder=mpeg4", "--enable-encoder=prores",
// ./configure --list-protocols
"--enable-protocols",
// ./configure --list-demuxers
// demuxersavformat8MB4MB
"--disable-demuxers",
"--enable-demuxer=aac", "--enable-demuxer=ac3", "--enable-demuxer=aiff", "--enable-demuxer=amr",
"--enable-demuxer=ape", "--enable-demuxer=asf", "--enable-demuxer=ass", "--enable-demuxer=av1",
"--enable-demuxer=avi", "--enable-demuxer=caf", "--enable-demuxer=concat",
"--enable-demuxer=dash", "--enable-demuxer=data", "--enable-demuxer=dv",
"--enable-demuxer=eac3",
"--enable-demuxer=flac", "--enable-demuxer=flv", "--enable-demuxer=h264", "--enable-demuxer=hevc",
"--enable-demuxer=hls", "--enable-demuxer=live_flv", "--enable-demuxer=loas", "--enable-demuxer=m4v",
// matroska=mkv,mka,mks,mk3d
"--enable-demuxer=matroska", "--enable-demuxer=mov", "--enable-demuxer=mp3", "--enable-demuxer=mpeg*",
"--enable-demuxer=nut",
"--enable-demuxer=ogg", "--enable-demuxer=rm", "--enable-demuxer=rtsp", "--enable-demuxer=rtp", "--enable-demuxer=srt",
"--enable-demuxer=vc1", "--enable-demuxer=wav", "--enable-demuxer=webm_dash_manifest",
// ./configure --list-bsfs
"--enable-bsfs",
// ./configure --list-decoders
// decodersavcodec40MB20MB
"--disable-decoders",
//
"--enable-decoder=av1", "--enable-decoder=dca", "--enable-decoder=dxv",
"--enable-decoder=ffv1", "--enable-decoder=ffvhuff", "--enable-decoder=flv",
"--enable-decoder=h263", "--enable-decoder=h263i", "--enable-decoder=h263p", "--enable-decoder=h264",
"--enable-decoder=hap", "--enable-decoder=hevc", "--enable-decoder=huffyuv",
"--enable-decoder=indeo5",
"--enable-decoder=mjpeg", "--enable-decoder=mjpegb", "--enable-decoder=mpeg*", "--enable-decoder=mts2",
"--enable-decoder=prores",
"--enable-decoder=rv10", "--enable-decoder=rv20", "--enable-decoder=rv30", "--enable-decoder=rv40",
"--enable-decoder=snow", "--enable-decoder=svq3",
"--enable-decoder=tscc", "--enable-decoder=tscc2", "--enable-decoder=txd",
"--enable-decoder=wmv1", "--enable-decoder=wmv2", "--enable-decoder=wmv3",
"--enable-decoder=vc1", "--enable-decoder=vp6", "--enable-decoder=vp6a", "--enable-decoder=vp6f",
"--enable-decoder=vp7", "--enable-decoder=vp8", "--enable-decoder=vp9",
//
"--enable-decoder=aac*", "--enable-decoder=ac3*", "--enable-decoder=adpcm*", "--enable-decoder=alac*",
"--enable-decoder=amr*", "--enable-decoder=ape", "--enable-decoder=cook",
"--enable-decoder=dca", "--enable-decoder=dolby_e", "--enable-decoder=eac3*", "--enable-decoder=flac",
"--enable-decoder=mp1*", "--enable-decoder=mp2*", "--enable-decoder=mp3*", "--enable-decoder=opus",
"--enable-decoder=pcm*", "--enable-decoder=sonic",
"--enable-decoder=truehd", "--enable-decoder=tta", "--enable-decoder=vorbis", "--enable-decoder=wma*", "--enable-decoder=wrapped_avframe",
//
"--enable-decoder=ass", "--enable-decoder=ccaption", "--enable-decoder=dvbsub", "--enable-decoder=dvdsub",
"--enable-decoder=mpl2", "--enable-decoder=movtext",
"--enable-decoder=pgssub", "--enable-decoder=srt", "--enable-decoder=ssa", "--enable-decoder=subrip",
"--enable-decoder=xsub", "--enable-decoder=webvtt",
// ./configure --list-filters
"--disable-filters",
"--enable-filter=aformat", "--enable-filter=amix", "--enable-filter=anull", "--enable-filter=aresample",
"--enable-filter=areverse", "--enable-filter=asetrate", "--enable-filter=atempo", "--enable-filter=atrim",
"--enable-filter=boxblur", "--enable-filter=bwdif", "--enable-filter=delogo",
"--enable-filter=equalizer", "--enable-filter=estdif",
"--enable-filter=firequalizer", "--enable-filter=format", "--enable-filter=fps",
"--enable-filter=gblur",
"--enable-filter=hflip", "--enable-filter=hwdownload", "--enable-filter=hwmap", "--enable-filter=hwupload",
"--enable-filter=idet", "--enable-filter=lenscorrection", "--enable-filter=lut*", "--enable-filter=negate", "--enable-filter=null",
"--enable-filter=overlay",
"--enable-filter=palettegen", "--enable-filter=paletteuse", "--enable-filter=pan",
"--enable-filter=rotate",
"--enable-filter=scale", "--enable-filter=setpts", "--enable-filter=superequalizer",
"--enable-filter=transpose", "--enable-filter=trim",
"--enable-filter=vflip", "--enable-filter=volume",
"--enable-filter=w3fdif",
"--enable-filter=yadif",
"--enable-filter=avgblur_vulkan", "--enable-filter=blend_vulkan", "--enable-filter=bwdif_vulkan",
"--enable-filter=chromaber_vulkan", "--enable-filter=flip_vulkan", "--enable-filter=gblur_vulkan",
"--enable-filter=hflip_vulkan", "--enable-filter=nlmeans_vulkan", "--enable-filter=overlay_vulkan",
"--enable-filter=vflip_vulkan", "--enable-filter=xfade_vulkan",
]
}
class BuildZvbi: BaseBuild {
init() {
super.init(library: .libzvbi)
let path = directoryURL + "configure.ac"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: "AC_FUNC_MALLOC", with: "")
str = str.replacingOccurrences(of: "AC_FUNC_REALLOC", with: "")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func platforms() -> [PlatformType] {
super.platforms().filter {
$0 != .maccatalyst
}
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
["--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)"]
}
}
class BuildSRT: BaseBuild {
init() {
super.init(library: .libsrt)
}
override func arguments(platform: PlatformType, arch _: ArchType) -> [String] {
[
"-Wno-dev",
// "-DUSE_ENCLIB=openssl",
"-DUSE_ENCLIB=gnutls",
"-DENABLE_STDCXX_SYNC=1",
"-DENABLE_CXX11=1",
"-DUSE_OPENSSL_PC=1",
"-DENABLE_DEBUG=0",
"-DENABLE_LOGGING=0",
"-DENABLE_HEAVY_LOGGING=0",
"-DENABLE_APPS=0",
"-DENABLE_SHARED=0",
platform == .maccatalyst ? "-DENABLE_MONOTONIC_CLOCK=0" : "-DENABLE_MONOTONIC_CLOCK=1",
]
}
}
class BuildFontconfig: BaseBuild {
init() {
super.init(library: .libfontconfig)
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
[
"-Ddoc=disabled",
"-Dtests=disabled",
]
}
}
class BuildBluray: BaseBuild {
init() {
super.init(library: .libbluray)
}
// macosmount
override func platforms() -> [PlatformType] {
[.macos]
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--disable-bdjava-jar",
"--disable-silent-rules",
"--disable-dependency-tracking",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
}
}

View File

@ -0,0 +1,70 @@
//
// BuildMPV.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
class BuildMPV: BaseBuild {
init() {
super.init(library: .libmpv)
let path = directoryURL + "meson.build"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: "# ffmpeg", with: """
add_languages('objc')
#ffmpeg
""")
str = str.replacingOccurrences(of: """
subprocess_source = files('osdep/subprocess-posix.c')
""", with: """
if host_machine.subsystem() == 'tvos' or host_machine.subsystem() == 'tvos-simulator'
subprocess_source = files('osdep/subprocess-dummy.c')
else
subprocess_source =files('osdep/subprocess-posix.c')
endif
""")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func flagsDependencelibrarys() -> [Library] {
[.gmp, .libsmbclient]
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
var array = [
"-Dlibmpv=true",
"-Dgl=enabled",
"-Dplain-gl=enabled",
"-Diconv=enabled",
]
if BaseBuild.disableGPL {
array.append("-Dgpl=false")
}
if !(platform == .macos && arch.executable) {
array.append("-Dcplayer=false")
}
if platform == .macos {
array.append("-Dswift-flags=-sdk \(platform.isysroot) -target \(platform.deploymentTarget(arch: arch))")
array.append("-Dcocoa=enabled")
array.append("-Dcoreaudio=enabled")
array.append("-Dgl-cocoa=enabled")
array.append("-Dvideotoolbox-gl=enabled")
} else {
array.append("-Dvideotoolbox-gl=disabled")
array.append("-Dswift-build=disabled")
array.append("-Daudiounit=enabled")
if platform == .maccatalyst {
array.append("-Dcocoa=disabled")
array.append("-Dcoreaudio=disabled")
} else if platform == .xros || platform == .xrsimulator {
array.append("-Dios-gl=disabled")
} else {
array.append("-Dios-gl=enabled")
}
}
return array
}
}

View File

@ -0,0 +1,219 @@
//
// BuildPlacebo.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
class BuildPlacebo: BaseBuild {
init() {
super.init(library: .libplacebo)
let path = directoryURL + "demos/meson.build"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: "if sdl.found()", with: "if false")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
["-Dxxhash=disabled", "-Dopengl=disabled"]
}
}
class BuildVulkan: BaseBuild {
init() {
super.init(library: .vulkan)
}
override func platforms() -> [PlatformType] {
// PlacebomaccatalystvulkanUIKit
super.platforms().filter {
![.maccatalyst].contains($0)
}
}
override func buildALL() throws {
var arguments = platforms().map {
"--\($0.name)"
}
if !FileManager.default.fileExists(atPath: (directoryURL + "External/build/Release").path) {
try Utility.launch(path: (directoryURL + "fetchDependencies").path, arguments: arguments, currentDirectoryURL: directoryURL)
}
arguments = platforms().map(\.name)
if !FileManager.default.fileExists(atPath: (directoryURL + "Package/Release/MoltenVK/static/MoltenVK.xcframework").path) || !BaseBuild.notRecompile {
try Utility.launch(path: "/usr/bin/make", arguments: arguments, currentDirectoryURL: directoryURL)
}
try? FileManager.default.removeItem(at: URL.currentDirectory() + "../Sources/MoltenVK.xcframework")
try? FileManager.default.copyItem(at: directoryURL + "Package/Release/MoltenVK/static/MoltenVK.xcframework", to: URL.currentDirectory() + "../Sources/MoltenVK.xcframework")
for platform in platforms() {
var frameworks = ["CoreFoundation", "CoreGraphics", "Foundation", "IOSurface", "Metal", "QuartzCore"]
if platform == .macos {
frameworks.append("Cocoa")
} else {
frameworks.append("UIKit")
}
if !(platform == .tvos || platform == .tvsimulator) {
frameworks.append("IOKit")
}
let libframework = frameworks.map {
"-framework \($0)"
}.joined(separator: " ")
for arch in platform.architectures {
let prefix = thinDir(platform: platform, arch: arch) + "lib/pkgconfig"
try? FileManager.default.removeItem(at: prefix)
try? FileManager.default.createDirectory(at: prefix, withIntermediateDirectories: true, attributes: nil)
let vulkanPC = prefix + "vulkan.pc"
let content = """
prefix=\((directoryURL + "Package/Release/MoltenVK").path)
includedir=${prefix}/include
libdir=${prefix}/static/MoltenVK.xcframework/\(platform.frameworkName)
Name: Vulkan-Loader
Description: Vulkan Loader
Version: 1.2
Libs: -L${libdir} -lMoltenVK \(libframework)
Cflags: -I${includedir}
"""
FileManager.default.createFile(atPath: vulkanPC.path, contents: content.data(using: .utf8), attributes: nil)
}
}
}
}
class BuildGlslang: BaseBuild {
init() {
super.init(library: .libglslang)
_ = try? Utility.launch(executableURL: directoryURL + "./update_glslang_sources.py", arguments: [], currentDirectoryURL: directoryURL)
var path = directoryURL + "External/spirv-tools/tools/reduce/reduce.cpp"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: """
int res = std::system(nullptr);
return res != 0;
""", with: """
FILE* fp = popen(nullptr, "r");
return fp == NULL;
""")
str = str.replacingOccurrences(of: """
int status = std::system(command.c_str());
""", with: """
FILE* fp = popen(command.c_str(), "r");
""")
str = str.replacingOccurrences(of: """
return status == 0;
""", with: """
return fp != NULL;
""")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
path = directoryURL + "External/spirv-tools/tools/fuzz/fuzz.cpp"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: """
int res = std::system(nullptr);
return res != 0;
""", with: """
FILE* fp = popen(nullptr, "r");
return fp == NULL;
""")
str = str.replacingOccurrences(of: """
int status = std::system(command.c_str());
""", with: """
FILE* fp = popen(command.c_str(), "r");
""")
str = str.replacingOccurrences(of: """
return status == 0;
""", with: """
return fp != NULL;
""")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
}
class BuildShaderc: BaseBuild {
init() {
super.init(library: .libshaderc)
_ = try? Utility.launch(executableURL: directoryURL + "utils/git-sync-deps", arguments: [], currentDirectoryURL: directoryURL)
var path = directoryURL + "third_party/spirv-tools/tools/reduce/reduce.cpp"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: """
int res = std::system(nullptr);
return res != 0;
""", with: """
FILE* fp = popen(nullptr, "r");
return fp == NULL;
""")
str = str.replacingOccurrences(of: """
int status = std::system(command.c_str());
""", with: """
FILE* fp = popen(command.c_str(), "r");
""")
str = str.replacingOccurrences(of: """
return status == 0;
""", with: """
return fp != NULL;
""")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
path = directoryURL + "third_party/spirv-tools/tools/fuzz/fuzz.cpp"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: """
int res = std::system(nullptr);
return res != 0;
""", with: """
FILE* fp = popen(nullptr, "r");
return fp == NULL;
""")
str = str.replacingOccurrences(of: """
int status = std::system(command.c_str());
""", with: """
FILE* fp = popen(command.c_str(), "r");
""")
str = str.replacingOccurrences(of: """
return status == 0;
""", with: """
return fp != NULL;
""")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func frameworks() throws -> [String] {
["libshaderc_combined"]
}
override func build(platform: PlatformType, arch: ArchType, buildURL: URL) throws {
try super.build(platform: platform, arch: arch, buildURL: buildURL)
let thinDir = thinDir(platform: platform, arch: arch)
let pkgconfig = thinDir + "lib/pkgconfig"
try FileManager.default.moveItem(at: pkgconfig + "shaderc.pc", to: pkgconfig + "shaderc_shared.pc")
try FileManager.default.moveItem(at: pkgconfig + "shaderc_combined.pc", to: pkgconfig + "shaderc.pc")
}
}
class BuildLittleCms: BaseBuild {
init() {
super.init(library: .lcms2)
}
}
class BuildDav1d: BaseBuild {
init() {
super.init(library: .libdav1d)
if Utility.shell("which nasm") == nil {
Utility.shell("brew install nasm")
}
}
override func arguments(platform _: PlatformType, arch _: ArchType) -> [String] {
["-Denable_asm=true", "-Denable_tools=false", "-Denable_examples=false", "-Denable_tests=false"]
}
}
class BuildDovi: BaseBuild {
init() {
super.init(library: .libdovi)
}
}

View File

@ -0,0 +1,238 @@
//
// BuildSmbclient.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
///
/// https://github.com/xbmc/xbmc/blob/8d852242b8fed6fc99132c5428e1c703970f7201/tools/depends/target/samba-gplv3/Makefile
class BuildSmbclient: BaseBuild {
init() {
super.init(library: .libsmbclient)
}
override func wafPath() -> String {
"buildtools/bin/waf"
}
override func cFlags(platform: PlatformType, arch: ArchType) -> [String] {
var cFlags = super.cFlags(platform: platform, arch: arch)
cFlags.append("-Wno-error=implicit-function-declaration")
return cFlags
}
override func environment(platform: PlatformType, arch: ArchType) -> [String: String] {
var env = super.environment(platform: platform, arch: arch)
env["PATH"]? += (":" + (URL.currentDirectory + "../Plugins/BuildFFmpeg/\(library.rawValue)/bin").path + ":" + (directoryURL + "buildtools/bin").path)
env["PYTHONHASHSEED"] = "1"
env["WAF_MAKE"] = "1"
return env
}
override func wafBuildArg() -> [String] {
["--targets=smbclient"]
}
override func wafInstallArg() -> [String] {
["--targets=smbclient"]
}
override func build(platform: PlatformType, arch: ArchType, buildURL: URL) throws {
try super.build(platform: platform, arch: arch, buildURL: buildURL)
try FileManager.default.copyItem(at: directoryURL + "bin/default/source3/libsmb/libsmbclient.a", to: thinDir(platform: platform, arch: arch) + "lib/libsmbclient.a")
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
var arg =
[
"--without-cluster-support",
"--disable-rpath",
"--without-ldap",
"--without-pam",
"--enable-fhs",
"--without-winbind",
"--without-ads",
"--disable-avahi",
"--disable-cups",
"--without-gettext",
"--without-ad-dc",
"--without-acl-support",
"--without-utmp",
"--disable-iprint",
"--nopyc",
"--nopyo",
"--disable-python",
"--disable-symbol-versions",
"--without-json",
"--without-libarchive",
"--without-regedit",
"--without-lttng",
"--without-gpgme",
"--disable-cephfs",
"--disable-glusterfs",
"--without-syslog",
"--without-quotas",
"--bundled-libraries=ALL",
"--with-static-modules=!vfs_snapper,ALL",
"--nonshared-binary=smbtorture,smbd/smbd,client/smbclient",
"--builtin-libraries=!smbclient,!smbd_base,!smbstatus,ALL",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
arg.append("--cross-compile")
arg.append("--cross-answers=cross-answers.txt")
return arg
}
}
class BuildReadline: BaseBuild {
init() {
super.init(library: .readline)
}
// readline
override func frameworks() throws -> [String] {
[]
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--enable-static",
"--disable-shared",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
}
}
class BuildGmp: BaseBuild {
init() {
super.init(library: .gmp)
if Utility.shell("which makeinfo") == nil {
Utility.shell("brew install texinfo")
}
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--disable-maintainer-mode",
"--disable-assembly",
"--with-pic",
"--enable-static",
"--disable-shared",
"--disable-fast-install",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
}
}
class BuildNettle: BaseBuild {
init() {
if Utility.shell("which autoconf") == nil {
Utility.shell("brew install autoconf")
}
super.init(library: .nettle)
}
override func flagsDependencelibrarys() -> [Library] {
[.gmp]
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--disable-assembler",
"--disable-openssl",
"--disable-gcov",
"--disable-documentation",
"--enable-pic",
"--enable-static",
"--disable-shared",
"--disable-dependency-tracking",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
// arch == .arm64 || arch == .arm64e ? "--enable-arm-neon" : "--enable-x86-aesni",
]
}
override func frameworks() throws -> [String] {
[library.rawValue, "hogweed"]
}
}
class BuildGnutls: BaseBuild {
init() {
if Utility.shell("which automake") == nil {
Utility.shell("brew install automake")
}
if Utility.shell("which gtkdocize") == nil {
Utility.shell("brew install gtk-doc")
}
if Utility.shell("which wget") == nil {
Utility.shell("brew install wget")
}
if Utility.shell("brew list bison") == nil {
Utility.shell("brew install bison")
}
if Utility.shell("which glibtoolize") == nil {
Utility.shell("brew install libtool")
}
if Utility.shell("which asn1Parser") == nil {
Utility.shell("brew install libtasn1")
}
super.init(library: .gnutls)
}
override func flagsDependencelibrarys() -> [Library] {
[.gmp, .nettle]
}
override func environment(platform: PlatformType, arch: ArchType) -> [String: String] {
var env = super.environment(platform: platform, arch: arch)
// bison2.4,/usr/bin/bison 2.3
env["PATH"] = "/usr/local/opt/bison/bin:/opt/homebrew/opt/bison/bin:" + (env["PATH"] ?? "")
return env
}
override func configure(buildURL: URL, environ: [String: String], platform: PlatformType, arch: ArchType) throws {
try super.configure(buildURL: buildURL, environ: environ, platform: platform, arch: arch)
let path = directoryURL + "lib/accelerated/aarch64/Makefile.in"
if let data = FileManager.default.contents(atPath: path.path), var str = String(data: data, encoding: .utf8) {
str = str.replacingOccurrences(of: "AM_CCASFLAGS =", with: "#AM_CCASFLAGS=")
try! str.write(toFile: path.path, atomically: true, encoding: .utf8)
}
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
[
"--with-included-libtasn1",
"--with-included-unistring",
"--without-brotli",
"--without-idn",
"--without-p11-kit",
"--without-zlib",
"--without-zstd",
"--enable-hardware-acceleration",
"--disable-openssl-compatibility",
"--disable-code-coverage",
"--disable-doc",
"--disable-maintainer-mode",
"--disable-manpages",
"--disable-nls",
"--disable-rpath",
// "--disable-tests",
"--disable-tools",
"--disable-full-test-suite",
"--with-pic",
"--enable-static",
"--disable-shared",
"--disable-fast-install",
"--disable-dependency-tracking",
"--host=\(platform.host(arch: arch))",
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
]
}
}

View File

@ -0,0 +1,61 @@
//
// SSL.swift
//
//
// Created by kintan on 12/26/23.
//
import Foundation
class BuildOpenSSL: BaseBuild {
init() {
super.init(library: .openssl)
}
override func frameworks() throws -> [String] {
["libssl", "libcrypto"]
}
override func arguments(platform: PlatformType, arch: ArchType) -> [String] {
var array = [
"--prefix=\(thinDir(platform: platform, arch: arch).path)",
"no-async", "no-shared", "no-dso", "no-engine", "no-tests",
arch == .x86_64 ? "darwin64-x86_64" : arch == .arm64e ? "iphoneos-cross" : "darwin64-arm64",
]
if [PlatformType.tvos, .tvsimulator, .watchos, .watchsimulator].contains(platform) {
array.append("-DHAVE_FORK=0")
}
return array
}
}
class BuildBoringSSL: BaseBuild {
init() {
super.init(library: .boringssl)
if Utility.shell("which go") == nil {
Utility.shell("brew install go")
}
}
}
class BuildLibreSSL: BaseBuild {
init() {
super.init(library: .libtls)
}
override func cFlags(platform: PlatformType, arch: ArchType) -> [String] {
var cFlags = super.cFlags(platform: platform, arch: arch)
if [PlatformType.tvos, .tvsimulator, .watchos, .watchsimulator].contains(platform) {
cFlags.append("-DOPENSSL_NO_SPEED=1")
}
return cFlags
}
override func environment(platform: PlatformType, arch: ArchType) -> [String: String] {
var env = super.environment(platform: platform, arch: arch)
if [PlatformType.tvos, .tvsimulator, .watchos, .watchsimulator].contains(platform) {
env["CFLAGS"]? += " -DOPENSSL_NO_SPEED=1"
}
return env
}
}

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
--- a/source3/libsmb/wscript
+++ b/source3/libsmb/wscript
@@ -22,6 +22,7 @@
libsmb
KRBCLIENT
msrpc3
+ RPC_NDR_SRVSVC
libcli_lsa3''',
public_headers='../include/libsmbclient.h',
abi_directory='ABI',

View File

@ -0,0 +1,290 @@
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -320,7 +320,7 @@
@conf
-def CHECK_SIZEOF(conf, vars, headers=None, define=None, critical=True):
+def CHECK_SIZEOF(conf, vars, headers=None, define=None, cflags='', critical=True):
'''check the size of a type'''
for v in TO_LIST(vars):
v_define = define
@@ -333,6 +333,7 @@
define=v_define,
quote=False,
headers=headers,
+ cflags=cflags,
local_include=False,
msg="Checking if size of %s == %d" % (v, size)):
conf.DEFINE(v_define, size)
@@ -843,7 +844,6 @@
for key in conf.env.define_key:
conf.undefine(key, from_env=False)
conf.env.define_key = []
- conf.SAMBA_CROSS_CHECK_COMPLETE()
@conf
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -101,25 +101,24 @@
else:
conf.DEFINE(flag_split[0], flag_split[1])
- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
- define,
- execute=True,
- msg='Checking for large file support without additional flags'):
+ conf.undefine("SIZEOF_OFF_T")
+ conf.CHECK_SIZEOF("off_t")
+ if int(conf.get_define("SIZEOF_OFF_T")) >= 8:
+ conf.undefine("SIZEOF_OFF_T")
+ conf.DEFINE(define, 1)
return True
- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
- define,
- execute=True,
- cflags='-D_FILE_OFFSET_BITS=64',
- msg='Checking for -D_FILE_OFFSET_BITS=64'):
+ conf.undefine("SIZEOF_OFF_T")
+ conf.CHECK_SIZEOF("off_t", cflags='-D_FILE_OFFSET_BITS=64')
+ if int(conf.get_define("SIZEOF_OFF_T")) >= 8:
+ conf.undefine("SIZEOF_OFF_T")
conf.DEFINE('_FILE_OFFSET_BITS', 64)
return True
- if conf.CHECK_CODE('if (sizeof(off_t) < 8) return 1',
- define,
- execute=True,
- cflags='-D_LARGE_FILES',
- msg='Checking for -D_LARGE_FILES'):
+ conf.undefine("SIZEOF_OFF_T")
+ conf.CHECK_SIZEOF("off_t", cflags='-D_LARGE_FILES')
+ if int(conf.get_define("SIZEOF_OFF_T")) >= 8:
+ conf.undefine("SIZEOF_OFF_T")
conf.DEFINE('_LARGE_FILES', 1)
return True
return False
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -317,7 +317,7 @@
conf.CHECK_CODE('printf("hello world")',
define='HAVE_SIMPLE_C_PROG',
mandatory=True,
- execute=True,
+ execute=False,
headers='stdio.h',
msg='Checking simple C program')
--- a/lib/replace/wscript
+++ b/lib/replace/wscript
@@ -41,6 +41,7 @@
conf.CHECK_HEADERS('linux/types.h crypt.h locale.h acl/libacl.h compat.h')
conf.CHECK_HEADERS('acl/libacl.h attr/xattr.h compat.h ctype.h dustat.h')
conf.CHECK_HEADERS('fcntl.h fnmatch.h glob.h history.h krb5.h langinfo.h')
+ conf.CHECK_FUNCS('nl_langinfo', headers='langinfo.h')
conf.CHECK_HEADERS('locale.h ndir.h pwd.h')
conf.CHECK_HEADERS('shadow.h sys/acl.h')
conf.CHECK_HEADERS('sys/attributes.h attr/attributes.h sys/capability.h sys/dir.h sys/epoll.h')
@@ -692,7 +693,7 @@
conf.CHECK_CODE('''#define LIBREPLACE_CONFIGURE_TEST_STRPTIME
#include "tests/strptime.c"''',
define='HAVE_WORKING_STRPTIME',
- execute=True,
+ execute=False,
addmain=False,
msg='Checking for working strptime')
@@ -707,7 +708,7 @@
conf.CHECK_CODE('#include "tests/snprintf.c"',
define="HAVE_C99_VSNPRINTF",
- execute=True,
+ execute=False,
addmain=False,
msg="Checking for C99 vsnprintf")
@@ -802,7 +803,7 @@
exit(0);
''',
define='HAVE_SECURE_MKSTEMP',
- execute=True,
+ execute=False,
mandatory=True) # lets see if we get a mandatory failure for this one
# look for a method of finding the list of network interfaces
@@ -814,6 +815,7 @@
#define %s 1
#define NO_CONFIG_H 1
#define AUTOCONF_TEST 1
+ #define __STDC_WANT_LIB_EXT1__ 1
#include "replace.c"
#include "inet_ntop.c"
#include "snprintf.c"
@@ -824,7 +826,7 @@
method,
lib='nsl socket' + bsd_for_strlcpy,
addmain=False,
- execute=True):
+ execute=False):
break
conf.RECURSE('system')
--- a/lib/socket/wscript
+++ b/lib/socket/wscript
@@ -4,4 +4,5 @@
conf.CHECK_HEADERS('linux/sockios.h linux/ethtool.h')
if (conf.CONFIG_SET('HAVE_LINUX_SOCKIOS_H') and \
conf.CONFIG_SET('HAVE_LINUX_ETHTOOL_H')):
- conf.DEFINE('HAVE_ETHTOOL', 1)
+ if conf.CHECK_FUNCS('ethtool_cmd_speed', headers='linux/sockios.h linux/ethtool.h'):
+ conf.DEFINE('HAVE_ETHTOOL', 1)
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -51,6 +51,10 @@
/* Max allowable allococation - 256mb - 0x10000000 */
#define MAX_ALLOC_SIZE (1024*1024*256)
+#ifndef YPERR_KEY
+#define YPERR_KEY 5
+#endif
+
static enum protocol_types Protocol = PROTOCOL_COREPLUS;
enum protocol_types get_Protocol(void)
--- a/source3/wscript
+++ b/source3/wscript
@@ -156,7 +156,7 @@
# Check for inotify support (Skip if we are SunOS)
#NOTE: illumos provides sys/inotify.h but is not an exact match for linux
- host_os = sys.platform
+ host_os = os.getenv('HOST', sys.platform)
if host_os.rfind('sunos') == -1:
conf.CHECK_HEADERS('sys/inotify.h')
if conf.env.HAVE_SYS_INOTIFY_H:
@@ -455,8 +455,8 @@
# FIXME: these should be tests for features, but the old build system just
# checks for OSes.
- host_os = sys.platform
- Logs.info("building on %s" % host_os)
+ host_os = os.getenv('HOST', sys.platform)
+ Logs.info("building for %s" % host_os)
# Python doesn't have case switches... :/
# FIXME: original was *linux* | gnu* | k*bsd*-gnu | kopensolaris*-gnu | *qnx*)
@@ -1027,7 +1027,7 @@
''',
'USE_SETREUID',
addmain=False,
- execute=True,
+ execute=False,
msg="Checking whether setreuid is available")
if not seteuid:
seteuid = conf.CHECK_CODE('''
@@ -1088,7 +1088,7 @@
''',
'HAVE_FCNTL_LOCK',
addmain=False,
- execute=True,
+ execute=False,
msg='Checking whether fcntl locking is available')
conf.CHECK_CODE('''
--- a/tests/summary.c
+++ b/tests/summary.c
@@ -9,7 +9,7 @@
#endif
#if !(defined(HAVE_IFACE_GETIFADDRS) || defined(HAVE_IFACE_IFCONF) || defined(HAVE_IFACE_IFREQ) || defined(HAVE_IFACE_AIX))
-#warning "WARNING: No automated network interface determination"
+#error "ERROR: No automated network interface determination"
#endif
#if !(defined(USE_SETEUID) || defined(USE_SETREUID) || defined(USE_SETRESUID) || defined(USE_SETUIDX) || defined(HAVE_LINUX_THREAD_CREDENTIALS))
--- a/third_party/popt/poptconfig.c
+++ b/third_party/popt/poptconfig.c
@@ -24,7 +24,7 @@
#if defined(HAVE_GLOB_H)
#include <glob.h>
-#if defined(__LCLINT__)
+#if defined(HAVE_GLOB) && defined(__LCLINT__)
/*@-declundef -exportheader -incondefs -protoparammatch -redecl -type @*/
extern int glob (const char *__pattern, int __flags,
/*@null@*/ int (*__errfunc) (const char *, int),
@@ -104,7 +104,7 @@
if (pat[0] == '@' && pat[1] != '(')
pat++;
-#if defined(HAVE_GLOB_H)
+#if defined(HAVE_GLOB)
if (glob_pattern_p(pat, 0)) {
glob_t _g, *pglob = &_g;
@@ -125,7 +125,7 @@
} else
rc = POPT_ERROR_ERRNO;
} else
-#endif /* HAVE_GLOB_H */
+#endif /* HAVE_GLOB */
{
if (acp)
*acp = 1;
--- a/third_party/popt/poptint.c
+++ b/third_party/popt/poptint.c
@@ -86,7 +86,7 @@
if (istr == NULL)
return NULL;
-#ifdef HAVE_LANGINFO_H
+#ifdef HAVE_NL_LANGINFO
codeset = nl_langinfo ((nl_item)CODESET);
#endif
--- a/third_party/popt/poptint.h
+++ b/third_party/popt/poptint.h
@@ -174,7 +174,7 @@
#ifdef HAVE_LANGINFO_H
#include <langinfo.h>
-#if defined(__LCLINT__)
+#if defined(HAVE_NL_LANGINFO) && defined(__LCLINT__)
/*@-declundef -incondefs @*/
extern char *nl_langinfo (nl_item __item)
/*@*/;
--- a/wscript
+++ b/wscript
@@ -175,7 +175,7 @@
conf.SAMBA_CHECK_PYTHON()
conf.SAMBA_CHECK_PYTHON_HEADERS()
- if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
+ if os.getenv('HOST', sys.platform).find('darwin') > -1 and not conf.env['HAVE_ENVIRON_DECL']:
# Mac OSX needs to have this and it's also needed that the python is compiled with this
# otherwise you face errors about common symbols
if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
@@ -183,7 +183,7 @@
if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
conf.env.append_value('cshlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
- if sys.platform == 'darwin':
+ if os.getenv('HOST', sys.platform).find('darwin') > -1:
conf.ADD_LDFLAGS('-framework CoreFoundation')
conf.RECURSE('dynconfig')
--- a/wscript_configure_embedded_heimdal
+++ b/wscript_configure_embedded_heimdal
@@ -8 +8,10 @@
conf.RECURSE('source4/heimdal_build')
+
+def check_system_heimdal_binary(name):
+ if not conf.find_program(name, var=name.upper()):
+ raise Exception("not conf.find_program(%s, var=%s)" % (name, name.upper()))
+ conf.define('USING_SYSTEM_%s' % name.upper(), 1)
+ return True
+
+check_system_heimdal_binary("compile_et")
+check_system_heimdal_binary("asn1_compile")

View File

@ -0,0 +1,45 @@
--- a/lib/ldb/wscript
+++ b/lib/ldb/wscript
@@ -519,10 +519,6 @@
install=False)
bld.SAMBA_BINARY('ldb_key_value_sub_txn_tdb_test',
- bld.SUBDIR('ldb_key_value',
- '''ldb_kv_search.c
- ldb_kv_index.c
- ldb_kv_cache.c''') +
'tests/ldb_key_value_sub_txn_test.c',
cflags='-DTEST_BE=\"tdb\"',
deps='cmocka ldb ldb_tdb_err_map',
--- a/source4/heimdal_build/wscript_build
+++ b/source4/heimdal_build/wscript_build
@@ -5,6 +5,7 @@
from samba_utils import SET_TARGET_TYPE
from samba_autoconf import CURRENT_CFLAGS
from samba_utils import LOAD_ENVIRONMENT, TO_LIST
+from samba_bundled import BUILTIN_LIBRARY
def heimdal_path(p, absolute=False):
hpath = os.path.join("../heimdal", p)
@@ -215,7 +216,10 @@
def HEIMDAL_LIBRARY(libname, source, deps, vnum, version_script, includes='', cflags=[]):
'''define a Heimdal library'''
- obj_target = libname + '.objlist'
+ if BUILTIN_LIBRARY(bld, libname):
+ obj_target = libname
+ else:
+ obj_target = libname + '.objlist'
# first create a target for building the object files for this library
# by separating in this way, we avoid recompiling the C files
@@ -227,6 +231,9 @@
cflags = cflags,
group = 'main')
+ if BUILTIN_LIBRARY(bld, libname):
+ return
+
if not SET_TARGET_TYPE(bld, libname, "LIBRARY"):
return

View File

@ -0,0 +1,52 @@
--- a/buildtools/wafsamba/pkgconfig.py
+++ b/buildtools/wafsamba/pkgconfig.py
@@ -60,6 +60,15 @@
t.env.LIB_RPATH = ''
if vnum:
t.env.PACKAGE_VERSION = vnum
+ LIBS_PRIVATE = []
+ REQUIRES_PRIVATE = []
+ for _target, _type in t.env['TARGET_TYPE'].items():
+ if _type == "SYSLIB" and 'LIB_' + _target.upper() in t.env:
+ LIBS_PRIVATE.append('-l%s' % _target)
+ if 'INCLUDES_' + _target.upper() in t.env and 'LIBPATH_' + _target.upper() in t.env and _target not in ['z']:
+ REQUIRES_PRIVATE.append(_target)
+ t.env.LIBS_PRIVATE = ' '.join(LIBS_PRIVATE)
+ t.env.REQUIRES_PRIVATE = ' '.join(REQUIRES_PRIVATE)
for v in [ 'PREFIX', 'EXEC_PREFIX', 'LIB_RPATH' ]:
t.vars.append(t.env[v])
bld.INSTALL_FILES(dest, target, flat=True, destname=base)
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -241,7 +241,7 @@
if bld.env['ENABLE_RELRO'] is True:
ldflags.extend(TO_LIST('-Wl,-z,relro,-z,now'))
- features = 'c cshlib symlink_lib install_lib'
+ features = 'c cstlib'
if pyext:
features += ' pyext'
if pyembed:
--- a/source3/libsmb/smbclient.pc.in
+++ b/source3/libsmb/smbclient.pc.in
@@ -7,5 +7,7 @@
Description: A SMB library interface
Version: @PACKAGE_VERSION@
Libs: @LIB_RPATH@ -L${libdir} -lsmbclient
+Libs.private: @LIBS_PRIVATE@
+Requires.private: @REQUIRES_PRIVATE@
Cflags: -I${includedir}
URL: http://www.samba.org/
--- a/source4/heimdal/lib/hcrypto/camellia-ntt.h
+++ b/source4/heimdal/lib/hcrypto/camellia-ntt.h
@@ -35,6 +35,10 @@
typedef u32 KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN];
+/* symbol renaming */
+#define Camellia_Ekeygen hc_Camellia_Ekeygen
+#define Camellia_EncryptBlock hc_Camellia_EncryptBlock
+#define Camellia_DecryptBlock hc_Camellia_DecryptBlock
void Camellia_Ekeygen(const int keyBitLength,
const unsigned char *rawKey,

View File

@ -0,0 +1,239 @@
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -53,7 +53,7 @@
{
pid_t newpid;
if (do_fork) {
- newpid = fork();
+ newpid = -1;
if (newpid == -1) {
exit_daemon("Fork failed", errno);
}
--- a/lib/util/fault.c
+++ b/lib/util/fault.c
@@ -150,7 +150,7 @@
}
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmdstring));
- result = system(cmdstring);
+ result = -1;
if (result == -1)
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
--- a/lib/util/sys_popen.c
+++ b/lib/util/sys_popen.c
@@ -74,7 +74,7 @@
goto err_exit;
}
- entry->child_pid = fork();
+ entry->child_pid = -1;
if (entry->child_pid == -1) {
DBG_ERR("fork failed: %s\n", strerror(errno));
@@ -105,7 +105,7 @@
for (p = popen_chain; p; p = p->next)
close(p->fd);
- ret = execv(argl[0], argl);
+ ret = -1;
if (ret == -1) {
DBG_ERR("ERROR executing command "
"'%s': %s\n", command, strerror(errno));
--- a/lib/util/tfork.c
+++ b/lib/util/tfork.c
@@ -511,7 +511,7 @@
ready_pipe_worker_fd = p[0];
ready_pipe_caller_fd = p[1];
- pid = fork();
+ pid = -1;
if (pid == -1) {
close(status_sp_caller_fd);
close(status_sp_waiter_fd);
@@ -580,7 +580,7 @@
close(event_pipe_caller_fd);
close(ready_pipe_caller_fd);
- pid = fork();
+ pid = -1;
if (pid == -1) {
state->waiter_errno = errno;
_exit(0);
--- a/lib/util/util_runcmd.c
+++ b/lib/util/util_runcmd.c
@@ -261,7 +261,6 @@
}
va_end(ap);
- (void)execvp(state->arg0, argv);
fprintf(stderr, "Failed to exec child - %s\n", strerror(errno));
_exit(255);
return NULL;
--- a/source3/lib/background.c
+++ b/source3/lib/background.c
@@ -159,7 +159,7 @@
return;
}
- res = fork();
+ res = -1;
if (res == -1) {
int err = errno;
close(fds[0]);
--- a/source3/lib/server_prefork.c
+++ b/source3/lib/server_prefork.c
@@ -109,7 +109,7 @@
pfp->pool[i].allowed_clients = 1;
pfp->pool[i].started = now;
- pid = fork();
+ pid = -1;
switch (pid) {
case -1:
DEBUG(1, ("Failed to prefork child n. %d !\n", i));
@@ -199,7 +199,7 @@
pfp->pool[i].allowed_clients = 1;
pfp->pool[i].started = now;
- pid = fork();
+ pid = -1;
switch (pid) {
case -1:
DEBUG(1, ("Failed to prefork child n. %d !\n", j));
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -98,7 +98,7 @@
saved_handler = CatchChildLeaveStatus();
- if ((pid=fork()) < 0) {
+ if ((pid=-1) < 0) {
DEBUG(0,("smbrun: fork failed with error %s\n", strerror(errno) ));
(void)CatchSignal(SIGCLD, saved_handler);
if (outfd) {
@@ -193,15 +193,6 @@
exit(82);
}
- if (env != NULL) {
- execle("/bin/sh","sh","-c",
- newcmd ? (const char *)newcmd : cmd, NULL,
- env);
- } else {
- execl("/bin/sh","sh","-c",
- newcmd ? (const char *)newcmd : cmd, NULL);
- }
-
SAFE_FREE(newcmd);
}
@@ -263,7 +254,7 @@
saved_handler = CatchChildLeaveStatus();
- if ((pid=fork()) < 0) {
+ if ((pid=-1) < 0) {
DEBUG(0, ("smbrunsecret: fork failed with error %s\n", strerror(errno)));
(void)CatchSignal(SIGCLD, saved_handler);
return errno;
@@ -346,8 +333,6 @@
2 point to /dev/null from the startup code */
closefrom(3);
- execl("/bin/sh", "sh", "-c", cmd, NULL);
-
/* not reached */
exit(82);
return 1;
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -695,7 +695,7 @@
cmd = lp_panic_action(talloc_tos(), lp_sub);
if (cmd && *cmd) {
DEBUG(0, ("smb_panic(): calling panic action [%s]\n", cmd));
- result = system(cmd);
+ result = -1;
if (result == -1)
DEBUG(0, ("smb_panic(): fork failed in panic action: %s\n",
--- a/source4/heimdal/lib/roken/simple_exec.c
+++ b/source4/heimdal/lib/roken/simple_exec.c
@@ -155,7 +155,7 @@
pipe(out_fd);
if(stderr_fd != NULL)
pipe(err_fd);
- pid = fork();
+ pid = -1;
switch(pid) {
case 0:
va_start(ap, file);
@@ -196,7 +196,6 @@
closefrom(3);
- execv(file, argv);
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
case -1:
if(stdin_fd != NULL) {
@@ -233,12 +232,11 @@
simple_execvp_timed(const char *file, char *const args[],
time_t (*func)(void *), void *ptr, time_t timeout)
{
- pid_t pid = fork();
+ pid_t pid = -1;
switch(pid){
case -1:
return SE_E_FORKFAILED;
case 0:
- execvp(file, args);
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
default:
return wait_for_process_timed(pid, func, ptr, timeout);
@@ -256,12 +254,11 @@
simple_execve_timed(const char *file, char *const args[], char *const envp[],
time_t (*func)(void *), void *ptr, time_t timeout)
{
- pid_t pid = fork();
+ pid_t pid = -1;
switch(pid){
case -1:
return SE_E_FORKFAILED;
case 0:
- execve(file, args, envp);
exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
default:
return wait_for_process_timed(pid, func, ptr, timeout);
--- a/source4/libcli/resolve/dns_ex.c
+++ b/source4/libcli/resolve/dns_ex.c
@@ -620,7 +620,7 @@
}
tevent_fd_set_auto_close(state->fde);
- state->child = fork();
+ state->child = -1;
if (state->child == (pid_t)-1) {
composite_error(c, map_nt_error_from_unix_common(errno));
return c;
--- a/tests/fcntl_lock.c
+++ b/tests/fcntl_lock.c
@@ -50,7 +50,7 @@
alarm(10);
- if (!(pid=fork())) {
+ if (!(pid=-1)) {
sleep(2);
fd = open(DATA, O_RDONLY);
--- a/third_party/popt/popt.c
+++ b/third_party/popt/popt.c
@@ -562,7 +562,7 @@
#endif
/*@-nullstate@*/
- rc = execvp(argv[0], (char *const *)argv);
+ rc = -1;
/*@=nullstate@*/
exit:

View File

@ -0,0 +1,10 @@
--- a/lib/replace/replace.h
+++ b/lib/replace/replace.h
@@ -284,7 +284,6 @@
#if !defined(HAVE_DECL_ENVIRON)
# ifdef __APPLE__
-# include <crt_externs.h>
# define environ (*_NSGetEnviron())
# else /* __APPLE__ */
extern char **environ;

View File

@ -0,0 +1,11 @@
--- a/wscript
+++ b/wscript
@@ -191,7 +191,7 @@
conf.CHECK_CFG(package='zlib', minversion='1.2.3',
args='--cflags --libs',
- mandatory=True)
+ mandatory=False)
conf.CHECK_FUNCS_IN('inflateInit2', 'z')
if conf.CHECK_FOR_THIRD_PARTY():

View File

@ -0,0 +1,30 @@
--- a/source3/libsmb/libsmb_stat.c
+++ b/source3/libsmb/libsmb_stat.c
@@ -29,6 +29,12 @@
#include "../libcli/smb/smbXcli_base.h"
#include "lib/util/time.h"
+#if defined(__APPLE__)
+#define st_atim st_atimespec
+#define st_ctim st_ctimespec
+#define st_mtim st_mtimespec
+#endif
+
/*
* Generate an inode number from file name for those things that need it
*/
--- a/source4/torture/libsmbclient/libsmbclient.c
+++ b/source4/torture/libsmbclient/libsmbclient.c
@@ -30,6 +30,12 @@
#include "dynconfig.h"
#include "lib/util/time.h"
+#if defined(__APPLE__)
+#define st_atim st_atimespec
+#define st_ctim st_ctimespec
+#define st_mtim st_mtimespec
+#endif
+
/* test string to compare with when debug_callback is called */
#define TEST_STRING "smbc_setLogCallback test"