perl-dbi.spec 10 KB

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