summary refs log tree commit diff
path: root/pkgs/development/compilers/urweb
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2010-08-24 08:25:07 +0000
committerPeter Simons <simons@cryp.to>2010-08-24 08:25:07 +0000
commited19b4faf0313d5f5aa8d04ff05fec0a73b92d50 (patch)
tree413695a43e6c01c86e716342e7c4e5e097816b8a /pkgs/development/compilers/urweb
parentd64e59b56e050c547bea02b3ef5715956e907114 (diff)
downloadnixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar.gz
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar.bz2
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar.lz
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar.xz
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.tar.zst
nixlib-ed19b4faf0313d5f5aa8d04ff05fec0a73b92d50.zip
Add Nix expression for Ur/Web.
svn path=/nixpkgs/trunk/; revision=23381
Diffstat (limited to 'pkgs/development/compilers/urweb')
-rw-r--r--pkgs/development/compilers/urweb/default.nix70
-rw-r--r--pkgs/development/compilers/urweb/remove-header-include-directory-prefix.patch24
2 files changed, 94 insertions, 0 deletions
diff --git a/pkgs/development/compilers/urweb/default.nix b/pkgs/development/compilers/urweb/default.nix
new file mode 100644
index 000000000000..9a922e8e86ff
--- /dev/null
+++ b/pkgs/development/compilers/urweb/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, file, libmhash, mlton, mysql, postgresql, sqlite }:
+
+stdenv.mkDerivation rec {
+  name = "urweb";
+  version = "20100603";
+  pname = "${name}-${version}";
+
+  src = fetchurl {
+    url = "http://www.impredicative.com/ur/${pname}.tgz";
+    sha256 = "1f2l09g3586w0fyd7i7wkfnqlqwrk7c1q9pngmd8jz69g5ysl808";
+  };
+
+  buildInputs = [ stdenv.gcc file libmhash mlton mysql postgresql sqlite ];
+
+  patches = [ ./remove-header-include-directory-prefix.patch ];
+
+  postPatch = ''
+    sed -e 's@/usr/bin/file@${file}/bin/file@g' -i configure
+    sed -e 's@gcc @${stdenv.gcc}/bin/gcc @g' -i src/compiler.sml
+    '';
+
+  preConfigure =
+    ''
+      export GCCARGS="-I${mysql}/include -I${postgresql}/include -I${sqlite}/include -L${libmhash}/lib -L${mysql}/lib -L${postgresql}/lib -L${sqlite}/lib"
+    '';
+
+  meta = {
+    description = "Ur/Web supports construction of dynamic web applications backed by SQL databases.";
+    longDescription = ''
+      Ur is a programming language in the tradition of ML and Haskell, but
+      featuring a significantly richer type system. Ur is functional, pure,
+      statically-typed, and strict. Ur supports a powerful kind of
+      metaprogramming based on row types.
+
+      Ur/Web is Ur plus a special standard library and associated rules for
+      parsing and optimization. Ur/Web supports construction of dynamic web
+      applications backed by SQL databases. The signature of the standard
+      library is such that well-typed Ur/Web programs "don't go wrong" in a
+      very broad sense. Not only do they not crash during particular page
+      generations, but they also may not:
+
+      * Suffer from any kinds of code-injection attacks
+      * Return invalid HTML
+      * Contain dead intra-application links
+      * Have mismatches between HTML forms and the fields expected by their handlers
+      * Include client-side code that makes incorrect assumptions about the "AJAX"-style services that the remote web server provides
+      * Attempt invalid SQL queries
+      * Use improper marshaling or unmarshaling in communication with SQL databases or between browsers and web servers
+
+      This type safety is just the foundation of the Ur/Web methodology. It is
+      also possible to use metaprogramming to build significant application pieces
+      by analysis of type structure. For instance, the demo includes an ML-style
+      functor for building an admin interface for an arbitrary SQL table. The
+      type system guarantees that the admin interface sub-application that comes
+      out will always be free of the above-listed bugs, no matter which well-typed
+      table description is given as input.
+
+      The Ur/Web compiler also produces very efficient object code that does not use
+      garbage collection. These compiled programs will often be even more efficient
+      than what most programmers would bother to write in C. For example, the
+      standalone web server generated for the demo uses less RAM than the bash shell.
+      The compiler also generates JavaScript versions of client-side code, with no need
+      to write those parts of applications in a different language.
+    '';
+
+    homepage = http://www.impredicative.com/ur/;
+    license = "bsd";
+    platforms = [ "i686-linux" "x86_64-linux" ];
+  };
+}
diff --git a/pkgs/development/compilers/urweb/remove-header-include-directory-prefix.patch b/pkgs/development/compilers/urweb/remove-header-include-directory-prefix.patch
new file mode 100644
index 000000000000..a7c7c2da9c58
--- /dev/null
+++ b/pkgs/development/compilers/urweb/remove-header-include-directory-prefix.patch
@@ -0,0 +1,24 @@
+diff -Naur urweb-orig/src/mysql.sml urweb-patched/src/mysql.sml
+--- urweb-orig/src/mysql.sml	2010-08-23 15:36:58.665234434 -0430
++++ urweb-patched/src/mysql.sml	2010-08-23 15:44:10.765238334 -0430
+@@ -1521,7 +1521,7 @@
+ fun p_blank _ = "?"
+
+ val () = addDbms {name = "mysql",
+-                  header = "mysql/mysql.h",
++                  header = "mysql.h",
+                   link = "-lmysqlclient",
+                   init = init,
+                   p_sql_type = p_sql_type,
+diff -Naur urweb-orig/src/postgres.sml urweb-patched/src/postgres.sml
+--- urweb-orig/src/postgres.sml	2010-08-23 15:36:58.666253464 -0430
++++ urweb-patched/src/postgres.sml	2010-08-23 15:43:26.216251221 -0430
+@@ -928,7 +928,7 @@
+ fun p_blank (n, t) = p_cast ("$" ^ Int.toString n, t)
+
+ val () = addDbms {name = "postgres",
+-                  header = "postgresql/libpq-fe.h",
++                  header = "libpq-fe.h",
+                   link = "-lpq",
+                   p_sql_type = p_sql_type,
+                   init = init,