@@ -174,10 +174,25 @@ BuildRequires: (libfreeipmi-devel or freeipmi-devel)
174174%define NUTPKG_WITH_FREEIPMI 0
175175%endif
176176
177- BuildRequires: gcc-c++
177+ %if ( 0%{?rhel_version }>= 800 || ! 0%{?rhel_version } ) && ( 0%{?rhel }>= 8 || ! 0%{?rhel } )
178+ # Not in RHEL7
179+ %define NUTPKG_WITH_LIBGD 1
178180BuildRequires: gd-devel
181+ %else
182+ %define NUTPKG_WITH_LIBGD 0
183+ %endif
184+
185+ BuildRequires: gcc-c++
179186BuildRequires: libtool
187+
188+ %if ( 0%{?rhel_version }>= 800 || ! 0%{?rhel_version } ) && ( 0%{?rhel }>= 8 || ! 0%{?rhel } )
189+ # Not in RHEL7
190+ %define NUTPKG_WITH_LTDL 1
180191BuildRequires: libtool-ltdl-devel
192+ %else
193+ %define NUTPKG_WITH_LTDL 0
194+ %endif
195+
181196# libusb-0.1 or libusb-1.0:
182197BuildRequires: (libusb-devel or libusbx-devel)
183198#!Prefer: libusbx-devel
@@ -334,6 +349,7 @@ interface for monitoring and administering UPS hardware.
334349Detailed information about supported hardware can be found in
335350%{_docdir }/nut.
336351
352+ %if 0%{?NUTPKG_WITH_LTDL }
337353%package -n libnutscan%{SO_MAJOR_LIBNUTSCAN }
338354Summary: Network UPS Tools Library (Uninterruptible Power Supply Monitoring)
339355Group: System/Libraries
@@ -364,7 +380,9 @@ interface for monitoring and administering UPS hardware.
364380Detailed information about supported hardware can be found in
365381%{_docdir }/nut.
366382%endif
383+ %endif
367384
385+ %if 0%{?NUTPKG_WITH_LIBGD }
368386%package cgi
369387Summary: Network UPS Tools Web Server Support (UPS Status Pages)
370388Group: Hardware/UPS
@@ -380,6 +398,7 @@ interface for monitoring and administering UPS hardware.
380398
381399Detailed information about supported hardware can be found in
382400%{_docdir }/nut.
401+ %endif
383402
384403%package monitor
385404Summary: Network UPS Tools Web Server Support (GUI client)
@@ -582,6 +601,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro
582601
583602%postun -n libnutclientstub%{SO_MAJOR_LIBNUTCLIENTSTUB } -p /sbin/ldconfig
584603
604+ %if 0%{?NUTPKG_WITH_LTDL } > 0
585605%post -n libnutscan%{SO_MAJOR_LIBNUTSCAN } -p /sbin/ldconfig
586606
587607%postun -n libnutscan%{SO_MAJOR_LIBNUTSCAN } -p /sbin/ldconfig
@@ -590,7 +610,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro
590610%post -n libnutconf%{SO_MAJOR_LIBNUTCONF } -p /sbin/ldconfig
591611
592612%postun -n libnutconf%{SO_MAJOR_LIBNUTCONF } -p /sbin/ldconfig
593-
613+ %endif
594614%endif
595615
596616%files
@@ -754,6 +774,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro
754774%defattr(-,root,root)
755775%{_libdir }/libnutclientstub.so.*
756776
777+ %if 0%{?NUTPKG_WITH_LTDL }
757778%files -n libnutscan%{SO_MAJOR_LIBNUTSCAN }
758779%defattr(-,root,root)
759780%{_libdir }/libnutscan.so.*
@@ -763,7 +784,9 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro
763784%defattr(-,root,root)
764785%{_libdir }/libnutconf.so.*
765786%endif
787+ %endif
766788
789+ %if 0%{?NUTPKG_WITH_LIBGD }
767790%files cgi
768791%defattr(-,root,root)
769792%dir %{CGIPATH }
@@ -772,6 +795,7 @@ if [ -x /sbin/udevadm ] ; then /sbin/udevadm trigger --subsystem-match=usb --pro
772795%{HTMLPATH }/*
773796%config(noreplace) %{CONFPATH }/upsstats-single.html
774797%config(noreplace) %{CONFPATH }/upsstats.html
798+ %endif
775799
776800%files monitor
777801%defattr(-,root,root)
0 commit comments