File codelite.spec of Package codelite

#
# spec file for package codelite
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012-2014 Mariusz Fik <fisiu@opensuse.org>.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           codelite
Version:        5.4
Release:        0
Summary:        Powerful open-source, cross platform code editor for the C/C++
License:        GPL-3.0+
Group:          Development/Tools/IDE
Url:            http://codelite.org/
Source0:        https://downloads.sourceforge.net/project/codelite/Mirrors/%{name}-%{version}-gtk.src.tar.gz
Source1:        %{name}.desktop
Source2:        %name-rpmlintrc
# PATCH-FIX-OPENSUSE codelite-date-time-usage-fix.patch fisiu@opensuse.org -- It removes usage of __DATE__ and __TIME__
Patch0:         %{name}-date-time-usage-fix.patch
# PATCH-FEATURE-OPENSUSE codelite-disable-new-version-check.patch fisiu@opensuse.org -- Disable 'new version' check on startup
Patch1:         %{name}-disable-new-version-check.patch
BuildRequires:  cmake
BuildRequires:  dos2unix
BuildRequires:  gcc-c++
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
%endif
BuildRequires:  libmysqlclient-devel
BuildRequires:  llvm-clang-devel
BuildRequires:  wxWidgets-devel >= 3.0.0
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libssh)
%define _use_internal_dependency_generator 0
%if 0%{?suse_version} > 1320
Requires:       xterm-bin
%else
Requires:       xterm
%endif
Recommends:     gcc
Recommends:     wxWidgets-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
CodeLite is a powerful open-source, cross platform code editor for the C/C++
programming language. It uses a sophisticated, yet intuitive interface which
allows user easily to create, build and debug complex projects.

%prep
%setup -q
%patch0 -p0
%patch1 -p0
### FIXME: Bug reported, remove line belowe with next codelite version update.
mv -v translations/cz translations/zh_CN

%build
mkdir build && cd build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"

cmake .. \
    -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_SKIP_RPATH=ON \
    -DENABLE_CLANG=1 \
    -DWITH_MYSQL=1 \
    -DWITH_WXC=0 \
    -DCOPY_WX_LIBS=0

make %{?_smp_mflags}

%install
pushd build
%makeinstall
popd

### Install desktop menu entry
install -D -m 644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/%{name}.desktop"
### Fix desktop menu icon
install -D Runtime/images/cubes.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

### Add mime types
mkdir -p %{buildroot}%{_datadir}/mime/packages/
cp -p %{name}.xml %{buildroot}%{_datadir}/mime/packages/
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/32x32/mimetypes/
cp -p %{buildroot}%{_datadir}/%{name}/images/cubes.png %{buildroot}%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-%{name}-workspace.png
cp -p %{buildroot}%{_datadir}/%{name}/images/cubes.png %{buildroot}%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-%{name}-project.png

%if 0%{?suse_version}
### Search for duplicates
%fdupes %{buildroot}%{_prefix}
### Update translation in desktop menu entry
%suse_update_desktop_file %{name}
%endif

### Fix for wrong-script-end-of-line-encoding
dos2unix %{buildroot}%{_bindir}/%{name}_kill_children

### Fix unstripped-binary-or-object warning for SLE and openSUSE
%if 0%{?sles_version} == 11
strip -s -v %{buildroot}%{_bindir}/%{name}{,_indexer,_cppcheck,gcc,-clang}
strip -s -v %{buildroot}%{_libdir}/%{name}/*.so
strip -s -v %{buildroot}%{_libdir}/%{name}/debuggers/*.so
%else
strip -s -v %{buildroot}%{_libdir}/%{name}/libclang.so
%endif

%clean
%{?buildroot:rm -rf "%{buildroot}"}

%files
%defattr(-,root,root)
%doc about.html AUTHORS 
%{_bindir}/%{name}*
%{_bindir}/clg++
%{_bindir}/clgcc
%{_libdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/mime/packages/%{name}.xml
%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-%{name}-workspace.png
%{_datadir}/icons/hicolor/32x32/mimetypes/application-x-%{name}-project.png
### TODO Shoould we put it in separate -lang package?
%{_datadir}/locale/cs/LC_MESSAGES/codelite.mo
%{_datadir}/locale/zh_CN/LC_MESSAGES/codelite.mo

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

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

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

%changelog
openSUSE Build Service is sponsored by