summaryrefslogtreecommitdiff
path: root/sys-fs/ncdu/files/ncdu-2.2.2-makefile-add-zig-variable.patch
blob: 9a118508641b655da378c4a1d1e02fbc9d737be8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
From 74be2772499b4eb065a11477c6632146ed647dc8 Mon Sep 17 00:00:00 2001
From: Florian Schmaus <flo@geekplace.eu>
Date: Thu, 9 Mar 2023 16:01:40 +0100
Subject: [PATCH] Makefile: Add ZIG variable and build target

The ZIG variable helps to test ncdu with different zig installations,
and it allows Gentoo to inject the zig version that should be used to
build zig into the Makefile.

Also add a phony 'build' target as first target to the Makefile so
that it becomes the default target. This allows the Gentoo package to
use the default src_compile() function.

See also https://bugs.gentoo.org/900547
---
 Makefile | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 7cdbca3..eb854c6 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,8 @@
 # Optional semi-standard Makefile with some handy tools.
 # Ncdu itself can be built with just the zig build system.
 
+ZIG ?= zig
+
 PREFIX ?= /usr/local
 BINDIR ?= ${PREFIX}/bin
 MANDIR ?= ${PREFIX}/share/man/man1
@@ -11,11 +13,14 @@ ZIG_FLAGS ?= -Drelease-fast
 
 NCDU_VERSION=$(shell grep 'program_version = "' src/main.zig | sed -e 's/^.*"\(.\+\)".*$$/\1/')
 
+.PHONY: build
+build: release doc
+
 release:
-	zig build ${ZIG_FLAGS}
+	$(ZIG) build ${ZIG_FLAGS}
 
 debug:
-	zig build
+	$(ZIG) build
 
 clean:
 	rm -rf zig-cache zig-out