File lazarus.spec of Package lazarus3

Name:           lazarus
Version:        3.8
Release:        0
Summary:        Lazarus Component Library and IDE

Group:          Development/Languages
License:        GPL and modified LGPL
URL:            http://www.lazarus.freepascal.org/
Source0:        %{name}_%{version}.orig.tar.gz
#Patch0:         qt6pas.patch
Packager:       Mattias Gaertner
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  fpc >= 3.0.0, gtk2-devel, glibc-devel, libicu-devel
Requires:       fpc-src >= 3.0.0, fpc >= 3.0.0, gtk2-devel, glibc-devel, binutils, gdb

Requires(post): desktop-file-utils
Requires(postun): desktop-file-utils

# Qt5pas start
%global qt5pas_version 2.6+%{version}

%package -n     libQt5Pas1
Version:        %{qt5pas_version}
Release:        0
Summary:        Qt5 bindings for Pascal

BuildRequires:  libxml2-devel, gcc-c++
%if 0%{?suse_version}
BuildRequires:  libqt5-qtbase-devel >= 5.6.0, libqt5-qtx11extras-devel >= 5.6.0
%endif
%if 0%{?fedora_version} >= 11 || 0%{?centos_version} >= 8
BuildRequires:  qt5-qtbase-devel >= 5.6.0, qt5-qtx11extras-devel >= 5.6.0
%endif

%description -n libQt5Pas1
Qt5 bindings for Pascal from Lazarus.

%package -n     libQt5Pas1-devel
Version:        %{qt5pas_version}
Release:        0
Summary:        Development files for libQt5Pas1

Requires:       libQt5Pas1 = %{qt5pas_version}

%description -n libQt5Pas1-devel
The libQt5Pas1-devel package contains libraries and header files for
developing applications that use libQt5Pas1.
# Qt5pas end

# Qt6pas start
%global qt6pas_version 6.2.8+%{version}

%package -n     libQt6Pas
Version:        %{qt6pas_version}
Release:        0
Summary:        Qt6 bindings for Pascal

BuildRequires:  libxml2-devel, gcc-c++
%if 0%{?suse_version} >= 1110
BuildRequires:  qt6-base-devel >= 6.2
%endif
%if 0%{?fedora_version} >= 11 || 0%{?centos_version} >= 8
BuildRequires:  qt6-qtbase-devel >= 6.2
%endif

%description -n libQt6Pas
Qt6 bindings for Pascal from Lazarus.

%package -n     libQt6Pas-devel
Version:        %{qt6pas_version}
Release:        0
Summary:        Development files for libQt6Pas

Requires:       libQt6Pas = %{qt6pas_version}

%description -n libQt6Pas-devel
The libQt6Pas-devel package contains libraries and header files for
developing applications that use libQt6Pas.
# Qt6pas end

%define debug_package %{nil}
%define _source_filedigest_algorithm 0
%define _binary_filedigest_algorithm 0

%description
Lazarus is a free and open source Rapid Application Development tool for
the FreePascal compiler using the Lazarus component library - LCL. The LCL
is included in this package.

%prep
%setup -n %{name}
#%patch0 -p1

%build
#cd lazarus
MAKEOPTS="-g -gl -gw -O3"

make bigide OPT="$MAKEOPTS" USESVN2REVISIONINC=1

# Compile the LCL base + extra components for GUI widgetsets
for WIDGETSET in gtk2 qt5 qt6; do
	make -C lcl intf OPT="$MAKEOPTS" LCL_PLATFORM="${WIDGETSET}"
	make basecomponents OPT="$MAKEOPTS" LCL_PLATFORM="${WIDGETSET}"
	make -C components/datetimectrls OPT="$MAKEOPTS" LCL_PLATFORM="${WIDGETSET}"
done                         

export LCL_PLATFORM=
strip lazarus
strip startlazarus
strip lazbuild
strip tools/lazres
strip tools/updatepofiles
strip tools/lrstolfm
strip tools/svn2revisioninc
if [ -f components/chmhelp/lhelp/lhelp ]; then
  strip components/chmhelp/lhelp/lhelp
fi

# Build Qt5Pas
pushd lcl/interfaces/qt5/cbindings/
    qmake-qt5
    %__make %{?_smp_mflags}
popd

# Build Qt6Pas
pushd lcl/interfaces/qt6/cbindings/
    qmake6
    %__make %{?_smp_mflags}
popd

%install
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )
LAZARUSDIR=%{_libdir}/%{name}
mkdir -p %{buildroot}$LAZARUSDIR
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_datadir}/pixmaps
mkdir -p %{buildroot}%{_datadir}/applications
mkdir -p %{buildroot}%{_datadir}/mime/packages
mkdir -p %{buildroot}%{_mandir}/man1
mkdir -p %{buildroot}%{_sysconfdir}/lazarus
cp -a * %{buildroot}$LAZARUSDIR/
  install -m 644 images/icons/lazarus128x128.png %{buildroot}%{_datadir}/pixmaps/lazarus.png
  install -m 644 install/lazarus.desktop %{buildroot}%{_datadir}/applications/lazarus.desktop
  install -m 644 install/lazarus-mime.xml $LazBuildDir%{buildroot}%{_datadir}/mime/packages/lazarus.xml
ln -sf $LAZARUSDIR/lazarus %{buildroot}%{_bindir}/lazarus-ide
ln -sf $LAZARUSDIR/startlazarus %{buildroot}%{_bindir}/startlazarus
ln -sf $LAZARUSDIR/lazbuild %{buildroot}%{_bindir}/lazbuild
cat install/man/man1/lazbuild.1 | gzip > %{buildroot}%{_mandir}/man1/lazbuild.1.gz
cat install/man/man1/lazarus-ide.1 | gzip > %{buildroot}%{_mandir}/man1/lazarus-ide.1.gz
cat install/man/man1/startlazarus.1 | gzip > %{buildroot}%{_mandir}/man1/startlazarus.1.gz
#  install tools/install/linux/editoroptions.xml %{buildroot}%{_sysconfdir}/lazarus/editoroptions.xml
cat tools/install/linux/environmentoptions.xml | sed -e "s#__LAZARUSDIR__#$LAZARUSDIR/#" -e "s#__FPCSRCDIR__#%{_datadir}/fpcsrc/#" > %{buildroot}%{_sysconfdir}/lazarus/environmentoptions.xml

# Install Qt5Pas
pushd lcl/interfaces/qt5/cbindings/
    %__make install INSTALL_ROOT=%{buildroot}
popd

# Since we provide Qt5Pas as a standalone package, remove the .so files bundled in Lazarus dir
# and replace them with symlinks to the standalone .so.
for FILEPATH in %{buildroot}%{_libdir}/%{name}/lcl/interfaces/qt5/cbindings/libQt5Pas.so* ; do
    FILENAME="$(basename "${FILEPATH}")"
    ln -sf "%{_libdir}/${FILENAME}" "${FILEPATH}"
done

# Cannot be done earlier since "make install" expects the tmp/ directory to be present. Sigh.
rm -rf %{buildroot}%{_libdir}/%{name}/lcl/interfaces/qt5/cbindings/tmp/

# Install Qt6Pas
pushd lcl/interfaces/qt6/cbindings/
    %__make install INSTALL_ROOT=%{buildroot}
popd

# Since we provide Qt6Pas as a standalone package, remove the .so files bundled in Lazarus dir
# and replace them with symlinks to the standalone .so.
for FILEPATH in %{buildroot}%{_libdir}/%{name}/lcl/interfaces/qt6/cbindings/libQt6Pas.so* ; do
    FILENAME="$(basename "${FILEPATH}")"
    ln -sf "%{_libdir}/${FILENAME}" "${FILEPATH}"
done

# Cannot be done earlier since "make install" expects the tmp/ directory to be present. Sigh.
rm -rf %{buildroot}%{_libdir}/%{name}/lcl/interfaces/qt6/cbindings/tmp/

%clean
[ %{buildroot} != "/" ] && ( rm -rf %{buildroot} )

%post
%{_libdir}/%{name}/tools/install/rpm/create_gtk1_links.sh
#update-desktop-database &> /dev/null ||:

%postun
update-desktop-database &> /dev/null ||:

%post -n libQt5Pas1 -p /sbin/ldconfig
%postun -n libQt5Pas1 -p /sbin/ldconfig

%post -n libQt6Pas -p /sbin/ldconfig
%postun -n libQt6Pas -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/%{name}
%{_sysconfdir}/%{name}
%{_bindir}/*
  %{_datadir}/pixmaps/lazarus.png
  %{_datadir}/applications/lazarus.desktop
  %{_datadir}/mime/packages/lazarus.xml
#  %{_sysconfdir}/lazarus/editoroptions.xml
  %{_sysconfdir}/lazarus/environmentoptions.xml
%{_mandir}/*/*

# Qt5pas
%files -n libQt5Pas1
%{_libdir}/libQt5Pas.so.*

%files -n libQt5Pas1-devel
%{_libdir}/libQt5Pas.so

# Qt6pas
%files -n libQt6Pas
%{_libdir}/libQt6Pas.so.*

%files -n libQt6Pas-devel
%{_libdir}/libQt6Pas.so

%changelog
* Thu Jun 21 2012 Mattias Gaertner <mattias@freepascal.org> 1.0-0
- 128x128 icon, chmhelp
* Sat Sep 9 2006 Mattias Gaertner <mattias@freepascal.org> 0.9.18-0
- Initial build.
* Wed Jul 20 2005 Joost van der Sluis <joost@cnoc.nl> 0.9.8-0.1
- Initial build.
openSUSE Build Service is sponsored by