File pacman.spec of Package pacman

#
# spec file for package pacman
#
# Copyright (c) 2025 SUSE LLC
#
# 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 sover 15
Name:           pacman
Version:        @SERVICE@
Release:        0
Summary:        Package manager for Arch Linux
License:        GPL-2.0-or-later
Group:          System/Packages
URL:            https://www.archlinux.org/pacman/
Source0:        %{name}-%{version}.tar.xz
#https://archlinux.org/mirrorlist/all
Source1:        mirrorlist
#https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/raw/main/pacman.conf
Source2:        pacman.conf
#https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/raw/main/alpm.sysusers
Source3:        alpm.conf
#https://gitlab.archlinux.org/archlinux/packaging/packages/pacman/-/raw/main/makepkg.conf
Source4:        makepkg.conf
BuildRequires:  asciidoc
BuildRequires:  bsdtar
BuildRequires:  doxygen
BuildRequires:  fakechroot
BuildRequires:  meson >= 0.51
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(gpgme) >= 1.3.0
BuildRequires:  pkgconfig(libarchive) >= 3.0.0
BuildRequires:  pkgconfig(libcurl) >= 7.55.0
BuildRequires:  pkgconfig(openssl)
Requires:       bsdtar
Requires:       gpgme >= 1.3.0
Recommends:     %{name}-bash-completion = %{version}
Recommends:     %{name}-lang = %{version}
Recommends:     %{name}-zsh-completion = %{version}
Recommends:     arch-install-scripts
Recommends:     awk
Recommends:     dirmngr

%description
Pacman is the package manager used by the Arch Linux distribution. It is a
frontend for the ALPM (Arch Linux Package Management) library.

%package -n libalpm%{sover}
Summary:        Arch Linux Package Management library
Group:          System/Libraries
Recommends:     libalpm%{sover}-lang = %{version}

%description -n libalpm%{sover}
This library is the backend behind Pacman - the package manager used
by the Arch distribution. It uses simple compressed files as a package
format, and maintains a text-based package database.

%package -n libalpm%{sover}-devel
Summary:        Development headers for libalpm
Group:          Development/Libraries/C and C++
Requires:       libalpm%{sover} = %{version}

%description -n libalpm%{sover}-devel
This package contains the public headers necessary to use libalpm.

%package bash-completion
Summary:        Bash completion support for pacman
Group:          System/Base
Requires:       bash-completion
BuildArch:      noarch

%description bash-completion
Pacman offer bash completion, but it is an optional dependency.

%package zsh-completion
Summary:        Zsh completion support for pacman
Group:          System/Base
BuildArch:      noarch

%description zsh-completion
Pacman offer zsh completion, but it is an optional dependency.

%lang_package
%lang_package -n libalpm%{sover}

%prep
%autosetup -p1

# enable rackspace mirror
sed -i ' 10 s/^.//' %{SOURCE1}
# enable color output
sed -i 's/#Color/Color/g' %{SOURCE2}

%build
%meson \
       -Ddoc=enabled \
       -Ddoxygen=enabled \
       -Dscriptlet-shell=/usr/bin/bash

%meson_build

%install
%meson_install

mkdir -p %{buildroot}/usr/lib/sysusers.d

install -D -m 0644 -t %{buildroot}%{_sysconfdir}/%{name}.d/ %{SOURCE1}
install -D -m 0644 -t %{buildroot}%{_sysconfdir}/ %{SOURCE2}
install -D -m 0644 -t %{buildroot}/usr/lib/sysusers.d/ %{SOURCE3}
install -D -m 0644 -t %{buildroot}%{_sysconfdir}/ %{SOURCE4}

%find_lang %{name}
%find_lang %{name}-scripts
%find_lang libalpm

%check

%post -n libalpm%{sover} -p /sbin/ldconfig
%postun -n libalpm%{sover} -p /sbin/ldconfig

%files
%license COPYING
%doc AUTHORS NEWS README
%{_bindir}/*
%dir %{_sysconfdir}/%{name}.d
%{_sysconfdir}/makepkg.conf.d/
%config(noreplace) %{_sysconfdir}/makepkg.conf
%config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}.d/mirrorlist
%{_localstatedir}/lib/%{name}/
%dir %{_datadir}/libalpm/
%dir %{_datadir}/libalpm/hooks/
%dir %{_localstatedir}/cache/%{name}
%dir %{_localstatedir}/cache/%{name}/pkg
%{_datadir}/%{name}/
%{_datarootdir}/makepkg/
%dir /usr/lib/sysusers.d/
%config /usr/lib/sysusers.d/alpm.conf
%if 0%{?suse_version} > 1500
%{_mandir}/man1/*
%{_mandir}/man5/*
%{_mandir}/man8/*
%endif

%files lang -f %{name}.lang -f %{name}-scripts.lang

%files -n libalpm%{sover}
%{_libdir}/libalpm.so.*

%files -n libalpm%{sover}-lang -f libalpm.lang

%files -n libalpm%{sover}-devel
%license COPYING
%doc HACKING
%{_includedir}/*
%{_libdir}/pkgconfig/libalpm.pc
%{_datadir}/pkgconfig/libmakepkg.pc
%{_libdir}/libalpm.so
%if 0%{?suse_version} > 1500
%{_mandir}/man3/*
%endif

%files bash-completion
%exclude %{_datadir}/bash-completion/completions/makepkg
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/*

%files zsh-completion
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/*

%changelog
openSUSE Build Service is sponsored by