2011-01-24 16:27:07 +01:00
|
|
|
{ stdenv, fetchurl, file, openssl, mlton, mysql, postgresql, sqlite }:
|
2010-08-24 10:25:07 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2010-10-26 02:22:44 +02:00
|
|
|
pname = "urweb";
|
2012-08-25 16:02:27 +02:00
|
|
|
version = "20120807";
|
2010-10-26 02:22:44 +02:00
|
|
|
name = "${pname}-${version}";
|
2010-08-24 10:25:07 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
2010-10-26 02:22:44 +02:00
|
|
|
url = "http://www.impredicative.com/ur/${name}.tgz";
|
2012-08-25 16:02:27 +02:00
|
|
|
sha256 = "15g1cz108dkzlp433cg56x76f20y6zcs9sbgxgdniyfakmn4ld6l";
|
2010-08-24 10:25:07 +02:00
|
|
|
};
|
|
|
|
|
2011-01-24 16:27:07 +01:00
|
|
|
buildInputs = [ stdenv.gcc file openssl mlton mysql postgresql sqlite ];
|
2010-08-24 10:25:07 +02:00
|
|
|
|
2011-07-15 20:54:43 +02:00
|
|
|
prePatch = ''
|
2010-08-24 10:25:07 +02:00
|
|
|
sed -e 's@/usr/bin/file@${file}/bin/file@g' -i configure
|
|
|
|
'';
|
|
|
|
|
|
|
|
preConfigure =
|
|
|
|
''
|
2011-11-28 16:12:02 +01:00
|
|
|
export CC="${stdenv.gcc}/bin/gcc";
|
2011-09-23 04:46:05 +02:00
|
|
|
export CCARGS="-I$out/include \
|
2011-07-15 20:54:43 +02:00
|
|
|
-L${mysql}/lib/mysql -L${postgresql}/lib -L${sqlite}/lib";
|
|
|
|
|
|
|
|
export PGHEADER="${postgresql}/include/libpq-fe.h";
|
|
|
|
export MSHEADER="${mysql}/include/mysql/mysql.h";
|
|
|
|
export SQHEADER="${sqlite}/include/sqlite3.h";
|
2010-08-24 10:25:07 +02:00
|
|
|
'';
|
|
|
|
|
2011-01-24 16:27:07 +01:00
|
|
|
configureFlags = "--with-openssl=${openssl}";
|
|
|
|
|
2010-11-15 18:47:36 +01:00
|
|
|
dontDisableStatic = true;
|
|
|
|
|
2010-08-24 10:25:07 +02:00
|
|
|
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/;
|
2012-08-25 16:08:01 +02:00
|
|
|
license = stdenv.lib.licenses.bsd3;
|
2010-08-24 10:25:07 +02:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
|
|
|
};
|
|
|
|
}
|