2019-02-03 15:32:20 +00:00
|
|
|
{ config, lib, stdenv, fetchurl
|
2008-07-25 16:54:19 +01:00
|
|
|
, yacc, flex
|
2016-04-22 08:40:57 +01: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 16:54:19 +01:00
|
|
|
|
|
|
|
# FIXME: should add an option to choose between hotplug and udev.
|
|
|
|
stdenv.mkDerivation rec {
|
2018-03-21 08:36:15 +00:00
|
|
|
name = "pcmciautils-018";
|
2008-07-25 16:54:19 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-02-05 14:13:05 +00:00
|
|
|
url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/${name}.tar.gz";
|
2018-03-21 08:36:15 +00:00
|
|
|
sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
|
2008-07-25 16:54:19 +01:00
|
|
|
};
|
|
|
|
|
2016-04-22 08:40:57 +01:00
|
|
|
buildInputs = [udev yacc sysfsutils kmod flex];
|
2008-07-25 16:54:19 +01:00
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i "
|
2016-04-22 08:40:57 +01:00
|
|
|
s,/sbin/modprobe,${kmod}&,;
|
2008-07-25 16:54:19 +01: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 */
|
|
|
|
''
|
2008-08-27 14:59:33 +01:00
|
|
|
+ (if firmware == [] then ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'' else "")
|
2019-02-03 15:32:20 +00:00
|
|
|
+ (if configOpts == null then "" else ''
|
|
|
|
ln -sf ${configOpts} ./config/config.opts'')
|
2008-07-25 16:54:19 +01:00
|
|
|
;
|
|
|
|
|
2019-10-27 13:03:25 +00:00
|
|
|
makeFlags = [ "LEX=flex" ];
|
|
|
|
installFlags = [ "INSTALL=install" "DESTDIR=${placeholder "out"}" ];
|
2008-08-27 14:59:33 +01: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 14:59:33 +01:00
|
|
|
ln -s $f $out/lib/firmware/$\{f#${path}};
|
|
|
|
done;
|
|
|
|
'') firmware;
|
2008-07-25 16:54:19 +01:00
|
|
|
|
|
|
|
meta = {
|
2015-02-05 14:13:05 +00:00
|
|
|
homepage = https://www.kernel.org/pub/linux/utils/kernel/pcmcia/;
|
2008-07-25 16:54:19 +01:00
|
|
|
longDescription = "
|
|
|
|
PCMCIAutils contains the initialization tools necessary to allow
|
|
|
|
the PCMCIA subsystem to behave (almost) as every other
|
|
|
|
hotpluggable bus system.
|
|
|
|
";
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl2;
|
2016-08-02 18:50:55 +01:00
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2008-07-25 16:54:19 +01:00
|
|
|
};
|
|
|
|
}
|