2019-02-03 16:32:20 +01:00
|
|
|
{ config, lib, stdenv, fetchurl
|
2008-07-25 17:54:19 +02:00
|
|
|
, yacc, flex
|
2016-04-22 09:40:57 +02:00
|
|
|
, sysfsutils, kmod, udev
|
2019-02-03 16:32:20 +01: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 17:54:19 +02:00
|
|
|
|
|
|
|
# FIXME: should add an option to choose between hotplug and udev.
|
|
|
|
stdenv.mkDerivation rec {
|
2018-03-21 09:36:15 +01:00
|
|
|
name = "pcmciautils-018";
|
2008-07-25 17:54:19 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2015-02-05 15:13:05 +01:00
|
|
|
url = "https://kernel.org/pub/linux/utils/kernel/pcmcia/${name}.tar.gz";
|
2018-03-21 09:36:15 +01:00
|
|
|
sha256 = "0sfm3w2n73kl5w7gb1m6q8gy5k4rgwvzz79n6yhs9w3sag3ix8sk";
|
2008-07-25 17:54:19 +02:00
|
|
|
};
|
|
|
|
|
2016-04-22 09:40:57 +02:00
|
|
|
buildInputs = [udev yacc sysfsutils kmod flex];
|
2008-07-25 17:54:19 +02:00
|
|
|
|
|
|
|
patchPhase = ''
|
|
|
|
sed -i "
|
2016-04-22 09:40:57 +02:00
|
|
|
s,/sbin/modprobe,${kmod}&,;
|
2008-07-25 17:54:19 +02: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 15:59:33 +02:00
|
|
|
+ (if firmware == [] then ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'' else "")
|
2019-02-03 16:32:20 +01:00
|
|
|
+ (if configOpts == null then "" else ''
|
|
|
|
ln -sf ${configOpts} ./config/config.opts'')
|
2008-07-25 17:54:19 +02:00
|
|
|
;
|
|
|
|
|
2019-10-27 14:03:25 +01:00
|
|
|
makeFlags = [ "LEX=flex" ];
|
|
|
|
installFlags = [ "INSTALL=install" "DESTDIR=${placeholder "out"}" ];
|
2008-08-27 15:59:33 +02:00
|
|
|
postInstall =
|
|
|
|
lib.concatMapStrings (path: ''
|
|
|
|
for f in : $(find ${path} -type f); do
|
|
|
|
test "$f" == ":" && continue;
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $(dirname $out/lib/firmware/$\{f#${path}});
|
2008-08-27 15:59:33 +02:00
|
|
|
ln -s $f $out/lib/firmware/$\{f#${path}};
|
|
|
|
done;
|
|
|
|
'') firmware;
|
2008-07-25 17:54:19 +02:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://www.kernel.org/pub/linux/utils/kernel/pcmcia/";
|
2008-07-25 17:54:19 +02: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 06:19:00 +02:00
|
|
|
license = stdenv.lib.licenses.gpl2;
|
2016-08-02 19:50:55 +02:00
|
|
|
platforms = stdenv.lib.platforms.linux;
|
2008-07-25 17:54:19 +02:00
|
|
|
};
|
|
|
|
}
|