mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
vendor/pixman and basic building
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -31,3 +31,6 @@
|
|||||||
[submodule "vendor/cimgui"]
|
[submodule "vendor/cimgui"]
|
||||||
path = vendor/cimgui
|
path = vendor/cimgui
|
||||||
url = https://github.com/cimgui/cimgui.git
|
url = https://github.com/cimgui/cimgui.git
|
||||||
|
[submodule "vendor/pixman"]
|
||||||
|
path = vendor/pixman
|
||||||
|
url = https://github.com/freedesktop/pixman.git
|
||||||
|
137
pkg/pixman/build.zig
Normal file
137
pkg/pixman/build.zig
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
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 const pkg = std.build.Pkg{
|
||||||
|
.name = "pixman",
|
||||||
|
.source = .{ .path = 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.Builder) !void {
|
||||||
|
const target = b.standardTargetOptions(.{});
|
||||||
|
const mode = b.standardReleaseOptions();
|
||||||
|
_ = target;
|
||||||
|
_ = mode;
|
||||||
|
|
||||||
|
const tests = b.addTestExe("pixman-test", "main.zig");
|
||||||
|
_ = try link(b, tests, .{});
|
||||||
|
tests.install();
|
||||||
|
|
||||||
|
const test_step = b.step("test", "Run tests");
|
||||||
|
const tests_run = tests.run();
|
||||||
|
test_step.dependOn(&tests_run.step);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn link(
|
||||||
|
b: *std.build.Builder,
|
||||||
|
step: *std.build.LibExeObjStep,
|
||||||
|
opt: Options,
|
||||||
|
) !*std.build.LibExeObjStep {
|
||||||
|
const lib = try buildPixman(b, step, opt);
|
||||||
|
step.linkLibrary(lib);
|
||||||
|
step.addIncludePath(include_path);
|
||||||
|
step.addIncludePath(include_path_self);
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn buildPixman(
|
||||||
|
b: *std.build.Builder,
|
||||||
|
step: *std.build.LibExeObjStep,
|
||||||
|
opt: Options,
|
||||||
|
) !*std.build.LibExeObjStep {
|
||||||
|
_ = opt;
|
||||||
|
|
||||||
|
const target = step.target;
|
||||||
|
const lib = b.addStaticLibrary("pixman", null);
|
||||||
|
lib.setTarget(step.target);
|
||||||
|
lib.setBuildMode(step.build_mode);
|
||||||
|
|
||||||
|
// Include
|
||||||
|
lib.addIncludePath(include_path);
|
||||||
|
lib.addIncludePath(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",
|
||||||
|
});
|
||||||
|
|
||||||
|
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",
|
||||||
|
};
|
5
pkg/pixman/main.zig
Normal file
5
pkg/pixman/main.zig
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
test {
|
||||||
|
std.testing.refAllDecls(@This());
|
||||||
|
}
|
54
pkg/pixman/pixman-version.h
Normal file
54
pkg/pixman/pixman-version.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2008 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person
|
||||||
|
* obtaining a copy of this software and associated documentation
|
||||||
|
* files (the "Software"), to deal in the Software without
|
||||||
|
* restriction, including without limitation the rights to use, copy,
|
||||||
|
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
* of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be
|
||||||
|
* included in all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
||||||
|
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||||
|
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*
|
||||||
|
* Author: Carl D. Worth <cworth@cworth.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PIXMAN_VERSION_H__
|
||||||
|
#define PIXMAN_VERSION_H__
|
||||||
|
|
||||||
|
#ifndef PIXMAN_H__
|
||||||
|
# error pixman-version.h should only be included by pixman.h
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define PIXMAN_VERSION_MAJOR 999
|
||||||
|
#define PIXMAN_VERSION_MINOR 999
|
||||||
|
#define PIXMAN_VERSION_MICRO 999
|
||||||
|
|
||||||
|
#define PIXMAN_VERSION_STRING "999.999.999"
|
||||||
|
|
||||||
|
#define PIXMAN_VERSION_ENCODE(major, minor, micro) ( \
|
||||||
|
((major) * 10000) \
|
||||||
|
+ ((minor) * 100) \
|
||||||
|
+ ((micro) * 1))
|
||||||
|
|
||||||
|
#define PIXMAN_VERSION PIXMAN_VERSION_ENCODE( \
|
||||||
|
PIXMAN_VERSION_MAJOR, \
|
||||||
|
PIXMAN_VERSION_MINOR, \
|
||||||
|
PIXMAN_VERSION_MICRO)
|
||||||
|
|
||||||
|
#ifndef PIXMAN_API
|
||||||
|
# define PIXMAN_API
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PIXMAN_VERSION_H__ */
|
1
vendor/pixman
vendored
Submodule
1
vendor/pixman
vendored
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 713077d0a3c310ca1955bc331d46d55d0ae4a72b
|
Reference in New Issue
Block a user