Files
lidm/docs/PACKAGERS.md
javalsai 0b2d0bdf03 fixes: improve login environment handling (#114)
* chore(organization): allow nested header and c files

* feat: add shell login "middleware" & etc:
  * lidm now calls `bash` (or other shells, depends on PACKAGE cfg) in
  login mode as a session wrapper to source most env (can be disabled)
  * this fixes a lot of env problems with all `/etc/profile` and more

Extra:
* implemented a musl compatible version of `execvpe` and now lidm should
  search for PATH everywhere it needs to
* `search_path` now also checks if the found binary is properly
  executable
* lidm now uses `confstr` for a decent PATH default if none is found
* logs are unbuffered for cases where debug logs appear empty (exit
  without handlers moment)

* chore: one-time evaluate certain makefile vars

---------

Co-authored-by: grialion <48643945+grialion@users.noreply.github.com>
2026-02-07 17:12:03 +01:00

4.5 KiB

This is a guide listing all possible options packagers have to tweak behavior of lidm and the extra stuff to package.

Components

If you want to package lidm for a distribution you have to package the binary and:

Preprocessor Defines

Most of the behavior that can be tweaked using preprocessor #defines, to include some simply add CPPFLAGS+='-D{{name}}={{value}}' to your make command. e.g:

make \
    CPPFLAGS+='-DSESSIONS_XSESSIONS=\"/var/empty\"' \
    CPPFLAGS+='-DSESSIONS_WAYLAND=\"/var/empty\"'

The list of possible #defines is:

Name Default Description Env Override?
PAM_SERVICE_FALLBACK "login" Name of the default PAM module to use. Defaults to the distro's "login". Yes (LIDM_PAM_SERVICE)
SESSIONS_XSESSIONS "/usr/share/xsessions" No
SESSIONS_XSESSIONS_LOCAL "/usr/local/share/xsessions" No
SESSIONS_WAYLAND "/usr/share/wayland-sessions" No
SESSIONS_WAYLAND_LOCAL "/usr/local/share/wayland-sessions" No
LIDM_CONF_PATH "/etc/lidm.ini" Path of the default configuration. Yes (LIDM_CONF)
LOGIN_SHELL "bash" Login shell name. No

Other Build Settings

Compiler

Lidm attempts to support being built by gcc and clang with preference over the first. However, if you wish to take advantage of LLVM's optimizations over GNU's you can change the compiler with make CC=clang or try any other compiler.

Compiler Flags

Compiler flags should be passed with CFLAGS, its -O3 -Wall by default so adding anything will overwrite this.

Build Metadata

lidm -v outputs some information about the build version, this can be weaked with INFO_GIT_REV and INFO_BUILD_TS, by default they are:

INFO_GIT_REV?=$$(git describe --long --tags --always || echo '?')
INFO_BUILD_TS?=$$(date +%s)

But this can be changed by just passing those env variables, for example, in the case git is not applicable in the build environment of the package.

Target Directory

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.

$ fd -t f . --base-directory $out
bin/lidm
etc/lidm.ini
share/man/man1/lidm.1
share/man/man5/lidm-config.5

Build Recipes for Packaging

To ease most of the installation process there's several make recipes to install man pages and service files, I encpurage you to check their source yourself, but:

  • 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-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.

You can choose to use these packages or create your own service files / etc. There's are merely suggestions on what to use.