From 5029ef79ae53980584e5bd022fdb1430d9664f76 Mon Sep 17 00:00:00 2001 From: andromeda Date: Sun, 26 Apr 2026 10:39:46 +0200 Subject: add readme, dev shell, build script --- .gitignore | 1 + README.md | 23 +++++++++++++++++++++++ flake.nix | 25 +++++-------------------- get_wl.sh | 16 ++++++++++++++++ 4 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 README.md create mode 100755 get_wl.sh diff --git a/.gitignore b/.gitignore index efc68e0..d3803e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ out/ +wl/ result* diff --git a/README.md b/README.md new file mode 100644 index 0000000..5405eff --- /dev/null +++ b/README.md @@ -0,0 +1,23 @@ +# c3term + +eventually a terminal emulator, currently a port of [this example](https://github.com/ColleagueRiley/RSGL/blob/main/examples/basics/basic.c) + +## with nix + +`nix run` to run + +`nix develop` for a development shell, then follow the manual build instructions + +## manual build + +required by `get_wl.sh`: +- pkg-config +- wayland-protocols +- wayland-scanner + +see `project.json` for library requirements + +```bash +./get_wl.sh +c3c build c3term-linux-x64 +``` diff --git a/flake.nix b/flake.nix index a849cea..e8be043 100644 --- a/flake.nix +++ b/flake.nix @@ -8,6 +8,7 @@ }; }; outputs = { + self, nixpkgs, c3c, ... @@ -24,30 +25,16 @@ buildInputs = [ pkgs.c3c pkgs.wayland-scanner + pkgs.pkg-config + pkgs.wayland-protocols ]; nativeBuildInputs = [ pkgs.libxkbcommon pkgs.wayland pkgs.libGL ]; - configurePhase = '' - mkdir -p wl/ - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wl/xdg-shell.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/staging/pointer-warp/pointer-warp-v1.xml wl/pointer-warp-v1.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml wl/xdg-toplevel-icon-v1.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wl/xdg-decoration-unstable-v1.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml wl/relative-pointer-unstable-v1.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml wl/pointer-constraints-unstable-v1.h - wayland-scanner client-header ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml wl/xdg-output-unstable-v1.h - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml wl/xdg-shell.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/staging/pointer-warp/pointer-warp-v1.xml wl/pointer-warp-v1.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml wl/xdg-toplevel-icon-v1.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wl/xdg-decoration-unstable-v1.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml wl/relative-pointer-unstable-v1.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml wl/pointer-constraints-unstable-v1.c - wayland-scanner private-code ${pkgs.wayland-protocols}/share/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml wl/xdg-output-unstable-v1.c - ''; buildPhase = '' + ./get_wl.sh c3c build c3term-linux-x64 ''; installPhase = '' @@ -61,9 +48,7 @@ }; }; devShells.x86_64-linux.default = pkgs.mkShell { - buildInputs = [ - pkgs.c3c - ]; + inputsFrom = [self.packages.x86_64-linux.default]; }; }; } diff --git a/get_wl.sh b/get_wl.sh new file mode 100755 index 0000000..6136480 --- /dev/null +++ b/get_wl.sh @@ -0,0 +1,16 @@ +mkdir -p wl/ +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/stable/xdg-shell/xdg-shell.xml wl/xdg-shell.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/staging/pointer-warp/pointer-warp-v1.xml wl/pointer-warp-v1.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml wl/xdg-toplevel-icon-v1.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wl/xdg-decoration-unstable-v1.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml wl/relative-pointer-unstable-v1.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml wl/pointer-constraints-unstable-v1.h +wayland-scanner client-header $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml wl/xdg-output-unstable-v1.h + +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/stable/xdg-shell/xdg-shell.xml wl/xdg-shell.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/staging/pointer-warp/pointer-warp-v1.xml wl/pointer-warp-v1.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/staging/xdg-toplevel-icon/xdg-toplevel-icon-v1.xml wl/xdg-toplevel-icon-v1.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml wl/xdg-decoration-unstable-v1.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/relative-pointer/relative-pointer-unstable-v1.xml wl/relative-pointer-unstable-v1.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml wl/pointer-constraints-unstable-v1.c +wayland-scanner private-code $(pkg-config --variable datarootdir wayland-protocols)/wayland-protocols/unstable/xdg-output/xdg-output-unstable-v1.xml wl/xdg-output-unstable-v1.c -- cgit v1.3.1