Parcourir la source

add optional BDB module

Ralf S. Engelschall il y a 17 ans
Parent
commit
f95cb43407
1 fichiers modifiés avec 29 ajouts et 4 suppressions
  1. 29 4
      perl-db/perl-db.spec

+ 29 - 4
perl-db/perl-db.spec

@@ -24,6 +24,7 @@
 #   versions of individual parts
 %define       V_perl           5.10.0
 %define       V_berkeleydb     0.34
+%define       V_bdb            1.6
 %define       V_db_file        1.817
 %define       V_db_file_lock   0.05
 
@@ -38,12 +39,16 @@ Class:        BASE
 Group:        Perl
 License:      GPL/Artistic
 Version:      %{V_perl}
-Release:      20080331
+Release:      20080708
+
+#   package options
+%option       with_pthreads  no
 
 #   list of sources
 Source0:      http://www.cpan.org/modules/by-module/BerkeleyDB/BerkeleyDB-%{V_berkeleydb}.tar.gz
-Source1:      http://www.cpan.org/modules/by-module/DB_File/DB_File-%{V_db_file}.tar.gz
-Source2:      http://www.cpan.org/modules/by-module/DB_File/DB_File-Lock-%{V_db_file_lock}.tar.gz
+Source1:      http://www.cpan.org/authors/id/M/ML/MLEHMANN/BDB-%{V_bdb}.tar.gz
+Source2:      http://www.cpan.org/modules/by-module/DB_File/DB_File-%{V_db_file}.tar.gz
+Source3:      http://www.cpan.org/modules/by-module/DB_File/DB_File-Lock-%{V_db_file_lock}.tar.gz
 Patch0:       perl-db.patch
 
 #   build information
@@ -53,12 +58,17 @@ BuildPreReq:  OpenPKG, openpkg >= 20040130, perl >= %{V_perl}, perl-openpkg >= %
 PreReq:       OpenPKG, openpkg >= 20040130, perl >= %{V_perl}
 BuildPreReq:  db >= 4.1.24
 PreReq:       db >= 4.1.24
+%if "%{with_pthreads}" == "yes"
+BuildPreReq:  db::with_pthreads = yes
+PreReq:       db::with_pthreads = yes
+%endif
 AutoReq:      no
 AutoReqProv:  no
 
 %description
     Various modules for using the Berkeley-DB library from within Perl:
     - BerkeleyDB (%{V_berkeleydb})
+    - BDB (%{V_bdb})
     - DB_File (%{V_db_file})
     - DB_File::Lock (%{V_db_file_lock})
 
@@ -68,6 +78,11 @@ AutoReqProv:  no
         url       = http://www.cpan.org/modules/by-module/BerkeleyDB/
         regex     = BerkeleyDB-(__VER__)\.tar\.gz
     }
+    prog perl-db:BDB = {
+        version   = %{V_bdb}
+        url       = http://www.cpan.org/authors/id/M/ML/MLEHMANN/
+        regex     = BDB-(__VER__)\.tar\.gz
+    }
     prog perl-db:DB_File = {
         version   = %{V_db_file}
         url       = http://www.cpan.org/modules/by-module/DB_File/
@@ -83,6 +98,7 @@ AutoReqProv:  no
     %setup -q -c
     %setup -q -T -D -a 1
     %setup -q -T -D -a 2
+    %setup -q -T -D -a 3
     %patch -p0
 
 %build
@@ -99,6 +115,15 @@ AutoReqProv:  no
     ) || exit $?
     %{l_prefix}/bin/perl-openpkg -d BerkeleyDB-%{V_berkeleydb} configure build install
 
+    #   build BDB
+%if "%{with_pthreads}" == "yes"
+    %{l_shtool} subst \
+        -e 's;$INC = "";$INC = "%{l_cppflags} -pthread";' \
+        -e 's;-lpthread -ldb;%{l_ldflags} -pthread -ldb;' \
+        BDB-%{V_bdb}/Makefile.PL
+    %{l_prefix}/bin/perl-openpkg -d BDB-%{V_bdb} configure build install
+%endif
+
     #   build DB_File
     ( cd DB_File-%{V_db_file}
       ( echo "PREFIX = size_t"
@@ -110,7 +135,7 @@ AutoReqProv:  no
     ) || exit $?
     %{l_prefix}/bin/perl-openpkg -d DB_File-%{V_db_file} 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 -F perl-openpkg-files fixate cleanup
     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`