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