##
## perl-dbi.spec -- OpenPKG RPM Specification
## Copyright (c) 2000-2004 The OpenPKG Project
## Copyright (c) 2000-2004 Ralf S. Engelschall
## Copyright (c) 2000-2004 Cable & Wireless
##
## Permission to use, copy, modify, and distribute this software for
## any purpose with or without fee is hereby granted, provided that
## the above copyright notice and this permission notice appear in all
## copies.
##
## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
## SUCH DAMAGE.
##
# versions of individual parts
%define V_perl 5.8.4
%define V_dbi 1.43
%define V_sql_statement 1.09
%define V_dbd_anydata 0.08
%define V_dbd_sprite 0.50
%define V_dbd_sqlite 0.31
%define V_dbd_mysql 2.9003
%define V_dbd_pgsql 1.32
%define V_dbd_oracle 1.15
%define V_dbd_odbc 1.09
# package information
Name: perl-dbi
Summary: Perl Modules for use with DBI API
URL: http://www.cpan.org/
Vendor: Perl Community
Packager: The OpenPKG Project
Distribution: OpenPKG
Class: BASE
Group: Language
License: GPL/Artistic
Version: %{V_perl}
Release: 20040826
# package options
%option with_dbd_mysql no
%option with_dbd_pgsql no
%option with_dbd_oracle no
%option with_dbd_odbc no
# list of sources
Source0: http://www.cpan.org/modules/by-module/DBI/DBI-%{V_dbi}.tar.gz
Source1: http://www.cpan.org/modules/by-module/SQL/SQL-Statement-%{V_sql_statement}.tar.gz
Source2: http://www.cpan.org/modules/by-module/DBD/DBD-AnyData-%{V_dbd_anydata}.tar.gz
Source3: http://www.cpan.org/modules/by-module/DBD/DBD-Sprite-%{V_dbd_sprite}.tar.gz
Source4: http://www.cpan.org/modules/by-module/DBD/DBD-SQLite-%{V_dbd_sqlite}.tar.gz
Source5: http://www.cpan.org/modules/by-module/DBD/DBD-mysql-%{V_dbd_mysql}.tar.gz
Source6: http://www.cpan.org/modules/by-module/DBD/DBD-Pg-%{V_dbd_pgsql}.tar.gz
Source7: http://www.cpan.org/modules/by-module/DBD/DBD-Oracle-%{V_dbd_oracle}.tar.gz
Source8: http://www.cpan.org/modules/by-module/DBD/DBD-ODBC-%{V_dbd_odbc}.tar.gz
# build information
Prefix: %{l_prefix}
BuildRoot: %{l_buildroot}
BuildPreReq: OpenPKG, openpkg >= 2.1.0, perl >= %{V_perl}, perl-openpkg >= %{V_perl}-2.1.0
PreReq: OpenPKG, openpkg >= 2.1.0, perl >= %{V_perl}
BuildPreReq: perl-net
PreReq: perl-net
%if "%{with_dbd_mysql}" == "yes"
BuildPreReq: mysql
PreReq: mysql
%endif
%if "%{with_dbd_pgsql}" == "yes"
BuildPreReq: postgresql
PreReq: postgresql
%endif
%if "%{with_dbd_oracle}" == "yes"
BuildPreReq: ORACLE
PreReq: ORACLE
%endif
%if "%{with_dbd_odbc}" == "yes"
BuildPreReq: unixodbc
PreReq: unixodbc
%endif
AutoReq: no
AutoReqProv: no
%description
Various modules for using the DBI API of Perl:
- DBI (%{V_dbi})
- SQL::Statement (%{V_sql_statement})
- DBD::AnyData (%{V_dbd_anydata})
- DBD::Sprite (%{V_dbd_sprite})
- DBD::SQLite (%{V_dbd_sqlite})
- DBD::mysql (%{V_dbd_mysql}) [%{with_dbd_mysql}]
- DBD::Pg (%{V_dbd_pgsql}) [%{with_dbd_pgsql}]
- DBD::Oracle (%{V_dbd_oracle}) [%{with_dbd_oracle}]
- DBD::ODBC (%{V_dbd_odbc}) [%{with_dbd_odbc}]
%track
prog perl-dbi:DBD-AnyData = {
version = %{V_dbd_anydata}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-AnyData-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-mysql = {
version = %{V_dbd_mysql}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-mysql-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-ODBC = {
version = %{V_dbd_odbc}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-ODBC-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-Oracle = {
version = %{V_dbd_oracle}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-Oracle-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-Pg = {
version = %{V_dbd_pgsql}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-Pg-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-Sprite = {
version = %{V_dbd_sprite}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-Sprite-(__VER__)\.tar\.gz
}
prog perl-dbi:DBD-SQLite = {
version = %{V_dbd_sqlite}
url = http://www.cpan.org/modules/by-module/DBD/
regex = DBD-SQLite-(__VER__)\.tar\.gz
}
prog perl-dbi:DBI = {
version = %{V_dbi}
url = http://www.cpan.org/modules/by-module/DBI/
regex = DBI-(\d+\.\d\d)\.tar\.gz
}
prog perl-dbi:SQL-Statement = {
version = %{V_sql_statement}
url = http://www.cpan.org/modules/by-module/SQL/
regex = SQL-Statement-(__VER__)\.tar\.gz
}
%prep
%setup -q -c
%setup -q -T -D -a 1
%setup -q -T -D -a 2
%setup -q -T -D -a 3
%setup -q -T -D -a 4
%setup -q -T -D -a 5
%setup -q -T -D -a 6
%setup -q -T -D -a 7
%setup -q -T -D -a 8
%build
%install
rm -rf $RPM_BUILD_ROOT
%{l_prefix}/bin/perl-openpkg prepare
# build and install individual modules
%{l_prefix}/bin/perl-openpkg -d %{SOURCE0} configure build install
%{l_prefix}/bin/perl-openpkg -d %{SOURCE1} configure build install
%{l_prefix}/bin/perl-openpkg -d %{SOURCE2} configure build install
%{l_prefix}/bin/perl-openpkg -d %{SOURCE3} configure build install
%{l_prefix}/bin/perl-openpkg -d %{SOURCE4} configure build install
%if "%{with_dbd_mysql}" == "yes"
# build DBD::mysql
( cd DBD-mysql-%{V_dbd_mysql}
# (determines MySQL header/lib paths via mysql_config in $PATH)
) || exit $?
%{l_prefix}/bin/perl-openpkg -d DBD-mysql-%{V_dbd_mysql} configure build install
%endif
%if "%{with_dbd_pgsql}" == "yes"
# build DBD::Pg
( cd DBD-Pg-%{V_dbd_pgsql}
%{l_shtool} subst \
-e 's;/include;/include/postgresql;' \
-e 's;-lpq;-lpq -lssl -lcrypto -lcrypt;' \
Makefile.PL
POSTGRES_HOME=%{l_prefix}
export POSTGRES_HOME
%{l_prefix}/bin/perl-openpkg configure build install
) || exit $?
%endif
%if "%{with_dbd_oracle}" == "yes"
# build DBD::oracle
( cd DBD-Oracle-%{V_dbd_oracle}
ORACLE_HOME="`%{l_prefix}/etc/rc --query oracle_home`"
export ORACLE_HOME
# case "%{l_platform -t}" in
# i?86-linux* )
# ;;
# sun*-sunos* )
# # OpenPKG builds with gcc in 32-bit mode by default
# %{l_shtool} subst \
# -e 's;demo_rdbms\.mk;demo_rdbms32.mk;g' \
# Makefile.PL
# ;;
# * )
# echo "Platform \"%{l_platform -t}\" not supported" 1>&2
# exit 1
# ;;
# esac
%{l_prefix}/bin/perl-openpkg configure build install
) || exit $?
%endif
%if "%{with_dbd_odbc}" == "yes"
# build DBD::odbc
( cd DBD-ODBC-%{V_dbd_odbc}
ODBCHOME="%{l_prefix}"
DBROOT=
export ODBCHOME DBROOT
%{l_prefix}/bin/perl-openpkg configure build install
) || exit $?
%endif
%{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
%{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
%files -f files
%clean
rm -rf $RPM_BUILD_ROOT