diff --git a/pkgs/development/compilers/ats2/default.nix b/pkgs/development/compilers/ats2/default.nix index 51b3cf11823f..0a86f82d972b 100644 --- a/pkgs/development/compilers/ats2/default.nix +++ b/pkgs/development/compilers/ats2/default.nix @@ -1,17 +1,49 @@ -{ stdenv, fetchurl, gmp }: +{ stdenv, fetchurl, gmp +, withEmacsSupport ? true +, withContrib ? true }: + +let + versionPkg = "0.2.11" ; + + contrib = fetchurl { + url = "mirror://sourceforge/ats2-lang/ATS2-Postiats-contrib-${versionPkg}.tgz" ; + sha256 = "0kc4nx1904745c1rkj9yfbayidw7rks1mwq0lxmvsgghn98dxwjn" ; + }; +in stdenv.mkDerivation rec { name = "ats2-${version}"; - version = "0.2.7"; + version = versionPkg; - src = fetchurl { + src = fetchurl { url = "mirror://sourceforge/ats2-lang/ATS2-Postiats-${version}.tgz"; - sha256 = "1w9cncahv0vkqsj4vlfnn7bn61jvgxgjhk7wbppcm3yhb48pkmda"; + sha256 = "140xy129fr11bdf4bj6qya9mf0fhnv2x7ksb9j46pf2yzrsrks8g"; }; buildInputs = [ gmp ]; - setupHook = ./setup-hook.sh; + setupHook = let + hookFiles = [ ./setup-hook.sh ] ++ stdenv.lib.optionals withContrib [ ./setup-contrib-hook.sh ] ; + in + builtins.toFile "setupHook.sh" (stdenv.lib.concatMapStringsSep "\n" builtins.readFile hookFiles) ; + + patches = [ ./installed-lib-directory-version.patch ]; + + postInstallContrib = stdenv.lib.optionalString withContrib + '' + local contribDir=$out/lib/ats2-postiats-*/ ; + mkdir -p $contribDir ; + tar -xzf "${contrib}" --strip-components 1 -C $contribDir ; + ''; + + postInstallEmacs = stdenv.lib.optionalString withEmacsSupport + '' + local siteLispDir=$out/share/emacs/site-lisp/ats2 ; + mkdir -p $siteLispDir ; + install -m 0644 -v ./utils/emacs/*.el $siteLispDir ; + ''; + + postInstall = postInstallContrib + postInstallEmacs; meta = with stdenv.lib; { description = "Functional programming language with dependent types"; diff --git a/pkgs/development/compilers/ats2/installed-lib-directory-version.patch b/pkgs/development/compilers/ats2/installed-lib-directory-version.patch new file mode 100644 index 000000000000..d9e5ad2d21e7 --- /dev/null +++ b/pkgs/development/compilers/ats2/installed-lib-directory-version.patch @@ -0,0 +1,99 @@ +Change the name of the library directory to match the version of the package. + +diff -Naur ATS2-Postiats-0.2.11/configure postiats-new/configure +--- ATS2-Postiats-0.2.11/configure 2016-10-13 12:03:20.000000000 -0400 ++++ postiats-new/configure 2016-10-23 20:17:29.912579618 -0400 +@@ -1,6 +1,6 @@ + #! /bin/sh + # Guess values for system-dependent variables and create Makefiles. +-# Generated by GNU Autoconf 2.69 for ATS2/Postiats 0.2.10. ++# Generated by GNU Autoconf 2.69 for ATS2/Postiats 0.2.11. + # + # Report bugs to . + # +@@ -580,8 +580,8 @@ + # Identity of this package. + PACKAGE_NAME='ATS2/Postiats' + PACKAGE_TARNAME='ats2-postiats' +-PACKAGE_VERSION='0.2.10' +-PACKAGE_STRING='ATS2/Postiats 0.2.10' ++PACKAGE_VERSION='0.2.11' ++PACKAGE_STRING='ATS2/Postiats 0.2.11' + PACKAGE_BUGREPORT='gmpostiats@gmail.com' + PACKAGE_URL='' + +@@ -1242,7 +1242,7 @@ + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +-\`configure' configures ATS2/Postiats 0.2.10 to adapt to many kinds of systems. ++\`configure' configures ATS2/Postiats 0.2.11 to adapt to many kinds of systems. + + Usage: $0 [OPTION]... [VAR=VALUE]... + +@@ -1304,7 +1304,7 @@ + + if test -n "$ac_init_help"; then + case $ac_init_help in +- short | recursive ) echo "Configuration of ATS2/Postiats 0.2.10:";; ++ short | recursive ) echo "Configuration of ATS2/Postiats 0.2.11:";; + esac + cat <<\_ACEOF + +@@ -1384,7 +1384,7 @@ + test -n "$ac_init_help" && exit $ac_status + if $ac_init_version; then + cat <<\_ACEOF +-ATS2/Postiats configure 0.2.10 ++ATS2/Postiats configure 0.2.11 + generated by GNU Autoconf 2.69 + + Copyright (C) 2012 Free Software Foundation, Inc. +@@ -1936,7 +1936,7 @@ + This file contains any messages produced by compilers while + running configure, to aid debugging if configure makes a mistake. + +-It was created by ATS2/Postiats $as_me 0.2.10, which was ++It was created by ATS2/Postiats $as_me 0.2.11, which was + generated by GNU Autoconf 2.69. Invocation command line was + + $ $0 $@ +@@ -4226,7 +4226,7 @@ + # report actual input values of CONFIG_FILES etc. instead of their + # values after options handling. + ac_log=" +-This file was extended by ATS2/Postiats $as_me 0.2.10, which was ++This file was extended by ATS2/Postiats $as_me 0.2.11, which was + generated by GNU Autoconf 2.69. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES +@@ -4288,7 +4288,7 @@ + cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" + ac_cs_version="\\ +-ATS2/Postiats config.status 0.2.10 ++ATS2/Postiats config.status 0.2.11 + configured by $0, generated by GNU Autoconf 2.69, + with options \\"\$ac_cs_config\\" + +diff -Naur ATS2-Postiats-0.2.11/src/CBOOT/config.h postiats-new/src/CBOOT/config.h +--- ATS2-Postiats-0.2.11/src/CBOOT/config.h 2016-10-13 12:03:20.000000000 -0400 ++++ postiats-new/src/CBOOT/config.h 2016-10-23 20:16:34.613836556 -0400 +@@ -44,7 +44,7 @@ + #define PACKAGE_NAME "ATS2/Postiats" + + /* Define to the full name and version of this package. */ +-#define PACKAGE_STRING "ATS2/Postiats 0.2.10" ++#define PACKAGE_STRING "ATS2/Postiats 0.2.11" + + /* Define to the one symbol short name of this package. */ + #define PACKAGE_TARNAME "ats2-postiats" +@@ -53,7 +53,7 @@ + #define PACKAGE_URL "" + + /* Define to the version of this package. */ +-#define PACKAGE_VERSION "0.2.10" ++#define PACKAGE_VERSION "0.2.11" + + /* The size of `void*', as computed by sizeof. */ + #define SIZEOF_VOIDP 8 diff --git a/pkgs/development/compilers/ats2/setup-contrib-hook.sh b/pkgs/development/compilers/ats2/setup-contrib-hook.sh new file mode 100644 index 000000000000..8c5e123b61c4 --- /dev/null +++ b/pkgs/development/compilers/ats2/setup-contrib-hook.sh @@ -0,0 +1 @@ +export PATSHOMERELOC=@out@/lib/ats2-postiats-@version@