perl-dbi.spec 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. ##
  2. ## perl-dbi.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2002 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2002 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2002 Ralf S. Engelschall <rse@engelschall.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_dbi 1.30
  27. %define V_sql_statement 1.004
  28. %define V_dbd_anydata 0.05
  29. %define V_dbd_sprite 0.40
  30. %define V_dbd_sqlite 0.20
  31. %define V_dbd_mysql 2.1020
  32. %define V_dbd_pg 1.13
  33. %define V_dbd_oracle 1.12
  34. # package options
  35. %ifndef with_dbd_mysql
  36. %define with_dbd_mysql no
  37. %endif
  38. %ifndef with_dbd_pg
  39. %define with_dbd_pg no
  40. %endif
  41. %ifndef with_dbd_oracle
  42. %define with_dbd_oracle no
  43. %endif
  44. # package information
  45. Name: perl-dbi
  46. Summary: Perl Modules for use with DBI API
  47. URL: http://www.cpan.org/
  48. Vendor: Perl Community
  49. Packager: The OpenPKG Project
  50. Distribution: OpenPKG [BASE]
  51. Group: Language
  52. License: GPL/Artistic
  53. Version: 20021017
  54. Release: 20021017
  55. # list of sources
  56. Source0: http://www.cpan.org/modules/by-module/DBI/DBI-%{V_dbi}.tar.gz
  57. Source1: http://www.cpan.org/modules/by-module/SQL/SQL-Statement-%{V_sql_statement}.tar.gz
  58. Source2: http://www.cpan.org/modules/by-module/DBD/DBD-AnyData-%{V_dbd_anydata}.tar.gz
  59. Source3: http://www.cpan.org/modules/by-module/DBD/DBD-Sprite-%{V_dbd_sprite}.tar.gz
  60. Source4: http://www.cpan.org/modules/by-module/DBD/DBD-SQLite-%{V_dbd_sqlite}.tar.gz
  61. Source5: http://www.cpan.org/modules/by-module/DBD/DBD-mysql-%{V_dbd_mysql}.tar.gz
  62. Source6: http://www.cpan.org/modules/by-module/DBD/DBD-Pg-%{V_dbd_pg}.tar.gz
  63. Source7: http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-%{V_dbd_oracle}.tar.gz
  64. # build information
  65. Prefix: %{l_prefix}
  66. BuildRoot: %{l_buildroot}
  67. BuildPreReq: OpenPKG, openpkg >= 20020206, perl
  68. PreReq: OpenPKG, openpkg >= 20020206, perl
  69. %if "%{with_dbd_mysql}" == "yes"
  70. BuildPreReq: mysql
  71. PreReq: mysql
  72. %endif
  73. %if "%{with_dbd_pg}" == "yes"
  74. BuildPreReq: postgresql
  75. PreReq: postgresql
  76. %endif
  77. AutoReq: no
  78. AutoReqProv: no
  79. %description
  80. Various modules for using the DBI API of Perl:
  81. - DBI (%{V_dbi})
  82. - SQL::Statement (%{V_sql_statement})
  83. - DBD::AnyData (%{V_dbd_anydata})
  84. - DBD::Sprite (%{V_dbd_csv})
  85. - DBD::SQLite (%{V_dbd_sqlite})
  86. - DBD::mysql (%{V_dbd_mysql}) [with_dbd_mysql=%{V_with_dbd_mysql}]
  87. - DBD::Pg (%{V_dbd_pg}) [with_dbd_pg=%{V_with_dbd_pg}]
  88. - DBD::Oracle (%{V_dbd_oracle}) [with_dbd_oracle=%{V_with_dbd_oracle}]
  89. Options:
  90. --define 'with_dbd_mysql %{with_dbd_mysql}' \
  91. --define 'with_dbd_pg %{with_dbd_pg}' \
  92. --define 'with_dbd_oracle %{with_dbd_oracle}'
  93. %prep
  94. %setup0 -q -c -n %{name}-%{version}
  95. %setup1 -q -T -D -a 1
  96. %setup2 -q -T -D -a 2
  97. %setup3 -q -T -D -a 3
  98. %setup4 -q -T -D -a 4
  99. %if "%{with_dbd_mysql}" == "yes"
  100. %setup5 -q -T -D -a 5
  101. %endif
  102. %if "%{with_dbd_pg}" == "yes"
  103. %setup6 -q -T -D -a 6
  104. %endif
  105. %if "%{with_dbd_oracle}" == "yes"
  106. %setup7 -q -T -D -a 7
  107. %endif
  108. %build
  109. # no-op
  110. %install
  111. rm -rf $RPM_BUILD_ROOT
  112. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/lib/perl5
  113. # create a wrapper script which finds the includes
  114. eval `%{l_prefix}/bin/perl -V:version -V:archname`
  115. perl=$RPM_BUILD_ROOT/perl
  116. echo "#!/bin/sh" >$perl
  117. echo "exec %{l_prefix}/bin/perl \\" >>$perl
  118. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version} \\" >>$perl
  119. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/${version}/${archname} \\" >>$perl
  120. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl \\" >>$perl
  121. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version} \\" >>$perl
  122. echo " -I$RPM_BUILD_ROOT%{l_prefix}/lib/perl5/site_perl/${version}/${archname} \\" >>$perl
  123. echo " \"\$@\"" >>$perl
  124. chmod a+x $perl
  125. # determine general tools and arguments
  126. perlargs="PREFIX=$RPM_BUILD_ROOT%{l_prefix} PERL=$perl FULLPERL=$perl"
  127. make="%{l_make} %{l_mflags}"
  128. makeargs="PERL=$perl FULLPERL=$perl"
  129. # ensure we can write where we want to
  130. find . -exec chmod ug+w {} \;
  131. # make sure our Perl is used
  132. %{l_shtool} subst \
  133. -e "s:\$^X:'$perl':g" \
  134. `find . -name Makefile.PL -print`
  135. # build DBI modules
  136. ( cd DBI-%{V_dbi}
  137. $perl Makefile.PL $perlargs
  138. $make $makeargs all
  139. $make $makeargs install
  140. )
  141. # build SQL::Statement
  142. ( cd SQL-Statement-%{V_sql_statement}
  143. $perl Makefile.PL $perlargs
  144. $make $makeargs all
  145. $make $makeargs install
  146. )
  147. # build DBD::AnyData
  148. ( cd DBD-AnyData-%{V_dbd_anydata}
  149. $perl Makefile.PL $perlargs
  150. $make $makeargs all
  151. $make $makeargs install
  152. )
  153. # build DBD::Sprite
  154. ( cd DBD-Sprite-%{V_dbd_sprite}
  155. $perl Makefile.PL $perlargs
  156. $make $makeargs all
  157. $make $makeargs install
  158. )
  159. # build DBD::SQLite
  160. ( cd DBD-SQLite-%{V_dbd_sqlite}
  161. # (contains a copy of SQLite, so does not depend on "sqlite" package)
  162. $perl Makefile.PL $perlargs
  163. $make $makeargs all
  164. $make $makeargs install
  165. )
  166. %if "%{with_dbd_mysql}" == "yes"
  167. # build DBD::mysql
  168. ( cd DBD-mysql-%{V_dbd_mysql}
  169. # (determines MySQL header/lib paths via mysql_config in $PATH)
  170. $perl Makefile.PL $perlargs
  171. $make $makeargs all
  172. $make $makeargs install
  173. )
  174. %endif
  175. %if "%{with_dbd_pg}" == "yes"
  176. # build DBD::Pg
  177. ( cd DBD-Pg-%{V_dbd_pg}
  178. POSTGRES_HOME=%{l_prefix}
  179. export POSTGRES_HOME
  180. $perl Makefile.PL $perlargs
  181. $make $makeargs all
  182. $make $makeargs install
  183. )
  184. %endif
  185. %if "%{with_dbd_oracle}" == "yes"
  186. # build DBD::oracle
  187. ( cd DBD-Oracle-%{V_dbd_oracle}
  188. ORACLE_HOME=${ORACLE_HOME-%{l_prefix}}
  189. export ORACLE_HOME
  190. $perl Makefile.PL $perlargs
  191. $make $makeargs all
  192. $make $makeargs install
  193. )
  194. %endif
  195. # clean up
  196. find $RPM_BUILD_ROOT%{l_prefix} -name perllocal.pod -print | xargs rm -f
  197. find $RPM_BUILD_ROOT%{l_prefix} -name .packlist -print | xargs rm -f
  198. find $RPM_BUILD_ROOT%{l_prefix} -type d -depth -print | (xargs rmdir >/dev/null 2>&1 || true)
  199. # avoid conflicts
  200. eval `$perl -V:installarchlib -V:installprivlib -V:installsitearch -V:installsitelib`
  201. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  202. %{l_files_std} \
  203. '%not %dir %{l_prefix}/lib/perl5' \
  204. '%not %dir %{l_prefix}/lib/perl5/*' \
  205. "%not %dir $installarchlib" \
  206. "%not %dir $installprivlib" \
  207. "%not %dir $installsitearch" \
  208. "%not %dir $installsitelib" \
  209. "%not %dir $installarchlib/auto" \
  210. "%not %dir $installprivlib/auto" \
  211. "%not %dir $installsitearch/auto" \
  212. "%not %dir $installsitelib/auto"
  213. %files -f files
  214. %clean
  215. rm -rf $RPM_BUILD_ROOT