mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
Merge pull request #635 from mitchellh/modules
Remove Remaining Git Submodules
This commit is contained in:
3
.github/workflows/release-tip.yml
vendored
3
.github/workflows/release-tip.yml
vendored
@ -31,9 +31,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||||
- uses: cachix/install-nix-action@v23
|
- uses: cachix/install-nix-action@v23
|
||||||
|
13
.github/workflows/test.yml
vendored
13
.github/workflows/test.yml
vendored
@ -27,9 +27,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||||
- uses: cachix/install-nix-action@v23
|
- uses: cachix/install-nix-action@v23
|
||||||
@ -50,9 +47,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||||
- uses: cachix/install-nix-action@v23
|
- uses: cachix/install-nix-action@v23
|
||||||
@ -77,9 +71,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
# This could be from a script if we wanted to but inlining here for now
|
# This could be from a script if we wanted to but inlining here for now
|
||||||
# in one place.
|
# in one place.
|
||||||
# Using powershell so that we do not need to install WSL components. Also,
|
# Using powershell so that we do not need to install WSL components. Also,
|
||||||
@ -130,9 +122,6 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||||
- uses: cachix/install-nix-action@v23
|
- uses: cachix/install-nix-action@v23
|
||||||
|
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,6 +0,0 @@
|
|||||||
[submodule "vendor/harfbuzz"]
|
|
||||||
path = vendor/harfbuzz
|
|
||||||
url = https://github.com/harfbuzz/harfbuzz.git
|
|
||||||
[submodule "vendor/libxml2"]
|
|
||||||
path = vendor/libxml2
|
|
||||||
url = https://github.com/GNOME/libxml2.git
|
|
11
Makefile
11
Makefile
@ -1,16 +1,7 @@
|
|||||||
# Init initializes the repo for development.
|
|
||||||
init:
|
init:
|
||||||
git submodule update --init --recursive
|
@echo You probably want to run "zig build" instead.
|
||||||
.PHONY: init
|
.PHONY: init
|
||||||
|
|
||||||
# Slightly cursed way that we setup a dev version of this locally on NixOS.
|
|
||||||
dev/install:
|
|
||||||
zig build -Dcpu=baseline -Doptimize=ReleaseFast
|
|
||||||
if [ -f "/etc/NIXOS" ]; then patchelf --set-rpath "${LD_LIBRARY_PATH}" zig-out/bin/ghostty; fi
|
|
||||||
mkdir -p ${HOME}/bin
|
|
||||||
cp zig-out/bin/ghostty ${HOME}/bin/devtty
|
|
||||||
.PHONY: dev/install
|
|
||||||
|
|
||||||
# glad updates the GLAD loader. To use this, place the generated glad.zip
|
# glad updates the GLAD loader. To use this, place the generated glad.zip
|
||||||
# in this directory next to the Makefile, remove vendor/glad and run this target.
|
# in this directory next to the Makefile, remove vendor/glad and run this target.
|
||||||
#
|
#
|
||||||
|
@ -282,12 +282,6 @@ closer to generally releasing this to ease downstream packagers. During
|
|||||||
development, I'm sticking to nightly Zig. You can find binary releases of nightly builds
|
development, I'm sticking to nightly Zig. You can find binary releases of nightly builds
|
||||||
on the [Zig downloads page](https://ziglang.org/download/).
|
on the [Zig downloads page](https://ziglang.org/download/).
|
||||||
|
|
||||||
Install dependencies by running `make`:
|
|
||||||
|
|
||||||
```shell-session
|
|
||||||
$ make
|
|
||||||
```
|
|
||||||
|
|
||||||
With Zig installed, a binary can be built using `zig build`:
|
With Zig installed, a binary can be built using `zig build`:
|
||||||
|
|
||||||
```shell-session
|
```shell-session
|
||||||
|
@ -3,139 +3,11 @@ const std = @import("std");
|
|||||||
pub fn build(b: *std.Build) !void {
|
pub fn build(b: *std.Build) !void {
|
||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
_ = target;
|
||||||
const lib = b.addStaticLibrary(.{
|
_ = optimize;
|
||||||
.name = "stub",
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
lib.linkLibC();
|
|
||||||
lib.addCSourceFiles(&.{"stub.c"}, &.{});
|
|
||||||
try addPaths(b, lib);
|
|
||||||
|
|
||||||
b.installArtifact(lib);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add the necessary paths to the given compilation step for the Xcode SDK.
|
|
||||||
///
|
|
||||||
/// This is required to workaround a Zig issue where we can't depend directly
|
|
||||||
/// on the hexops/xcode-frameworks repository: https://github.com/ziglang/zig/pull/15382
|
|
||||||
///
|
|
||||||
/// This is copied and adapted from hexops/mach. I modified it slightly
|
|
||||||
/// for my own personal taste (nothing wrong with theirs!), but the logic
|
|
||||||
/// is effectively identical.
|
|
||||||
pub fn addPaths(b: *std.Build, step: *std.build.CompileStep) !void {
|
pub fn addPaths(b: *std.Build, step: *std.build.CompileStep) !void {
|
||||||
// branch: mach
|
_ = b;
|
||||||
try ensureGitRepoCloned(
|
@import("macos_sdk").addPaths(step);
|
||||||
b.allocator,
|
|
||||||
// WARNING: forked temporarily for https://github.com/hexops/xcode-frameworks/issues/4
|
|
||||||
"https://github.com/mitchellh/xcode-frameworks",
|
|
||||||
"983deb1ab8d03861db30ea297cc78e6d121da4db",
|
|
||||||
xSdkPath("/zig-cache/xcode_frameworks"),
|
|
||||||
);
|
|
||||||
|
|
||||||
// https://github.com/ziglang/zig/issues/17358
|
|
||||||
if (step.target.isNative()) b.sysroot = xSdkPath("/zig-cache/xcode_frameworks");
|
|
||||||
|
|
||||||
step.addSystemFrameworkPath(.{ .path = xSdkPath("/zig-cache/xcode_frameworks/Frameworks") });
|
|
||||||
step.addSystemIncludePath(.{ .path = xSdkPath("/zig-cache/xcode_frameworks/include") });
|
|
||||||
step.addLibraryPath(.{ .path = xSdkPath("/zig-cache/xcode_frameworks/lib") });
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ensureGitRepoCloned(
|
|
||||||
allocator: std.mem.Allocator,
|
|
||||||
clone_url: []const u8,
|
|
||||||
revision: []const u8,
|
|
||||||
dir: []const u8,
|
|
||||||
) !void {
|
|
||||||
if (envVarIsTruthy(allocator, "NO_ENSURE_SUBMODULES") or
|
|
||||||
envVarIsTruthy(allocator, "NO_ENSURE_GIT")) return;
|
|
||||||
|
|
||||||
ensureGit(allocator);
|
|
||||||
|
|
||||||
if (std.fs.openDirAbsolute(dir, .{})) |_| {
|
|
||||||
const current_revision = try currentGitRevision(allocator, dir);
|
|
||||||
if (!std.mem.eql(u8, current_revision, revision)) {
|
|
||||||
// Reset to the desired revision
|
|
||||||
exec(
|
|
||||||
allocator,
|
|
||||||
&[_][]const u8{ "git", "fetch" },
|
|
||||||
dir,
|
|
||||||
) catch |err| std.debug.print(
|
|
||||||
"warning: failed to 'git fetch' in {s}: {s}\n",
|
|
||||||
.{ dir, @errorName(err) },
|
|
||||||
);
|
|
||||||
try exec(allocator, &[_][]const u8{ "git", "checkout", "--quiet", "--force", revision }, dir);
|
|
||||||
try exec(allocator, &[_][]const u8{ "git", "submodule", "update", "--init", "--recursive" }, dir);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} else |err| return switch (err) {
|
|
||||||
error.FileNotFound => {
|
|
||||||
std.log.info("cloning required dependency..\ngit clone {s} {s}..\n", .{ clone_url, dir });
|
|
||||||
try exec(allocator, &[_][]const u8{ "git", "clone", "-c", "core.longpaths=true", clone_url, dir }, ".");
|
|
||||||
try exec(allocator, &[_][]const u8{ "git", "checkout", "--quiet", "--force", revision }, dir);
|
|
||||||
try exec(allocator, &[_][]const u8{ "git", "submodule", "update", "--init", "--recursive" }, dir);
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
else => err,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
fn exec(
|
|
||||||
allocator: std.mem.Allocator,
|
|
||||||
argv: []const []const u8,
|
|
||||||
cwd: []const u8,
|
|
||||||
) !void {
|
|
||||||
var child = std.ChildProcess.init(argv, allocator);
|
|
||||||
child.cwd = cwd;
|
|
||||||
_ = try child.spawnAndWait();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn currentGitRevision(allocator: std.mem.Allocator, cwd: []const u8) ![]const u8 {
|
|
||||||
const result = try std.ChildProcess.exec(.{
|
|
||||||
.allocator = allocator,
|
|
||||||
.argv = &.{ "git", "rev-parse", "HEAD" },
|
|
||||||
.cwd = cwd,
|
|
||||||
});
|
|
||||||
allocator.free(result.stderr);
|
|
||||||
if (result.stdout.len > 0) return result.stdout[0 .. result.stdout.len - 1]; // trim newline
|
|
||||||
return result.stdout;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn ensureGit(allocator: std.mem.Allocator) void {
|
|
||||||
const argv = &[_][]const u8{ "git", "--version" };
|
|
||||||
const result = std.ChildProcess.exec(.{
|
|
||||||
.allocator = allocator,
|
|
||||||
.argv = argv,
|
|
||||||
.cwd = ".",
|
|
||||||
}) catch { // e.g. FileNotFound
|
|
||||||
std.log.err("mach: error: 'git --version' failed. Is git not installed?", .{});
|
|
||||||
std.process.exit(1);
|
|
||||||
};
|
|
||||||
defer {
|
|
||||||
allocator.free(result.stderr);
|
|
||||||
allocator.free(result.stdout);
|
|
||||||
}
|
|
||||||
if (result.term.Exited != 0) {
|
|
||||||
std.log.err("mach: error: 'git --version' failed. Is git not installed?", .{});
|
|
||||||
std.process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn envVarIsTruthy(allocator: std.mem.Allocator, name: []const u8) bool {
|
|
||||||
if (std.process.getEnvVarOwned(allocator, name)) |truthy| {
|
|
||||||
defer allocator.free(truthy);
|
|
||||||
if (std.mem.eql(u8, truthy, "true")) return true;
|
|
||||||
return false;
|
|
||||||
} else |_| {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn xSdkPath(comptime suffix: []const u8) []const u8 {
|
|
||||||
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
|
|
||||||
return comptime blk: {
|
|
||||||
const root_dir = std.fs.path.dirname(@src().file) orelse ".";
|
|
||||||
break :blk root_dir ++ suffix;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
10
pkg/apple-sdk/build.zig.zon
Normal file
10
pkg/apple-sdk/build.zig.zon
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
.{
|
||||||
|
.name = "apple-sdk",
|
||||||
|
.version = "0.1.0",
|
||||||
|
.dependencies = .{
|
||||||
|
.macos_sdk = .{
|
||||||
|
.url = "https://github.com/mitchellh/zig-build-macos-sdk/archive/166ff65bb7688c0a08c4ea98166ec8300aa34128.tar.gz",
|
||||||
|
.hash = "1220bfe1b32491a3448dff55c1dc0c12aa573f1e5bdb0a962bfbadaaa59e4833798b",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
@ -1 +0,0 @@
|
|||||||
// Blank on purpose
|
|
@ -14,6 +14,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
.@"enable-libpng" = true,
|
.@"enable-libpng" = true,
|
||||||
});
|
});
|
||||||
const macos = b.dependency("macos", .{ .target = target, .optimize = optimize });
|
const macos = b.dependency("macos", .{ .target = target, .optimize = optimize });
|
||||||
|
const upstream = b.dependency("harfbuzz", .{});
|
||||||
|
|
||||||
const module = b.addModule("harfbuzz", .{
|
const module = b.addModule("harfbuzz", .{
|
||||||
.source_file = .{ .path = "main.zig" },
|
.source_file = .{ .path = "main.zig" },
|
||||||
@ -23,8 +24,6 @@ pub fn build(b: *std.Build) !void {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const upstream_root = "../../vendor/harfbuzz";
|
|
||||||
|
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary(.{
|
||||||
.name = "harfbuzz",
|
.name = "harfbuzz",
|
||||||
.target = target,
|
.target = target,
|
||||||
@ -32,7 +31,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
lib.linkLibCpp();
|
lib.linkLibCpp();
|
||||||
lib.addIncludePath(.{ .path = upstream_root ++ "/src" });
|
lib.addIncludePath(upstream.path("src"));
|
||||||
|
|
||||||
const freetype_dep = b.dependency("freetype", .{ .target = target, .optimize = optimize });
|
const freetype_dep = b.dependency("freetype", .{ .target = target, .optimize = optimize });
|
||||||
lib.linkLibrary(freetype_dep.artifact("freetype"));
|
lib.linkLibrary(freetype_dep.artifact("freetype"));
|
||||||
@ -65,11 +64,11 @@ pub fn build(b: *std.Build) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = .{ .path = upstream_root ++ "/src/harfbuzz.cc" },
|
.file = upstream.path("src/harfbuzz.cc"),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
});
|
});
|
||||||
lib.installHeadersDirectoryOptions(.{
|
lib.installHeadersDirectoryOptions(.{
|
||||||
.source_dir = .{ .path = upstream_root ++ "/src" },
|
.source_dir = upstream.path("src"),
|
||||||
.install_dir = .header,
|
.install_dir = .header,
|
||||||
.install_subdir = "",
|
.install_subdir = "",
|
||||||
.include_extensions = &.{".h"},
|
.include_extensions = &.{".h"},
|
||||||
|
@ -2,6 +2,11 @@
|
|||||||
.name = "harfbuzz",
|
.name = "harfbuzz",
|
||||||
.version = "2.13.2",
|
.version = "2.13.2",
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
|
.harfbuzz = .{
|
||||||
|
.url = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/8.2.1.tar.gz",
|
||||||
|
.hash = "12203c1b09a2cf778367376076301322235816598eaf0639da08b233ab852548df92",
|
||||||
|
},
|
||||||
|
|
||||||
.freetype = .{ .path = "../freetype" },
|
.freetype = .{ .path = "../freetype" },
|
||||||
.macos = .{ .path = "../macos" },
|
.macos = .{ .path = "../macos" },
|
||||||
.apple_sdk = .{ .path = "../apple-sdk" },
|
.apple_sdk = .{ .path = "../apple-sdk" },
|
||||||
|
@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const target = b.standardTargetOptions(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
const optimize = b.standardOptimizeOption(.{});
|
const optimize = b.standardOptimizeOption(.{});
|
||||||
|
|
||||||
const upstream_root = "../../vendor/libxml2";
|
const upstream = b.dependency("libxml2", .{});
|
||||||
|
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary(.{
|
||||||
.name = "xml2",
|
.name = "xml2",
|
||||||
@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
lib.linkLibC();
|
lib.linkLibC();
|
||||||
|
|
||||||
lib.addIncludePath(.{ .path = upstream_root ++ "/include" });
|
lib.addIncludePath(upstream.path("include"));
|
||||||
lib.addIncludePath(.{ .path = "override/include" });
|
lib.addIncludePath(.{ .path = "override/include" });
|
||||||
if (target.isWindows()) {
|
if (target.isWindows()) {
|
||||||
lib.addIncludePath(.{ .path = "override/config/win32" });
|
lib.addIncludePath(.{ .path = "override/config/win32" });
|
||||||
@ -96,14 +96,14 @@ pub fn build(b: *std.Build) !void {
|
|||||||
|
|
||||||
inline for (srcs) |src| {
|
inline for (srcs) |src| {
|
||||||
lib.addCSourceFile(.{
|
lib.addCSourceFile(.{
|
||||||
.file = .{ .path = upstream_root ++ "/" ++ src },
|
.file = upstream.path(src),
|
||||||
.flags = flags.items,
|
.flags = flags.items,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
lib.installHeader("override/include/libxml/xmlversion.h", "libxml/xmlversion.h");
|
lib.installHeader("override/include/libxml/xmlversion.h", "libxml/xmlversion.h");
|
||||||
lib.installHeadersDirectoryOptions(.{
|
lib.installHeadersDirectoryOptions(.{
|
||||||
.source_dir = .{ .path = upstream_root ++ "/include" },
|
.source_dir = upstream.path("include"),
|
||||||
.install_dir = .header,
|
.install_dir = .header,
|
||||||
.install_subdir = "",
|
.install_subdir = "",
|
||||||
.include_extensions = &.{".h"},
|
.include_extensions = &.{".h"},
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
.{
|
.{
|
||||||
.name = "libxml2",
|
.name = "libxml2",
|
||||||
.version = "2.11.5",
|
.version = "2.11.5",
|
||||||
.dependencies = .{},
|
.dependencies = .{
|
||||||
|
.libxml2 = .{
|
||||||
|
.url = "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz",
|
||||||
|
.hash = "122032442d95c3b428ae8e526017fad881e7dc78eab4d558e9a58a80bfbd65a64f7d",
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
1
vendor/harfbuzz
vendored
1
vendor/harfbuzz
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 0967a3e24ab5d79cc55dbe224652d8aabd942def
|
|
1
vendor/libxml2
vendored
1
vendor/libxml2
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 58de9d31da4d0e8cb6bcf7f5e99714f9df2c4411
|
|
Reference in New Issue
Block a user