at v192 115 lines 4.2 kB view raw
1{fetchurl, stdenv, unixODBC, glibc, libtool, openssl, zlib, postgresql, mysql, sqlite}: 2# each attr contains the name deriv referencing the derivation and ini which 3# evaluates to a string which can be appended to the global unix odbc ini file 4# to register the driver 5# I haven't done any parameter tweaking.. So the defaults provided here might be bad 6{ 7# new postgres connector library (doesn't work yet) 8 psqlng = rec { 9 deriv = stdenv.mkDerivation { 10 name = "unix-odbc-pg-odbcng-0.90.101"; 11 buildInputs = [ unixODBC glibc libtool postgresql ]; 12 # added -ltdl to resolve missing references `dlsym' `dlerror' `dlopen' `dlclose' 13 preConfigure=" 14 export CPPFLAGS=-I${unixODBC}/include 15 export LDFLAGS='-L${unixODBC}/lib -lltdl' 16 "; 17 src = fetchurl { 18 # using my mirror because original url is https 19 # https://projects.commandprompt.com/public/odbcng/attachment/wiki/Downloads/odbcng-0.90.101.tar.gz"; 20 url = http://mawercer.de/~publicrepos/odbcng-0.90.101.tar.gz; 21 sha256 = "13z3sify4z2jcil379704w0knkpflg6di4jh6zx1x2gdgzydxa1y"; 22 }; 23 meta = { 24 description = "unix odbc driver for postgresql"; 25 homepage = https://projects.commandprompt.com/public/odbcng; 26 license = stdenv.lib.licenses.gpl2; 27 }; 28 }; 29 ini = ""; 30 }; 31# official postgres connector 32 psql = rec { 33 deriv = stdenv.mkDerivation rec { 34 name = "psqlodbc-09.03.0100"; 35 buildInputs = [ unixODBC libtool postgresql openssl ]; 36 preConfigure=" 37 export CPPFLAGS=-I${unixODBC}/include 38 export LDFLAGS='-L${unixODBC}/lib -lltdl' 39 "; 40 # added -ltdl to resolve missing references `dlsym' `dlerror' `dlopen' `dlclose' 41 src = fetchurl { 42 url = "http://ftp.postgresql.org/pub/odbc/versions/src/${name}.tar.gz"; 43 sha256 = "0mh10chkmlppidnmvgbp47v5jnphsrls28zwbvyk2crcn8gdx9q1"; 44 }; 45 meta = { 46 description = "unix odbc driver for postgresql"; 47 homepage = http://pgfoundry.org/projects/psqlodbc/; 48 license = "LGPL"; 49 }; 50 }; 51 ini = 52 "[PostgreSQL]\n" + 53 "Description = official PostgreSQL driver for Linux & Win32\n" + 54 "Driver = ${deriv}/lib/psqlodbcw.so\n" + 55 "Threading = 2\n"; 56 }; 57# mysql connector 58 mysql = rec { 59 libraries = ["lib/libmyodbc3-3.51.12.so"]; 60 deriv = stdenv.mkDerivation { 61 name = "mysql-connector-odbc-3.51.12"; 62 src = fetchurl { 63 url = http://ftp.snt.utwente.nl/pub/software/mysql/Downloads/MyODBC3/mysql-connector-odbc-3.51.12.tar.gz; 64 md5 = "a484f590464fb823a8f821b2f1fd7fef"; 65 }; 66 configureFlags = "--disable-gui" 67 + " --with-mysql-path=${mysql.lib} --with-unixODBC=${unixODBC}"; 68 buildInputs = [ libtool zlib ]; 69 inherit mysql unixODBC; 70 }; 71 ini = 72 "[MYSQL]\n" + 73 "Description = MySQL driver\n" + 74 "Driver = ${deriv}/lib/libmyodbc3-3.51.12.so\n" + 75 "CPTimeout = \n" + 76 "CPReuse = \n" + 77 "FileUsage = 3\n "; 78 }; 79 sqlite = rec { 80 deriv = let version = "0.995"; in 81 stdenv.mkDerivation { 82 name = "sqlite-connector-odbc-${version}"; 83 84 src = fetchurl { 85 url = "http://www.ch-werner.de/sqliteodbc/sqliteodbc-${version}.tar.gz"; 86 sha256 = "1r97fw6xy5w2f8c0ii7blfqfi6salvd3k8wnxpx9wqc1gxk8jnyy"; 87 }; 88 89 buildInputs = [ sqlite ]; 90 91 configureFlags = "--with-sqlite3=${sqlite} --with-odbc=${unixODBC}"; 92 93 # move libraries to $out/lib where they're expected to be 94 postInstall = '' 95 mkdir -p "$out/lib" 96 mv "$out"/*.so "$out/lib" 97 mv "$out"/*.la "$out/lib" 98 ''; 99 100 meta = { 101 description = "ODBC driver for SQLite"; 102 homepage = http://www.ch-werner.de/sqliteodbc; 103 license = stdenv.lib.licenses.bsd2; 104 platforms = stdenv.lib.platforms.linux; 105 maintainers = with stdenv.lib.maintainers; [ vlstill ]; 106 }; 107 }; 108 ini = 109 "[SQLite]\n" + 110 "Description = SQLite ODBC Driver\n" + 111 "Driver = ${deriv}/lib/libsqlite3odbc.so\n" + 112 "Setup = ${deriv}/lib/libsqlite3odbc.so\n" + 113 "Threading = 2\n"; 114 }; 115}