chore(make): installs to ${PREFIX}, /usr or /usr/local, no mix

This commit is contained in:
2026-01-19 23:54:06 +01:00
parent 08c284e056
commit aca9d0be5d
5 changed files with 29 additions and 15 deletions

View File

@@ -4,6 +4,7 @@
<!-- By "very relevant" I mean big features or something manual packagers should know, like leftover files --> <!-- By "very relevant" I mean big features or something manual packagers should know, like leftover files -->
<!-- Once a release would be opened, group the last bunch of dangling changes, add release version as header and its date --> <!-- Once a release would be opened, group the last bunch of dangling changes, add release version as header and its date -->
- Most stuff (most of `/etc` being a notable exception) now installs to `/usr/local` by default, check [`docs/PACKAGERS.md`](./docs/PACKAGERS.md).
- Added a changelog. - Added a changelog.
- Finally add proper (experimental) xorg support. - Finally add proper (experimental) xorg support.
- Systemd service install path changed to `/usr/local/lib/systemd`, there could be a leftover file at `/etc/systemd/system/lidm.service`. - Systemd service install path changed to `/usr/local/lib/systemd`, there could be a leftover file at `/etc/systemd/system/lidm.service`.

View File

@@ -6,7 +6,7 @@ LDIR=lib
IDIR=include IDIR=include
ODIR=dist ODIR=dist
PREFIX=/usr PREFIX=/usr/local
CC?=gcc CC?=gcc
CFLAGS?=-O3 -Wall -Wextra -fdata-sections -ffunction-sections CFLAGS?=-O3 -Wall -Wextra -fdata-sections -ffunction-sections
@@ -47,7 +47,6 @@ lidm: $(OBJ)
clean: clean:
rm -f $(ODIR)/*.o lidm rm -f $(ODIR)/*.o lidm
# Copy lidm to ${DESTDIR}${PREFIX}/bin (/usr/bin)
install: lidm install: lidm
mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5} mkdir -p ${DESTDIR}${PREFIX}/bin ${DESTDIR}${PREFIX}/share/man/man{1,5}
install -Dm755 ./lidm ${DESTDIR}${PREFIX}/bin/ install -Dm755 ./lidm ${DESTDIR}${PREFIX}/bin/
@@ -57,8 +56,14 @@ install: lidm
uninstall: uninstall:
rm -rf ${DESTDIR}${PREFIX}/bin/lidm ${DESTDIR}/etc/lidm.ini 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 ${DESTDIR}${PREFIX}/share/man/man{1/lidm.1,5/lidm-config.5}.gz
rm -rf ${DESTDIR}/usr/local/lib/systemd/system/lidm.service ${DESTDIR}/etc/dinit.d/lidm ${DESTDIR}/etc/runit/sv/lidm rm -rf \
${DESTDIR}${PREFIX}/lib/systemd/system/lidm.service \
${DESTDIR}/etc/dinit.d/lidm \
${DESTDIR}/etc/sv/lidm \
${DESTDIR}/etc/runit/sv/lidm \
${DESTDIR}/etc/init.d/lidm \
${DESTDIR}/etc/s6/sv/lidm
install-service: install-service:
@if command -v systemctl &> /dev/null; then \ @if command -v systemctl &> /dev/null; then \
@@ -88,13 +93,13 @@ install-service:
fi fi
install-service-systemd: install-service-systemd:
install -Dm644 ./assets/services/systemd.service ${DESTDIR}/usr/local/lib/systemd/system/lidm.service install -Dm644 ./assets/services/systemd.service ${DESTDIR}${PREFIX}/lib/systemd/system/lidm.service
@printf '\033[1m%s\033[0m\n\n' " don't forget to run 'systemctl enable lidm'" @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'systemctl enable lidm'"
install-service-dinit: install-service-dinit:
install -m644 ./assets/services/dinit ${DESTDIR}/etc/dinit.d/lidm install -m644 ./assets/services/dinit ${DESTDIR}/etc/dinit.d/lidm
@printf '\033[1m%s\033[0m\n\n' " don't forget to run 'dinitctl enable lidm'" @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'dinitctl enable lidm'"
install-service-runit: install-service-runit:
@if [ ! -e /etc/sv ] && [ -d /etc/runit/sv ] && [ -z "$FORCE" ]; then \ @if [ ! -e /etc/sv ] && [ -d /etc/runit/sv ] && [ -z "$$FORCE" ]; then \
printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/runit/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/runit/sv does" >&2; \
printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit-etc'" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit-etc'" >&2; \
exit 1; \ exit 1; \
@@ -103,7 +108,7 @@ install-service-runit:
cp -r --update=all ./assets/services/runit/* ${DESTDIR}/etc/sv/lidm/ cp -r --update=all ./assets/services/runit/* ${DESTDIR}/etc/sv/lidm/
@printf '\033[1m%s\033[0m\n\n' " don't forget to run 'ln -s ${DESTDIR}/etc/sv/lidm /var/service' or your distro equivalent" @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'ln -s ${DESTDIR}/etc/sv/lidm /var/service' or your distro equivalent"
install-service-runit-etc: install-service-runit-etc:
@if [ ! -e /etc/runit/sv ] && [ -d /etc/sv ] && [ -z "$FORCE" ]; then \ @if [ ! -e /etc/runit/sv ] && [ -d /etc/sv ] && [ -z "$$FORCE" ]; then \
printf '\033[31m%s\033[0m\n' "/etc/runit/sv doesn't exist but /etc/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "/etc/runit/sv doesn't exist but /etc/sv does" >&2; \
printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit'" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-runit'" >&2; \
exit 1; \ exit 1; \
@@ -115,7 +120,7 @@ install-service-openrc:
install -m755 ./assets/services/openrc ${DESTDIR}/etc/init.d/lidm install -m755 ./assets/services/openrc ${DESTDIR}/etc/init.d/lidm
@printf '\033[1m%s\033[0m\n\n' " don't forget to run 'rc-update add lidm'" @printf '\033[1m%s\033[0m\n\n' " don't forget to run 'rc-update add lidm'"
install-service-s6: install-service-s6:
@if [ ! -e /etc/sv ] && [ -d /etc/s6/sv ] && [ -z "$FORCE" ]; then \ @if [ ! -e /etc/sv ] && [ -d /etc/s6/sv ] && [ -z "$$FORCE" ]; then \
printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/s6/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "/etc/sv doesn't exist but /etc/s6/sv does" >&2; \
printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6-etc'" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6-etc'" >&2; \
exit 1; \ exit 1; \
@@ -124,7 +129,7 @@ install-service-s6:
cp -r --update=all ./assets/services/s6/* ${DESTDIR}/etc/sv/lidm/ cp -r --update=all ./assets/services/s6/* ${DESTDIR}/etc/sv/lidm/
@printf '\033[1m%s\033[0m\n\n' " don't forget to run 's6-service add default lidm' and 's6-db-reload'" @printf '\033[1m%s\033[0m\n\n' " don't forget to run 's6-service add default lidm' and 's6-db-reload'"
install-service-s6-etc: install-service-s6-etc:
@if [ ! -e /etc/s6/sv ] && [ -d /etc/sv ] && [ -z "$FORCE" ]; then \ @if [ ! -e /etc/s6/sv ] && [ -d /etc/sv ] && [ -z "$$FORCE" ]; then \
printf '\033[31m%s\033[0m\n' "/etc/s6/sv doesn't exist but /etc/sv does" >&2; \ printf '\033[31m%s\033[0m\n' "/etc/s6/sv doesn't exist but /etc/sv does" >&2; \
printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6'" >&2; \ printf '\033[31m%s\033[0m\n' "you probably meant to 'make install-service-s6'" >&2; \
exit 1; \ exit 1; \

View File

@@ -13,7 +13,7 @@ The manual steps for installation are:
## Systemd ## Systemd
- Copy `systemd.service` to `/usr/local/lib/systemd/system/lidm.service` (if the directory doesn't exist, create it first) - Copy `systemd.service` to `/usr/local/lib/systemd/system/lidm.service` (if the directory doesn't exist, create it first) or `/usr/lib/systemd/system/lidm.service` (if you wish to install along your system files).
- To enable it you can run `systemctl enable lidm` - To enable it you can run `systemctl enable lidm`
## Dinit ## Dinit
@@ -23,8 +23,10 @@ The manual steps for installation are:
## Runit ## Runit
- Copy `runit/` to `/etc/runit/sv/lidm/` Your runit service path can be either `/etc/runit/sv` or `/etc/sv`.
- Add the service with `ln -s /etc/runit/sv/lidm /run/runit/service`
- Copy `runit/` to `runit-path/lidm/`
- Add the service with `ln -s runit-path/lidm /run/runit/service`
- And to enable it `sv enable lidm` - And to enable it `sv enable lidm`
## OpenRC ## OpenRC
@@ -34,7 +36,9 @@ The manual steps for installation are:
## S6 ## S6
- Copy `s6/` to `/etc/s6/sv/lidm/` Your S6 service path can be either `/etc/s6/sv` or `/etc/sv`.
- Copy `s6/` to `s6-path/lidm/`
- Add the service with `s6-service add default lidm` - Add the service with `s6-service add default lidm`
- Reload the database with `s6-db-reload` (you might have to run this every time the service file changes) - Reload the database with `s6-db-reload` (you might have to run this every time the service file changes)

View File

@@ -131,6 +131,8 @@ Then you can install the files onto your filesystem with:
make install make install
``` ```
This will install mostly into `/usr/local` by default, this path is mostly unused nowadays and could feel like lidm didn't install at all. You can add `PREFIX=/usr` to install along the rest of your system packages if you wish.
And additionally, to install service files (start-up behavior). <sup>[more docs](../assets/services/README.md)</sup> And additionally, to install service files (start-up behavior). <sup>[more docs](../assets/services/README.md)</sup>
```sh ```sh

View File

@@ -53,7 +53,9 @@ But this can be changed by just passing those env variables, for example, in the
## Target Directory ## Target Directory
`DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=` `DESTDIR` can be used to for installation recipes to install on alternative root directories. Along with `PREFIX` (defaults to `/usr/local`, packaging this you'll probably want to make it `/usr`) for systems which don't use the common `/usr` structure. e.g. `make install DESTDIR=$out PREFIX=`
`/etc` is sometimes in that `PREFIX` and sometimes not, be careful.
```txt ```txt
$ fd -t f . --base-directory $out $ fd -t f . --base-directory $out
@@ -69,7 +71,7 @@ To ease most of the installation process there's several `make` recipes to insta
- `make` / `make lidm`: Builds the app binary. - `make` / `make lidm`: Builds the app binary.
- `make install`: Attempts to install the binary, place a default config file in `/etc/lidm.ini` and install the man pages. - `make install`: Attempts to install the binary, place a default config file in `/etc/lidm.ini` and install the man pages.
- `make install-service-(systemd|dinit|runit|openrc|s6)(|-etc)`: Just check the source, service files for different init systems and `-etc` variants for alternative paths. - `make install-service-(systemd|dinit|runit|openrc|s6)(|-etc)`: Just check the source, service files for different init systems and `-etc` variants for alternative paths. You might need `FORCE=1` in the environment if you are packaging for other init system or scripting.
- `make print-version`: Outputs the current version in the `Makefile` for scripts that might want to extract that info. - `make print-version`: Outputs the current version in the `Makefile` for scripts that might want to extract that info.
You can choose to use these packages or create your own service files / etc. There's are merely suggestions on what to use. You can choose to use these packages or create your own service files / etc. There's are merely suggestions on what to use.