at master 104 lines 3.0 kB view raw
1{ 2 lib, 3 fetchurl, 4 kaem, 5 tinycc, 6 gnumake, 7 gnupatch, 8 coreutils, 9}: 10let 11 pname = "heirloom-devtools"; 12 version = "070527"; 13 14 src = fetchurl { 15 url = "mirror://sourceforge/heirloom/heirloom-devtools/heirloom-devtools-${version}.tar.bz2"; 16 sha256 = "9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba"; 17 }; 18 19 # Thanks to the live-bootstrap project! 20 # See https://github.com/fosslinux/live-bootstrap/blob/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem 21 liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527"; 22 23 patches = [ 24 # Remove all kinds of wchar support. Mes Libc does not support wchar in any form 25 (fetchurl { 26 url = "${liveBootstrap}/patches/yacc_remove_wchar.patch"; 27 sha256 = "0wgiz02bb7xzjy2gnbjp8y31qy6rc4b29v01zi32zh9lw54j68hc"; 28 }) 29 # Similarly to yacc, remove wchar. See yacc patch for further information 30 (fetchurl { 31 url = "${liveBootstrap}/patches/lex_remove_wchar.patch"; 32 sha256 = "168dfngi51ljjqgd55wbvmffaq61gk48gak50ymnl1br92qkp4zh"; 33 }) 34 ]; 35in 36kaem.runCommand "${pname}-${version}" 37 { 38 inherit pname version; 39 40 nativeBuildInputs = [ 41 tinycc.compiler 42 gnumake 43 gnupatch 44 coreutils 45 ]; 46 47 meta = with lib; { 48 description = "Portable yacc and lex derived from OpenSolaris"; 49 homepage = "https://heirloom.sourceforge.net/devtools.html"; 50 license = with licenses; [ 51 cddl 52 bsdOriginalUC 53 caldera 54 ]; 55 teams = [ teams.minimal-bootstrap ]; 56 platforms = platforms.unix; 57 }; 58 } 59 '' 60 # Unpack 61 unbz2 --file ${src} --output heirloom-devtools.tar 62 untar --file heirloom-devtools.tar 63 rm heirloom-devtools.tar 64 build=''${NIX_BUILD_TOP}/heirloom-devtools-${version} 65 cd ''${build} 66 67 # Patch 68 ${lib.concatLines (map (f: "patch -Np0 -i ${f}") patches)} 69 70 # Build yacc 71 cd yacc 72 make -f Makefile.mk \ 73 CC="tcc -B ${tinycc.libs}/lib" \ 74 AR="tcc -ar" \ 75 CFLAGS="-DMAXPATHLEN=4096 -DEILSEQ=84 -DMB_LEN_MAX=100" \ 76 LDFLAGS="-lgetopt" \ 77 RANLIB=true \ 78 LIBDIR=''${out}/lib 79 80 # Install yacc 81 install -D yacc ''${out}/bin/yacc 82 install -Dm 444 liby.a ''${out}/lib/liby.a 83 install -Dm 444 yaccpar ''${out}/lib/yaccpar 84 85 # Make yacc available to lex 86 PATH="''${out}/bin:''${PATH}" 87 88 # Build lex 89 cd ../lex 90 make -f Makefile.mk \ 91 CC="tcc -B ${tinycc.libs}/lib" \ 92 AR="tcc -ar" \ 93 CFLAGS="-DEILSEQ=84 -DMB_LEN_MAX=100" \ 94 LDFLAGS="-lgetopt" \ 95 RANLIB=true \ 96 LIBDIR=''${out}/lib 97 98 # Install lex 99 install -D lex ''${out}/bin/lex 100 install -Dm 444 ncform ''${out}/lib/lex/ncform 101 install -Dm 444 nceucform ''${out}/lib/lex/nceucform 102 install -Dm 444 nrform ''${out}/lib/lex/nrform 103 install -Dm 444 libl.a ''${out}/lib/libl.a 104 ''