perl-dbi.spec 9.7 KB

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