perl-dbi.spec 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. ##
  2. ## perl-dbi.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2004 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2004 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2004 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.5
  27. %define V_dbi 1.43
  28. %define V_sql_statement 1.09
  29. %define V_dbd_anydata 0.08
  30. %define V_dbd_sprite 0.50
  31. %define V_dbd_sqlite 1.04
  32. %define V_dbd_mysql 2.9004
  33. %define V_dbd_pgsql 1.32
  34. %define V_dbd_oracle 1.15
  35. %define V_dbd_odbc 1.10
  36. # package information
  37. Name: perl-dbi
  38. Summary: Perl Modules for use with DBI API
  39. URL: http://www.cpan.org/
  40. Vendor: Perl Community
  41. Packager: The OpenPKG Project
  42. Distribution: OpenPKG
  43. Class: BASE
  44. Group: Language
  45. License: GPL/Artistic
  46. Version: %{V_perl}
  47. Release: 20040909
  48. # package options
  49. %option with_dbd_sqlite no
  50. %option with_dbd_mysql no
  51. %option with_dbd_pgsql no
  52. %option with_dbd_oracle no
  53. %option with_dbd_odbc no
  54. # list of sources
  55. Source0: http://www.cpan.org/modules/by-module/DBI/DBI-%{V_dbi}.tar.gz
  56. Source1: http://www.cpan.org/modules/by-module/SQL/SQL-Statement-%{V_sql_statement}.tar.gz
  57. Source2: http://www.cpan.org/modules/by-module/DBD/DBD-AnyData-%{V_dbd_anydata}.tar.gz
  58. Source3: http://www.cpan.org/modules/by-module/DBD/DBD-Sprite-%{V_dbd_sprite}.tar.gz
  59. Source4: http://www.cpan.org/modules/by-module/DBD/DBD-SQLite-%{V_dbd_sqlite}.tar.gz
  60. Source5: http://www.cpan.org/modules/by-module/DBD/DBD-mysql-%{V_dbd_mysql}.tar.gz
  61. Source6: http://www.cpan.org/modules/by-module/DBD/DBD-Pg-%{V_dbd_pgsql}.tar.gz
  62. Source7: http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-%{V_dbd_oracle}.tar.gz
  63. Source8: http://www.cpan.org/modules/by-module/DBD/DBD-ODBC-%{V_dbd_odbc}.tar.gz
  64. Patch0: perl-dbi.patch
  65. # build information
  66. Prefix: %{l_prefix}
  67. BuildRoot: %{l_buildroot}
  68. BuildPreReq: OpenPKG, openpkg >= 20040130, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-20040126
  69. PreReq: OpenPKG, openpkg >= 20040130, perl >= %{V_perl}
  70. BuildPreReq: perl-net
  71. PreReq: perl-net
  72. %if "%{with_dbd_sqlite}" == "yes"
  73. BuildPreReq: sqlite, sqlite::with_v3 = yes
  74. PreReq: sqlite, sqlite::with_v3 = yes
  75. %endif
  76. %if "%{with_dbd_mysql}" == "yes"
  77. BuildPreReq: mysql
  78. PreReq: mysql
  79. %endif
  80. %if "%{with_dbd_pgsql}" == "yes"
  81. BuildPreReq: postgresql
  82. PreReq: postgresql
  83. %endif
  84. %if "%{with_dbd_oracle}" == "yes"
  85. BuildPreReq: ORACLE
  86. PreReq: ORACLE
  87. %endif
  88. %if "%{with_dbd_odbc}" == "yes"
  89. BuildPreReq: unixodbc
  90. PreReq: unixodbc
  91. %endif
  92. AutoReq: no
  93. AutoReqProv: no
  94. %description
  95. Various modules for using the DBI API of Perl:
  96. - DBI (%{V_dbi})
  97. - SQL::Statement (%{V_sql_statement})
  98. - DBD::AnyData (%{V_dbd_anydata})
  99. - DBD::Sprite (%{V_dbd_sprite})
  100. - DBD::SQLite (%{V_dbd_sqlite}) [%{with_dbd_sqlite}]
  101. - DBD::mysql (%{V_dbd_mysql}) [%{with_dbd_mysql}]
  102. - DBD::Pg (%{V_dbd_pgsql}) [%{with_dbd_pgsql}]
  103. - DBD::Oracle (%{V_dbd_oracle}) [%{with_dbd_oracle}]
  104. - DBD::ODBC (%{V_dbd_odbc}) [%{with_dbd_odbc}]
  105. %track
  106. prog perl-dbi:DBD-AnyData = {
  107. version = %{V_dbd_anydata}
  108. url = http://www.cpan.org/modules/by-module/DBD/
  109. regex = DBD-AnyData-(__VER__)\.tar\.gz
  110. }
  111. prog perl-dbi:DBD-mysql = {
  112. version = %{V_dbd_mysql}
  113. url = http://www.cpan.org/modules/by-module/DBD/
  114. regex = DBD-mysql-(__VER__)\.tar\.gz
  115. }
  116. prog perl-dbi:DBD-ODBC = {
  117. version = %{V_dbd_odbc}
  118. url = http://www.cpan.org/modules/by-module/DBD/
  119. regex = DBD-ODBC-(__VER__)\.tar\.gz
  120. }
  121. prog perl-dbi:DBD-Oracle = {
  122. version = %{V_dbd_oracle}
  123. url = http://www.cpan.org/modules/by-module/DBD/
  124. regex = DBD-Oracle-(__VER__)\.tar\.gz
  125. }
  126. prog perl-dbi:DBD-Pg = {
  127. version = %{V_dbd_pgsql}
  128. url = http://www.cpan.org/modules/by-module/DBD/
  129. regex = DBD-Pg-(__VER__)\.tar\.gz
  130. }
  131. prog perl-dbi:DBD-Sprite = {
  132. version = %{V_dbd_sprite}
  133. url = http://www.cpan.org/modules/by-module/DBD/
  134. regex = DBD-Sprite-(__VER__)\.tar\.gz
  135. }
  136. prog perl-dbi:DBD-SQLite = {
  137. version = %{V_dbd_sqlite}
  138. url = http://www.cpan.org/modules/by-module/DBD/
  139. regex = DBD-SQLite-(__VER__)\.tar\.gz
  140. }
  141. prog perl-dbi:DBI = {
  142. version = %{V_dbi}
  143. url = http://www.cpan.org/modules/by-module/DBI/
  144. regex = DBI-(\d+\.\d\d)\.tar\.gz
  145. }
  146. prog perl-dbi:SQL-Statement = {
  147. version = %{V_sql_statement}
  148. url = http://www.cpan.org/modules/by-module/SQL/
  149. regex = SQL-Statement-(__VER__)\.tar\.gz
  150. }
  151. %prep
  152. %setup -q -c
  153. %setup -q -T -D -a 1
  154. %setup -q -T -D -a 2
  155. %setup -q -T -D -a 3
  156. %setup -q -T -D -a 4
  157. %setup -q -T -D -a 5
  158. %setup -q -T -D -a 6
  159. %setup -q -T -D -a 7
  160. %setup -q -T -D -a 8
  161. %patch -p0 -d DBD-SQLite-%{V_dbd_sqlite}
  162. %build
  163. %install
  164. rm -rf $RPM_BUILD_ROOT
  165. %{l_prefix}/bin/perl-openpkg prepare
  166. # build and install individual modules
  167. %{l_prefix}/bin/perl-openpkg -d %{SOURCE0} configure build install
  168. %{l_prefix}/bin/perl-openpkg -d %{SOURCE1} configure build install
  169. %{l_prefix}/bin/perl-openpkg -d %{SOURCE2} configure build install
  170. %{l_prefix}/bin/perl-openpkg -d %{SOURCE3} configure build install
  171. %if "%{with_dbd_sqlite}" == "yes"
  172. # build DBD::SQLite
  173. ( cd DBD-SQLite-%{V_dbd_sqlite}
  174. # remove local SQLite sources (we use external one)
  175. # in order to not confuse ExtUtils::MakeMaker
  176. mv ppport.h dbdimp.[ch] SQLiteXS.h ..
  177. rm -f *.[ch] getsqlite.pl
  178. mv ../ppport.h ../dbdimp.[ch] ../SQLiteXS.h .
  179. # substitute paths in patched Makefile.PL
  180. %{l_shtool} subst %{l_value -s -a} Makefile.PL
  181. # perform regular build and install
  182. %{l_prefix}/bin/perl-openpkg configure build install
  183. ) || exit $?
  184. %endif
  185. %if "%{with_dbd_mysql}" == "yes"
  186. # build DBD::mysql
  187. ( cd DBD-mysql-%{V_dbd_mysql}
  188. # (determines MySQL header/lib paths via mysql_config in $PATH)
  189. %{l_prefix}/bin/perl-openpkg configure build install
  190. ) || exit $?
  191. %endif
  192. %if "%{with_dbd_pgsql}" == "yes"
  193. # build DBD::Pg
  194. ( cd DBD-Pg-%{V_dbd_pgsql}
  195. %{l_shtool} subst \
  196. -e 's;/include;/include/postgresql;' \
  197. -e 's;-lpq;-lpq -lssl -lcrypto -lcrypt;' \
  198. Makefile.PL
  199. POSTGRES_HOME=%{l_prefix}
  200. export POSTGRES_HOME
  201. %{l_prefix}/bin/perl-openpkg configure build install
  202. ) || exit $?
  203. %endif
  204. %if "%{with_dbd_oracle}" == "yes"
  205. # build DBD::oracle
  206. ( cd DBD-Oracle-%{V_dbd_oracle}
  207. ORACLE_HOME="`%{l_prefix}/etc/rc --query oracle_home`"
  208. export ORACLE_HOME
  209. case "%{l_platform -t}" in
  210. i?86-linux* )
  211. ;;
  212. sun*-sunos* )
  213. # OpenPKG builds with gcc in 32-bit mode by default
  214. %{l_shtool} subst \
  215. -e 's;demo_rdbms\.mk;demo_rdbms32.mk;g' \
  216. Makefile.PL
  217. ;;
  218. * )
  219. echo "Platform \"%{l_platform -t}\" not supported" 1>&2
  220. exit 1
  221. ;;
  222. esac
  223. %{l_prefix}/bin/perl-openpkg configure build install
  224. ) || exit $?
  225. %endif
  226. %if "%{with_dbd_odbc}" == "yes"
  227. # build DBD::odbc
  228. ( cd DBD-ODBC-%{V_dbd_odbc}
  229. ODBCHOME="%{l_prefix}"
  230. DBROOT=
  231. export ODBCHOME DBROOT
  232. %{l_prefix}/bin/perl-openpkg configure build install
  233. ) || exit $?
  234. %endif
  235. # determine installation files
  236. %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
  237. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
  238. %files -f files
  239. %clean
  240. rm -rf $RPM_BUILD_ROOT