From adc8828c9638fd744f5b69e097aa686475534acc Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Thu, 26 Jan 2012 14:20:06 +0000 Subject: [PATCH] development/tools/parsing/ebnf2ps: added initial version 1.0.8 svn path=/nixpkgs/trunk/; revision=31855 --- .../tools/parsing/ebnf2ps/default.nix | 35 +++ .../tools/parsing/ebnf2ps/modernize.patch | 256 ++++++++++++++++++ pkgs/top-level/haskell-packages.nix | 4 + 3 files changed, 295 insertions(+) create mode 100644 pkgs/development/tools/parsing/ebnf2ps/default.nix create mode 100644 pkgs/development/tools/parsing/ebnf2ps/modernize.patch diff --git a/pkgs/development/tools/parsing/ebnf2ps/default.nix b/pkgs/development/tools/parsing/ebnf2ps/default.nix new file mode 100644 index 00000000000..5abb52566fe --- /dev/null +++ b/pkgs/development/tools/parsing/ebnf2ps/default.nix @@ -0,0 +1,35 @@ +{ cabal, fetchurl, happy }: + +let + pname = "ebnf2ps"; + version = "1.0.8"; +in +cabal.mkDerivation (self: { + inherit pname version; + + src = fetchurl { + url = "http://www.informatik.uni-freiburg.de/~thiemann/haskell/ebnf2ps/${pname}-${version}.tar.gz"; + sha256 = "1yfgq4nf79g1nyfb0yxqi887kxc04dvwpm1fwrk50bs4xj1vg3wf"; + }; + + buildTools = [ happy ]; + + patches = [ ./modernize.patch ]; + + meta = { + homepage = "http://www.informatik.uni-freiburg.de/~thiemann/haskell/ebnf2ps/"; + description = "Syntax Diagram Drawing Tool"; + license = "BSD"; + + longDescription = '' + Ebnf2ps generates nice looking syntax diagrams in EPS and FIG + format from EBNF specifications and from yacc, bison, and Happy + input grammars. The diagrams can be immediatedly included in + TeX/LaTeX documents and in texts created with other popular + document preparation systems. + ''; + + platforms = self.stdenv.lib.platforms.linux; + maintainers = [ self.stdenv.lib.maintainers.simons ]; + }; +}) diff --git a/pkgs/development/tools/parsing/ebnf2ps/modernize.patch b/pkgs/development/tools/parsing/ebnf2ps/modernize.patch new file mode 100644 index 00000000000..edb5e366d48 --- /dev/null +++ b/pkgs/development/tools/parsing/ebnf2ps/modernize.patch @@ -0,0 +1,256 @@ +diff --git a/Ebnf2ps.cabal b/Ebnf2ps.cabal +index 483d34a..0a7b96e 100644 +--- a/Ebnf2ps.cabal ++++ b/Ebnf2ps.cabal +@@ -1,66 +1,30 @@ +--- Ebnf2ps.cabal auto-generated by cabal init. For additional options, +--- see +--- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr. +--- The name of the package. + Name: Ebnf2ps +- +--- The package version. See the Haskell package versioning policy +--- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for +--- standards guiding when and how versions should be incremented. + Version: 1.0.8 +- +--- A short (one-line) description of the package. +-Synopsis: Ebnf2ps: Peter's Syntax Diagram Drawing Tool +- +--- A longer description of the package. +--- Description: +- +--- URL for the project homepage or repository. ++Synopsis: Peter's Syntax Diagram Drawing Tool + Homepage: http://www.informatik.uni-freiburg.de/~thiemann/haskell/ebnf2ps/ +- +--- The license under which the package is released. + License: BSD4 +- +--- The file containing the license text. + -- License-file: LICENSE +- +--- The package author(s). +-Author: Peter Thiemann +- +--- An email address to which users can send suggestions, bug reports, +--- and patches. +-Maintainer: thiemann@acm.org +- +--- A copyright notice. +--- Copyright: +- ++Author: Peter Thiemann ++Maintainer: Peter Thiemann + Category: Language +- + Build-type: Simple +- +--- Extra files to be distributed with the package, such as examples or +--- a README. +--- Extra-source-files: +- +--- Constraint on the version of Cabal needed to build this package. + Cabal-version: >=1.2 +- ++Tested-With: GHC == 6.10.4, GHC == 6.12.3, GHC == 7.0.4, GHC == 7.2.2 ++Description: Ebnf2ps generates nice looking syntax diagrams in EPS ++ and FIG format from EBNF specifications and from yacc, ++ bison, and Happy input grammars. The diagrams can be ++ immediatedly included in TeX/LaTeX documents and in ++ texts created with other popular document preparation ++ systems. + + Executable Ebnf2ps +- -- .hs or .lhs file containing the Main module. + Main-is: Ebnf2ps.hs + Hs-source-dirs: src +- +- -- Packages needed in order to build this package. +- Build-depends: base < 4.3 +- , containers < 0.4 +- , haskell98 +- , unix < 2.5 +- +- -- Modules not exported by this package. +- -- Other-modules: +- +- -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source. ++ Build-depends: base >= 2 && < 5, ++ containers, ++ old-time, ++ directory, ++ unix + Build-tools: happy + Cc-options: -DAFMPATH=/usr/share/texmf-texlive/fonts/afm + +diff --git a/src/Color.hs b/src/Color.hs +index 184e5e6..8786dac 100644 +--- a/src/Color.hs ++++ b/src/Color.hs +@@ -23,7 +23,7 @@ + module Color where + -- (Color (..), lookupColor, showsColor, showsAColor, prepareColors) + +-import Char ++import Data.Char + import Numeric + + type Color = (Int, Int, Int) +diff --git a/src/CommandLine.hs b/src/CommandLine.hs +index 50d6546..518b107 100644 +--- a/src/CommandLine.hs ++++ b/src/CommandLine.hs +@@ -1,6 +1,6 @@ + module CommandLine (parse_cmds) where +-import System +- ++import System.IO ++import System.Environment + + defaultArgs :: Args + defaultArgs = MkArgs "Times-Roman" 10 "black" "Times-Roman" 10 "black" "white" "black" "Times-Roman" 10 "black" "white" "black" "black" 500 500 30 100 200 "rgb.txt" False False False False True False False False False +diff --git a/src/Ebnf2ps.hs b/src/Ebnf2ps.hs +index 9dc2e4d..6f340cf 100644 +--- a/src/Ebnf2ps.hs ++++ b/src/Ebnf2ps.hs +@@ -25,11 +25,10 @@ import Defaults (afmPathDefault, ebnfInputDefault, rgbPathDefault) + import PathExpansion (expandPath) + import Color + import Info +-import IO +-import Monad ++import System.Time ++import System.Environment ++import Control.Monad + import Numeric +-import System +-import Time + + -------------------------------------------------------------------------------- + main :: IO () +diff --git a/src/Ebnf2psParser.hs b/src/Ebnf2psParser.hs +index 4cc7052..0fb4557 100644 +--- a/src/Ebnf2psParser.hs ++++ b/src/Ebnf2psParser.hs +@@ -4,7 +4,7 @@ + module Ebnf2psParser (theEbnfParser, theHappyParser, theYaccParser) where + import AbstractSyntax + import Lexer +-import List ++import Data.List + + data HappyAbsSyn + = HappyTerminal Token' +diff --git a/src/EbnfLayout.hs b/src/EbnfLayout.hs +index cd0b4d9..aecc0b4 100644 +--- a/src/EbnfLayout.hs ++++ b/src/EbnfLayout.hs +@@ -25,7 +25,7 @@ import AbstractSyntax + import Color + import Fonts (FONT, stringWidth, stringHeight, fontDescender) + import Info +-import List ++import Data.List + + -- all arithmetic is done in 1/100 pt + +diff --git a/src/Fonts.hs b/src/Fonts.hs +index c1639de..ed36a79 100644 +--- a/src/Fonts.hs ++++ b/src/Fonts.hs +@@ -17,7 +17,7 @@ + module Fonts (FONT, makeFont, fontDescender, stringWidth, stringHeight, fontName, fontScale, noFont) + where + +-import Char ++import Data.Char + import Numeric + + data FONT = FONT String Int Int (String -> Int) +diff --git a/src/GrammarTransform.hs b/src/GrammarTransform.hs +index 99c3840..65624ab 100644 +--- a/src/GrammarTransform.hs ++++ b/src/GrammarTransform.hs +@@ -13,7 +13,7 @@ module GrammarTransform + where + + import AbstractSyntax +-import List ++import Data.List + + + data RInfo +diff --git a/src/GrammarUnfold.hs b/src/GrammarUnfold.hs +index 056119a..d35a630 100644 +--- a/src/GrammarUnfold.hs ++++ b/src/GrammarUnfold.hs +@@ -17,7 +17,7 @@ module GrammarUnfold ( + import AbstractSyntax + import GrammarTransform + import StringMatch (stringMatch) +-import List ++import Data.List + + import qualified Data.Map (Map, keys, elems, findWithDefault, fromList) + +diff --git a/src/IOSupplement.hs b/src/IOSupplement.hs +index 3251365..ba666b1 100644 +--- a/src/IOSupplement.hs ++++ b/src/IOSupplement.hs +@@ -29,8 +29,9 @@ + module IOSupplement (getPath, readPathFile, readRGBPathFile) + where + +-import System +-import IO ++import System.IO ++import System.IO.Error ++import System.Environment + + #ifdef __HBC__ + ioError = fail +diff --git a/src/Lexer.hs b/src/Lexer.hs +index 52f2549..8bf9f82 100644 +--- a/src/Lexer.hs ++++ b/src/Lexer.hs +@@ -3,7 +3,7 @@ module Lexer where + -- Last Modified By: M. Walter + -- + +-import Char ++import Data.Char + + ------------------------------------------------------------------------------ + --NOW the lexer +diff --git a/src/PathExpansion.hs b/src/PathExpansion.hs +index 48e27d6..01807e5 100644 +--- a/src/PathExpansion.hs ++++ b/src/PathExpansion.hs +@@ -3,10 +3,11 @@ module PathExpansion (expandPath) + where + + #ifdef __GLASGOW_HASKELL__ +-import System +-import Directory +-import Monad +-import IO ++import System.Directory ++import System.Environment ++import Control.Monad ++import System.IO ++import System.IO.Error + import System.Posix.User (getUserEntryForName, homeDirectory) + #endif + +@@ -99,8 +100,8 @@ replaceEnv (x:xs) = do t <- replaceEnv xs + return (x:t) + + getEnv2 t +- |t == "HOME" = catch (getEnv t) (\e -> if IO.isDoesNotExistError e then return ['.'] else ioError e) +- |otherwise = catch (getEnv t) (\e -> if IO.isDoesNotExistError e then return [] else ioError e) ++ |t == "HOME" = catch (getEnv t) (\e -> if isDoesNotExistError e then return ['.'] else ioError e) ++ |otherwise = catch (getEnv t) (\e -> if isDoesNotExistError e then return [] else ioError e) + ------------------------------------------------------- + + ---------------- Teilen nach Doppelpunkt -------------- diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 1e29fc0fffa..04bc3fdae11 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1521,6 +1521,10 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y); cpphs = callPackage ../development/tools/misc/cpphs {}; + ebnf2ps = callPackage ../development/tools/parsing/ebnf2ps { + inherit (pkgs) fetchurl; + }; + frown = callPackage ../development/tools/parsing/frown {}; haddock_2_4_2 = callPackage ../development/tools/documentation/haddock/2.4.2.nix {};