sqlite.spec 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. ##
  2. ## sqlite.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2012 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_sqlite 3.7.10.0
  25. %define V_dist 3071000
  26. %define V_odbc 0.93
  27. %define V_jdbc 20120202
  28. # package information
  29. Name: sqlite
  30. Summary: Lightweight Embedded SQL Database
  31. URL: http://www.sqlite.org/
  32. Vendor: D. Richard Hipp
  33. Packager: OpenPKG Foundation e.V.
  34. Distribution: OpenPKG Community
  35. Class: BASE
  36. Group: Database
  37. License: PD
  38. Version: %{V_sqlite}
  39. Release: 20120206
  40. # package options
  41. %option with_debug no
  42. %option with_readline no
  43. %option with_threads no
  44. %option with_fts3 no
  45. %option with_rtree no
  46. %option with_odbc no
  47. %option with_jdbc no
  48. %option with_regexp yes
  49. # list of sources
  50. Source0: http://www.sqlite.org/sqlite-src-%{V_dist}.zip
  51. Source1: http://www.ch-werner.de/sqliteodbc/sqliteodbc-%{V_odbc}.tar.gz
  52. Source2: http://www.ch-werner.de/javasqlite/javasqlite-%{V_jdbc}.tar.gz
  53. Patch0: sqlite.patch
  54. Patch1: sqlite.patch.odbc
  55. # build information
  56. BuildPreReq: OpenPKG, openpkg >= 20100101, make, gawk, tcl
  57. PreReq: OpenPKG, openpkg >= 20100101
  58. %if "%{with_readline}" == "yes"
  59. BuildPreReq: readline, pkgconfig
  60. PreReq: readline
  61. %endif
  62. %if "%{with_odbc}" == "yes"
  63. BuildPreReq: ODBC
  64. PreReq: ODBC
  65. %endif
  66. %if "%{with_jdbc}" == "yes"
  67. BuildPreReq: java, JAVA-JDK
  68. PreReq: java, JAVA-JDK
  69. %endif
  70. %description
  71. SQLite is a C library that implements an embeddable SQL database
  72. engine. Programs that link with the SQLite library can have SQL
  73. database access without running a separate RDBMS process. The
  74. distribution comes with a standalone command-line access program
  75. (sqlite) that can be used to administer an SQLite database and which
  76. serves as an example of how to use the SQLite library. SQLite is not
  77. a client library used to connect to a big database server. SQLite is
  78. the server. The SQLite library reads and writes directly to and from
  79. the database files on disk.
  80. %track
  81. prog sqlite = {
  82. version = %{V_dist}
  83. url = http://www.sqlite.org/download.html
  84. regex = sqlite-src-(\d+)\.zip
  85. }
  86. prog sqlite:odbc = {
  87. version = %{V_odbc}
  88. url = http://www.ch-werner.de/sqliteodbc/
  89. regex = sqliteodbc-(__VER__)\.tar\.gz
  90. }
  91. prog sqlite:jdbc = {
  92. version = %{V_jdbc}
  93. url = http://www.ch-werner.de/javasqlite/overview-summary.html
  94. regex = javasqlite-(\d{8})\.tar\.gz
  95. }
  96. %prep
  97. %setup -q -n sqlite-src-%{V_dist}
  98. %patch -p0 -P 0
  99. %if "%{with_odbc}" == "yes"
  100. %setup -q -n sqlite-src-%{V_dist} -D -T -a 1
  101. %patch -p0 -d sqliteodbc-%{V_odbc} -P 1
  102. %endif
  103. %if "%{with_jdbc}" == "yes"
  104. %setup -q -n sqlite-src-%{V_dist} -D -T -a 2
  105. %endif
  106. %build
  107. # configure and build SQLite
  108. CC="%{l_cc}"
  109. CFLAGS="%{l_cflags -O}"
  110. CPPFLAGS="-I. %{l_cppflags}"
  111. LDFLAGS="-L. %{l_ldflags}"
  112. LIBS="-lm"
  113. export CC
  114. export CPPFLAGS
  115. export CFLAGS
  116. export LDFLAGS
  117. export LIBS
  118. GREP="grep" \
  119. ./configure \
  120. --prefix=%{l_prefix} \
  121. %if "%{with_threads}" == "yes"
  122. --enable-threadsafe \
  123. %else
  124. --disable-threadsafe \
  125. %endif
  126. %if "%{with_readline}" == "yes"
  127. --enable-readline \
  128. --with-readline-lib="`%{l_prefix}/bin/pkg-config --libs readline`" \
  129. --with-readline-inc="`%{l_prefix}/bin/pkg-config --cflags readline`" \
  130. %else
  131. --disable-readline \
  132. %endif
  133. %if "%{with_debug}" == "yes"
  134. --enable-debug \
  135. %else
  136. --disable-debug \
  137. %endif
  138. --disable-tcl \
  139. --disable-amalgamation \
  140. --disable-shared
  141. MFLAGS=""
  142. %if "%{with_regexp}" == "yes"
  143. MFLAGS="$MFLAGS REGEXP=1"
  144. %endif
  145. %if "%{with_fts3}" == "yes"
  146. MFLAGS="$MFLAGS FTS3=1"
  147. %endif
  148. %if "%{with_rtree}" == "yes"
  149. MFLAGS="$MFLAGS RTREE=1"
  150. %endif
  151. %{l_make} %{l_mflags -O} $MFLAGS
  152. # optionally build ODBC driver
  153. %if "%{with_odbc}" == "yes"
  154. ( cd sqliteodbc-%{V_odbc}
  155. export CC="%{l_cc}"
  156. export CFLAGS="%{l_cflags -O}"
  157. export CPPFLAGS=""
  158. export LDFLAGS=""
  159. CPPFLAGS="$CPPFLAGS -I.."
  160. LDFLAGS="$LDFLAGS -L../.libs"
  161. ./configure \
  162. --prefix=%{l_prefix} \
  163. --with-sqlite3=.. \
  164. --with-odbc=%{l_prefix} \
  165. --disable-static \
  166. --enable-shared
  167. %{l_make} %{l_mflags -O}
  168. ) || exit $?
  169. %endif
  170. # optionally build JDBC driver
  171. %if "%{with_jdbc}" == "yes"
  172. ( cd javasqlite-%{V_jdbc}
  173. export JAVA_PLATFORM="sun-jdk"
  174. eval `%{l_prefix}/bin/java-toolkit -e`
  175. export CC="%{l_cc}"
  176. export CFLAGS="%{l_cflags -O}"
  177. export CPPFLAGS=""
  178. export LDFLAGS=""
  179. CPPFLAGS="$CPPFLAGS -I.."
  180. LDFLAGS="$LDFLAGS -L../.libs"
  181. ./configure \
  182. --prefix=%{l_prefix} \
  183. --with-jardir=%{l_prefix}/lib \
  184. --with-jdk=$JAVA_HOME \
  185. --with-sqlite3=..
  186. %{l_make} %{l_mflags}
  187. ) || exit $?
  188. %endif
  189. %install
  190. # create installation hierarchy
  191. %{l_shtool} mkdir -f -p -m 755 \
  192. $RPM_BUILD_ROOT%{l_prefix}/bin \
  193. $RPM_BUILD_ROOT%{l_prefix}/lib \
  194. $RPM_BUILD_ROOT%{l_prefix}/include \
  195. $RPM_BUILD_ROOT%{l_prefix}/man/man1
  196. # install SQLite
  197. %{l_make} %{l_mflags} install \
  198. prefix=$RPM_BUILD_ROOT%{l_prefix}
  199. %{l_shtool} install -c -m 644 \
  200. sqlite3.1 $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite3.1
  201. # install SQLite ODBC driver (optional)
  202. %if "%{with_odbc}" == "yes"
  203. ( cd sqliteodbc-%{V_odbc}
  204. %{l_make} %{l_mflags} install \
  205. prefix=$RPM_BUILD_ROOT%{l_prefix}
  206. ) || exit $?
  207. %endif
  208. # install SQLite JDBC driver (optional)
  209. %if "%{with_jdbc}" == "yes"
  210. ( cd javasqlite-%{V_jdbc}
  211. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  212. ) || exit $?
  213. %endif
  214. # strip down installation files
  215. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  216. # provide convenient symlinks
  217. ln $RPM_BUILD_ROOT%{l_prefix}/bin/sqlite3 \
  218. $RPM_BUILD_ROOT%{l_prefix}/bin/sqlite
  219. ln $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite3.1 \
  220. $RPM_BUILD_ROOT%{l_prefix}/man/man1/sqlite.1
  221. # determine installation files
  222. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  223. %{l_files_std}
  224. %files -f files
  225. %clean
  226. %post
  227. # optionally link into ODBC
  228. %if "%{with_odbc}" == "yes"
  229. if ! $RPM_INSTALL_PREFIX/bin/odbcinst -q -d -n "SQLite3" >/dev/null 2>&1; then
  230. ( echo "[SQLite3]"
  231. echo "Description = SQLite 3 ODBC Driver"
  232. echo "Driver = $RPM_INSTALL_PREFIX/lib/libsqlite3odbc.so"
  233. echo "Setup = $RPM_INSTALL_PREFIX/lib/libsqlite3odbc.so"
  234. echo "FileUsage = 1"
  235. ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -d -n "SQLite3" -r >/dev/null 2>&1 || true
  236. fi
  237. %endif
  238. %preun
  239. if [ $1 -eq 1 ]; then : ;
  240. # optionally unlink from ODBC
  241. %if "%{with_odbc}" == "yes"
  242. $RPM_INSTALL_PREFIX/bin/odbcinst -u -s -l -n "SQLite3 DataSource" >/dev/null 2>&1 || true
  243. %endif
  244. fi