2017-01-16 21:24:21 +00:00
{ stdenv , fetchFromGitHub , bc , python , fuse , libarchive }:
stdenv . mkDerivation rec {
2017-05-22 23:59:49 +00:00
name = " l k l - 2 0 1 7 - 0 3 - 2 4 " ;
rev = " a 0 6 3 e 1 6 3 1 d b 5 e 2 b 9 b 0 4 f 1 8 4 c 5 e 6 d 1 8 5 c 1 c d 6 4 5 c b " ;
2017-01-16 21:24:21 +00:00
2017-05-22 23:41:22 +00:00
nativeBuildInputs = [ bc python ] ;
buildInputs = [ fuse libarchive ] ;
2017-01-16 21:24:21 +00:00
src = fetchFromGitHub {
inherit rev ;
2017-01-17 18:40:58 +00:00
owner = " l k l " ;
2017-01-16 21:24:21 +00:00
repo = " l i n u x " ;
2017-05-22 23:59:49 +00:00
sha256 = " 0 7 d m i r a 7 6 i 0 k i 5 7 7 s r a 4 f d l 1 w v z f z x z d 7 5 2 5 2 l z a 0 s c 6 j d z r r w v j " ;
2017-01-16 21:24:21 +00:00
} ;
2017-01-25 21:30:46 +00: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 21:24:21 +00:00
installPhase = ''
mkdir - p $ out / { bin , lib }
# This tool assumes a different directory structure so let's point it at the right location
cp tools/lkl/bin/lkl-hijack.sh $ out/bin
substituteInPlace $ out/bin/lkl-hijack.sh - - replace ' /.. / ' ' /../lib '
cp tools/lkl / { cptofs , cpfromfs , fs2tar , lklfuse } $ out/bin
cp - r tools/lkl/include $ out
cp tools/lkl/liblkl * . { a , so } $ out/lib
'' ;
# 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 13:38:01 +00:00
enableParallelBuilding = true ;
2017-01-16 21:24:21 +00:00
meta = with stdenv . lib ; {
description = " L K L ( L i n u x K e r n e l L i b r a r y ) a i m s t o a l l o w r e u s i n g t h e L i n u x k e r n e l c o d e a s e x t e n s i v e l y a s p o s s i b l e w i t h m i n i m a l e f f o r t a n d r e d u c e d m a i n t e n a n c e o v e r h e a d " ;
2017-05-21 13:25:55 +00:00
homepage = https://github.com/lkl/linux/ ;
2017-03-02 01:59:31 +00:00
platforms = [ " x 8 6 _ 6 4 - l i n u x " ] ; # Darwin probably works too but I haven't tested it
2017-01-16 21:24:21 +00:00
license = licenses . gpl2 ;
maintainers = with maintainers ; [ copumpkin ] ;
} ;
}