perl-dbi.spec 11 KB

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