linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / libdbi-drivers / default.nix
blob6a86d4941bff3f79c79d727146503bd29b7eff3b
1 { lib, stdenv, fetchurl, libdbi
2 , libmysqlclient ? null
3 , sqlite ? null
4 , postgresql ? null
5 }:
7 with lib;
8 stdenv.mkDerivation rec {
9   name = "libdbi-drivers-0.9.0";
11   src = fetchurl {
12     url = "mirror://sourceforge/libdbi-drivers/${name}.tar.gz";
13     sha256 = "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3";
14   };
16   buildInputs = [ libdbi sqlite postgresql ] ++ optional (libmysqlclient != null) libmysqlclient;
18   postPatch = ''
19     sed -i '/SQLITE3_LIBS/ s/-lsqlite/-lsqlite3/' configure;
20   '';
22   configureFlags = [
23     "--sysconfdir=/etc"
24     "--localstatedir=/var"
25     "--disable-docs"
26     "--enable-libdbi"
27     "--with-dbi-incdir=${libdbi}/include"
28     "--with-dbi-libdir=${libdbi}/lib"
29   ] ++ optionals (libmysqlclient != null) [
30     "--with-mysql"
31     "--with-mysql-incdir=${getDev libmysqlclient}/include/mysql"
32     "--with-mysql-libdir=${libmysqlclient}/lib/mysql"
33   ] ++ optionals (sqlite != null) [
34     "--with-sqlite3"
35     "--with-sqlite3-incdir=${sqlite.dev}/include/sqlite"
36     "--with-sqlite3-libdir=${sqlite.out}/lib/sqlite"
37   ] ++ optionals (postgresql != null) [
38     "--with-pgsql"
39     "--with-pgsql_incdir=${postgresql}/include"
40     "--with-pgsql_libdir=${postgresql.lib}/lib"
41   ];
43   installFlags = [ "DESTDIR=\${out}" ];
45   postInstall = ''
46     mv $out/$out/* $out
47     DIR=$out/$out
48     while rmdir $DIR 2>/dev/null; do
49       DIR="$(dirname "$DIR")"
50     done
52     # Remove the unneeded var/lib directories
53     rm -rf $out/var
54   '';
56   meta = {
57     homepage = "http://libdbi-drivers.sourceforge.net/";
58     description = "Database drivers for libdbi";
59     platforms = platforms.all;
60     license = licenses.lgpl21;
61   };