diff --git a/pkgs/applications/science/logic/acgtk/default.nix b/pkgs/applications/science/logic/acgtk/default.nix new file mode 100644 index 000000000000..41c6cf75f325 --- /dev/null +++ b/pkgs/applications/science/logic/acgtk/default.nix @@ -0,0 +1,51 @@ +{ stdenv, fetchurl, ocaml, findlib, dypgen, bolt, ansiterminal, + buildBytecode ? true, + buildNative ? true, + installExamples ? true, + installEmacsMode ? true }: + +let inherit (stdenv.lib) getVersion versionAtLeast + optionals optionalString; in + +assert versionAtLeast (getVersion ocaml) "3.07"; +assert versionAtLeast (getVersion dypgen) "20080925"; +assert versionAtLeast (getVersion bolt) "1.4"; + +assert buildBytecode || buildNative; + +stdenv.mkDerivation { + + name = "acgtk-1.1"; + + src = fetchurl { + url = "http://www.loria.fr/equipes/calligramme/acg/software/acg-1.1-20140905.tar.gz"; + sha256 = "1k1ldqg34bwmgdpmi9gry9czlsk85ycjxnkd25fhlf3mmgg4n9p6"; + }; + + buildInputs = [ ocaml findlib dypgen bolt ansiterminal ]; + + patches = [ ./install-emacs-to-site-lisp.patch + ./use-nix-ocaml-byteflags.patch ]; + + # The bytecode executable is dependent on the dynamic library provided by + # ANSITerminal. We can use the -dllpath flag of ocamlc (analogous to + # -rpath) to make sure that ocamlrun is able to link the library at + # runtime and that Nix detects a runtime dependency. + NIX_OCAML_BYTEFLAGS = "-dllpath ${ansiterminal}/lib/ocaml/${getVersion ocaml}/site-lib/ANSITerminal"; + + buildFlags = optionalString buildBytecode "byte" + + " " + + optionalString buildNative "opt"; + + installTargets = "install" + + " " + optionalString installExamples "install-examples" + + " " + optionalString installEmacsMode "install-emacs"; + + meta = with stdenv.lib; { + homepage = "http://www.loria.fr/equipes/calligramme/acg"; + description = "A toolkit for developing ACG signatures and lexicon"; + license = licenses.cecill20; + platforms = ocaml.meta.platforms; + maintainers = [ maintainers.jirkamarsik ]; + }; +} diff --git a/pkgs/applications/science/logic/acgtk/install-emacs-to-site-lisp.patch b/pkgs/applications/science/logic/acgtk/install-emacs-to-site-lisp.patch new file mode 100644 index 000000000000..43ddd20b4a39 --- /dev/null +++ b/pkgs/applications/science/logic/acgtk/install-emacs-to-site-lisp.patch @@ -0,0 +1,23 @@ +--- acg-1.1-20140905/Makefile.in 2014-10-24 15:21:39.442287208 +0200 ++++ acg-1.1-20140905/Makefile.in.new 2014-10-24 15:24:58.557117228 +0200 +@@ -35,6 +35,7 @@ + ACGC_DIR=src/acg-data + + DATA_DIR=@datarootdir@/acgtk ++EMACS_DIR=@prefix@/share/emacs/site-lisp + + + +@@ -82,10 +83,10 @@ + rm -r $(DATA_DIR) + + install-emacs: +- mkdir -p $(DATA_DIR) && cp -r emacs $(DATA_DIR)/. ++ mkdir -p $(EMACS_DIR) && cp emacs/acg.el $(EMACS_DIR) + + uninstall-emacs: +- rm -rf $(DATA_DIR)/emacs ++ rm -rf $(EMACS_DIR)/emacs + + install-examples: + mkdir -p $(DATA_DIR) && cp -r examples $(DATA_DIR)/. diff --git a/pkgs/applications/science/logic/acgtk/use-nix-ocaml-byteflags.patch b/pkgs/applications/science/logic/acgtk/use-nix-ocaml-byteflags.patch new file mode 100644 index 000000000000..26ade37e4521 --- /dev/null +++ b/pkgs/applications/science/logic/acgtk/use-nix-ocaml-byteflags.patch @@ -0,0 +1,11 @@ +--- acg-1.1-20140905/src/Makefile.master.in 2014-10-27 10:59:42.263382081 +0100 ++++ acg-1.1-20140905/src/Makefile.master.in.new 2014-10-27 10:59:59.683597972 +0100 +@@ -23,7 +23,7 @@ + # All warnings are treated as errors + WARNINGS = @OCAML09WARNINGS@ -warn-error A + COMMONFLAGS= $(WARNINGS) @TYPES@ +-BYTEFLAGS = $(COMMONFLAGS) $(DEBUGFLAG) ++BYTEFLAGS = $(COMMONFLAGS) $(DEBUGFLAG) $(NIX_OCAML_BYTEFLAGS) + OPTFLAGS = $(COMMONFLAGS) + LFLAGS= -a + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 09ac8e44af11..6dfdec050ed6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3444,6 +3444,8 @@ let in rec { inherit ocaml; + acgtk = callPackage ../applications/science/logic/acgtk { }; + ansiterminal = callPackage ../development/ocaml-modules/ansiterminal { }; bolt = callPackage ../development/ocaml-modules/bolt { };