debase: init at 2

debase: fix build on linux
This commit is contained in:
Jeremy Schlatter 2024-06-06 22:03:24 -07:00 committed by aleksana
parent 818dbe2f96
commit 162acc638e
3 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,31 @@
diff --git a/Makefile b/Makefile
index b0b682cb..513822d9 100644
--- a/Makefile
+++ b/Makefile
@@ -58,17 +58,14 @@ endif
INCDIRS = \
-isystem ./lib/ncurses/include \
- -iquote ./lib/libgit2/include \
-iquote ./src \
-iquote .
LIBDIRS = \
- -L./lib/libgit2/build-$(PLATFORM) \
-L./lib/ncurses/build-$(PLATFORM)
LIBS = \
-lgit2 \
- -lz \
-lpthread \
-lformw \
-lmenuw \
@@ -102,7 +99,7 @@ $(OBJS): | lib $(GITHASHHEADER)
# Libs: execute make from `lib` directory
.PHONY: lib
lib:
- $(MAKE) -C $@
+ $(MAKE) -C $@ ncurses/$(BUILDROOT)
# C rule
$(BUILDDIR)/%.o: %.c

View File

@ -0,0 +1,96 @@
{
darwin,
fetchFromGitHub,
fetchpatch, # Delete at next version bump.
lib,
libgit2,
stdenv,
}:
stdenv.mkDerivation rec {
pname = "debase";
# NOTE: When updating version, also update commit hash in prePatch.
version = "2";
src =
(fetchFromGitHub {
owner = "toasterllc";
repo = "debase";
rev = "refs/tags/v${version}";
hash = "sha256-6AavH8Ag+879ntcxJDbVgsg8V6U4cxwPQYPKvq2PpoQ=";
fetchSubmodules = true;
}).overrideAttrs
{
# Workaround to fetch git@github.com submodules.
# See https://github.com/NixOS/nixpkgs/issues/195117
#
# Already fixed in latest upstream, so delete at next version bump.
GIT_CONFIG_COUNT = 1;
GIT_CONFIG_KEY_0 = "url.https://github.com/.insteadOf";
GIT_CONFIG_VALUE_0 = "git@github.com:";
};
prePatch = ''
# xcrun is not available in the Darwin stdenv, but we don't need it anyway.
substituteInPlace Makefile \
--replace-fail 'xcrun dsymutil' dsymutil
# NOTE: Update this when updating version.
substituteInPlace Makefile \
--replace-fail 'git rev-parse HEAD' 'echo bbe9f1737ab229dd370640a4b5d5e742a051c13b' \
--replace-fail '$(GITHASHHEADER): .git/HEAD .git/index' '$(GITHASHHEADER):'
'';
patches = [
# Ignore debase's vendored copy of libgit2 in favor of the nixpkgs version.
./ignore-vendored-libgit2.patch
# Already fixed in latest upstream, so delete at next version bump.
(fetchpatch {
url = "https://github.com/toasterllc/debase/commit/d483c5ac016ac2ef3600e93ae4022cd9d7781c83.patch";
hash = "sha256-vVQMOEiLTd46+UknZm8Y197sjyK/kTK/M+9sRX9AssY=";
})
];
buildInputs = [
libgit2
] ++ lib.optionals stdenv.isDarwin [ darwin.apple_sdk_11_0.frameworks.Foundation ];
installPhase = ''
runHook preInstall
install -Dm755 build-${if stdenv.isDarwin then "mac" else "linux"}/release/debase $out/bin/debase
runHook postInstall
'';
enableParallelBuilding = true;
makeFlags = [
"ARCHS=${
if stdenv.isx86_64 then
"x86_64"
else if stdenv.isAarch64 then
"arm64"
else
abort "unsupported system: ${stdenv.system}"
}"
];
meta = {
description = "TUI for drag-and-drop manipulation of git commits";
homepage = "https://toaster.llc/debase";
# The author has not yet specified a license.
# See https://github.com/toasterllc/debase/pull/4
license = lib.licenses.publicDomain;
mainProgram = "debase";
maintainers = with lib.maintainers; [
jeremyschlatter
aleksana
];
platforms = [
# Only these systems are supported by Makefile
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
};
}

View File

@ -2217,6 +2217,10 @@ with pkgs;
delta = darwin.apple_sdk_11_0.callPackage ../applications/version-management/delta { };
debase = callPackage ../by-name/de/debase/package.nix {
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
};
diff-so-fancy = callPackage ../applications/version-management/diff-so-fancy { };
gex = callPackage ../applications/version-management/gex {