1{stdenv, fetchurl, libedit, ncurses, automake, autoconf, libtool
2,
3 # icu = null: use icu which comes with firebird
4
5 # icu = pkgs.icu => you may have trouble sharing database files with windows
6 # users if "Collation unicode" columns are being used
7 # windows icu version is *30.dll, however neither the icu 3.0 nor the 3.6
8 # sources look close to what ships with this package.
9 # Thus I think its best to trust firebird devs and use their version
10
11 # icu version missmatch may cause such error when selecting from a table:
12 # "Collation unicode for character set utf8 is not installed"
13
14 # icu 3.0 can still be build easily by nix (by dropping the #elif case and
15 # make | make)
16 icu ? null
17
18, superServer ? false
19, port ? 3050
20, serviceName ? "gds_db"
21}:
22
23/*
24 there are 3 ways to use firebird:
25 a) superserver
26 - one process, one thread for each connection
27 b) classic
28 - is built by default
29 - one process for each connection
30 - on linux direct io operations (?)
31 c) embedded.
32
33 manual says that you usually don't notice the difference between a and b.
34
35 I'm only interested in the embedder shared libary for now.
36 So everything isn't tested yet
37
38*/
39
40stdenv.mkDerivation rec {
41 version = "2.5.2.26540-0";
42 name = "firebird-${version}";
43
44 # enableParallelBuilding = false; build fails
45
46 # http://tracker.firebirdsql.org/browse/CORE-3246
47 preConfigure = ''
48 makeFlags="$makeFlags CPU=$NIX_BUILD_CORES"
49 '';
50
51 configureFlags =
52 [ "--with-serivec-port=${builtins.toString port}"
53 "--with-service-name=${serviceName}"
54 # "--disable-static"
55 "--with-system-editline"
56 "--with-fblog=/var/log/firebird"
57 "--with-fbconf=/etc/firebird"
58 "--with-fbsecure-db=/var/db/firebird/system"
59 ]
60 ++ (stdenv.lib.optional (icu != null) "--with-system-icu")
61 ++ (stdenv.lib.optional superServer "--enable-superserver");
62
63 src = fetchurl {
64 url = "mirror://sourceforge/firebird/Firebird-${version}.tar.bz2";
65 sha256 = "0887a813wffp44hnc2gmwbc4ylpqw3fh3hz3bf6q3648344a9fdv";
66 };
67
68 # configurePhase = ''
69 # sed -i 's@cp /usr/share/automake-.*@@' autogen.sh
70 # sh autogen.sh $configureFlags --prefix=$out
71 # '';
72 buildInputs = [libedit icu automake autoconf libtool];
73
74 # TODO: Probably this hase to be tidied up..
75 # make install requires beeing. disabling the root checks
76 # dosen't work. Copying the files manually which can be found
77 # in ubuntu -dev -classic, -example packages:
78 # maybe some of those files can be removed again
79 installPhase = ''cp -r gen/firebird $out'';
80
81 meta = {
82 description = "SQL relational database management system";
83 homepage = http://www.firebirdnews.org;
84 license = ["IDPL" "Interbase-1.0"];
85 maintainers = [stdenv.lib.maintainers.marcweber];
86 platforms = stdenv.lib.platforms.linux;
87 };
88
89}