File klayout.spec of Package klayout

#
# spec file for package klayout
#
# Copyright (c) 2016 SUSE LINUX Products 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 http://bugs.opensuse.org/
#

Name:           klayout
Version:        1701476586.5b4473e
Release:        0
Summary:        GDS2 chip layout viewer
License:        GPL-2.0+
Group:          Productivity/Scientific/Electronics
Url:            http://www.klayout.de
Source0:        http://www.klayout.de/downloads/%{name}-%{version}.tar.gz
Source1:        %{name}.desktop
Requires:       python313-klayout
Requires:       klayout-devel

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  libstdc++-devel
BuildRequires:  pkgconf-pkg-config
BuildRequires:  libqt5-qtbase-common-devel
BuildRequires:  libqt5-qttools-devel
BuildRequires:  libqt5-qtxmlpatterns-devel
BuildRequires:  libqt5-qtmultimedia-private-headers-devel
BuildRequires:  libqt5-qtmultimedia-devel
BuildRequires:  libqt5-qtsvg-devel
BuildRequires:  libQt5PrintSupport-devel
BuildRequires:  libgit2-devel

%if 0%{?suse_version} == 1320
BuildRequires:  ruby2.1
BuildRequires:  ruby2.1-devel
BuildRequires:  libruby2_1-2_1
%endif
# SLE 12
%if 0%{?suse_version} == 1315
BuildRequires:  ruby
BuildRequires:  ruby-devel
%endif

%if (0%{?suse_version} > 0 && 0%{?suse_version} < 1300)
BuildRequires:  ruby
BuildRequires:  ruby-devel
%endif

%if 0%{?fedora} 
BuildRequires:  ruby
BuildRequires:  ruby-devel
%endif

%if 0%{?centos_version} 
BuildRequires:  ruby
%if 0%{?centos_version} > 600
BuildRequires:  ruby-libs
%endif
BuildRequires:  ruby-devel
%endif

BuildRequires:  python3
BuildRequires:  python3-devel
BuildRequires:  python313-setuptools
BuildRequires:  ruby
BuildRequires:  ruby-devel
BuildRequires:  libexpat-devel
BuildRequires:  libcurl-devel

BuildRequires:  git 

%if 0%{?suse_version}%{?sles_version}
BuildRequires:  update-desktop-files
%endif

BuildRequires:  pkgconfig
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
GDS2 (chip layout) viewer for the chip design engineer.
The main objective was to focus on the basic functionality but adding some
useful features that many, even commercial viewers don't have:
* shows the design as it is
* can animate layers to make them blink or scroll the fill pattern.
* display a layer "marked" by drawing a small cross on all shapes<
All comes wrapped in a nice, Qt based state of the art GUI. Usage of the viewer
is simple and is similar to that of other tools.

%package -n python313-klayout
Summary:        Python module for the GDS2 chip layout viewer
Group:          Productivity/Scientific/Electronics

%description -n python313-klayout
GDS2 (chip layout) viewer for the chip design engineer.
The main objective was to focus on the basic functionality but adding some
useful features that many, even commercial viewers don't have:
* shows the design as it is
* can animate layers to make them blink or scroll the fill pattern.
* display a layer "marked" by drawing a small cross on all shapes<
All comes wrapped in a nice, Qt based state of the art GUI. Usage of the viewer
is simple and is similar to that of other tools.

%package devel
Summary:        Plugin libs for GDS2 chip layout viewer
Group:          Productivity/Scientific/Electronics

%description devel
GDS2 (chip layout) viewer for the chip design engineer.
The main objective was to focus on the basic functionality but adding some
useful features that many, even commercial viewers don't have:
* shows the design as it is
* can animate layers to make them blink or scroll the fill pattern.
* display a layer "marked" by drawing a small cross on all shapes<
All comes wrapped in a nice, Qt based state of the art GUI. Usage of the viewer
is simple and is similar to that of other tools.

%pre -p /sbin/ldconfig
%preun -p /sbin/ldconfig
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%pre devel -p /sbin/ldconfig
%preun devel -p /sbin/ldconfig
%post devel -p /sbin/ldconfig
%postun devel -p /sbin/ldconfig

%prep
%autosetup -p1

%build
%ifarch %ix86
TARGET="linux-32-gcc-release"
%else
TARGET="linux-64-gcc-release"
%endif

./build.sh -platform $TARGET \
           -rpath %{_libdir}/klayout \
           -prefix %{_libdir}/klayout \
           -dry-run \
           -with-qtbinding \
           -qt5

cd build-release
%make_build  CCOPT="%optflags -fno-strict-aliasing -c -o" \
             CXXOP="%optflags -fno-strict-aliasing -c -o" \
             CCOPT_SO="%optflags -fno-strict-aliasing -fPIC -c -o" \
             CXXOPT_SO="%optflags -fno-strict-aliasing -fPIC -c -o" \
             LOPT="%optflags -o" \
             LOPT_SO="%optflags -shared -fPIC -o" \
             PREFIX=%{_libdir}/klayout

%install
#Installing the files
export INSTALL_ROOT=%{buildroot}
export INSTALLROOT=%{buildroot}
cd build-release
%make_install
#Create proper folders
install -m777 -d %{buildroot}%{_bindir}
install -m777 -d %{buildroot}%{_datadir}
install -m777 -d %{buildroot}%{_datadir}/applications
install -m777 -d %{buildroot}/etc/ld.so.conf.d

#Move stuff into the right place
mv %{buildroot}%{_libdir}/klayout/strm* %{buildroot}%{_bindir}
mv %{buildroot}%{_libdir}/klayout/klayout %{buildroot}%{_bindir}

install -Dm644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm644 %{_builddir}/%{name}-%{version}/etc/logo.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

#install pymod
cd %{buildroot}%{_libdir}/klayout/pymod
for f in `find`; do
  if [ -f "$f" ]; then
    install -Dm644 "$f" "%{buildroot}%{python3_sitearch}/$f"
  fi
done
rm -rf %{buildroot}%{_libdir}/klayout/pymod

echo %{_libdir}/klayout >> /tmp/klayout.conf
echo %{_libdir}/klayout/db_plugins >> /tmp/klayout.conf
echo %{_libdir}/klayout/lay_plugins >> /tmp/klayout.conf
install -Dm644 -t %{buildroot}/etc/ld.so.conf.d /tmp/klayout.conf

%if 0%{?suse_version}%{?sles_version}
%suse_update_desktop_file -n %{name}
%endif

#chmod -R 644 %{buildroot}%{_datadir}

%files
%defattr(-,root,root)
#%doc LICENSE
%dir %{_libdir}/klayout
%dir %{_datadir}/applications
%{_bindir}/*
%{_libdir}/klayout/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%exclude %{_libdir}/klayout/*/*.so
%exclude %{_libdir}/klayout/*.so

%files -n python313-klayout
%{python3_sitearch}

%files devel
%{_libdir}/klayout/*/*.so
%{_libdir}/klayout/*.so
%config /etc/ld.so.conf.d/klayout.conf

%changelog
openSUSE Build Service is sponsored by