From: PLI <philippe.libat@free.fr>
Date: 28-Mar-2007
Subject: fix build conditionnal perl module and add c++ build

fix --args params to pass correct LIBS and INC
add conditionnal c++ bindings

regards.

--- qdbm.spec.orig	2007-03-28 19:30:32.000000000 +0200
+++ qdbm.spec	2007-03-28 20:55:39.000000000 +0200
@@ -38,9 +38,11 @@
 #   package options
 %option       with_ndbm  no
 %option       with_perl  no
+%option       with_cxx   no
 
 #   list of sources
 Source0:      http://qdbm.sourceforge.net/qdbm-%{version}.tar.gz
+Patch:        qdbm.patch
 
 #   build information
 Prefix:       %{l_prefix}
@@ -72,6 +74,7 @@
 
 %prep
     %setup -q
+    %patch0 -p0
 
 %build
     ( echo "ac_cv_lib_iconv_main=no"
@@ -88,12 +91,39 @@
         --enable-nowarn
     %{l_make} %{l_mflags -O} \
         MYLIBS="libqdbm.a"
+%if "%{with_cxx}" == "yes"
+    ( cd plus
+    CC="%{l_cc}" \
+    CFLAGS="%{l_cflags -O}" \
+    CXX="%{l_cxx}" \
+    CXXFLAGS="%{l_cxxflags}" \
+    ./configure \
+        --cache-file=../config.cache \
+        --prefix=%{l_prefix} \
+        --includedir=%{l_prefix}/include/qdbm \
+        --disable-zlib \
+        --disable-iconv \
+        --disable-shared \
+        --enable-static \
+        --enable-nowarn
+    %{l_make} %{l_mflags -O} \
+        MYLIBS="libxqdbm.a"
+    ) || exit $?
+%endif
 
 %install
     rm -rf $RPM_BUILD_ROOT
     %{l_make} %{l_mflags} install \
         DESTDIR=$RPM_BUILD_ROOT \
         MYLIBS="libqdbm.a"
+%if "%{with_cxx}" == "yes"
+    ( cd plus
+      %{l_make} %{l_mflags} install \
+        DESTDIR=$RPM_BUILD_ROOT \
+        MYLIBS="libxqdbm.a"
+    ) || exit $?
+    rm -fr $RPM_BUILD_ROOT%{l_prefix}/share/qdbm/plus*
+%endif
     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
     rm -f $RPM_BUILD_ROOT%{l_prefix}/share/qdbm/[A-Z]*
     rm -f $RPM_BUILD_ROOT%{l_prefix}/share/qdbm/spex-ja.html
@@ -108,12 +138,12 @@
     for dir in depot curia villa; do
         ( cd perl/$dir
           %{l_prefix}/bin/perl-openpkg \
-              --args CC="%{l_cc}" \
-              --args OPTIMIZE="%{l_cflags}" \
-              --args INC="-I../.. %{l_cppflags}" \
-              --args LD="%{l_cc}" \
-              --args LIBS="-L../.. %{l_ldflags} -lqdbm" \
-              --args PREFIX="%{l_prefix}" \
+              --args PREFIX=%{l_prefix} \
+              --args CC=%{l_cc} \
+              --args LD=%{l_cc} \
+              --args "OPTIMIZE='%{l_cflags -O}'" \
+              --args "INC='-I../.. %{l_cppflags}'" \
+              --args "LIBS='-L../.. %{l_ldflags} -lqdbm'" \
               configure build install
         ) || exit $?
     done
--- /dev/null	2007-03-28 14:21:39.480206000 +0200
+++ qdbm.patch	2007-03-28 19:41:14.000000000 +0200
@@ -0,0 +1,39 @@
+--- ./perl/depot/Makefile.PL.orig	2007-03-28 19:23:05.000000000 +0200
++++ ./perl/depot/Makefile.PL	2007-03-28 19:39:42.000000000 +0200
+@@ -10,8 +10,10 @@
+ WriteMakefile(
+     'NAME'		=> 'Depot',
+     'VERSION_FROM'	=> 'Depot.pm',
++    EXE_FILES           => ['pldptest'],
+ );
+ 
+ 
+ 
+ # END OF FILE
++
+--- ./perl/curia/Makefile.PL.orig	2007-03-28 19:23:09.000000000 +0200
++++ ./perl/curia/Makefile.PL	2007-03-28 19:38:55.000000000 +0200
+@@ -10,8 +10,10 @@
+ WriteMakefile(
+     'NAME'		=> 'Curia',
+     'VERSION_FROM'	=> 'Curia.pm',
++    EXE_FILES           => ['plcrtest'],
+ );
+ 
+ 
+ 
+ # END OF FILE
++
+--- ./perl/villa/Makefile.PL.orig	2007-03-28 19:23:13.000000000 +0200
++++ ./perl/villa/Makefile.PL	2007-03-28 19:40:07.000000000 +0200
+@@ -10,8 +10,10 @@
+ WriteMakefile(
+     'NAME'		=> 'Villa',
+     'VERSION_FROM'	=> 'Villa.pm',
++    EXE_FILES           => ['plvltest'],
+ );
+ 
+ 
+ 
+ # END OF FILE
++
