Update Zig requirement in README + set preferred build mode

+ minor irrelevant build system changes.
This commit is contained in:
Yorhel 2024-04-20 15:40:51 +02:00
parent 5944b738d0
commit 29bbab64b3
3 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@ ZIG ?= zig
PREFIX ?= /usr/local PREFIX ?= /usr/local
BINDIR ?= ${PREFIX}/bin BINDIR ?= ${PREFIX}/bin
MANDIR ?= ${PREFIX}/share/man/man1 MANDIR ?= ${PREFIX}/share/man/man1
ZIG_FLAGS ?= -Doptimize=ReleaseFast ZIG_FLAGS ?= --release
NCDU_VERSION=$(shell grep 'program_version = "' src/main.zig | sed -e 's/^.*"\(.\+\)".*$$/\1/') NCDU_VERSION=$(shell grep 'program_version = "' src/main.zig | sed -e 's/^.*"\(.\+\)".*$$/\1/')
@ -65,7 +65,7 @@ static-%.tar.gz:
CC="${ZIG} cc --target=$*"\ CC="${ZIG} cc --target=$*"\
LD="${ZIG} cc --target=$*"\ LD="${ZIG} cc --target=$*"\
AR="${ZIG} ar" RANLIB="${ZIG} ranlib"\ AR="${ZIG} ar" RANLIB="${ZIG} ranlib"\
CPPFLAGS=-D_GNU_SOURCE && make && make install.libs CPPFLAGS=-D_GNU_SOURCE && make -j8 && make install.libs
@# zig-build - cleaner approach but doesn't work, results in a dynamically linked binary. @# zig-build - cleaner approach but doesn't work, results in a dynamically linked binary.
@#cd static-$* && PKG_CONFIG_LIBDIR="`pwd`/inst/pkg" zig build -Dtarget=$* @#cd static-$* && PKG_CONFIG_LIBDIR="`pwd`/inst/pkg" zig build -Dtarget=$*
@# --build-file ../build.zig --search-prefix inst/ --cache-dir zig -Drelease-fast=true @# --build-file ../build.zig --search-prefix inst/ --cache-dir zig -Drelease-fast=true

View file

@ -19,7 +19,7 @@ C version (1.x).
## Requirements ## Requirements
- Zig 0.11.0 - Zig 0.12.0
- Some sort of POSIX-like OS - Some sort of POSIX-like OS
- ncurses libraries and header files - ncurses libraries and header files

View file

@ -5,9 +5,9 @@ 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 t = target.result; const optimize = b.standardOptimizeOption(.{
.preferred_optimize_mode = .ReleaseFast,
const optimize = b.standardOptimizeOption(.{}); });
const pie = b.option(bool, "pie", "Build with PIE support (by default false)") orelse false; const pie = b.option(bool, "pie", "Build with PIE support (by default false)") orelse false;
@ -22,7 +22,7 @@ pub fn build(b: *std.Build) void {
exe.pie = pie; exe.pie = pie;
exe.root_module.linkSystemLibrary("ncursesw", .{}); exe.root_module.linkSystemLibrary("ncursesw", .{});
// https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554 // https://github.com/ziglang/zig/blob/b52be973dfb7d1408218b8e75800a2da3dc69108/build.zig#L551-L554
if (t.isDarwin()) { if (target.result.isDarwin()) {
// useful for package maintainers // useful for package maintainers
exe.headerpad_max_install_names = true; exe.headerpad_max_install_names = true;
} }