Imported Upstream version 3.2.1
[debian/amanda] / packaging / rpm / amanda.spec.src
index 5155879073f8a36c70bd5bd4dec23e1994fa486a..291c44f505c36ec8ed619cedc68efbf32fa46c98 100644 (file)
 
 %{?PKG_CONFIG_PATH:%{echo:PKG_CONFIG_PATH = %{PKG_CONFIG_PATH}}}
 
+# LDFLAGS: newer gnu linkers can use "-Wl,--as-needed", while older ones,
+# like rhel3 and sles9 can't.
+%define LDFLAGS -Wl,--as-needed
+
 # Define which Distribution we are building:
 # Try to detect the distribution we are building:
 %if %{_vendor} == redhat 
         %define disttag fc
         %define distver 3
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "Fedora" && $4 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 4
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "Fedora" && $4 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 5
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "Fedora" && $4 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 6
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "Fedora" && $3 ~ /7.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist fedora
         %define disttag fc
         %define distver 7
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     # if macro cannot have an empty test and we're just testing the existance
     %if %{?fedora:yes}%{!?fedora:no} == yes
         %define distver %{fedora}
        %if %{distver} <= 8
            %define requires_libtermcap Requires: libtermcap.so.2
+           %define curl curl
+       %endif
+       %if %{distver} >= 9
+           %define curl libcurl
        %endif
         %if %{_host_cpu} == x86_64 && %{_target_cpu} == i686
                 # Do nothing if PKG_CONFIG_PATH was set by the user above.
@@ -86,7 +99,9 @@
         %define distver 3
         %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
        %define without_ipv6 --without-ipv6
+       %undefine LDFLAGS
     %endif
     %if %(awk '$1 == "Red" && $7 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define distver 4
         %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "CentOS" && $3 ~ /4.*/ { exit 1; }' /etc/redhat-release; echo $?)
        %define dist redhat
        %define distver 4
        %define tarver 1.14
        %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "Red" && $7 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 5
-       %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
     %endif
     %if %(awk '$1 == "CentOS" && $3 ~ /5.*/ { exit 1; }' /etc/redhat-release; echo $?)
         %define dist redhat
         %define disttag rhel
         %define distver 5
-       %define requires_libtermcap Requires: libtermcap.so.2
+       %define curl curl
+    %endif
+    %if %(awk '$1 == "Red" && $7 ~ /6.*/ { exit 1; }' /etc/redhat-release; echo $?)
+        %define dist redhat
+        %define disttag rhel
+        %define distver 6
+       %define curl libcurl
     %endif
     
     # If dist is undefined, we didn't detect.
     %if %(awk '$1 == "SUSE" { exit 1; }' /etc/SuSE-release; echo $?)
         %define disttag %(awk '$1=="SUSE" {$3=="Enterprise" ? TAG="sles" : TAG="suse" ; print TAG}' /etc/SuSE-release)
         %define distver %(awk '$1=="SUSE" {$3=="Enterprise" ? VER=$5 : VER=$3 ; print VER}' /etc/SuSE-release)
+       # Always use quotes in rpm comparisons if values could be interpreted
+       # as integers.
+       %define curl curl
+       %if "%{distver}" == "9"
+           %undefine LDFLAGS
+       %endif
     %endif
 %endif
 
@@ -187,8 +216,8 @@ BuildRequires: readline
 # Note: newer distros have changed most *-devel to lib*-devel, and added a
 # provides tag for backwards compat.
 BuildRequires: readline-devel
-BuildRequires: curl >= 7.10.0
-BuildRequires: curl-devel >= 7.10.0
+BuildRequires: %{curl} >= 7.10.0
+BuildRequires: %{curl}-devel >= 7.10.0
 BuildRequires: openssl
 BuildRequires: openssl-devel
 BuildRequires: perl(ExtUtils::Embed)
@@ -202,10 +231,7 @@ Requires: /usr/sbin/usermod
 Requires: fileutils
 Requires: grep
 Requires: gnuplot
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
-Requires: curl >= 7.10.0
+Requires: %{curl} >= 7.10.0
 Requires: openssl
 Requires: xinetd
 Requires: perl >= 5.6.0
@@ -223,9 +249,6 @@ Requires: grep
 %{?requires_libtermcap}
 %{?requires_initscripts}
 Requires: xinetd
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
 Requires: perl >= 5.6.0
 Requires: tar >= %{tarver}
 Requires: readline
@@ -242,9 +265,6 @@ Group: %{rpm_group}
 Requires: /bin/awk
 Requires: fileutils
 Requires: grep
-Requires: libc.so.6
-Requires: libm.so.6
-Requires: libnsl.so.1
 %{?requires_libtermcap}
 %{?requires_initscripts}
 Requires: xinetd
@@ -348,9 +368,11 @@ Amanda Documentation is available at: http://wiki.zmanda.com/
 # Set PKG_CONFIG_PATH=some/path if some/path was set on the command line, or by 
 # the platform detection bits.
 # without_ipv6 should only be defined on rhel3.
+# LDFLAGS macro is defined except on rhel3.
 ./configure \
         %{?PKG_CONFIG_PATH: PKG_CONFIG_PATH=%PKG_CONFIG_PATH} \
         CFLAGS="%{optflags} -g -pipe" CXXFLAGS="%{optflags}" \
+        %{?LDFLAGS:LDFLAGS="${LDFLAGS} %{?LDFLAGS:%LDFLAGS}"} \
         --quiet \
         --prefix=%{PREFIX} \
         --sysconfdir=%{SYSCONFDIR} \