File upp.spec of Package ultimatepp

#
# spec file for package upp
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 https://bugs.opensuse.org/
#


%define         bin_name theide
%define         title Ultimate++
%define         reldate 2018.1
Name:           upp
Version:        11873
Release:        0
Summary:        C++ cross-platform rapid application development suite
License:        BSD-2-Clause
Group:          Development/Tools/IDE
URL:            http://www.ultimatepp.org
Source0:        https://sourceforge.net/projects/upp/files/upp/%{reldate}/upp-x11-src-%{version}.tar.gz
# PATCH-FIX-OPENSUSE ultimatepp-fix-zero-length-error.patch malcolmlewis@opensuse.org - Add placeholder statement in zero-length files.
Patch0:         ultimatepp-fix-zero-length-error.patch
BuildRequires:  atk-devel
BuildRequires:  cairo-devel
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  freetype2-devel
%if 0%{?suse_version} == 1315
BuildRequires:  gcc7
BuildRequires:  gcc7-c++
%else
BuildRequires:  gcc-c++ >= 4.9
%endif
BuildRequires:  gtk2-devel
BuildRequires:  libbz2-devel
BuildRequires:  libexpat-devel
BuildRequires:  libnotify-devel
BuildRequires:  libpng-devel
BuildRequires:  pango-devel
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel

%description
The U++ integrated development environment, TheIDE, introduces modular concepts to C++
programming. It provides:

	- TheIDE, a visual designers for U++ libraries
	- Topic++, for documenting code and creating rich text resources
	- Assist++, a powerful C++ code analyzer providing code completion,
	  navigation and transformation
	- BLITZ-build technology to speedup C++ rebuilds up to 4 times

%package devel
Summary:        TheIDE code examples
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description devel
The U++ integrated development environment, TheIDE, introduces modular concepts to C++
programming. It provides:

	- TheIDE, a visual designers for U++ libraries
	- Topic++, for documenting code and creating rich text resources
	- Assist++, a powerful C++ code analyzer providing code completion,
	  navigation and transformation
	- BLITZ-build technology to speedup C++ rebuilds up to 4 times

This development package contains code examples for using with theide.

%prep
%setup -q -n %{name}-x11-src-%{version}
%patch0 -p1
# Fix end-of-line encoding
sed -i 's/\r//' uppsrc/ide/Copying
# Remove zero-length files
rm uppsrc/ide/Browser/COPYING-PLAIN
rm uppsrc/RichText/RichText.usc
# Remove hidden file
rm bazaar/plugin/gdal/ogr/ogrsf_frmts/libkml/.indent.pro
#Fix rpm runtime dependency rpmlint error replace the shebang in all the scripts with %%{_bindir}/python
find . -type f -exec perl -pi -e 'BEGIN{undef $/};s[^#\!/usr/bin/env python][#\!%{_bindir}/python]' {} \;

%build
export CC=gcc
export CXX=g++
test -x "$(type -p gcc-7)" && export CC=gcc-7
test -x "$(type -p g++-7)" && export CXX=g++-7

sed -e "s@-I((INCLUDES))@@g" -e '/^CXX =/s/c++/$CXX/' \
    -e '/^CFLAGS/s/=/= %{optflags}/' -e '/^CXXFLAGS/s/=/= %{optflags}/' \
       uppsrc/Makefile.in >uppsrc/Makefile

make -C uppsrc \
     -e LIBPATH=$(pkg-config --libs-only-L x11 freetype2 gtk+-2.0 glib-2.0 cairo pango atk)     \
     -e CINC=" -I. $(pkg-config --cflags x11 freetype2 gtk+-2.0 glib-2.0 cairo pango atk)" \
     -e UPPOUT="$PWD/out/" \
     -e OutFile="$PWD/out/ide.out" \
     %{?_smp_mflags}


%install
install -d %{buildroot}%{_datadir}/{applications,pixmaps}
install -d %{buildroot}%{_datadir}/icons/hicolor/48x48/apps
install -d %{buildroot}%{_datadir}/%{name}

install -Dm755 out/ide.out %{buildroot}%{_bindir}/theide

cp -p uppsrc/ide/%{bin_name}-48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/%{bin_name}.png
cp -p uppsrc/ide/%{bin_name}-48.png %{buildroot}%{_datadir}/pixmaps/%{bin_name}.png

cp -a bazaar    %{buildroot}%{_datadir}/%{name}/
cp -a uppsrc    %{buildroot}%{_datadir}/%{name}/
cp -a examples  %{buildroot}%{_datadir}/%{name}/
cp -a reference %{buildroot}%{_datadir}/%{name}/
cp -a tutorial  %{buildroot}%{_datadir}/%{name}/

# We create our own GCC.bm
INCLUDEDIR=$( pkg-config --cflags x11 freetype2 gtk+-2.0 glib-2.0 cairo pango atk | awk ' { gsub ( / /, "" ) ; gsub ( /-I/, ";" ) ; sub ( /;/, "" ) ; print $0 }' )
LIBDIR=$( pkg-config --libs-only-L x11 freetype2 gtk+-2.0 glib-2.0 cairo pango atk | awk ' { gsub ( / /, "" ) ; gsub ( /-I/, ";" ) ; sub ( /;/, "" ) ; print $0 }' )

cat > %{buildroot}%{_datadir}/%{name}/GCC.bm << EOF
BUILDER		= "GCC";
COMPILER	= "g++";
DEBUG_INFO	= "2";
DEBUG_BLITZ	= "1";
DEBUG_LINKMODE	= "1";
DEBUG_LINK  = "";
DEBUG_OPTIONS	= "-O0";
DEBUG_FLAGS	= "";
RELEASE_BLITZ		= "0";
RELEASE_LINKMODE	= "1";
RELEASE_OPTIONS		= "-O3 -ffunction-sections -fdata-sections";
RELEASE_SIZE_OPTIONS	= "-Os -finline-limit=20 -ffunction-sections -fdata-sections";
RELEASE_FLAGS	= "";
RELEASE_LINK	= "-Wl,--gc-sections";
DEBUGGER	= "gdb";
PATH		= "";
INCLUDE		= "$INCLUDEDIR";
LIB		= "$LIBDIR";
REMOTE_HOST	= "";
REMOTE_OS	= "";
REMOTE_TRANSFER	= "";
REMOTE_MAP	= "";
LINKMODE_LOCK	= "0";
EOF

%suse_update_desktop_file -i %{bin_name}

%fdupes -s %{buildroot}

# fix non-executable-script
for file in maxpdf_frontend/maxpdf \
            FreeType/src/tools/afblue.pl \
            FreeType/src/tools/chktrcmp.py \
            FreeType/src/tools/docmaker/docbeauty.py \
            FreeType/src/tools/docmaker/docmaker.py \
            FreeType/src/tools/glnames.py \
            plugin/gdal/frmts/grass/pkg/configure \
            plugin/gdal/frmts/gtiff/libgeotiff/dump_symbols.sh \
            plugin/gdal/frmts/gtiff/libtiff/dump_symbols.sh \
            plugin/gdal/frmts/iso8211/teststream.sh \
            plugin/gdal/ogr/ogrsf_frmts/geojson/libjson/dump_symbols.sh \
            plugin/gdal/ogr/ogrsf_frmts/s57/s57tables.py \
            plugin/gdal/ogr/ogrsf_frmts/sdts/install-libs.sh \
            plugin/geotiff/libgeotiff/hfa/img2tif_build.sh \
            plugin/geotiff/libgeotiff/hfa/tst1tif.sh \
            plugin/geotiff/libgeotiff/hfa/tst_hfa.sh \
            plugin/geotiff/libgeotiff/hfa/tst_img2tif_1.sh \
            plugin/tcc/gcctestsuite.sh \
            plugin/tcc/texi2pod.pl \
            plugin/tcc/configure ; do
    chmod +x %{buildroot}%{_datadir}/%{name}/bazaar/$file
done

%files
%license uppsrc/ide/Copying
%{_bindir}/%{bin_name}
%{_datadir}/applications/%{bin_name}.desktop
%{_datadir}/icons/hicolor/48x48/apps/%{bin_name}.png
%{_datadir}/pixmaps/%{bin_name}.png

%files devel
%{_datadir}/%{name}/

%changelog
openSUSE Build Service is sponsored by