Parcourir la source

libzdb: import version 3.0

Signed-off-by: Gergely Kiss <mail.gery@gmail.com>
Tested-by: Gergely Kiss <mail.gery@gmail.com>
Gergely Kiss il y a 10 ans
Parent
révision
42b3bce850

+ 90
- 0
libs/libzdb/Makefile Voir le fichier

@@ -0,0 +1,90 @@
1
+#
2
+# Copyright (C) 2007-2014 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=libzdb
11
+PKG_VERSION:=3.0
12
+PKG_RELEASE:=1
13
+PKG_LICENSE:=GPL-3.0
14
+
15
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17
+PKG_SOURCE_URL:=http://www.tildeslash.com/libzdb/dist/
18
+PKG_MD5SUM:=3bb9efff10a1f3ebc5b76c1055c48635
19
+PKG_CAT:=zcat
20
+PKG_FIXUP:=autoreconf
21
+PKG_INSTALL:=1
22
+
23
+PKG_BUILD_DEPENDS:=libzdb/host
24
+
25
+include $(INCLUDE_DIR)/package.mk
26
+
27
+define Package/libzdb
28
+    SECTION:=libs
29
+    CATEGORY:=Libraries
30
+    TITLE:=A thread-safe multi database connection pool library
31
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
32
+    URL:=http://www.tildeslash.com/libzdb/
33
+    DEPENDS:=+libsqlite3 +libpq +libmysqlclient +zlib +libpthread +libopenssl
34
+endef
35
+
36
+define Package/libzdb/description
37
+   zdb is a database library with thread-safe connection pooling. The library can connect
38
+   transparently to multiple database systems. It has zero runtime configuration and connections
39
+   are specified via a URL scheme. A modern object-oriented API is provided.
40
+   zdb supports MySQL, PostgreSQL, SQLite, and Oracle.
41
+   NOTE: This package does not include Oracle support.
42
+endef
43
+
44
+CONFIGURE_ARGS += --disable-profiling \
45
+		    --enable-optimized \
46
+		    --with-mysql \
47
+		    --with-postgresql \
48
+		    --with-sqlite \
49
+		    --enable-sqliteunlock \
50
+		    --enable-openssl
51
+
52
+TARGET_CPPFLAGS += -std=c99
53
+
54
+include $(INCLUDE_DIR)/host-build.mk
55
+
56
+define Hooks/HostConfigure/Pre
57
+endef
58
+
59
+define Host/Configure
60
+endef
61
+
62
+define Host/Compile
63
+	$(HOSTCC) $(HOST_BUILD_DIR)/tools/filterh/lex.yy.c -o $(HOST_BUILD_DIR)/tools/bin/filterh
64
+endef
65
+
66
+define Host/Install
67
+	$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
68
+	$(CP) $(HOST_BUILD_DIR)/tools/bin/filterh $(STAGING_DIR_HOST)/bin/
69
+endef
70
+
71
+$(eval $(call HostBuild))
72
+
73
+define Build/Compile
74
+	$(call Build/Compile/Default)
75
+endef
76
+
77
+define Build/InstallDev
78
+	$(INSTALL_DIR) $(1)/usr/include/zdb
79
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
80
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/zdb/ $(1)/usr/include/
81
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzdb* $(1)/usr/lib/
82
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/zdb.pc $(1)/usr/lib/pkgconfig
83
+endef
84
+
85
+define Package/libzdb/install
86
+	$(INSTALL_DIR) $(1)/usr/lib
87
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzdb.so* $(1)/usr/lib/
88
+endef
89
+
90
+$(eval $(call BuildPackage,libzdb))

+ 186
- 0
libs/libzdb/patches/010-cross-compile-fixes.patch Voir le fichier

@@ -0,0 +1,186 @@
1
+diff -rupN libzdb-3.0.orig/configure.ac libzdb-3.0/configure.ac
2
+--- libzdb-3.0.orig/configure.ac	2014-01-06 22:17:57.000000000 +0100
3
++++ libzdb-3.0/configure.ac	2014-11-20 13:59:27.456957651 +0100
4
+@@ -196,15 +196,6 @@ AC_SEARCH_LIBS([pthread_create], [pthrea
5
+ # Database Libraries 
6
+ 
7
+ mysql="yes"
8
+-check_mysql_config() 
9
+-{
10
+-        AC_PATH_PROG([MYSQLCONFIG], [mysql_config], [no], [$PATH:/usr/local/bin:/usr/local/mysql/bin])
11
+-        if test "x$MYSQLCONFIG" = "xno" 
12
+-        then
13
+-                AC_MSG_WARN([mysql_config is required to build libzdb with mysql])
14
+-                mysql="no"
15
+-        fi
16
+-}
17
+ AC_MSG_CHECKING(for mysql)
18
+ AC_ARG_WITH([mysql], 
19
+         AS_HELP_STRING([--with-mysql(=<path>)], 
20
+@@ -216,22 +207,20 @@ AC_ARG_WITH([mysql],
21
+                         mysql="no"
22
+                 else
23
+                         AC_MSG_RESULT([yes])
24
+-                        AC_CHECK_FILE([$with_mysql], [MYSQLCONFIG=$with_mysql], [check_mysql_config])        
25
+                 fi
26
+         ],
27
+         [
28
+                 AC_MSG_RESULT([yes])
29
+-                check_mysql_config
30
+         ])
31
+ if test "xyes" = "x$mysql"; then
32
+         svd_CPPFLAGS=$CPPFLAGS
33
+         svd_LDFLAGS=$LDFLAGS
34
+-        CPPFLAGS="`$MYSQLCONFIG --include` $CPPFLAGS"
35
+-        LDFLAGS="`$MYSQLCONFIG --libs` $LDFLAGS"
36
++        CPPFLAGS="-I$STAGING_DIR/usr/include/mysql $CPPFLAGS"
37
++        LDFLAGS="-L$STAGING_DIR/usr/lib/mysql -L$STAGING_DIR/usr/lib $LDFLAGS"
38
+         AC_CHECK_HEADERS([mysql.h], [], [mysql="no"])
39
+         if test "xyes" = "x$mysql"; then
40
+-                DBCPPFLAGS="$DBCPPFLAGS `$MYSQLCONFIG --include`"
41
+-                DBLDFLAGS="$DBLDFLAGS `$MYSQLCONFIG --libs`"
42
++                DBCPPFLAGS="$DBCPPFLAGS -I$STAGING_DIR/usr/include/mysql"
43
++                DBLDFLAGS="$DBLDFLAGS -L$STAGING_DIR/usr/lib/mysql -L$STAGING_DIR/usr/lib -lmysqlclient -lz -lcrypt -lnsl -lm"
44
+                 AC_DEFINE([HAVE_LIBMYSQLCLIENT], 1, [Define to 1 to enable mysql])
45
+         else
46
+                 CPPFLAGS=$svd_CPPFLAGS
47
+@@ -241,15 +230,6 @@ fi
48
+ AM_CONDITIONAL([WITH_MYSQL], test "xyes" = "x$mysql")
49
+ 
50
+ postgresql="yes"
51
+-check_postgres_config() 
52
+-{
53
+-        AC_PATH_PROG([PGCONFIG], [pg_config], [no], [$PATH:/usr/local/bin:/usr/local/pgsql/bin])
54
+-        if test "x$PGCONFIG" = "xno"
55
+-        then
56
+-                AC_MSG_WARN([pg_config is required to build libzdb with postgresql])
57
+-                postgresql="no"
58
+-        fi
59
+-}
60
+ AC_MSG_CHECKING(for postgresql)
61
+ AC_ARG_WITH([postgresql], 
62
+         AS_HELP_STRING([--with-postgresql(=<path>)], 
63
+@@ -261,22 +241,20 @@ AC_ARG_WITH([postgresql],
64
+                         postgresql="no"
65
+                 else
66
+                         AC_MSG_RESULT([yes])
67
+-                        AC_CHECK_FILE([$with_postgresql], [PGCONFIG=$with_postgresql],[check_postgres_config])
68
+                 fi
69
+         ],
70
+         [
71
+                 AC_MSG_RESULT([yes])
72
+-                check_postgres_config
73
+         ])
74
+ if test "xyes" = "x$postgresql"; then
75
+         svd_CPPFLAGS=$CPPFLAGS
76
+         svd_LDFLAGS=$LDFLAGS
77
+-        CPPFLAGS="-I`$PGCONFIG --includedir` $CPPFLAGS"
78
+-        LDFLAGS="-L`$PGCONFIG --libdir` $LDFLAGS"
79
++        CPPFLAGS="-I$STAGING_DIR/usr/include/postgresql -I$STAGING_DIR/usr/include $CPPFLAGS"
80
++        LDFLAGS="-L$STAGING_DIR/usr/lib $LDFLAGS"
81
+         AC_CHECK_HEADERS([libpq-fe.h], [], [postgresql="no"])
82
+         if test "xyes" = "x$postgresql"; then
83
+-                DBCPPFLAGS="$DBCPPFLAGS -I`$PGCONFIG --includedir`"
84
+-                DBLDFLAGS="$DBLDFLAGS -L`$PGCONFIG --libdir` -lpq"
85
++                DBCPPFLAGS="$DBCPPFLAGS -I$STAGING_DIR/usr/include/postgresql -I$STAGING_DIR/usr/include"
86
++                DBLDFLAGS="$DBLDFLAGS -L$STAGING_DIR/usr/lib -lpq"
87
+                 AC_DEFINE([HAVE_LIBPQ], 1, [Define to 1 to enable postgresql])
88
+         else
89
+                 CPPFLAGS=$svd_CPPFLAGS
90
+@@ -298,22 +276,7 @@ AC_ARG_WITH([sqlite],
91
+                         sqlite="no"
92
+                 else
93
+                         AC_MSG_RESULT([yes])
94
+-                        AC_CHECK_FILE([$with_sqlite],
95
+-                        [
96
+-                                svd_LDFLAGS=$LDFLAGS
97
+-                                svd_CPPFLAGS=$CPPFLAGS
98
+-                                LDFLAGS="-L$with_sqlite/lib $LDFLAGS -lsqlite3"
99
+-                                CPPFLAGS="-I$with_sqlite/include $CPPFLAGS"
100
+-                                AC_SEARCH_LIBS([sqlite3_open], [sqlite3],
101
+-                                [
102
+-                                        DBCPPFLAGS="$DBCPPFLAGS -I$with_sqlite/include"
103
+-                                        DBLDFLAGS="$DBLDFLAGS -L$with_sqlite/lib/ -lsqlite3"
104
+-                                ],[sqlite="no"])
105
+-                                LDFLAGS=$svd_LDFLAGS
106
+-                                CPPFLAGS=$svd_CPPFLAGS
107
+-   
108
+-                        ],
109
+-                        AC_SEARCH_LIBS([sqlite3_open], [sqlite3], [], [sqlite="no"]))
110
++                        AC_SEARCH_LIBS([sqlite3_open], [sqlite3], [], [sqlite="no"])
111
+                 fi
112
+         ], 
113
+         [
114
+@@ -328,20 +291,8 @@ if test "xyes" = "x$sqlite"; then
115
+ fi
116
+ AM_CONDITIONAL([WITH_SQLITE], test "xyes" = "x$sqlite")
117
+ 
118
+-oracle="yes"
119
+-AC_MSG_CHECKING(for oracle)
120
+-AX_LIB_ORACLE_OCI
121
+-if test -n "$ORACLE_OCI_CFLAGS" -a -n "$ORACLE_OCI_LDFLAGS"; then
122
+-        DBCPPFLAGS="$DBCPPFLAGS $ORACLE_OCI_CFLAGS"
123
+-        DBLDFLAGS="$DBLDFLAGS $ORACLE_OCI_LDFLAGS"
124
+-        AC_DEFINE([HAVE_ORACLE], 1, [Define to 1 to enable oracle])
125
+-else
126
+-        oracle="no"
127
+-fi
128
+-AM_CONDITIONAL([WITH_ORACLE], test "xyes" = "x$oracle")
129
+-
130
+ # Test if any database system was found
131
+-if test "xno" = "x$postgresql" -a "xno" = "x$mysql" -a "xno" = "x$sqlite" -a "xno" = "x$oracle"; then
132
++if test "xno" = "x$postgresql" -a "xno" = "x$mysql" -a "xno" = "x$sqlite"; then
133
+         AC_MSG_ERROR([No available database found or selected. Try configure --help])
134
+ fi
135
+ 
136
+@@ -358,23 +309,6 @@ AC_HEADER_STDC
137
+ # Functions 
138
+ # ------------------------------------------------------------------------
139
+ 
140
+-# Require a working setjmp
141
+-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
142
+-        #include <setjmp.h>
143
+-        ]],
144
+-        [[jmp_buf env; setjmp(env);]])], 
145
+-        [], [AC_MSG_FAILURE([setjmp is required])]
146
+-)
147
+-
148
+-# Require that we have vsnprintf that conforms to c99. I.e. does bounds check
149
+-AC_RUN_IFELSE([AC_LANG_PROGRAM([[
150
+-        #include <stdarg.h> 
151
+-        #include <stdio.h>
152
+-        ]],
153
+-        [[char t[1]; va_list ap; int n = vsnprintf(t, 1, "hello", ap); if(n == 5) return 0;return 1;]])], 
154
+-        [], [AC_MSG_FAILURE([vsnprintf does not conform to c99])]
155
+-)
156
+-
157
+ AC_CHECK_FUNCS([timegm])
158
+ 
159
+ 
160
+@@ -487,11 +421,6 @@ echo "|   PostgreSQL:
161
+ else
162
+ echo "|   PostgreSQL:                                   DISABLED   |"
163
+ fi
164
+-if test "xyes" = "x$oracle"; then
165
+-echo "|   Oracle:                                       ENABLED    |"
166
+-else
167
+-echo "|   Oracle:                                       DISABLED   |"
168
+-fi
169
+ echo "+------------------------------------------------------------+"
170
+ 
171
+ 
172
+diff -rupN libzdb-3.0.orig/Makefile.am libzdb-3.0/Makefile.am
173
+--- libzdb-3.0.orig/Makefile.am	2014-01-06 22:34:08.000000000 +0100
174
++++ libzdb-3.0/Makefile.am	2014-11-20 13:51:22.508204689 +0100
175
+@@ -45,11 +45,6 @@ libzdb_la_SOURCES += src/db/sqlite/SQLit
176
+                      src/db/sqlite/SQLiteResultSet.c \
177
+                      src/db/sqlite/SQLitePreparedStatement.c
178
+ endif
179
+-if WITH_ORACLE
180
+-libzdb_la_SOURCES += src/db/oracle/OracleConnection.c \
181
+-                     src/db/oracle/OracleResultSet.c \
182
+-                     src/db/oracle/OraclePreparedStatement.c
183
+-endif
184
+ 
185
+ API_INTERFACES  = src/zdb.h src/db/ConnectionPool.h src/db/Connection.h \
186
+                   src/db/ResultSet.h src/net/URL.h src/db/PreparedStatement.h \

+ 20
- 0
libs/libzdb/patches/020-filterh-use-host-built-version.patch Voir le fichier

@@ -0,0 +1,20 @@
1
+diff -rupN libzdb-3.0.orig/Makefile.am libzdb-3.0/Makefile.am
2
+--- libzdb-3.0.orig/Makefile.am	2014-01-06 22:34:08.000000000 +0100
3
++++ libzdb-3.0/Makefile.am	2014-11-19 20:26:20.588547729 +0100
4
+@@ -1,5 +1,7 @@
5
+ # Copyright (C) Tildeslash Ltd. All rights reserved.
6
+ 
7
++include $(TOPDIR)/rules.mk
8
++
9
+ AUTOMAKE_OPTIONS = foreign no-dependencies subdir-objects
10
+ ACLOCAL_AMFLAGS  = -I m4
11
+ 
12
+@@ -12,7 +14,7 @@ LIBRARY_NAME    = zdb
13
+ 
14
+ RE2C		= @RE2C@
15
+ RE2CFLAGS       = -b
16
+-FILTERH         = ./tools/bin/filterh
17
++FILTERH         = $(STAGING_DIR_HOST)/bin/filterh
18
+ 
19
+ AM_CPPFLAGS     = $(CPPFLAGS) $(DBCPPFLAGS)
20
+ AM_CPPFLAGS     += -Isrc -Isrc/util -Isrc/net -Isrc/db -Isrc/exceptions