libghostty-vt: nix package updates and more nix tests
parent
da835757b0
commit
1322d64534
|
|
@ -813,28 +813,40 @@ jobs:
|
|||
run: nm result/bin/.ghostty-wrapped 2>&1 | grep -q 'main_ghostty.main'
|
||||
|
||||
- name: Test ReleaseFast build of libghostty-vt
|
||||
run: nix build .#libghostty-vt-releasefast
|
||||
|
||||
- name: Check to see if the library looks sane
|
||||
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
|
||||
run: |
|
||||
nix build .#libghostty-vt-releasefast
|
||||
nix build .#libghostty-vt-releasefast.tests.sanity-check
|
||||
nix build .#libghostty-vt-releasefast.tests.pkg-config
|
||||
nix build .#libghostty-vt-releasefast.tests.build-with-shared
|
||||
nix build .#libghostty-vt-releasefast.tests.build-with-static
|
||||
nix build .#libghostty-vt-releasefast.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test ReleaseFast (no SIMD) build of libghostty-vt
|
||||
run: nix build .#libghostty-vt-releasefast-no-simd
|
||||
|
||||
- name: Check to see if the library looks sane
|
||||
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
|
||||
run: |
|
||||
nix build .#libghostty-vt-releasefast-no-simd
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.sanity-check
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.pkg-config
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-with-shared
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-with-static
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test Debug build of libghostty-vt
|
||||
run: nix build .#libghostty-vt-debug
|
||||
|
||||
- name: Check to see if the library looks sane
|
||||
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
|
||||
run: |
|
||||
nix build .#libghostty-vt-debug
|
||||
nix build .#libghostty-vt-debug.tests.sanity-check
|
||||
nix build .#libghostty-vt-debug.tests.pkg-config
|
||||
nix build .#libghostty-vt-debug.tests.build-with-shared
|
||||
nix build .#libghostty-vt-debug.tests.build-with-static
|
||||
nix build .#libghostty-vt-debug.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test Debug (no SIMD) build of libghostty-vt
|
||||
run: nix build .#libghostty-vt-debug-no-simd
|
||||
|
||||
- name: Check to see if the library looks sane
|
||||
run: nm result/lib/libghostty-vt.so.0.1.0 2>&1 | grep -q 'ghostty_terminal_new'
|
||||
run: |
|
||||
nix build .#libghostty-vt-debug-no-simd
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.sanity-check
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.pkg-config
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-with-shared
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-with-static
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-example-c-vt-build-info
|
||||
|
||||
build-dist:
|
||||
runs-on: namespace-profile-ghostty-sm
|
||||
|
|
@ -956,6 +968,58 @@ jobs:
|
|||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build-nix-macos:
|
||||
runs-on: namespace-profile-ghostty-macos-tahoe
|
||||
needs: test
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
|
||||
# Install Nix and use that to run our tests so our environment matches exactly.
|
||||
- uses: cachix/install-nix-action@96951a368ba55167b55f1c916f7d416bac6505fe # v31.10.3
|
||||
with:
|
||||
nix_path: nixpkgs=channel:nixos-unstable
|
||||
- uses: cachix/cachix-action@1eb2ef646ac0255473d23a5907ad7b04ce94065c # v17
|
||||
with:
|
||||
name: ghostty
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- name: Test ReleaseFast build of libghostty-vt
|
||||
run: |
|
||||
nix build .#libghostty-vt-releasefast
|
||||
nix build .#libghostty-vt-releasefast.tests.sanity-check
|
||||
nix build .#libghostty-vt-releasefast.tests.pkg-config
|
||||
nix build .#libghostty-vt-releasefast.tests.build-with-shared
|
||||
nix build .#libghostty-vt-releasefast.tests.build-with-static
|
||||
nix build .#libghostty-vt-releasefast.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test ReleaseFast (no SIMD) build of libghostty-vt
|
||||
run: |
|
||||
nix build .#libghostty-vt-releasefast-no-simd
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.sanity-check
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.pkg-config
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-with-shared
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-with-static
|
||||
nix build .#libghostty-vt-releasefast-no-simd.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test Debug build of libghostty-vt
|
||||
run: |
|
||||
nix build .#libghostty-vt-debug
|
||||
nix build .#libghostty-vt-debug.tests.sanity-check
|
||||
nix build .#libghostty-vt-debug.tests.pkg-config
|
||||
nix build .#libghostty-vt-debug.tests.build-with-shared
|
||||
nix build .#libghostty-vt-debug.tests.build-with-static
|
||||
nix build .#libghostty-vt-debug.tests.build-example-c-vt-build-info
|
||||
|
||||
- name: Test Debug (no SIMD) build of libghostty-vt
|
||||
run: |
|
||||
nix build .#libghostty-vt-debug-no-simd
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.sanity-check
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.pkg-config
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-with-shared
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-with-static
|
||||
nix build .#libghostty-vt-debug-no-simd.tests.build-example-c-vt-build-info
|
||||
|
||||
build-macos:
|
||||
runs-on: namespace-profile-ghostty-macos-tahoe
|
||||
needs: test
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
{
|
||||
lib,
|
||||
stdenv,
|
||||
callPackage,
|
||||
git,
|
||||
lib,
|
||||
llvmPackages,
|
||||
pkg-config,
|
||||
runCommand,
|
||||
stdenv,
|
||||
testers,
|
||||
versionCheckHook,
|
||||
zig_0_15,
|
||||
revision ? "dirty",
|
||||
optimize ? "Debug",
|
||||
|
|
@ -22,10 +26,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
root = ../.;
|
||||
fileset = lib.fileset.intersection (lib.fileset.fromSource (lib.sources.cleanSource ../.)) (
|
||||
lib.fileset.unions [
|
||||
../dist/linux
|
||||
../images
|
||||
../include
|
||||
../po
|
||||
../pkg
|
||||
../src
|
||||
../vendor
|
||||
|
|
@ -36,7 +37,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
);
|
||||
};
|
||||
|
||||
deps = callPackage ../build.zig.zon.nix {name = "ghostty-cache-${finalAttrs.version}";};
|
||||
deps = callPackage ../build.zig.zon.nix {name = "${finalAttrs.pname}-cache-${finalAttrs.version}";};
|
||||
|
||||
nativeBuildInputs = [
|
||||
git
|
||||
|
|
@ -46,6 +47,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
buildInputs = [];
|
||||
|
||||
doCheck = false;
|
||||
dontSetZigDefaultFlags = true;
|
||||
|
||||
zigBuildFlags = [
|
||||
|
|
@ -58,6 +60,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
"-Demit-lib-vt=true"
|
||||
"-Dsimd=${lib.boolToString simd}"
|
||||
];
|
||||
zigCheckFlags = finalAttrs.zigBuildFlags ++ ["test-lib-vt"];
|
||||
|
||||
outputs = [
|
||||
"out"
|
||||
|
|
@ -71,17 +74,159 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
mv "$out/include" "$dev"
|
||||
mv "$out/share" "$dev"
|
||||
|
||||
ln -sf "$out/lib/libghostty-vt.so.0" "$dev/lib/libghostty-vt.so"
|
||||
ln -sf "$out/lib/libghostty-vt.so.${lib.versions.major finalAttrs.version}" "$dev/lib/libghostty-vt.so"
|
||||
'';
|
||||
|
||||
postFixup = ''
|
||||
substituteInPlace "$dev/share/pkgconfig/libghostty-vt.pc" \
|
||||
--replace "$out" "$dev"
|
||||
--replace-fail "$out" "$dev"
|
||||
'';
|
||||
|
||||
passthru.tests = {
|
||||
sanity-check = let
|
||||
version = "${lib.versions.major finalAttrs.version}.${lib.versions.minor finalAttrs.version}.${lib.versions.patch finalAttrs.version}";
|
||||
in
|
||||
runCommand "sanity-check" {} (builtins.concatStringsSep "\n" [
|
||||
''
|
||||
${lib.getExe' stdenv.cc "nm"} "${finalAttrs.finalPackage}/lib/libghostty-vt.so.${version}" | grep -q 'T ghostty_terminal_new'
|
||||
${lib.getExe' stdenv.cc "nm"} "${finalAttrs.finalPackage.dev}/lib/libghostty-vt.a" | grep -q 'T ghostty_terminal_new'
|
||||
''
|
||||
(
|
||||
lib.optionalString simd
|
||||
''
|
||||
${lib.getExe' stdenv.cc "nm"} "${finalAttrs.finalPackage.dev}/lib/libghostty-vt.a" | grep -q 'T .*simdutf'
|
||||
${lib.getExe' stdenv.cc "nm"} "${finalAttrs.finalPackage.dev}/lib/libghostty-vt.a" | grep -q 'T .*3hwy'
|
||||
''
|
||||
)
|
||||
''
|
||||
touch "$out"
|
||||
''
|
||||
]);
|
||||
pkg-config = testers.hasPkgConfigModules {
|
||||
package = finalAttrs.finalPackage.dev;
|
||||
};
|
||||
build-with-shared = stdenv.mkDerivation {
|
||||
name = "build-with-shared";
|
||||
src = ./test-src;
|
||||
doInstallCheck = true;
|
||||
nativeBuildInputs = [pkg-config];
|
||||
buildInputs = [finalAttrs.finalPackage];
|
||||
buildPhase = ''
|
||||
runHook preBuildHooks
|
||||
|
||||
cc -o test test_libghostty_vt.c \
|
||||
''$(pkg-config --cflags --libs libghostty-vt) \
|
||||
-Wl,-rpath,"${finalAttrs.finalPackage}/lib"
|
||||
|
||||
runHook postBuildHooks
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstallHooks
|
||||
|
||||
mkdir -p "$out/bin";
|
||||
cp -a test "$out/bin/test";
|
||||
|
||||
runHook postInstallHooks
|
||||
'';
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheckHooks
|
||||
|
||||
"$out/bin/test" | grep -q "SIMD: ${
|
||||
if simd
|
||||
then "yes"
|
||||
else "no"
|
||||
}"
|
||||
ldd "$out/bin/test" 2>/dev/null | grep -q libghostty-vt
|
||||
|
||||
runHook postInstallCheckHooks
|
||||
'';
|
||||
meta = {
|
||||
mainProgram = "test";
|
||||
};
|
||||
};
|
||||
build-with-static = stdenv.mkDerivation {
|
||||
name = "build-with-static";
|
||||
src = ./test-src;
|
||||
doInstallCheck = true;
|
||||
nativeBuildInputs = [pkg-config];
|
||||
buildInputs = [finalAttrs.finalPackage llvmPackages.libcxxClang];
|
||||
buildPhase = ''
|
||||
runHook preBuildHooks
|
||||
|
||||
cc -o test test_libghostty_vt.c \
|
||||
''$(pkg-config --cflags libghostty-vt) \
|
||||
${finalAttrs.finalPackage.dev}/lib/libghostty-vt.a \
|
||||
''$(pkg-config --libs-only-l --static libghostty-vt | sed 's/-lghostty-vt//') \
|
||||
-Wl,-rpath,"${finalAttrs.finalPackage}/lib"
|
||||
|
||||
runHook postBuildHooks
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstallHooks
|
||||
|
||||
mkdir -p "$out/bin";
|
||||
cp -a test "$out/bin/test";
|
||||
|
||||
runHook postInstallHooks
|
||||
'';
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheckHooks
|
||||
|
||||
"$out/bin/test" | grep -q "SIMD: ${
|
||||
if simd
|
||||
then "yes"
|
||||
else "no"
|
||||
}"
|
||||
! ldd "$out/bin/test" 2>/dev/null | grep -q libghostty-vt
|
||||
|
||||
runHook postInstallCheckHooks
|
||||
'';
|
||||
meta = {
|
||||
mainProgram = "test";
|
||||
};
|
||||
};
|
||||
build-example-c-vt-build-info = stdenv.mkDerivation {
|
||||
name = "build-example-c-vt-build-info";
|
||||
version = finalAttrs.version;
|
||||
src = ../example/c-vt-build-info/src;
|
||||
doInstallCheck = true;
|
||||
nativeBuildInputs = [pkg-config];
|
||||
nativeInstallCheckInputs = [versionCheckHook];
|
||||
buildInputs = [finalAttrs.finalPackage];
|
||||
buildPhase = ''
|
||||
runHook preBuildHooks
|
||||
|
||||
cc -o test main.c \
|
||||
''$(pkg-config --cflags --libs libghostty-vt) \
|
||||
-Wl,-rpath,"${finalAttrs.finalPackage}/lib"
|
||||
|
||||
runHook postBuildHooks
|
||||
'';
|
||||
installPhase = ''
|
||||
runHook preInstallHooks
|
||||
|
||||
mkdir -p "$out/bin";
|
||||
cp -a test "$out/bin/test";
|
||||
|
||||
runHook postInstallHooks
|
||||
'';
|
||||
installCheckPhase = ''
|
||||
runHook preInstallCheckHooks
|
||||
|
||||
ldd "$out/bin/test" 2>/dev/null | grep -q libghostty-vt
|
||||
|
||||
runHook postInstallCheckHooks
|
||||
'';
|
||||
meta = {
|
||||
mainProgram = "test";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
homepage = "https://ghostty.org";
|
||||
license = lib.licenses.mit;
|
||||
platforms = zig_0_15.meta.platforms;
|
||||
pkgConfigModules = ["libghostty-vt"];
|
||||
};
|
||||
})
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "ghostty";
|
||||
version = "1.3.2-dev";
|
||||
version = "1.3.2-dev+${revision}-nix";
|
||||
|
||||
# We limit source like this to try and reduce the amount of rebuilds as possible
|
||||
# thus we only provide the source that is needed for the build
|
||||
|
|
@ -86,7 +86,7 @@ in
|
|||
zigBuildFlags = [
|
||||
"--system"
|
||||
"${finalAttrs.deps}"
|
||||
"-Dversion-string=${finalAttrs.version}-${revision}-nix"
|
||||
"-Dversion-string=${finalAttrs.version}"
|
||||
"-Dgtk-x11=${lib.boolToString enableX11}"
|
||||
"-Dgtk-wayland=${lib.boolToString enableWayland}"
|
||||
"-Dcpu=baseline"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
#include <ghostty/vt.h>
|
||||
#include <stdio.h>
|
||||
int main(void) {
|
||||
bool simd = false;
|
||||
GhosttyResult r = ghostty_build_info(GHOSTTY_BUILD_INFO_SIMD, &simd);
|
||||
if (r != GHOSTTY_SUCCESS) return 1;
|
||||
printf("SIMD: %s\n", simd ? "yes" : "no");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in New Issue