pcsc-lite now uses meson build tool

With the version 2.2.0 of pcsc-lite I just released (see New version of pcsc-lite: 2.2.0) the recommanded tool to configure and build pcsc-lite is now meson.

Problems with autoconf/automake

The change was motivated by the effects of the xz utils backdoor in March 2024.

Meson

Meson (and ninja used by meson) is used by a lot of software, like GNOME libraries and applications. See the list of adopters in the Wikipedia Meson page.

It is also an opportunity to learn new tools.

Meson for pcsc-lite

A typical use case is:

meson setup builddir
cd builddir
meson compile
meson install

If you need/want to disable some pcsc-lite options then change the first command to use something like:

meson setup builddir -Dlibudev=false -Dipcdir=/var/run/pcscd

The available options are (file meson.options):

embedded

for embedded systems [limit RAM and CPU resources by disabling features (log)] (disabled by default)

filter_names

reader filtering using PCSCLITE_FILTER_IGNORE_READER_NAMES and PCSCLITE_FILTER_EXTEND_READER_NAMES environment variables

ipcdir

Direcrory for pcsc-lite internal communication socket (/run/pcscd by default)

libsystemd

Use systemd for daemon auto start

libudev

Use libudev (preferred) for USB hotplug

libusb

Use libusb for USB hotplug (disabled by default)

polkit

Use polkit to enforce access control

serial

Support serial readers (disabled by default)

serialconfdir

Path for serial configuration files (/etc/reader.conf.d by default)

systemdunit

Systemd unit directory to use ("user" by default)

usb

Support USB readers

usbdropdir

Path for USB drivers (/usr/lib/pcsc/drivers by default)

Peformances

Another reason to use meson is that the configuration + compilation times should be much shorter.

Computer I used for the tests: MacBook Pro from 2009, MacBookPro5,3, 4 GB of RAM, CPU Core 2 Duo at 2.66 GHz. I just replaced the hard drive by an SSD and installed Debian GNU/Linux (to replace macOS).

I use an old (15 year-old) computer on purpose. The goal is to be able measure times.

autoconf

  • bootstrap: 18 seconds (48 %)

  • configure: 9.5 seconds (25 %)

  • compile: 10 seconds (26 %)

  • total: 37.5 seconds

meson

  • configure: 2 seconds (22 %)

  • compile: 7 seconds (77 %)

  • total : 9 seconds

Speed up: x4.1

Here, a lot of time is used to generate the configure script (in the autoconf case) and run it. If you have a lot more files to compile in your project the speed up may be lower for you. I guess meson should always be faster than autoconf/automake.

Drop unused features

The move to meson is also an occasion to do some cleanup in the code and features supported by pcsc-lite.

Serial readers

I have not removed anything, but the support of serial readers is not enabled by default. I think I have not had a computer with a serial port since at least 10 years.

In case you need it, you can enable it using:

meson setup builddir -Dserial=true

Vintage Unix systems

pcsc-lite has special code for HPUX, OSF, AIX, Solaris and SunOS4. I guess nobody is using these systems anymore.

In the case of regression

If you need a special configuration that is not possible using meson it is still possible to generate and run the configure script and build pcsc-lite as before:

./bootstrap
./configure your_arguments

You can also create a patch and submit it to https://salsa.debian.org/rousseau/PCSC/ or https://github.com/LudovicRousseau/PCSC.

I already fixed Meson issues. So be sure to use the current master branch of the pcsc-lite git repository.

Conclusion

It is funny to note that we have now much faster computers than 20 years ago when the pcsc-lite project was started. But faster tools are developed now to replace the slower ones. How could we be happy to use slower tools on our slower computers?

The erooM principle is a nice idea. I hope to see more examples.

[UPDATE May 2024]

pcsc-lite version 2.2.1 added the meson option filter_names.