Prechádzať zdrojové kódy

add Java JDBC driver

Ralf S. Engelschall 18 rokov pred
rodič
commit
494a89267f
1 zmenil súbory, kde vykonal 43 pridanie a 1 odobranie
  1. 43 1
      sqlite/sqlite.spec

+ 43 - 1
sqlite/sqlite.spec

@@ -25,6 +25,7 @@
 #   package version
 %define       V_sqlite   3.5.0
 %define       V_odbc     0.75
+%define       V_jdbc     20070823
 
 #   package information
 Name:         sqlite
@@ -37,7 +38,7 @@ Class:        BASE
 Group:        Database
 License:      PD
 Version:      %{V_sqlite}
-Release:      20070906
+Release:      20070912
 
 #   package options
 %option       with_assert          no
@@ -46,10 +47,12 @@ Release:      20070906
 %option       with_fts1            no
 %option       with_fts2            no
 %option       with_odbc            no
+%option       with_jdbc            no
 
 #   list of sources
 Source0:      http://www.sqlite.org/sqlite-%{V_sqlite}.tar.gz
 Source1:      http://www.ch-werner.de/sqliteodbc/sqliteodbc-%{V_odbc}.tar.gz
+Source2:      http://www.ch-werner.de/javasqlite/javasqlite-%{V_jdbc}.tar.gz
 Patch0:       sqlite.patch
 Patch1:       sqlite.patch.odbc
 
@@ -66,6 +69,10 @@ PreReq:       readline
 BuildPreReq:  ODBC
 PreReq:       ODBC
 %endif
+%if "%{with_jdbc}" == "yes"
+BuildPreReq:  java, JAVA-JDK
+PreReq:       java, JAVA-JDK
+%endif
 AutoReq:      no
 AutoReqProv:  no
 
@@ -91,6 +98,11 @@ AutoReqProv:  no
         url       = http://www.ch-werner.de/sqliteodbc/
         regex     = sqliteodbc-(__VER__)\.tar\.gz
     }
+    prog sqlite:jdbc = {
+        version   = %{V_jdbc}
+        url       = http://www.ch-werner.de/javasqlite/overview-summary.html
+        regex     = javasqlite-(\d+)\.tar\.gz
+    }
 
 %prep
     %setup -q
@@ -99,6 +111,9 @@ AutoReqProv:  no
     %setup -q -D -T -a 1
     %patch -p0 -d sqliteodbc-%{V_odbc} -P 1
 %endif
+%if "%{with_jdbc}" == "yes"
+    %setup -q -D -T -a 2
+%endif
 
     #   post-adjust sources
     %{l_shtool} subst \
@@ -169,6 +184,26 @@ AutoReqProv:  no
     ) || exit $?
 %endif
 
+    #   optionally build JDBC driver
+%if "%{with_jdbc}" == "yes"
+    ( cd javasqlite-%{V_jdbc}
+      export JAVA_PLATFORM="sun-jdk"
+      eval `%{l_prefix}/bin/java-toolkit -e`
+      export CC="%{l_cc}"
+      export CFLAGS="%{l_cflags -O}"
+      export CPPFLAGS=""
+      export LDFLAGS=""
+      CPPFLAGS="$CPPFLAGS -I.."
+      LDFLAGS="$LDFLAGS -L../.libs"
+      ./configure \
+          --prefix=%{l_prefix} \
+          --with-jardir=%{l_prefix}/lib \
+          --with-jdk=$JAVA_HOME \
+          --with-sqlite3=..
+          %{l_make} %{l_mflags}
+    ) || exit $?
+%endif
+
 %install
     #   create installation hierarchy
     rm -rf $RPM_BUILD_ROOT
@@ -192,6 +227,13 @@ AutoReqProv:  no
     ) || exit $?
 %endif
 
+    #   install SQLite JDBC driver (optional)
+%if "%{with_jdbc}" == "yes"
+    ( cd javasqlite-%{V_jdbc}
+      %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
+    ) || exit $?
+%endif
+
     #   strip down installation files
     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true