File lal-refactor.spec of Package lal-refactor

%define _pkg_ver_ 25.0.0
%define _src_ver_ 25.0.0

Name:          lal-refactor
Version:       %{_pkg_ver_}
Release:       2.1
Summary:       Source code refactoring tools for the Ada programming language.
License:       Apache-2.0
Group:         Development/Languages/Ada
Url:           https://github.com/AdaCore/lal-refactor
Source0:       %{name}-%{_src_ver_}.tar.gz
BuildRequires: gcc-ada
BuildRequires: gprbuild
BuildRequires: VSS-devel >= 25.0
BuildRequires: liblal_tools-devel
BuildRequires: chrpath
#!BuildIgnore: gcc-PIE
Requires:      lib%{name} = %{version}

%description
The collection of source code refactoring tools for the Ada programming language,
leveraging the power of Libadalang. These tools aim to automate and assist with
common code refactoring tasks, improving code maintainability and reducing the
risk of introducing errors during the refactoring process.

Currently, the main user of this tools is the Ada Language Server.

%package -n lib%{name}
Summary: Source code refactoring tools for the Ada programming language.

%description -n lib%{name}
Library files for lal-refactor tools for Ada.

%package devel
Summary:  Source code refactoring tools for the Ada programming language.
Requires: lib%{name} = %{version}
Requires: VSS-devel >= 25.0
Requires: liblal_tools-devel

%description devel
Library files for lal-refactor tools for Ada.

This package contains the development files.

%prep
%setup -q

# To build in production mode BUILD_MODE=prod".
# To build in development mode BUILD_MODE=dev".
%define build_mode prod

%build
# build lib
for kind in static static-pic relocatable; do
gprbuild -p -v -k %{?_smp_mflags} \
    -XLAL_REFACTOR_LIBRARY_TYPE=$kind \
    -XLIBRARY_TYPE=$kind \
    -XLAL_REFACTOR_BUILD_MODE=%{build_mode} \
    gnat/lal_refactor.gpr
done
# build bin
gprbuild -p -v -k %{?_smp_mflags} \
    -XLAL_REFACTOR_LIBRARY_TYPE=$kind \
    -XLIBRARY_TYPE=$kind \
    -XLAL_REFACTOR_BUILD_MODE=%{build_mode} \
    gnat/lal_refactor_driver.gpr

%install
# install lib
for kind in static static-pic relocatable; do
  gprinstall -p -f \
    --prefix=%{buildroot}%{_prefix} \
    -XLAL_REFACTOR_LIBRARY_TYPE=$kind \
    -XLIBRARY_TYPE=$kind \
    -XLAL_REFACTOR_BUILD_MODE=%{build_mode} \
    --sources-subdir=include/lal-refactor \
    --lib-subdir=%{_lib}/lal-refactor.$kind \
    --link-lib-subdir=%{_lib} \
    --build-name=$kind \
    --build-var=LIBRARY_TYPE \
    --no-manifest \
    gnat/lal_refactor.gpr
done
# install bin
gprinstall -p -f \
    --prefix=%{buildroot}%{_prefix} \
    -XLAL_REFACTOR_LIBRARY_TYPE=static \
    -XLIBRARY_TYPE=static \
    -XBUILD_MODE=%{build_mode} \
    --mode=usage \
    --no-manifest \
    gnat/lal_refactor_driver.gpr
chrpath --delete %{buildroot}%{_bindir}/lalrefactor
chrpath --delete %{buildroot}%{_libdir}/lal-refactor.relocatable/liblal-refactor.so

%post -n lib%{name}
%run_ldconfig

%postun -n lib%{name}
%run_ldconfig

%files
%license LICENSE*
%doc README.md
%{_bindir}/lalrefactor

%files -n lib%{name}
%defattr(-,root,root)
%license LICENSE*
%dir %{_libdir}/lal-refactor.relocatable
%{_libdir}/lal-refactor.relocatable/liblal-refactor.so
%{_libdir}/liblal-refactor.so

%files devel
%defattr(-,root,root)
%dir %{_includedir}/lal-refactor
%{_includedir}/lal-refactor/*
%dir %{_libdir}/lal-refactor.*
%{_libdir}/lal-refactor.static/*.ali
%{_libdir}/lal-refactor.static/liblal-refactor.a
%{_libdir}/lal-refactor.static-pic/*.ali
%{_libdir}/lal-refactor.static-pic/liblal-refactor.a
%{_libdir}/lal-refactor.relocatable/*.ali
#{_libdir}/lal-refactor.relocatable/liblal-refactor.so
%{_datadir}/gpr/lal_refactor.gpr

%changelog
openSUSE Build Service is sponsored by