2018-10-14 22:36:17 +02:00
{ stdenv , fetchFromGitHub , bc , python , bison , flex , fuse , libarchive }:
2017-01-16 22:24:21 +01:00
stdenv . mkDerivation rec {
2018-10-14 22:36:17 +02:00
name = " l k l - 2 0 1 8 - 0 8 - 2 2 " ;
rev = " 5 2 2 1 c 5 4 7 a f 3 d 2 9 5 8 2 7 0 3 f 0 1 0 4 9 6 1 7 a 6 b f 9 f 6 2 3 2 a " ;
2017-01-16 22:24:21 +01:00
2017-05-24 00:43:22 +02:00
outputs = [ " d e v " " l i b " " o u t " ] ;
2018-10-14 22:36:17 +02:00
nativeBuildInputs = [ bc bison flex python ] ;
2017-05-23 01:41:22 +02:00
buildInputs = [ fuse libarchive ] ;
2017-01-16 22:24:21 +01:00
src = fetchFromGitHub {
inherit rev ;
2017-01-17 19:40:58 +01:00
owner = " l k l " ;
2017-01-16 22:24:21 +01:00
repo = " l i n u x " ;
2018-10-14 22:36:17 +02:00
sha256 = " 1 k 2 p l y x 4 0 x a p h m 8 z s k 2 d d 1 l y v 6 d h s p 7 k j 6 h f m d g i a m v l 8 0 b j a j q y " ;
2017-01-16 22:24:21 +01:00
} ;
2017-01-25 22:30:46 +01:00
# Fix a /usr/bin/env reference in here that breaks sandboxed builds
prePatch = " p a t c h S h e b a n g s a r c h / l k l / s c r i p t s " ;
2017-01-16 22:24:21 +01:00
installPhase = ''
2017-05-24 00:43:22 +02:00
mkdir - p $ out/bin $ lib/lib $ dev
2017-01-16 22:24:21 +01:00
cp tools/lkl/bin/lkl-hijack.sh $ out/bin
2017-05-24 00:43:22 +02:00
sed - i $ out/bin/lkl-hijack.sh \
- e " s , L D _ L I B R A R Y _ P A T H = . * , L D _ L I B R A R Y _ P A T H = $ l i b / l i b , "
2017-01-16 22:24:21 +01:00
2018-03-11 12:42:07 +01:00
cp tools/lkl / { cptofs , fs2tar , lklfuse } $ out/bin
ln - s cptofs $ out/bin/cpfromfs
2017-05-24 00:43:22 +02:00
cp - r tools/lkl/include $ dev /
cp tools/lkl/liblkl * . { a , so } $ lib/lib
2017-01-16 22:24:21 +01:00
'' ;
# We turn off format and fortify because of these errors (fortify implies -O2, which breaks the jitter entropy code):
# fs/xfs/xfs_log_recover.c:2575:3: error: format not a string literal and no format arguments [-Werror=format-security]
# crypto/jitterentropy.c:54:3: error: #error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy.c."
hardeningDisable = [ " f o r m a t " " f o r t i f y " ] ;
makeFlags = " - C t o o l s / l k l " ;
2017-05-20 15:38:01 +02:00
enableParallelBuilding = true ;
2017-01-16 22:24:21 +01:00
meta = with stdenv . lib ; {
2017-05-23 23:55:55 +02:00
description = " T h e L i n u x k e r n e l a s a l i b r a r y " ;
longDescription = ''
LKL ( Linux Kernel Library ) aims to allow reusing the Linux kernel code as
extensively as possible with minimal effort and reduced maintenance
overhead
'' ;
2017-05-21 15:25:55 +02:00
homepage = https://github.com/lkl/linux/ ;
2017-11-21 23:01:13 +01:00
platforms = [ " x 8 6 _ 6 4 - l i n u x " " a a r c h 6 4 - l i n u x " ] ; # Darwin probably works too but I haven't tested it
2017-01-16 22:24:21 +01:00
license = licenses . gpl2 ;
maintainers = with maintainers ; [ copumpkin ] ;
} ;
}