diff options
author | Shea Levy <shea@shealevy.com> | 2015-03-06 19:02:36 +0000 |
---|---|---|
committer | Shea Levy <shea@shealevy.com> | 2015-03-06 19:02:36 +0000 |
commit | 6b53021205cba1074ecddcdd269feb7bad9b34a9 (patch) | |
tree | 25b8550cf629ea35224d9a914095a0d08505a49e /pkgs/build-support | |
parent | 33fbec14b643b47a611e13c4d9bf3858c28568c3 (diff) | |
parent | d1e302121a1cbe4ead2573c8790a15ebec094af4 (diff) | |
download | nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar.gz nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar.bz2 nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar.lz nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar.xz nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.tar.zst nixlib-6b53021205cba1074ecddcdd269feb7bad9b34a9.zip |
Merge branch 'master' into staging
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/emacs/generic.nix | 41 | ||||
-rw-r--r-- | pkgs/build-support/emacs/melpa.nix | 67 | ||||
-rw-r--r-- | pkgs/build-support/emacs/melpa2nix.el (renamed from pkgs/build-support/melpa/melpa2nix.el) | 0 | ||||
-rw-r--r-- | pkgs/build-support/emacs/setup-hook.sh (renamed from pkgs/build-support/melpa/setup-hook.sh) | 0 | ||||
-rw-r--r-- | pkgs/build-support/emacs/trivial.nix | 34 | ||||
-rw-r--r-- | pkgs/build-support/melpa/default.nix | 104 |
6 files changed, 142 insertions, 104 deletions
diff --git a/pkgs/build-support/emacs/generic.nix b/pkgs/build-support/emacs/generic.nix new file mode 100644 index 000000000000..be81e93e32ae --- /dev/null +++ b/pkgs/build-support/emacs/generic.nix @@ -0,0 +1,41 @@ +# generic builder for Emacs packages + +{ lib, stdenv, emacs, texinfo }: + +with lib; + +{ pname +, version ? null + +, buildInputs ? [] +, packageRequires ? [] + +, meta ? {} + +, ... +}@args: + +let + defaultMeta = { + broken = false; + platforms = emacs.meta.platforms; + }; +in + +stdenv.mkDerivation ({ + name = "emacs-${pname}${optionalString (version != null) "-${version}"}"; + + buildInputs = [emacs texinfo] ++ packageRequires ++ buildInputs; + propagatedBuildInputs = packageRequires; + propagatedUserEnvPkgs = packageRequires; + + setupHook = ./setup-hook.sh; + + doCheck = false; + + meta = defaultMeta // meta; +} + +// removeAttrs args [ "buildInputs" "packageRequires" + "meta" + ]) diff --git a/pkgs/build-support/emacs/melpa.nix b/pkgs/build-support/emacs/melpa.nix new file mode 100644 index 000000000000..607a1b4a5ef6 --- /dev/null +++ b/pkgs/build-support/emacs/melpa.nix @@ -0,0 +1,67 @@ +# builder for Emacs packages built for packages.el +# using MELPA package-build.el + +{ lib, stdenv, fetchurl, emacs, texinfo }: + +with lib; + +{ pname +, version + +, files ? null +, fileSpecs ? [ "*.el" "*.el.in" "dir" + "*.info" "*.texi" "*.texinfo" + "doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo" + ] + +, meta ? {} + +, ... +}@args: + +let + + packageBuild = fetchurl { + url = https://raw.githubusercontent.com/milkypostman/melpa/12a862e5c5c62ce627dab83d7cf2cca6e8b56c47/package-build.el; + sha256 = "1nviyyprypz7nmam9rwli4yv3kxh170glfbznryrp4czxkrjjdhk"; + }; + + fname = "${pname}-${version}"; + + targets = concatStringsSep " " (if files == null then fileSpecs else files); + + defaultMeta = { + homepage = "http://melpa.org/#/${pname}"; + }; + +in + +import ./generic.nix { inherit lib stdenv emacs texinfo; } ({ + inherit packageBuild; + + buildPhase = '' + runHook preBuild + + emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ + -f melpa2nix-build-package \ + ${pname} ${version} ${targets} + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ + -f melpa2nix-install-package \ + ${fname}.* $out/share/emacs/site-lisp/elpa + + runHook postInstall + ''; + + meta = defaultMeta // meta; +} + +// removeAttrs args [ "files" "fileSpecs" + "meta" + ]) diff --git a/pkgs/build-support/melpa/melpa2nix.el b/pkgs/build-support/emacs/melpa2nix.el index d54e9d21e25e..d54e9d21e25e 100644 --- a/pkgs/build-support/melpa/melpa2nix.el +++ b/pkgs/build-support/emacs/melpa2nix.el diff --git a/pkgs/build-support/melpa/setup-hook.sh b/pkgs/build-support/emacs/setup-hook.sh index defef45b55f5..defef45b55f5 100644 --- a/pkgs/build-support/melpa/setup-hook.sh +++ b/pkgs/build-support/emacs/setup-hook.sh diff --git a/pkgs/build-support/emacs/trivial.nix b/pkgs/build-support/emacs/trivial.nix new file mode 100644 index 000000000000..9c97e8bf9514 --- /dev/null +++ b/pkgs/build-support/emacs/trivial.nix @@ -0,0 +1,34 @@ +# trivial builder for Emacs packages + +{ lib, ... }@envargs: + +with lib; + +args: + +import ./generic.nix envargs ({ + #preConfigure = '' + # export LISPDIR=$out/share/emacs/site-lisp + # export VERSION_SPECIFIC_LISPDIR=$out/share/emacs/site-lisp + #''; + + buildPhase = '' + eval "$preBuild" + + emacs -L . --batch -f batch-byte-compile *.el + + eval "$postBuild" + ''; + + installPhase = '' + eval "$preInstall" + + LISPDIR=$out/share/emacs/site-lisp + install -d $LISPDIR + install *.el *.elc $LISPDIR + + eval "$postInstall" + ''; +} + +// args) diff --git a/pkgs/build-support/melpa/default.nix b/pkgs/build-support/melpa/default.nix deleted file mode 100644 index 11cb14f93db4..000000000000 --- a/pkgs/build-support/melpa/default.nix +++ /dev/null @@ -1,104 +0,0 @@ -# generic builder for Emacs packages - -{ stdenv, fetchurl, emacs, texinfo -, extension ? (self : super : {}) -}: - -{ pname -, version -, src -, packageRequires ? [] -, extraBuildInputs ? [] - -, files ? null -, fileSpecs ? [ "*.el" "*.el.in" "dir" - "*.info" "*.texi" "*.texinfo" - "doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo" - ] - -, meta ? {} - -, preUnpack ? "", postUnpack ? "" -, patches ? [], patchPhase ? "", prePatch ? "", postPatch ? "" -, configureFlags ? [], preConfigure ? "", postConfigure ? "" -, buildPhase ? "", preBuild ? "", postBuild ? "" -, preInstall ? "", postInstall ? "" -, doCheck ? false, checkPhase ? "", preCheck ? "", postCheck ? "" -, preFixup ? "", postFixup ? "" -}: - -let - inherit (stdenv.lib) concatStringsSep optionalAttrs; - - packageBuild = fetchurl { - url = https://raw.githubusercontent.com/milkypostman/melpa/12a862e5c5c62ce627dab83d7cf2cca6e8b56c47/package-build.el; - sha256 = "1nviyyprypz7nmam9rwli4yv3kxh170glfbznryrp4czxkrjjdhk"; - }; - - fname = "${pname}-${version}"; - - targets = concatStringsSep " " (if files == null then fileSpecs else files); - - defaultMeta = { - broken = false; - homepage = "http://melpa.org/#/${pname}"; - platforms = emacs.meta.platforms; - }; - -in - -stdenv.mkDerivation ({ - name = "emacs-${fname}"; - - inherit src packageBuild; - - buildInputs = [emacs texinfo] ++ packageRequires ++ extraBuildInputs; - propagatedBuildInputs = packageRequires; - propagatedUserEnvPkgs = packageRequires; - - setupHook = ./setup-hook.sh; - - buildPhase = '' - runHook preBuild - - emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ - -f melpa2nix-build-package \ - ${pname} ${version} ${targets} - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - emacs --batch -Q -l $packageBuild -l ${./melpa2nix.el} \ - -f melpa2nix-install-package \ - ${fname}.* $out/share/emacs/site-lisp/elpa - - runHook postInstall - ''; - - meta = defaultMeta // meta; -} - -// optionalAttrs (preUnpack != "") { inherit preUnpack; } -// optionalAttrs (postUnpack != "") { inherit postUnpack; } -// optionalAttrs (configureFlags != []) { inherit configureFlags; } -// optionalAttrs (patches != []) { inherit patches; } -// optionalAttrs (patchPhase != "") { inherit patchPhase; } -// optionalAttrs (prePatch != "") { inherit prePatch; } -// optionalAttrs (postPatch != "") { inherit postPatch; } -// optionalAttrs (preConfigure != "") { inherit preConfigure; } -// optionalAttrs (postConfigure != "") { inherit postConfigure; } -// optionalAttrs (buildPhase != "") { inherit buildPhase; } -// optionalAttrs (preBuild != "") { inherit preBuild; } -// optionalAttrs (postBuild != "") { inherit postBuild; } -// optionalAttrs (doCheck) { inherit doCheck; } -// optionalAttrs (checkPhase != "") { inherit checkPhase; } -// optionalAttrs (preCheck != "") { inherit preCheck; } -// optionalAttrs (postCheck != "") { inherit postCheck; } -// optionalAttrs (preInstall != "") { inherit preInstall; } -// optionalAttrs (postInstall != "") { inherit postInstall; } -// optionalAttrs (preFixup != "") { inherit preFixup; } -// optionalAttrs (postFixup != "") { inherit postFixup; } -) |