haskell-ghc-mod-5.0.1: use wrapProgram
Use wrapProgram from makeWrapper to wrap ghc-mod and ghc-modi like haddock. The wrapper code is clearer and hopefully more maintainable. As a side-effect, the bug where emacs would hang while loading ghc-modi is fixed.
This commit is contained in:
parent
030439d8fe
commit
2af1a92a28
@ -3,7 +3,7 @@
|
|||||||
{ cabal, Cabal, convertible, deepseq, djinnGhc, doctest, emacs
|
{ cabal, Cabal, convertible, deepseq, djinnGhc, doctest, emacs
|
||||||
, filepath, ghcPaths, ghcSybUtils, haskellSrcExts, hlint, hspec
|
, filepath, ghcPaths, ghcSybUtils, haskellSrcExts, hlint, hspec
|
||||||
, ioChoice, monadControl, monadJournal, mtl, split, syb, text, time
|
, ioChoice, monadControl, monadJournal, mtl, split, syb, text, time
|
||||||
, transformers, transformersBase
|
, transformers, transformersBase, makeWrapper
|
||||||
}:
|
}:
|
||||||
|
|
||||||
cabal.mkDerivation (self: {
|
cabal.mkDerivation (self: {
|
||||||
@ -22,9 +22,11 @@ cabal.mkDerivation (self: {
|
|||||||
ghcSybUtils haskellSrcExts hlint hspec ioChoice monadControl
|
ghcSybUtils haskellSrcExts hlint hspec ioChoice monadControl
|
||||||
monadJournal mtl split syb text time transformers transformersBase
|
monadJournal mtl split syb text time transformers transformersBase
|
||||||
];
|
];
|
||||||
buildTools = [ emacs ];
|
buildTools = [ emacs makeWrapper ];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
configureFlags = "--datasubdir=${self.pname}-${self.version}";
|
configureFlags = "--datasubdir=${self.pname}-${self.version}";
|
||||||
|
# The method used below to wrap ghc-mod and ghc-modi was borrowed from the
|
||||||
|
# wrapper for haddock.
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
cd $out/share/$pname-$version
|
cd $out/share/$pname-$version
|
||||||
make
|
make
|
||||||
@ -32,20 +34,11 @@ cabal.mkDerivation (self: {
|
|||||||
cd ..
|
cd ..
|
||||||
ensureDir "$out/share/emacs"
|
ensureDir "$out/share/emacs"
|
||||||
mv $pname-$version emacs/site-lisp
|
mv $pname-$version emacs/site-lisp
|
||||||
mv $out/bin/ghc-mod $out/bin/.ghc-mod-wrapped
|
|
||||||
cat - > $out/bin/ghc-mod <<EOF
|
|
||||||
#! ${self.stdenv.shell}
|
|
||||||
eval exec $out/bin/.ghc-mod-wrapped \$( ${self.ghc.GHCGetPackages} ${self.ghc.version} | tr " " "\n" | tail -n +2 | paste -d " " - - | sed 's/.*/-g "&"/' | tr "\n" " ") "\$@"
|
|
||||||
EOF
|
|
||||||
|
|
||||||
mv $out/bin/ghc-modi $out/bin/.ghc-modi-wrapped
|
wrapProgram $out/bin/ghc-mod --add-flags \
|
||||||
cat - > $out/bin/ghc-modi <<EOF
|
"\$(${self.ghc.GHCGetPackages} ${self.ghc.version} \"\$(dirname \$0)\" \"-g -package-db -g\")"
|
||||||
#! ${self.stdenv.shell}
|
wrapProgram $out/bin/ghc-modi --add-flags \
|
||||||
eval exec $out/bin/.ghc-modi-wrapped \$( ${self.ghc.GHCGetPackages} ${self.ghc.version} | tr " " "\n" | tail -n +2 | paste -d " " - - | sed 's/.*/-g "&"/' | tr "\n" " ") "\$@"
|
"\$(${self.ghc.GHCGetPackages} ${self.ghc.version} \"\$(dirname \$0)\" \"-g -package-db -g\")"
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod +x $out/bin/ghc-mod
|
|
||||||
chmod +x $out/bin/ghc-modi
|
|
||||||
'';
|
'';
|
||||||
meta = {
|
meta = {
|
||||||
homepage = "http://www.mew.org/~kazu/proj/ghc-mod/";
|
homepage = "http://www.mew.org/~kazu/proj/ghc-mod/";
|
||||||
|
Loading…
Reference in New Issue
Block a user