Makefile: Honor ZIG variable + fix static build for x86

This commit is contained in:
Yorhel 2023-08-01 13:12:16 +02:00
parent ab6dc5be75
commit 83d3630ca7

View file

@ -70,15 +70,15 @@ static-%.tar.gz:
--without-gpm --without-sysmouse --enable-widec --with-default-terminfo-dir=/usr/share/terminfo\
--with-terminfo-dirs=/usr/share/terminfo:/lib/terminfo:/usr/local/share/terminfo\
--with-fallbacks="screen linux vt100 xterm xterm-256color" --host=$*\
CC="zig cc --target=$*"\
LD="zig cc --target=$*"\
AR="zig ar" RANLIB="zig ranlib"\
CC="${ZIG} cc --target=$*"\
LD="${ZIG} cc --target=$*"\
AR="${ZIG} ar" RANLIB="${ZIG} ranlib"\
CPPFLAGS=-D_GNU_SOURCE && make && make install.libs
@# 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=$*
@# --build-file ../build.zig --search-prefix inst/ --cache-dir zig -Drelease-fast=true
@# Alternative approach, bypassing zig-build
cd static-$* && zig build-exe -target $*\
cd static-$* && ${ZIG} build-exe -target $*\
-Iinst/include -Iinst/include/ncursesw -lc inst/lib/libncursesw.a\
--cache-dir zig-cache -static -fstrip -O ReleaseFast ../src/main.zig ../src/ncurses_refs.c
cd static-$* && mv main ncdu && tar -czf ../static-$*.tar.gz ncdu
@ -87,8 +87,8 @@ static-%.tar.gz:
static-linux-x86_64: static-x86_64-linux-musl.tar.gz
mv $< ncdu-${NCDU_VERSION}-linux-x86_64.tar.gz
static-linux-i386: static-i386-linux-musl.tar.gz
mv $< ncdu-${NCDU_VERSION}-linux-i386.tar.gz
static-linux-x86: static-x86-linux-musl.tar.gz
mv $< ncdu-${NCDU_VERSION}-linux-x86.tar.gz
static-linux-aarch64: static-aarch64-linux-musl.tar.gz
mv $< ncdu-${NCDU_VERSION}-linux-aarch64.tar.gz
@ -98,6 +98,6 @@ static-linux-arm: static-arm-linux-musleabi.tar.gz
static:\
static-linux-x86_64 \
static-linux-i386 \
static-linux-x86 \
static-linux-aarch64 \
static-linux-arm