File klayout.spec of Package klayout

#
# spec file for package klayout
#
%global  debug_package %{nil}

Name:           klayout
Version:        0.30.2
Release:        <CI_CNT>.<B_CNT>.f0f7b8eea
Summary:        KLayout, viewer and editor for mask layouts
License:        GPL-2.0+
Group:          Productivity/Scientific/Electronics
Url:            http://www.klayout.de
Source0:        %{name}-%{version}.tar.gz

# Disable auto-detection of dependencies (to prevent including the
# so's of klayout itself)
AutoReqProv: 	no

BuildRequires: python3-devel
BuildRequires: libgit2-devel

%if 0%{?rhel} == 8
Requires: ruby
Requires: python3 >= 3.6.0
Requires: libgit2 >= 0.26.8
Requires: qt5-qtbase >= 5.11.1
Requires: qt5-qtmultimedia >= 5.11.1
Requires: qt5-qtxmlpatterns >= 5.11.1
Requires: qt5-qtsvg >= 5.11.1
Requires: qt5-qttools >= 5.11.1
# NOTE: this package is required for libQt5Designer and pulls in a lot of devel stuff.
# Maybe it's worth considering to drop designer support and replace by QUiLoader.
Requires: qt5-qttools-devel >= 5.11.1

BuildRequires:  ruby-devel
BuildRequires:	qt5-qtbase-devel
BuildRequires:	qt5-qtmultimedia-devel
BuildRequires:	qt5-qtxmlpatterns-devel
BuildRequires:	qt5-qtsvg-devel
BuildRequires:	qt5-qttools-devel
#BuildRequires:  clang-libs
%define __python /usr/bin/python3
%endif

# ALmaLinux 9
%if 0%{?rhel} >= 9 || 0%{?fedora} >= 39
Requires: ruby
Requires: python3 >= 3.9.0
Requires: qt5-qtbase >= 5.15.9
Requires: qt5-qtmultimedia >= 5.15.9
Requires: qt5-qtxmlpatterns >= 5.15.9
Requires: qt5-qtsvg >= 5.15.9
Requires: qt5-qttools >= 5.15.9
# NOTE: this package is required for libQt5Designer and pulls in a lot of devel stuff.
# Maybe it's worth considering to drop designer support and replace by QUiLoader.
Requires: qt5-qttools-devel >= 5.15.9
# Needed by something else (still?)
Requires: http-parser >= 2.9.4

BuildRequires:  ruby-devel
BuildRequires:	qt5-qtbase-devel
BuildRequires:	qt5-qtmultimedia-devel
BuildRequires:	qt5-qtxmlpatterns-devel
BuildRequires:	qt5-qtsvg-devel
BuildRequires:	qt5-qttools-devel

# libgit2 is not available as standard package, but through EPEL
# So we include it explicitly
%define __python /usr/bin/python3
%endif

# openSUSE
%if 0%{?suse_version} > 1400 && 0%{?is_opensuse}
Requires: ruby >= 2.5
Requires: python3 >= 3.6
Requires: libgit2-1_3 >= 1.3.0
Requires: libqt5-qtbase >= 5.15.2
Requires: libQt5PrintSupport5 >= 5.15.2
Requires: libQt5Designer5 >= 5.15.2
Requires: libQt5Multimedia5 >= 5.15.2
Requires: libQt5Svg5 >= 5.15.2
Requires: libQt5XmlPatterns5 >= 5.15.2

BuildRequires:  ruby-devel
BuildRequires:	libqt5-qtbase-devel
BuildRequires:	libqt5-qtmultimedia-devel
BuildRequires:	libqt5-qtxmlpatterns-devel
BuildRequires:	libqt5-qtsvg-devel
BuildRequires:	libqt5-qttools-devel
%endif


%description
Mask layout viewer and editor for the chip design engineer.

For details see README.md


%prep


%setup -q	


%build
%if 0%{?rhel} >= 9 || 0%{?fedora} >= 39
%endif

TARGET="linux-release"

# clean bin dir
rm -rf %{_builddir}/bin.$TARGET

# do the actual build
./build.sh -ruby /usr/bin/ruby \
           -rpath %{_libdir}/klayout \
           -bin %{_builddir}/bin.$TARGET \
           -build %{_builddir}/build.$TARGET \

cp -p LICENSE Changelog CONTRIB %{_builddir}
strip %{_builddir}/bin.$TARGET/*.so
strip %{_builddir}/bin.$TARGET/*/*.so
strip %{_builddir}/bin.$TARGET/*/*/*.so
strip %{_builddir}/bin.$TARGET/klayout
strip %{_builddir}/bin.$TARGET/strm*


%install
%global  _pkgbuilddir %{_builddir}/%{name}-%{version}

TARGET="linux-release"

# create and populate libdir
mkdir -p %{buildroot}%{_libdir}/klayout
mkdir -p %{buildroot}%{_libdir}/klayout/db_plugins
mkdir -p %{buildroot}%{_libdir}/klayout/lay_plugins
mkdir -p %{buildroot}%{_libdir}/klayout/pymod
cp -pd %{_builddir}/bin.$TARGET/lib*.so* %{buildroot}%{_libdir}/klayout
cp -pd %{_builddir}/bin.$TARGET/db_plugins/lib*.so* %{buildroot}%{_libdir}/klayout/db_plugins
cp -pd %{_builddir}/bin.$TARGET/lay_plugins/lib*.so* %{buildroot}%{_libdir}/klayout/lay_plugins
cp -rpd %{_builddir}/bin.$TARGET/pymod/* %{buildroot}%{_libdir}/klayout/pymod
%if %{defined copylibs}
  cp -pd %{copylibs} %{buildroot}%{_libdir}/klayout
%endif
chmod 644 %{buildroot}%{_libdir}/klayout/*.so*
chmod 644 %{buildroot}%{_libdir}/klayout/db_plugins/*.so*
chmod 644 %{buildroot}%{_libdir}/klayout/lay_plugins/*.so*
find %{buildroot}%{_libdir}/klayout/pymod -type f -exec chmod 644 {} +
find %{buildroot}%{_libdir}/klayout/pymod -type d -exec chmod 755 {} +

# create and populate bindir
mkdir -p %{buildroot}%{_bindir}
cp -pd %{_builddir}/bin.$TARGET/klayout %{_builddir}/bin.$TARGET/strm* %{buildroot}%{_bindir}
chmod 755 %{buildroot}%{_bindir}/*

# other files
install -Dm644 %{_pkgbuilddir}/etc/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm644 %{_pkgbuilddir}/etc/logo.png %{buildroot}%{_datadir}/pixmaps/%{name}.png


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


%changelog
* Mon Jul 27 2025  Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr> - 0.30.2-1
- Upgrade to 0.30.2.
- Supply ruby interpreter location (not found by build.sh).

* Sun Jan 12 2025  Jean-Paul Chaput <Jean-Paul.Chaput@lip6.fr> - 0.29.9-1
- Initial packaging in Coriolis/OBS repository.
openSUSE Build Service is sponsored by