commit: 57329cb47d3306caa2d8888356d8fbfa97fc86df
parent 7f1abfe6e7a9957754581f551ab865626d8b3f6f
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 29 Apr 2024 11:19:24 +0200
Link executables statically
Diffstat:
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
@@ -9,6 +9,9 @@ SYS_BINDIR ?= /bin
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
+# Dynamically linked executables are unsupported
+LDSTATIC = -static
+
SYS_EXE = login su
TEST_EXE = common_test
MAN1 = login.1
@@ -16,17 +19,17 @@ MAN1 = login.1
all: $(SYS_EXE)
.c:
- $(CC) -std=c11 $(CFLAGS) -o $@ $< $(LDFLAGS)
+ $(CC) -std=c11 $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDSTATIC)
common.c: common.h
login_SRC = login.c common.c
login: $(login_SRC) Makefile
- $(CC) -std=c11 $(CFLAGS) -o $@ $(login_SRC) -lcrypt $(LDFLAGS)
+ $(CC) -std=c11 $(CFLAGS) -o $@ $(login_SRC) -lcrypt $(LDFLAGS) $(LDSTATIC)
su_SRC = su.c common.c
su: $(su_SRC) Makefile
- $(CC) -std=c11 $(CFLAGS) -o $@ $(su_SRC) -lcrypt $(LDFLAGS)
+ $(CC) -std=c11 $(CFLAGS) -o $@ $(su_SRC) -lcrypt $(LDFLAGS) $(LDSTATIC)
common_test: common_test.c common.c Makefile
$(CC) -std=c11 $(CFLAGS) `pkg-config --cflags atf-c` -o $@ common_test.c common.c `pkg-config --libs atf-c` -lcrypt $(LDFLAGS)
diff --git a/README.md b/README.md
@@ -10,6 +10,7 @@ Status: Experimental, enough done to work but needs thorough review.
## Dependencies
- POSIX Environment
- libc with `termios.h`
+- Proper support for static executables (glibc is out)
- `/dev/tty` file pointing to currently attached console
- (test-only) [ATF](https://github.com/jmmv/atf)
- (test-only) [Kyua](https://github.com/jmmv/kyua)
@@ -18,7 +19,7 @@ Status: Experimental, enough done to work but needs thorough review.
- (lint-only) [mandoc](https://mdocml.bsd.lv/)
## Unsupported
-- Broken authentication systems like PAM
+- Broken authentication systems like PAM and [nsswitch](https://skarnet.org/software/nsss/nsswitch.html)
- Remote host arguments (believed to be legacy)
- `/etc/login.defs` configuration file
- Checking for emails, consider using `/etc/profile` or `~/.profile` instead