File codelite.spec of Package codelite

# Maintainer: Brenton Horne <brentonhorne77@gmail.com>
# For contributors see changelog
%define debug_package %{nil}
Name:           codelite
Version:        12.0
Release:        1%{?dist}
License:        GPL-2.0
Group:          Development/Tools
Summary:        CodeLite is a powerful open-source, cross platform IDE
URL:            http://codelite.sourceforge.net
Source0:        https://github.com/eranif/codelite/archive/%{version}.tar.gz
Source1:        rpmlintrc
Conflicts:      %{name}-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  fdupes
Requires:       xterm libssh clang
BuildRequires:	wxGTK3-devel cmake clang-devel lldb-devel libssh-devel hunspell-devel sqlite-devel desktop-file-utils

%define __find_requires %cl_wx_requires
# Needed to prevent cpio "digest mismatch" errors when trying to install an rpm that incorporates
# already-prelinked .so libs. See http://www.redhat.com/archives/rhl-devel-list/2009-December/msg00813.html
%global __prelink_undo_cmd %{nil}

# Filter out these false-alarms from 'requires', as the package itself supplies them!
%{?filter_setup:
%filter_from_requires /lib(codelite|plugin|wxscintilla|wxsqlite3)u\.so/d
%filter_setup
}

%description
CodeLite uses a sophisticated, yet intuitive interface which allows
users to easily create, build and debug complex projects.

%prep
%setup -q -b 0 -n %{name}-%{version}

%build
mkdir -p build_release
export PATH=/usr/libexec/wxGTK31/:$PATH
(cd build_release && cmake -G "Unix Makefiles" -DCOPY_WX_LIBS=1 -DAUTOGEN_REVISION=0 ..)

(cd build_release && make %{?_smp_mflags})

%install
%{__rm} -rf $RPM_BUILD_ROOT
(cd build_release && make DESTDIR=$RPM_BUILD_ROOT install)

# Create the .desktop on the fly, as it's not quite the same as the tarball one
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop <<EOF
[Desktop Entry]
Encoding=UTF-8
Name=%{name}
GenericName=C/C++/Node.js/PHP IDE
Comment=An IDE for creating C/C++/Node.js/PHP programs
Exec=%{name} %f
Icon=codelite
Terminal=false
Type=Application
MimeType=application/x-codelite-workspace;application/x-codelite-project;
Categories=Development;IDE;
StartupNotify=false
Version=1.0
EOF

mkdir -p $RPM_BUILD_ROOT%{_datadir}/mime/packages/
cp -p %{name}.xml $RPM_BUILD_ROOT%{_datadir}/mime/packages/

desktop-file-install  --delete-original       \
          --dir $RPM_BUILD_ROOT%{_datadir}/applications            \
                $RPM_BUILD_ROOT%{_datadir}/applications/codelite.desktop

%find_lang %{name}

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS LICENSE COPYING
%{_bindir}/codelite*
%{_datadir}/%{name}
%{_datadir}/%{name}/templates/projects
%{_datadir}/applications/codelite.desktop
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/*
%{_libdir}/%{name}
%{_mandir}/man1/codelite.1*
%{_mandir}/man1/codelite-make.1*
%{_mandir}/man1/codelite_fix_files.1*

%post
update-mime-database %{_datadir}/mime &> /dev/null || :
update-desktop-database &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :

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

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


%changelog
* Fri Jan 20 2017 Brenton Horne <brentonhorne77@gmail.com>
- Adding conflicts devel to fix conflict
* Fri Jan 20 2017 Brenton Horne <brentonhorne77@gmail.com>
- Rm devel subpackage; using rpmlintrc to silence rpmlint errors
* Thu Jun 23 2016 DH
- Update for fedora24
* Fri Dec 04 2015 DH
- Update for icon change
* Wed Nov 04 2015 DH
- Fixes for fedora23 build
* Wed May 27 2015 DH
- Use the official wxGTK3 package for fedora22 builds
- Don't include the wx libs in the CL binary for fedora22
- Updated .*Requires accordingly
* Sat May 02 2015 DH
- Updated .*Requires and %files as CL no longer supplies clang/lldb
* Thu Feb 05 2015 DH
- Updated %files
* Tue May 13 2014 DH
- Added new files to %files
- Updated BuildRequires (libedit)
* Fri Jan 10 2014 DH
- Added a new file to %files
- Updated BuildRequires
* Sun Oct 20 2013 DH
- Added a new file to %files
- Updated BuildRequires
* Thu Jul 11 2013 DH
- Added two new files to %files
* Fri Mar 01 2013 DH
- Updated for the change to using cmake
* Wed Jan 23 2013 DH
- Additions for wxCrafter
* Wed Aug 29 2012 DH
- Added new binary codelitegcc to %files
* Tue Nov 22 2011 DH
- Add libclang.so to the Requires filter
* Wed May 25 2011 DH
- Add filter for FC15 to remove the codelite-provided lib*.so from 'Requires'!
* Tue Jan 18 2011 DH
- Changes for mimetype stuff
* Fri Dec 24 2010 DH
- Use %find_lang for translations
* Wed Mar 03 2010 DH
- Spec file: Added codelite_xterm
* Thu Sep 24 2009 DH
- Spec file: Added codelite_cppcheck
* Tue Feb 24 2009 DH
- Spec file: Corrected names. Disabled unwanted things in configure
* Tue Feb 24 2009 Jess Portnoy <kernel01@gmail.com> 1.0.2782-1
- Spec file: Added call to desktop-file-install and %doc
  code: fixed perms and other rpmlint issues.
* Sat Feb 21 2009 Jess Portnoy <kernel01@gmail.com> 1.0.2781-1
- Reworked the rpm package to satisfy Fedora Core conventions.