perl-dbi.spec 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. ##
  2. ## perl-dbi.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2005 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # versions of individual parts
  26. %define V_perl 5.8.6
  27. %define V_dbi 1.47
  28. %define V_sql_statement 1.09
  29. %define V_sql_abstract 1.17
  30. %define V_dbd_anydata 0.08
  31. %define V_dbd_sprite 0.50
  32. %define V_dbd_sqlite 1.08
  33. %define V_dbd_mysql 2.9004
  34. %define V_dbd_pgsql 1.40
  35. %define V_dbd_oracle 1.16
  36. %define V_dbd_sybase 1.05
  37. %define V_dbd_odbc 1.13
  38. # package information
  39. Name: perl-dbi
  40. Summary: Perl Modules for use with DBI API
  41. URL: http://www.cpan.org/
  42. Vendor: Perl Community
  43. Packager: The OpenPKG Project
  44. Distribution: OpenPKG
  45. Class: BASE
  46. Group: Language
  47. License: GPL/Artistic
  48. Version: %{V_perl}
  49. Release: 20050227
  50. # package options
  51. %option with_dbd_sqlite no
  52. %option with_dbd_mysql no
  53. %option with_dbd_pgsql no
  54. %option with_dbd_oracle no
  55. %option with_dbd_sybase no
  56. %option with_dbd_odbc no
  57. # list of sources
  58. Source0: http://www.cpan.org/modules/by-module/DBI/DBI-%{V_dbi}.tar.gz
  59. Source1: http://www.cpan.org/modules/by-module/SQL/SQL-Statement-%{V_sql_statement}.tar.gz
  60. Source2: http://www.cpan.org/modules/by-module/SQL/SQL-Abstract-%{V_sql_abstract}.tar.gz
  61. Source3: http://www.cpan.org/modules/by-module/DBD/DBD-AnyData-%{V_dbd_anydata}.tar.gz
  62. Source4: http://www.cpan.org/modules/by-module/DBD/DBD-Sprite-%{V_dbd_sprite}.tar.gz
  63. Source5: http://www.cpan.org/modules/by-module/DBD/DBD-SQLite-%{V_dbd_sqlite}.tar.gz
  64. Source6: http://www.cpan.org/modules/by-module/DBD/DBD-mysql-%{V_dbd_mysql}.tar.gz
  65. Source7: http://www.cpan.org/modules/by-module/DBD/DBD-Pg-%{V_dbd_pgsql}.tar.gz
  66. Source8: http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-%{V_dbd_oracle}.tar.gz
  67. Source9: http://www.cpan.org/modules/by-module/DBD/DBD-ODBC-%{V_dbd_odbc}.tar.gz
  68. Source10: http://www.peppler.org/downloads/DBD-Sybase-%{V_dbd_sybase}.tar.gz
  69. Patch0: perl-dbi.patch
  70. # build information
  71. Prefix: %{l_prefix}
  72. BuildRoot: %{l_buildroot}
  73. BuildPreReq: OpenPKG, openpkg >= 20040130, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
  74. PreReq: OpenPKG, openpkg >= 20040130, perl >= %{V_perl}
  75. BuildPreReq: perl-util, perl-net
  76. PreReq: perl-util, perl-net
  77. %if "%{with_dbd_sqlite}" == "yes"
  78. BuildPreReq: sqlite, sqlite::with_v3 = yes
  79. PreReq: sqlite, sqlite::with_v3 = yes
  80. %endif
  81. %if "%{with_dbd_mysql}" == "yes"
  82. BuildPreReq: mysql
  83. PreReq: mysql
  84. %endif
  85. %if "%{with_dbd_pgsql}" == "yes"
  86. BuildPreReq: postgresql
  87. PreReq: postgresql
  88. %endif
  89. %if "%{with_dbd_oracle}" == "yes"
  90. BuildPreReq: oracle
  91. PreReq: oracle
  92. %endif
  93. %if "%{with_dbd_sybase}" == "yes"
  94. BuildPreReq: freetds, libiconv
  95. PreReq: freetds, libiconv
  96. %endif
  97. %if "%{with_dbd_odbc}" == "yes"
  98. BuildPreReq: unixodbc
  99. PreReq: unixodbc
  100. %endif
  101. AutoReq: no
  102. AutoReqProv: no
  103. %description
  104. Various modules for using the DBI API of Perl:
  105. - DBI (%{V_dbi})
  106. - SQL::Statement (%{V_sql_statement})
  107. - SQL::Abstract (%{V_sql_abstract})
  108. - DBD::AnyData (%{V_dbd_anydata})
  109. - DBD::Sprite (%{V_dbd_sprite})
  110. - DBD::SQLite (%{V_dbd_sqlite}) [%{with_dbd_sqlite}]
  111. - DBD::mysql (%{V_dbd_mysql}) [%{with_dbd_mysql}]
  112. - DBD::Pg (%{V_dbd_pgsql}) [%{with_dbd_pgsql}]
  113. - DBD::Oracle (%{V_dbd_oracle}) [%{with_dbd_oracle}]
  114. - DBD::Sybase (%{V_dbd_sybase}) [%{with_dbd_sybase}]
  115. - DBD::ODBC (%{V_dbd_odbc}) [%{with_dbd_odbc}]
  116. %track
  117. prog perl-dbi:DBD-AnyData = {
  118. version = %{V_dbd_anydata}
  119. url = http://www.cpan.org/modules/by-module/DBD/
  120. regex = DBD-AnyData-(__VER__)\.tar\.gz
  121. }
  122. prog perl-dbi:DBD-mysql = {
  123. version = %{V_dbd_mysql}
  124. url = http://www.cpan.org/modules/by-module/DBD/
  125. regex = DBD-mysql-(__VER__)\.tar\.gz
  126. }
  127. prog perl-dbi:DBD-ODBC = {
  128. version = %{V_dbd_odbc}
  129. url = http://www.cpan.org/modules/by-module/DBD/
  130. regex = DBD-ODBC-(__VER__)\.tar\.gz
  131. }
  132. prog perl-dbi:DBD-Oracle = {
  133. version = %{V_dbd_oracle}
  134. url = http://www.cpan.org/modules/by-module/DBD/
  135. regex = DBD-Oracle-(__VER__)\.tar\.gz
  136. }
  137. prog perl-dbi:DBD-Pg = {
  138. version = %{V_dbd_pgsql}
  139. url = http://www.cpan.org/modules/by-module/DBD/
  140. regex = DBD-Pg-(__VER__)\.tar\.gz
  141. }
  142. prog perl-dbi:DBD-Sprite = {
  143. version = %{V_dbd_sprite}
  144. url = http://www.cpan.org/modules/by-module/DBD/
  145. regex = DBD-Sprite-(__VER__)\.tar\.gz
  146. }
  147. prog perl-dbi:DBD-SQLite = {
  148. version = %{V_dbd_sqlite}
  149. url = http://www.cpan.org/modules/by-module/DBD/
  150. regex = DBD-SQLite-(__VER__)\.tar\.gz
  151. }
  152. prog perl-dbi:DBD-Sybase = {
  153. version = %{V_dbd_sybase}
  154. url = http://www.peppler.org/downloads/
  155. regex = DBD-Sybase-(__VER__)\.tar\.gz
  156. }
  157. prog perl-dbi:DBI = {
  158. version = %{V_dbi}
  159. url = http://www.cpan.org/modules/by-module/DBI/
  160. regex = DBI-(\d+\.\d\d)\.tar\.gz
  161. }
  162. prog perl-dbi:SQL-Statement = {
  163. version = %{V_sql_statement}
  164. url = http://www.cpan.org/modules/by-module/SQL/
  165. regex = SQL-Statement-(__VER__)\.tar\.gz
  166. }
  167. prog perl-dbi:SQL-Abstract = {
  168. version = %{V_sql_abstract}
  169. url = http://www.cpan.org/modules/by-module/SQL/
  170. regex = SQL-Abstract-(__VER__)\.tar\.gz
  171. }
  172. %prep
  173. %setup -q -c
  174. %setup -q -T -D -a 1
  175. %setup -q -T -D -a 2
  176. %setup -q -T -D -a 3
  177. %setup -q -T -D -a 4
  178. %setup -q -T -D -a 5
  179. %setup -q -T -D -a 6
  180. %setup -q -T -D -a 7
  181. %setup -q -T -D -a 8
  182. %setup -q -T -D -a 9
  183. %setup -q -T -D -a 10
  184. %patch -p0 -d DBD-SQLite-%{V_dbd_sqlite}
  185. %build
  186. %install
  187. rm -rf $RPM_BUILD_ROOT
  188. %{l_prefix}/bin/perl-openpkg prepare
  189. # build and install individual modules
  190. %{l_prefix}/bin/perl-openpkg -d %{SOURCE0} configure build install
  191. %{l_prefix}/bin/perl-openpkg -d %{SOURCE1} configure build install
  192. %{l_prefix}/bin/perl-openpkg -d %{SOURCE2} configure build install
  193. %{l_prefix}/bin/perl-openpkg -d %{SOURCE3} configure build install
  194. %{l_prefix}/bin/perl-openpkg -d %{SOURCE4} configure build install
  195. %if "%{with_dbd_sqlite}" == "yes"
  196. # build DBD::SQLite
  197. ( cd DBD-SQLite-%{V_dbd_sqlite}
  198. # remove local SQLite sources (we use external one)
  199. # in order to not confuse ExtUtils::MakeMaker
  200. mv ppport.h dbdimp.[ch] SQLiteXS.h ..
  201. for file in `echo *.[ch] getsqlite.pl`; do
  202. sed -e "s;^ *$file *$;;" <MANIFEST >MANIFEST.NEW && mv MANIFEST.NEW MANIFEST
  203. rm -f $file
  204. done
  205. mv ../ppport.h ../dbdimp.[ch] ../SQLiteXS.h .
  206. # substitute paths in patched Makefile.PL
  207. %{l_shtool} subst %{l_value -s -a} Makefile.PL
  208. # perform regular build and install
  209. %{l_prefix}/bin/perl-openpkg configure build install
  210. ) || exit $?
  211. %endif
  212. %if "%{with_dbd_mysql}" == "yes"
  213. # build DBD::mysql
  214. ( cd DBD-mysql-%{V_dbd_mysql}
  215. # (determines MySQL header/lib paths via mysql_config in $PATH)
  216. %{l_prefix}/bin/perl-openpkg configure build install
  217. ) || exit $?
  218. %endif
  219. %if "%{with_dbd_pgsql}" == "yes"
  220. # build DBD::Pg
  221. ( cd DBD-Pg-%{V_dbd_pgsql}
  222. %{l_shtool} subst \
  223. -e 's;/include;/include/postgresql;' \
  224. -e 's;-lpq;-lpq -lssl -lcrypto -lcrypt;' \
  225. Makefile.PL
  226. POSTGRES_HOME=%{l_prefix}
  227. export POSTGRES_HOME
  228. %{l_prefix}/bin/perl-openpkg configure build install
  229. ) || exit $?
  230. %endif
  231. %if "%{with_dbd_oracle}" == "yes"
  232. # build DBD::oracle
  233. ( cd DBD-Oracle-%{V_dbd_oracle}
  234. ORACLE_HOME="`%{l_rc} --query oracle_home`"
  235. export ORACLE_HOME
  236. case "%{l_platform -t}" in
  237. i?86-linux* )
  238. ;;
  239. sun*-sunos* )
  240. # OpenPKG builds with gcc in 32-bit mode by default
  241. %{l_shtool} subst \
  242. -e 's;demo_rdbms\.mk;demo_rdbms32.mk;g' \
  243. Makefile.PL
  244. ;;
  245. * )
  246. echo "Platform \"%{l_platform -t}\" not supported" 1>&2
  247. exit 1
  248. ;;
  249. esac
  250. %{l_prefix}/bin/perl-openpkg configure build install
  251. ) || exit $?
  252. %endif
  253. %if "%{with_dbd_sybase}" == "yes"
  254. # build DBD::Sybase
  255. ( cd DBD-Sybase-%{V_dbd_sybase}
  256. SYBASE="%{l_prefix}"
  257. export SYBASE
  258. %{l_shtool} subst \
  259. -e 's;\([^s(]/lib\);\1/freetds;g' \
  260. -e 's;-lct;%{l_ldflags} -lct -liconv;g' \
  261. Makefile.PL
  262. %{l_prefix}/bin/perl-openpkg configure build install
  263. ) || exit $?
  264. %endif
  265. %if "%{with_dbd_odbc}" == "yes"
  266. # build DBD::odbc
  267. ( cd DBD-ODBC-%{V_dbd_odbc}
  268. ODBCHOME="%{l_prefix}"
  269. DBROOT=
  270. export ODBCHOME DBROOT
  271. %{l_prefix}/bin/perl-openpkg configure build install
  272. ) || exit $?
  273. %endif
  274. # determine installation files
  275. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  276. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
  277. %files -f files
  278. %clean
  279. rm -rf $RPM_BUILD_ROOT