What’s the best practice to handle hardcoded paths in proprietary/binary-only drivers or libraries?
I want to use and package the proprietary SANE-scanner-drivers for Fujitsu / Ricoh SP-series document scanners (e.g. SP-1120, SP-1125, SP-1130), so I (and others) can use the scanners on NixOS. Fujitsu/Ricoh only provide a binary-only driver for Ubuntu. The libraries of this driver contain several hardcoded paths:
- /etc/sane.d/
- /opt/pfusp/
- /usr/bin/ps
- /usr/bin/grep
Since the driver does not find these paths, it fails.
So, what’s the best way here, so that the driver-libraries can find these paths/files?
- Quick-and-dirty: manually add symlinks to the system. Works, but…
- Patch the binary libraries? But the “new” paths are probably longer than the hardcoded ones, so that doesn’t work nicely.
- Patch the binaries, so the hardcoded paths point to /etc/… (
/opt/pfusp→/etc/pfusp,/usr/bin→/etc/bin) and add symlinks via environment.etc (environment.etc."sane.d".source,environment.etc."pfusb".source,environment.etc."bin".source).
But this looks like a workaround in an unintended way. - buildFHSEnv? AFAIK does not work on libraries.
- buildFHSEnv or wrap all binaries using the driver (xsane, simple-scan, gscan2pdf)? Looks wrong.
- Create a custom nix-shell-configuration, which provides the paths, an run the binaries in there? Should work without patching the libraries, but seems a bit strange.
- write wrapper-libraries?
- …?
Currently, I’m considering and testing way 2 and 6, but maybe there’s a better way?