mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
pkg/pixman
This commit is contained in:
10
build.zig
10
build.zig
@ -20,7 +20,6 @@ const libxev = @import("vendor/libxev/build.zig");
|
|||||||
const libxml2 = @import("vendor/zig-libxml2/libxml2.zig");
|
const libxml2 = @import("vendor/zig-libxml2/libxml2.zig");
|
||||||
const macos = @import("pkg/macos/build.zig");
|
const macos = @import("pkg/macos/build.zig");
|
||||||
const objc = @import("vendor/zig-objc/build.zig");
|
const objc = @import("vendor/zig-objc/build.zig");
|
||||||
const pixman = @import("pkg/pixman/build.zig");
|
|
||||||
const utf8proc = @import("pkg/utf8proc/build.zig");
|
const utf8proc = @import("pkg/utf8proc/build.zig");
|
||||||
const tracylib = @import("pkg/tracy/build.zig");
|
const tracylib = @import("pkg/tracy/build.zig");
|
||||||
const system_sdk = @import("vendor/mach-glfw/system_sdk.zig");
|
const system_sdk = @import("vendor/mach-glfw/system_sdk.zig");
|
||||||
@ -29,6 +28,7 @@ const fontconfig = @import("pkg/fontconfig/build.old.zig");
|
|||||||
const freetype = @import("pkg/freetype/build.old.zig");
|
const freetype = @import("pkg/freetype/build.old.zig");
|
||||||
const harfbuzz = @import("pkg/harfbuzz/build.old.zig");
|
const harfbuzz = @import("pkg/harfbuzz/build.old.zig");
|
||||||
const libpng = @import("pkg/libpng/build.old.zig");
|
const libpng = @import("pkg/libpng/build.old.zig");
|
||||||
|
const pixman = @import("pkg/pixman/build.old.zig");
|
||||||
const zlib = @import("pkg/zlib/build.old.zig");
|
const zlib = @import("pkg/zlib/build.old.zig");
|
||||||
|
|
||||||
// Do a comptime Zig version requirement. The required Zig version is
|
// Do a comptime Zig version requirement. The required Zig version is
|
||||||
@ -688,6 +688,10 @@ fn addDeps(
|
|||||||
.target = step.target,
|
.target = step.target,
|
||||||
.optimize = step.optimize,
|
.optimize = step.optimize,
|
||||||
});
|
});
|
||||||
|
const pixman_dep = b.dependency("pixman", .{
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
});
|
||||||
const zlib_dep = b.dependency("zlib", .{
|
const zlib_dep = b.dependency("zlib", .{
|
||||||
.target = step.target,
|
.target = step.target,
|
||||||
.optimize = step.optimize,
|
.optimize = step.optimize,
|
||||||
@ -790,8 +794,8 @@ fn addDeps(
|
|||||||
try static_libs.append(harfbuzz_dep.artifact("harfbuzz").getEmittedBin());
|
try static_libs.append(harfbuzz_dep.artifact("harfbuzz").getEmittedBin());
|
||||||
|
|
||||||
// Pixman
|
// Pixman
|
||||||
const pixman_step = try pixman.link(b, step, .{});
|
step.linkLibrary(pixman_dep.artifact("pixman"));
|
||||||
try static_libs.append(pixman_step.getEmittedBin());
|
try static_libs.append(pixman_dep.artifact("pixman").getEmittedBin());
|
||||||
|
|
||||||
// Only Linux gets fontconfig
|
// Only Linux gets fontconfig
|
||||||
if (font_backend.hasFontconfig()) {
|
if (font_backend.hasFontconfig()) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
.freetype = .{ .path = "./pkg/freetype" },
|
.freetype = .{ .path = "./pkg/freetype" },
|
||||||
.harfbuzz = .{ .path = "./pkg/harfbuzz" },
|
.harfbuzz = .{ .path = "./pkg/harfbuzz" },
|
||||||
.libpng = .{ .path = "./pkg/libpng" },
|
.libpng = .{ .path = "./pkg/libpng" },
|
||||||
|
.pixman = .{ .path = "./pkg/pixman" },
|
||||||
.zlib = .{ .path = "./pkg/zlib" },
|
.zlib = .{ .path = "./pkg/zlib" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
144
pkg/pixman/build.old.zig
Normal file
144
pkg/pixman/build.old.zig
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
const builtin = @import("builtin");
|
||||||
|
|
||||||
|
/// Directories with our includes.
|
||||||
|
const root = thisDir() ++ "../../../vendor/pixman/";
|
||||||
|
const include_path = root ++ "pixman/";
|
||||||
|
const include_path_self = thisDir();
|
||||||
|
|
||||||
|
pub const include_paths = .{ include_path, include_path_self };
|
||||||
|
|
||||||
|
pub fn module(b: *std.Build) *std.build.Module {
|
||||||
|
return b.createModule(.{
|
||||||
|
.source_file = .{ .path = (comptime thisDir()) ++ "/main.zig" },
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fn thisDir() []const u8 {
|
||||||
|
return std.fs.path.dirname(@src().file) orelse ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const Options = struct {};
|
||||||
|
|
||||||
|
pub fn build(b: *std.Build) !void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const mode = b.standardReleaseOptions();
|
||||||
|
|
||||||
|
const tests = b.addTestExe("pixman-test", "main.zig");
|
||||||
|
tests.setBuildMode(mode);
|
||||||
|
tests.setTarget(target);
|
||||||
|
_ = try link(b, tests, .{});
|
||||||
|
b.installArtifact(tests);
|
||||||
|
|
||||||
|
const test_step = b.step("test", "Run tests");
|
||||||
|
const tests_run = b.addRunArtifact(tests);
|
||||||
|
test_step.dependOn(&tests_run.step);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn link(
|
||||||
|
b: *std.Build,
|
||||||
|
step: *std.build.LibExeObjStep,
|
||||||
|
opt: Options,
|
||||||
|
) !*std.build.LibExeObjStep {
|
||||||
|
const lib = try buildPixman(b, step, opt);
|
||||||
|
step.linkLibrary(lib);
|
||||||
|
step.addIncludePath(.{ .path = include_path });
|
||||||
|
step.addIncludePath(.{ .path = include_path_self });
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn buildPixman(
|
||||||
|
b: *std.Build,
|
||||||
|
step: *std.build.LibExeObjStep,
|
||||||
|
opt: Options,
|
||||||
|
) !*std.build.LibExeObjStep {
|
||||||
|
_ = opt;
|
||||||
|
|
||||||
|
const target = step.target;
|
||||||
|
const lib = b.addStaticLibrary(.{
|
||||||
|
.name = "pixman",
|
||||||
|
.target = step.target,
|
||||||
|
.optimize = step.optimize,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Include
|
||||||
|
lib.addIncludePath(.{ .path = include_path });
|
||||||
|
lib.addIncludePath(.{ .path = include_path_self });
|
||||||
|
|
||||||
|
// Link
|
||||||
|
lib.linkLibC();
|
||||||
|
if (!target.isWindows()) {
|
||||||
|
lib.linkSystemLibrary("pthread");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compile
|
||||||
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
|
defer flags.deinit();
|
||||||
|
|
||||||
|
try flags.appendSlice(&.{
|
||||||
|
"-DHAVE_SIGACTION=1",
|
||||||
|
"-DHAVE_ALARM=1",
|
||||||
|
"-DHAVE_MPROTECT=1",
|
||||||
|
"-DHAVE_GETPAGESIZE=1",
|
||||||
|
"-DHAVE_MMAP=1",
|
||||||
|
"-DHAVE_GETISAX=1",
|
||||||
|
"-DHAVE_GETTIMEOFDAY=1",
|
||||||
|
|
||||||
|
"-DHAVE_FENV_H=1",
|
||||||
|
"-DHAVE_SYS_MMAN_H=1",
|
||||||
|
"-DHAVE_UNISTD_H=1",
|
||||||
|
|
||||||
|
"-DSIZEOF_LONG=8",
|
||||||
|
"-DPACKAGE=foo",
|
||||||
|
|
||||||
|
// There is ubsan
|
||||||
|
"-fno-sanitize=undefined",
|
||||||
|
"-fno-sanitize-trap=undefined",
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!target.isWindows()) {
|
||||||
|
try flags.appendSlice(&.{
|
||||||
|
"-DHAVE_PTHREADS=1",
|
||||||
|
|
||||||
|
"-DHAVE_POSIX_MEMALIGN=1",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// C files
|
||||||
|
lib.addCSourceFiles(srcs, flags.items);
|
||||||
|
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
const srcs = &.{
|
||||||
|
root ++ "pixman/pixman.c",
|
||||||
|
root ++ "pixman/pixman-access.c",
|
||||||
|
root ++ "pixman/pixman-access-accessors.c",
|
||||||
|
root ++ "pixman/pixman-bits-image.c",
|
||||||
|
root ++ "pixman/pixman-combine32.c",
|
||||||
|
root ++ "pixman/pixman-combine-float.c",
|
||||||
|
root ++ "pixman/pixman-conical-gradient.c",
|
||||||
|
root ++ "pixman/pixman-filter.c",
|
||||||
|
root ++ "pixman/pixman-x86.c",
|
||||||
|
root ++ "pixman/pixman-mips.c",
|
||||||
|
root ++ "pixman/pixman-arm.c",
|
||||||
|
root ++ "pixman/pixman-ppc.c",
|
||||||
|
root ++ "pixman/pixman-edge.c",
|
||||||
|
root ++ "pixman/pixman-edge-accessors.c",
|
||||||
|
root ++ "pixman/pixman-fast-path.c",
|
||||||
|
root ++ "pixman/pixman-glyph.c",
|
||||||
|
root ++ "pixman/pixman-general.c",
|
||||||
|
root ++ "pixman/pixman-gradient-walker.c",
|
||||||
|
root ++ "pixman/pixman-image.c",
|
||||||
|
root ++ "pixman/pixman-implementation.c",
|
||||||
|
root ++ "pixman/pixman-linear-gradient.c",
|
||||||
|
root ++ "pixman/pixman-matrix.c",
|
||||||
|
root ++ "pixman/pixman-noop.c",
|
||||||
|
root ++ "pixman/pixman-radial-gradient.c",
|
||||||
|
root ++ "pixman/pixman-region16.c",
|
||||||
|
root ++ "pixman/pixman-region32.c",
|
||||||
|
root ++ "pixman/pixman-solid-fill.c",
|
||||||
|
//root ++ "pixman/pixman-timer.c",
|
||||||
|
root ++ "pixman/pixman-trap.c",
|
||||||
|
root ++ "pixman/pixman-utils.c",
|
||||||
|
};
|
@ -1,80 +1,26 @@
|
|||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const builtin = @import("builtin");
|
|
||||||
|
|
||||||
/// Directories with our includes.
|
|
||||||
const root = thisDir() ++ "../../../vendor/pixman/";
|
|
||||||
const include_path = root ++ "pixman/";
|
|
||||||
const include_path_self = thisDir();
|
|
||||||
|
|
||||||
pub const include_paths = .{ include_path, include_path_self };
|
|
||||||
|
|
||||||
pub fn module(b: *std.Build) *std.build.Module {
|
|
||||||
return b.createModule(.{
|
|
||||||
.source_file = .{ .path = (comptime thisDir()) ++ "/main.zig" },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn thisDir() []const u8 {
|
|
||||||
return std.fs.path.dirname(@src().file) orelse ".";
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const Options = struct {};
|
|
||||||
|
|
||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const mode = b.standardReleaseOptions();
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const tests = b.addTestExe("pixman-test", "main.zig");
|
const upstream = b.dependency("pixman", .{});
|
||||||
tests.setBuildMode(mode);
|
|
||||||
tests.setTarget(target);
|
|
||||||
_ = try link(b, tests, .{});
|
|
||||||
b.installArtifact(tests);
|
|
||||||
|
|
||||||
const test_step = b.step("test", "Run tests");
|
|
||||||
const tests_run = b.addRunArtifact(tests);
|
|
||||||
test_step.dependOn(&tests_run.step);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn link(
|
|
||||||
b: *std.Build,
|
|
||||||
step: *std.build.LibExeObjStep,
|
|
||||||
opt: Options,
|
|
||||||
) !*std.build.LibExeObjStep {
|
|
||||||
const lib = try buildPixman(b, step, opt);
|
|
||||||
step.linkLibrary(lib);
|
|
||||||
step.addIncludePath(.{ .path = include_path });
|
|
||||||
step.addIncludePath(.{ .path = include_path_self });
|
|
||||||
return lib;
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn buildPixman(
|
|
||||||
b: *std.Build,
|
|
||||||
step: *std.build.LibExeObjStep,
|
|
||||||
opt: Options,
|
|
||||||
) !*std.build.LibExeObjStep {
|
|
||||||
_ = opt;
|
|
||||||
|
|
||||||
const target = step.target;
|
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary(.{
|
||||||
.name = "pixman",
|
.name = "pixman",
|
||||||
.target = step.target,
|
.target = target,
|
||||||
.optimize = step.optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Include
|
|
||||||
lib.addIncludePath(.{ .path = include_path });
|
|
||||||
lib.addIncludePath(.{ .path = include_path_self });
|
|
||||||
|
|
||||||
// Link
|
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
if (!target.isWindows()) {
|
if (!target.isWindows()) {
|
||||||
lib.linkSystemLibrary("pthread");
|
lib.linkSystemLibrary("pthread");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compile
|
lib.addIncludePath(upstream.path(""));
|
||||||
|
lib.addIncludePath(.{ .path = "" });
|
||||||
|
|
||||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||||
defer flags.deinit();
|
defer flags.deinit();
|
||||||
|
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
"-DHAVE_SIGACTION=1",
|
"-DHAVE_SIGACTION=1",
|
||||||
"-DHAVE_ALARM=1",
|
"-DHAVE_ALARM=1",
|
||||||
@ -95,7 +41,6 @@ pub fn buildPixman(
|
|||||||
"-fno-sanitize=undefined",
|
"-fno-sanitize=undefined",
|
||||||
"-fno-sanitize-trap=undefined",
|
"-fno-sanitize-trap=undefined",
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!target.isWindows()) {
|
if (!target.isWindows()) {
|
||||||
try flags.appendSlice(&.{
|
try flags.appendSlice(&.{
|
||||||
"-DHAVE_PTHREADS=1",
|
"-DHAVE_PTHREADS=1",
|
||||||
@ -104,41 +49,53 @@ pub fn buildPixman(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// C files
|
for (srcs) |src| {
|
||||||
lib.addCSourceFiles(srcs, flags.items);
|
lib.addCSourceFile(.{
|
||||||
|
.file = upstream.path(src),
|
||||||
return lib;
|
.flags = flags.items,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const srcs = &.{
|
lib.installHeader("pixman-version.h", "pixman-version.h");
|
||||||
root ++ "pixman/pixman.c",
|
lib.installHeadersDirectoryOptions(.{
|
||||||
root ++ "pixman/pixman-access.c",
|
.source_dir = upstream.path("pixman"),
|
||||||
root ++ "pixman/pixman-access-accessors.c",
|
.install_dir = .header,
|
||||||
root ++ "pixman/pixman-bits-image.c",
|
.install_subdir = "",
|
||||||
root ++ "pixman/pixman-combine32.c",
|
.include_extensions = &.{".h"},
|
||||||
root ++ "pixman/pixman-combine-float.c",
|
});
|
||||||
root ++ "pixman/pixman-conical-gradient.c",
|
|
||||||
root ++ "pixman/pixman-filter.c",
|
b.installArtifact(lib);
|
||||||
root ++ "pixman/pixman-x86.c",
|
}
|
||||||
root ++ "pixman/pixman-mips.c",
|
|
||||||
root ++ "pixman/pixman-arm.c",
|
const srcs: []const []const u8 = &.{
|
||||||
root ++ "pixman/pixman-ppc.c",
|
"pixman/pixman.c",
|
||||||
root ++ "pixman/pixman-edge.c",
|
"pixman/pixman-access.c",
|
||||||
root ++ "pixman/pixman-edge-accessors.c",
|
"pixman/pixman-access-accessors.c",
|
||||||
root ++ "pixman/pixman-fast-path.c",
|
"pixman/pixman-bits-image.c",
|
||||||
root ++ "pixman/pixman-glyph.c",
|
"pixman/pixman-combine32.c",
|
||||||
root ++ "pixman/pixman-general.c",
|
"pixman/pixman-combine-float.c",
|
||||||
root ++ "pixman/pixman-gradient-walker.c",
|
"pixman/pixman-conical-gradient.c",
|
||||||
root ++ "pixman/pixman-image.c",
|
"pixman/pixman-filter.c",
|
||||||
root ++ "pixman/pixman-implementation.c",
|
"pixman/pixman-x86.c",
|
||||||
root ++ "pixman/pixman-linear-gradient.c",
|
"pixman/pixman-mips.c",
|
||||||
root ++ "pixman/pixman-matrix.c",
|
"pixman/pixman-arm.c",
|
||||||
root ++ "pixman/pixman-noop.c",
|
"pixman/pixman-ppc.c",
|
||||||
root ++ "pixman/pixman-radial-gradient.c",
|
"pixman/pixman-edge.c",
|
||||||
root ++ "pixman/pixman-region16.c",
|
"pixman/pixman-edge-accessors.c",
|
||||||
root ++ "pixman/pixman-region32.c",
|
"pixman/pixman-fast-path.c",
|
||||||
root ++ "pixman/pixman-solid-fill.c",
|
"pixman/pixman-glyph.c",
|
||||||
//root ++ "pixman/pixman-timer.c",
|
"pixman/pixman-general.c",
|
||||||
root ++ "pixman/pixman-trap.c",
|
"pixman/pixman-gradient-walker.c",
|
||||||
root ++ "pixman/pixman-utils.c",
|
"pixman/pixman-image.c",
|
||||||
|
"pixman/pixman-implementation.c",
|
||||||
|
"pixman/pixman-linear-gradient.c",
|
||||||
|
"pixman/pixman-matrix.c",
|
||||||
|
"pixman/pixman-noop.c",
|
||||||
|
"pixman/pixman-radial-gradient.c",
|
||||||
|
"pixman/pixman-region16.c",
|
||||||
|
"pixman/pixman-region32.c",
|
||||||
|
"pixman/pixman-solid-fill.c",
|
||||||
|
//"pixman/pixman-timer.c",
|
||||||
|
"pixman/pixman-trap.c",
|
||||||
|
"pixman/pixman-utils.c",
|
||||||
};
|
};
|
||||||
|
10
pkg/pixman/build.zig.zon
Normal file
10
pkg/pixman/build.zig.zon
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.{
|
||||||
|
.name = "pixman",
|
||||||
|
.version = "0.42.2",
|
||||||
|
.dependencies = .{
|
||||||
|
.pixman = .{
|
||||||
|
.url = "https://gitlab.freedesktop.org/pixman/pixman/-/archive/pixman-0.42.2/pixman-pixman-0.42.2.tar.gz",
|
||||||
|
.hash = "12209b9206f9a5d31ccd9a2312cc72cb9dfc3e034aee1883c549dc1d753fae457230",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Reference in New Issue
Block a user