Blob Blame History Raw
%ifarch x86_64 i686
%bcond_without ddcpci
%else
%bcond_with ddcpci
%endif

%global git_commit c3af663de0ebae2d899469f2de7f9a4a128ff5ed
%global git_date 20120904

%global git_short_commit %(echo %{git_commit} | cut -c -8)
%global git_suffix %{git_date}git%{git_short_commit}

# git clone git://ddccontrol.git.sourceforge.net/gitroot/ddccontrol/%%{name}
# cd %%{name}
# git archive --format=tar --prefix=%%{name}-%%{version}/ %%{git_commit} | \
# bzip2 > ../%%{name}-%%{version}-%%{git_suffix}.tar.bz2


Name:             ddccontrol
URL:              http://ddccontrol.sourceforge.net/
Version:          0.4.2
Release:          13.%{git_suffix}%{?dist}
License:          GPLv2+
BuildRequires:    gtk2-devel, pkgconfig, pciutils-devel, desktop-file-utils
BuildRequires:    perl(XML::Parser), gettext, libtool, libxml2-devel, tidy
BuildRequires:    libX11-devel, xml-common, libxslt, libXt-devel
BuildRequires:    docbook-style-xsl, gettext-devel, intltool
Requires:         ddccontrol-db
Requires(post):   /sbin/modprobe
Requires(post):   /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Group:            Applications/System
Summary:          Control your monitor by software using the DDC/CI protocol
#Source0:          http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
Source0:          %{name}-%{version}-%{git_suffix}.tar.bz2
# autoload i2c-dev module
Source1:          %{name}-modules-autoload.conf
# use autopoint instead of gettextize that is interactive tool
Patch0:           %{name}-autopoint.patch
# no monitors on s390(x)
ExcludeArch:      s390 s390x

%description
DDCcontrol is a program to control monitor parameters, like brightness and
contrast, by software, i.e. without using the OSD (On Screen Display) and
the monitor HW controls.

%package gtk
Summary:        GTK GUI for ddccontrol
Group:          Applications/System
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       hicolor-icon-theme

%description gtk
This package provides the GTK graphical user interface for ddccontrol.

%package doc
Summary:        Documentation files for ddccontrol
Group:          Applications/System
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch

%description doc
Documentation files for ddccontrol.

%package devel
Summary:        Development files for ddccontrol
Group:          Applications/System
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description devel
Development files for ddccontrol.

%prep
%setup -q
%patch0 -p1 -b .autopoint

./autogen.sh

%build
# applet is not supported on Gnome 3
%configure --enable-doc --disable-gnome-applet --prefix=%{_prefix} \
  --exec-prefix=%{_exec_prefix} --disable-rpath %{!?with_ddcpci:--disable-ddcpci}

# kill rpaths
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

# use as-needed to remove unused-direct-shlib-dependency
sed -i -e 's! -shared ! -Wl,--as-needed\0!g' libtool

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} libdir=%{_libdir}

desktop-file-validate %{buildroot}%{_datadir}/applications/gddccontrol.desktop

# autoload i2c-dev module
install -m 644 -D %{SOURCE1} %{buildroot}%{_prefix}/lib/modules-load.d/%{name}.conf

# move html to subdir
mkdir %{buildroot}%{_docdir}/%{name}/html
mv %{buildroot}%{_docdir}/%{name}/*.html %{buildroot}%{_docdir}/%{name}/html

# remove static and *.la files
rm -f %{buildroot}%{_libdir}/{*.a,*.la}

# remove Bluecurve icon (duplicate of the hicolor one)
rm -rf %{buildroot}%{_datadir}/icons/Bluecurve

%find_lang %{name}

%post
/sbin/ldconfig

# autoload i2c-dev module
/sbin/modprobe i2c-dev &>/dev/null || :

%postun -p /sbin/ldconfig

%post gtk
/bin/touch --no-create %{_datadir}/icons/{hicolor,Bluecurve} &>/dev/null || :

%postun gtk
if [ $1 -eq 0 ] ; then
    /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    /bin/touch --no-create %{_datadir}/icons/Bluecurve &>/dev/null
    /usr/bin/gtk-update-icon-cache -f %{_datadir}/icons/hicolor &>/dev/null || :
    /usr/bin/gtk-update-icon-cache -f %{_datadir}/icons/Bluecurve &>/dev/null || :
fi

%posttrans gtk
/usr/bin/gtk-update-icon-cache -f %{_datadir}/icons/hicolor &>/dev/null || :
/usr/bin/gtk-update-icon-cache -f %{_datadir}/icons/Bluecurve &>/dev/null || :

%files -f %{name}.lang
%doc AUTHORS COPYING NEWS README TODO
%exclude %{_docdir}/%{name}/html
%{_bindir}/ddccontrol
%if 0%{?with_ddcpci}
%attr(0755,root,root) %{_bindir}/ddcpci
%endif
%{_prefix}/lib/modules-load.d/%{name}.conf
%{_libdir}/lib*.so.*
%{_mandir}/man1/ddccontrol.1*

%files gtk
%{_bindir}/gddccontrol
%{_mandir}/man1/gddccontrol.1*
%{_datadir}/icons/hicolor/*/apps/*.png
%{_datadir}/applications/*

%files doc
%doc %{_docdir}/%{name}/html

%files devel
%{_includedir}/%{name}
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/%{name}.pc

%changelog
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.4.2-13.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-12.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Dec 16 2014 Jaroslav Škarvada <jskarvad@redhat.com> - 0.4.2-11.20120904gitc3af663d
- Conditionalized ddcpci build, it is build only on i686, x86_64 architectures
- Fixed icons packaging

* Wed Dec 10 2014 David King <amigadave@amigadave.com> - 0.4.2-10.20120904gitc3af663d
- Fix directory ownership for icons and pkg-config (#1172555)

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-9.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-8.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue Aug  6 2013 Jaroslav Škarvada <jskarvad@redhat.com> - 0.4.2-7.20120904gitc3af663d
- Used unversioned doc directory
  Resolves: rhbz#993720

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-6.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.4.2-5.20120904gitc3af663d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Tue Sep 18 2012 Dan Horák <dan[at]danny.cz> - 0.4.2-4.20120904gitc3af663d
- no monitors on s390(x)

* Tue Sep 04 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 0.4.2-3.20120904gitc3af663d
- Rebased to latest git head

* Tue Sep 04 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 0.4.2-2
- Desktop file and icon moved to gtk subpackage
- Man pages are no longer explicitly gzipped
- Config for modules autoload moved to /usr/lib/modules-load.d
- Fixed requirements for gtk subpackage
- Fixed unused-direct-shlib-dependency

* Wed Aug 29 2012 Jaroslav Škarvada <jskarvad@redhat.com> - 0.4.2-1
- Initial version