at master 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 makeWrapper, 6 curl, 7 git, 8 ncurses, 9 tzdata, 10 unzip, 11 12 # Version-specific attributes 13 version, 14 src, 15}: 16 17stdenv.mkDerivation (finalAttrs: { 18 pname = "factor-lang"; 19 20 inherit src version; 21 22 patches = [ 23 # Use full path to image while bootstrapping 24 ./staging-command-line-0.99-pre.patch 25 # Point work vocabulary root to a writable location 26 ./workdir-0.99-pre.patch 27 # Patch hard-coded FHS paths 28 ./adjust-paths-in-unit-tests.patch 29 # Avoid using /sbin/ldconfig 30 ./ld.so.cache-from-env.patch 31 ]; 32 33 nativeBuildInputs = [ 34 git 35 makeWrapper 36 curl 37 unzip 38 ]; 39 40 postPatch = '' 41 sed -ie '4i GIT_LABEL = heads/master-'$(< git-id) GNUmakefile 42 # Some other hard-coded paths to fix: 43 substituteInPlace extra/tzinfo/tzinfo.factor \ 44 --replace-fail '/usr/share/zoneinfo' '${tzdata}/share/zoneinfo' 45 46 substituteInPlace extra/terminfo/terminfo.factor \ 47 --replace-fail '/usr/share/terminfo' '${ncurses.out}/share/terminfo' 48 49 # update default paths in fuel-listener.el for fuel mode 50 substituteInPlace misc/fuel/fuel-listener.el \ 51 --replace-fail '(defcustom fuel-factor-root-dir nil' "(defcustom fuel-factor-root-dir \"$out/lib/factor\"" 52 ''; 53 54 dontConfigure = true; 55 56 preBuild = '' 57 patchShebangs ./build.sh 58 # Factor uses XDG_CACHE_HOME for cache during compilation. 59 # We can't have that. So, set it to $TMPDIR/.cache 60 export XDG_CACHE_HOME=$TMPDIR/.cache 61 mkdir -p $XDG_CACHE_HOME 62 ''; 63 64 makeTarget = "linux-x86-64"; 65 66 postBuild = '' 67 printf "First build from upstream boot image\n" >&2 68 ./build.sh bootstrap 69 printf "Rebuild boot image\n" >&2 70 ./factor -script -e='"unix-x86.64" USING: system bootstrap.image memory ; make-image save 0 exit' 71 printf "Second build from local boot image\n" >&2 72 ./build.sh bootstrap 73 ''; 74 75 installPhase = '' 76 runHook preInstall 77 mkdir -p $out/lib/factor $out/share/emacs/site-lisp 78 cp -r factor factor.image libfactor.a libfactor-ffi-test.so \ 79 boot.*.image LICENSE.txt README.md basis core extra misc \ 80 $out/lib/factor 81 82 # install fuel mode for emacs 83 ln -r -s $out/lib/factor/misc/fuel/*.el $out/share/emacs/site-lisp 84 runHook postInstall 85 ''; 86 87 meta = with lib; { 88 homepage = "https://factorcode.org/"; 89 description = "Concatenative, stack-based programming language"; 90 longDescription = '' 91 The Factor programming language is a concatenative, stack-based 92 programming language with high-level features including dynamic types, 93 extensible syntax, macros, and garbage collection. On a practical side, 94 Factor has a full-featured library, supports many different platforms, and 95 has been extensively documented. 96 97 The implementation is fully compiled for performance, while still 98 supporting interactive development. Factor applications are portable 99 between all common platforms. Factor can deploy stand-alone applications 100 on all platforms. Full source code for the Factor project is available 101 under a BSD license. 102 ''; 103 license = licenses.bsd2; 104 maintainers = with maintainers; [ 105 vrthra 106 spacefrogg 107 ]; 108 platforms = [ "x86_64-linux" ]; 109 }; 110})