lidm/Makefile
Robin Candau 5d298ea6d8
Don't compress man page(s) in Makefile
Compressing man pages is a distribution / user preference that should be handled on the packaging side of things.

Indeed, compressing man pages by default imposes a compression algorithm / level whereas most package managers handle that already and eventually allow users to choose or customize them if wanted.

Additionally, it can lead to unexpected side effects. For instance, gzip is recording timestamps in metadata by default, which prevents [reproducible builds](https://reproducible-builds.org/):

```
==> ERROR: Package is not reproducible
--- lidm-0.2.0-1-any.pkg.tar.zst
+++ ./build/lidm-0.2.0-1-any.pkg.tar.zst
├── lidm-0.2.0-1-any.pkg.tar
│ ├── file list
│ │ @@ -1,9 +1,9 @@
│ │  -rw-r--r--   0 root         (0) root         (0)     5391 2025-03-10 12:01:53.000000 .BUILDINFO
│ │ --rw-r--r--   0 root         (0) root         (0)      488 2025-03-10 12:01:53.000000 .MTREE
│ │ +-rw-r--r--   0 root         (0) root         (0)      492 2025-03-10 12:01:53.000000 .MTREE
│ │  -rw-r--r--   0 root         (0) root         (0)      427 2025-03-10 12:01:53.000000 .PKGINFO
│ │  drwxr-xr-x   0 root         (0) root         (0)        0 2025-03-10 12:01:53.000000 etc/
│ │  -rw-r--r--   0 root         (0) root         (0)      930 2025-03-10 12:01:53.000000 etc/lidm.ini
│ │  drwxr-xr-x   0 root         (0) root         (0)        0 2025-03-10 12:01:53.000000 usr/
│ │  drwxr-xr-x   0 root         (0) root         (0)        0 2025-03-10 12:01:53.000000 usr/bin/
│ │  -rwxr-xr-x   0 root         (0) root         (0)    39656 2025-03-10 12:01:53.000000 usr/bin/lidm
│ │  drwxr-xr-x   0 root         (0) root         (0)        0 2025-03-10 12:01:53.000000 usr/share/
│ ├── .MTREE
│ │ ├── .MTREE-content
│ │ │ @@ -7,10 +7,10 @@
│ │ │  /set mode=755
│ │ │  ./usr time=1741608113.0 type=dir
│ │ │  ./usr/bin time=1741608113.0 type=dir
│ │ │  ./usr/bin/lidm time=1741608113.0 size=39656 sha256digest=1a27eef50f6caf35d408f7650c362dea788c7a00a2736f0ec4c94ecd38ae6c6f
│ │ │  ./usr/share time=1741608113.0 type=dir
│ │ │  ./usr/share/man time=1741608113.0 type=dir
│ │ │  ./usr/share/man/man1 time=1741608113.0 type=dir
│ │ │ -./usr/share/man/man1/lidm.1.gz time=1741608113.0 mode=644 size=615 sha256digest=7babc0d1e7d84c3ff18db5ea327313cdbe2ba1117c33d733622a916dfd9d8d0e
│ │ │ +./usr/share/man/man1/lidm.1.gz time=1741608113.0 mode=644 size=615 sha256digest=497e49b75ab0d2c3f3edb70967bf189724990c46df23492738254395ec835d8c
│ │ │  ./usr/share/man/man5 time=1741608113.0 type=dir
│ │ │ -./usr/share/man/man5/lidm-config.5.gz time=1741608113.0 mode=644 size=1374 sha256digest=d0b54c3117c417dfdc43a7629f26cf4c64235742f698a0498722a03a4d1c25c2
│ │ │ +./usr/share/man/man5/lidm-config.5.gz time=1741608113.0 mode=644 size=1374 sha256digest=4e16649cb31029b039a594ffa2f2d4d8a624917aaacc865836c5c2d2a92cd3e4
│ ├── usr/share/man/man1/lidm.1.gz
│ │ ├── filetype from file(1)
│ │ │ @@ -1 +1 @@
│ │ │ -gzip compressed data, was "lidm.1", last modified: Mon Mar 10 12:01:59 2025, from Unix
│ │ │ +gzip compressed data, was "lidm.1", last modified: Mon Mar 10 12:15:51 2025, from Unix
│ ├── usr/share/man/man5/lidm-config.5.gz
│ │ ├── filetype from file(1)
│ │ │ @@ -1 +1 @@
│ │ │ -gzip compressed data, was "lidm-config.5", last modified: Mon Mar 10 12:01:59 2025, from Unix
│ │ │ +gzip compressed data, was "lidm-config.5", last modified: Mon Mar 10 12:15:51 2025, from Unix
```

See https://cmpct.info/~sam/blog/posts/automatic-manpage-compression/ for detailed rational.
2025-03-10 13:16:07 +01:00

75 lines
2.6 KiB
Makefile

CDIR=src
LDIR=lib
IDIR=include
ODIR=dist
PREFIX=/usr
CC?=gcc
CFLAGS?=-O3 -Wall
_CFLAGS=-I$(DIR)
ALLFLAGS=$(CFLAGS) -I$(IDIR)
LIBS=-lm -lpam -lpam_misc
_DEPS = util.h ui.h config.h auth.h efield.h keys.h users.h sessions.h chvt.h
DEPS = $(patsubst %,$(IDIR)/%,$(_DEPS))
_OBJ = main.o util.o ui.o config.o auth.o efield.o users.o sessions.o chvt.o
OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ))
$(ODIR)/%.o: $(CDIR)/%.c $(DEPS)
@mkdir -p $(ODIR)
$(CC) -c -o $@ $< $(ALLFLAGS)
lidm: $(OBJ)
$(CC) -o $@ $^ $(ALLFLAGS) $(LIBS)
.PHONY: clean
clean:
rm -f $(ODIR)/*.o lidm
# Copy lidm to ${DESTDIR}${PREFIX}/bin (/usr/bin)
install: lidm
mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5}
install -Dm755 ./lidm ${DESTDIR}${PREFIX}/bin/
install -Dm644 ./themes/default.ini ${DESTDIR}/etc/lidm.ini
install -Dm644 ./assets/man/lidm.1 ${DESTDIR}${PREFIX}/share/man/man1/
install -Dm644 ./assets/man/lidm-config.5 ${DESTDIR}${PREFIX}/share/man/man5/
uninstall:
rm -rf ${DESTDIR}${PREFIX}/bin/lidm ${DESTDIR}/etc/lidm.ini
rm -rf ${DESTDIR}/usr/share/man/man{1/lidm.1,5/lidm-config.5}.gz
rm -rf /etc/systemd/system/lidm.service /etc/dinit.d/lidm /etc/runit/sv/lidm
install-service:
@if command -v systemctl &> /dev/null; then \
make install-service-systemd; \
elif command -v dinitctl &> /dev/null; then \
make install-service-dinit; \
elif command -v sv &> /dev/null; then \
make install-service-runit; \
elif command -v rc-update &> /dev/null; then \
make install-service-openrc; \
elif command -v s6-service &> /dev/null; then \
make install-service-s6; \
else \
printf '\x1b[1;31m%s\x1b[0m\n' "Unknown init system, skipping service install..."; \
fi
install-service-systemd:
install -m644 ./assets/services/systemd.service /etc/systemd/system/lidm.service
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'systemctl enable lidm'"
install-service-dinit:
install -m644 ./assets/services/dinit /etc/dinit.d/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'dinitctl enable lidm'"
install-service-runit:
rsync -a --no-owner --no-group ./assets/services/runit/. /etc/runit/sv/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'ln -s /etc/runit/sv/lidm /run/runit/service' and 'sv enable lidm'"
install-service-openrc:
install -m755 ./assets/services/openrc /etc/init.d/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 'rc-update add lidm'"
install-service-s6:
rsync -a --no-owner --no-group ./assets/services/s6/. /etc/s6/sv/lidm
@printf '\x1b[1m%s\x1b[0m\n\n' " don't forget to run 's6-service add default lidm' and 's6-db-reload'"