2019-02-03 15:32:20 +00:00
|
|
|
{ config, lib, stdenv, fetchurl
|
2021-03-14 17:50:12 +00:00
|
|
|
, bison, flex
|
2016-04-22 07:40:57 +00:00
|
|
|
, sysfsutils, kmod, udev
|
2019-02-03 15:32:20 +00:00
|
|
|
, firmware ? config.pcmciaUtils.firmware or [] # Special pcmcia cards.
|
|
|
|
, configOpts ? config.pcmciaUtils.config or null # Special hardware (map memory & port & irq)
|
|
|
|
}: # used to generate postInstall script.
|
2008-07-25 15:54:19 +00:00
|
|
|
|
|
|
|
# FIXME: should add an option to choose between hotplug and udev.
|
|
|
|
stdenv.mkDerivation rec {
|
2021-08-27 14:47:49 +00:00
|
|
|
pname = "pcmciautils";
|
|
|
|
version = "018";
|
2008-07-25 15:54:19 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-08-27 14:47:49 +00:00
|
|
|
url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/pcmciautils-${version}.tar.gz";
|
2018-03-21 08:36:15 +00:00
|
|
|
sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
|
2008-07-25 15:54:19 +00:00
|
|
|
};
|
|
|
|
|
2021-03-14 17:50:12 +00:00
|
|
|
buildInputs = [udev bison sysfsutils kmod flex];
|
2008-07-25 15:54:19 +00:00
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i "
|
2016-04-22 07:40:57 +00:00
|
|
|
s,/sbin/modprobe,${kmod}&,;
|
2008-07-25 15:54:19 +00:00
|
|
|
s,/lib/udev/,$out/sbin/,;
|
|
|
|
" udev/* # fix-color */
|
|
|
|
sed -i "
|
|
|
|
s,/lib/firmware,$out&,;
|
|
|
|
s,/etc/pcmcia,$out&,;
|
|
|
|
" src/{startup.c,pcmcia-check-broken-cis.c} # fix-color */
|
|
|
|
''
|
2023-02-06 20:49:02 +00:00
|
|
|
+ (lib.optionalString (firmware == []) ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'')
|
|
|
|
+ (lib.optionalString (configOpts != null) "ln -sf ${configOpts} ./config/config.opts")
|
2008-07-25 15:54:19 +00:00
|
|
|
;
|
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
makeFlags = [ "LEX=flex" ];
|
|
|
|
installFlags = [ "INSTALL=install" "DESTDIR=${placeholder "out"}" ];
|
2008-08-27 13:59:33 +00:00
|
|
|
postInstall =
|
|
|
|
lib.concatMapStrings (path: ''
|
|
|
|
for f in : $(find ${path} -type f); do
|
|
|
|
test "$f" == ":" && continue;
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $(dirname $out/lib/firmware/$\{f#${path}});
|
2008-08-27 13:59:33 +00:00
|
|
|
ln -s $f $out/lib/firmware/$\{f#${path}};
|
|
|
|
done;
|
|
|
|
'') firmware;
|
2008-07-25 15:54:19 +00:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.kernel.org/pub/linux/utils/kernel/pcmcia/";
|
2008-07-25 15:54:19 +00:00
|
|
|
longDescription = "
|
|
|
|
PCMCIAutils contains the initialization tools necessary to allow
|
|
|
|
the PCMCIA subsystem to behave (almost) as every other
|
|
|
|
hotpluggable bus system.
|
|
|
|
";
|
2021-01-15 14:45:37 +00:00
|
|
|
license = lib.licenses.gpl2;
|
|
|
|
platforms = lib.platforms.linux;
|
2008-07-25 15:54:19 +00:00
|
|
|
};
|
|
|
|
}
|