2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, libdbi
|
2022-12-02 08:20:57 +00:00
|
|
|
# TODO: migrate away from overriding packages to null
|
2020-04-24 23:36:52 +00:00
|
|
|
, libmysqlclient ? null
|
|
|
|
, sqlite ? null
|
|
|
|
, postgresql ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2022-01-13 20:06:32 +00:00
|
|
|
pname = "libdbi-drivers";
|
|
|
|
version = "0.9.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2022-01-13 20:06:32 +00:00
|
|
|
url = "mirror://sourceforge/libdbi-drivers/libdbi-drivers-${version}.tar.gz";
|
2020-04-24 23:36:52 +00:00
|
|
|
sha256 = "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3";
|
|
|
|
};
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
buildInputs = [ libdbi sqlite postgresql ] ++ lib.optional (libmysqlclient != null) libmysqlclient;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
patches = [
|
|
|
|
# https://sourceforge.net/p/libdbi-drivers/libdbi-drivers/ci/24f48b86c8988ee3aaebc5f303d71e9d789f77b6
|
|
|
|
./libdbi-drivers-0.9.0-buffer_overflow.patch
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i '/SQLITE3_LIBS/ s/-lsqlite/-lsqlite3/' configure;
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--sysconfdir=/etc"
|
|
|
|
"--localstatedir=/var"
|
|
|
|
"--disable-docs"
|
|
|
|
"--enable-libdbi"
|
|
|
|
"--with-dbi-incdir=${libdbi}/include"
|
|
|
|
"--with-dbi-libdir=${libdbi}/lib"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals (libmysqlclient != null) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-mysql"
|
2022-12-02 08:20:57 +00:00
|
|
|
"--with-mysql-incdir=${lib.getDev libmysqlclient}/include/mysql"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-mysql-libdir=${libmysqlclient}/lib/mysql"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals (sqlite != null) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-sqlite3"
|
|
|
|
"--with-sqlite3-incdir=${sqlite.dev}/include/sqlite"
|
|
|
|
"--with-sqlite3-libdir=${sqlite.out}/lib/sqlite"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals (postgresql != null) [
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-pgsql"
|
|
|
|
];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = toString (lib.optionals stdenv.cc.isClang [
|
|
|
|
"-Wno-error=incompatible-function-pointer-types"
|
|
|
|
"-Wno-error=int-conversion"
|
|
|
|
]);
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installFlags = [ "DESTDIR=\${out}" ];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mv $out/$out/* $out
|
|
|
|
DIR=$out/$out
|
|
|
|
while rmdir $DIR 2>/dev/null; do
|
|
|
|
DIR="$(dirname "$DIR")"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Remove the unneeded var/lib directories
|
|
|
|
rm -rf $out/var
|
|
|
|
'';
|
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
meta = with lib; {
|
2023-02-02 18:25:31 +00:00
|
|
|
homepage = "https://libdbi-drivers.sourceforge.net/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Database drivers for libdbi";
|
|
|
|
platforms = platforms.all;
|
|
|
|
license = licenses.lgpl21;
|
2024-07-31 10:19:44 +00:00
|
|
|
maintainers = [ ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|