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/
#


Name:           pacman
Version:        7.0.0
Release:        0
Summary:        A library-based package manager with dependency support
License:        GPL-2.0-or-later
Group:          System/Packages
URL:            https://projects.archlinux.org/pacman
Source:         %{name}-%{version}.tar.xz
# https://www.archlinux.org/mirrorlist/all
Source1:        mirrorlist
Source3:        pacman.conf
Source4:        makepkg.conf
Source5:        rust.conf
Source6:        alpm.sysusers
Patch0:         revertme-makepkg-remove-libdepends-and-libprovides.patch
BuildRequires:  asciidoc
BuildRequires:  fakechroot
BuildRequires:  libarchive-devel
BuildRequires:  libcurl-devel
BuildRequires:  libgpgme-devel
BuildRequires:  meson
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  bsdtar
BuildRequires:  doxygen
Requires:       archlinux-keyring
Requires:       libalpm15 = %{version}

%description
pacman is a utility which manages software packages in Linux. It uses simple compressed files as a package format, and maintains a text-based package database (more of a hierarchy), just in case some hand tweaking is necessary.
pacman does not strive to "do everything." It will add, remove and upgrade packages in the system, and it will allow you to query the package database for installed packages, files and owners. It also attempts to handle dependencies automatically and can download packages from a remote server.

%package -n libalpm15
Summary:        Shared libraries for pacman
Group:          System/Libraries

%description -n libalpm15
Shared libraries for pacman.

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

%description -n libalpm-devel
Development files for libalpm.

%prep
%setup -q
%patch -P 0 -R -p 1

%build
meson --prefix=%{_prefix} \
  --buildtype=plain \
  -Ddoc=enabled \
  -Ddoxygen=enabled \
  -Dscriptlet-shell=%{_bindir}/bash \
  -Dldconfig=%{_bindir}/ldconfig \
  build
meson compile -C build

%install
DESTDIR=%{buildroot} meson install -C build

find %{buildroot}%{_libdir} -name "libalpm.a" -delete -print
find %{buildroot}%{_libdir} -name "libalpm.la" -delete -print

mv %{buildroot}%{_datadir}/pkgconfig/libmakepkg.pc %{buildroot}%{_libdir}/pkgconfig
rm -rf %{buildroot}%{_datadir}/pkgconfig

mv %{buildroot}%{_datadir}/bash-completion/completions/makepkg %{buildroot}%{_datadir}/bash-completion/completions/makepkg_archlinux

mkdir -p %{buildroot}%{_sysconfdir}/pacman.d
install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pacman.d/

rm -rf %{buildroot}%{_sysconfdir}/pacman.conf
rm -rf %{buildroot}%{_sysconfdir}/makepkg.conf
install -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/pacman.conf
install -m 0644 %{SOURCE4} %{buildroot}%{_sysconfdir}/makepkg.conf
mkdir -p %{buildroot}%{_sysconfdir}/makepkg.conf.d
install -m 0644 %{SOURCE5} %{buildroot}%{_sysconfdir}/makepkg.conf.d

for i in makepkg.conf makepkg.conf.d/fortran.conf makepkg.conf.d/rust.conf; do
  sed -i 's/#\!\/hint\/bash/#\!\/bin\/bash/' %{buildroot}%{_sysconfdir}/$i;
done

mkdir -p %{buildroot}%{_libexecdir}/sysusers.d
install -m 0644 %{SOURCE6} %{buildroot}%{_libexecdir}/sysusers.d/alpm.conf

mkdir -p %{buildroot}%{_localstatedir}/lib/pacman/sync
mkdir -p %{buildroot}%{_localstatedir}/lib/pacman/local
touch %{buildroot}%{_localstatedir}/lib/pacman/local/AlPM_DB_VERSION
mkdir -p %{buildroot}%{_localstatedir}/cache/pacman/pkg
mkdir -p %{buildroot}%{_sysconfdir}/pacman.d/gnupg
mkdir -p %{buildroot}%{_sysconfdir}/pacman.d/hooks

%find_lang libalpm
%find_lang pacman-scripts
%find_lang pacman

#%check
#make check

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

%files -n libalpm15 -f libalpm.lang
%{_libdir}/libalpm.so.15
%{_libdir}/libalpm.so.15.0.0

%files -n libalpm-devel
%{_includedir}/alpm.h
%{_includedir}/alpm_list.h
%{_libdir}/libalpm.so
%{_libdir}/pkgconfig/libalpm.pc
%{_libdir}/pkgconfig/libmakepkg.pc

%files -f pacman-scripts.lang -f pacman.lang
%license COPYING
%doc README NEWS
%dir %{_sysconfdir}/makepkg.conf.d
%dir %{_sysconfdir}/pacman.d
%dir %{_sysconfdir}/pacman.d/gnupg
%dir %{_sysconfdir}/pacman.d/hooks
%dir %{_libexecdir}/sysusers.d
# needed by namcap build
%dir %attr(0777,root,root) %{_localstatedir}/lib/pacman
%dir %attr(0777,root,root) %{_localstatedir}/lib/pacman/sync
%dir %attr(0777,root,root) %{_localstatedir}/lib/pacman/local
%dir %{_localstatedir}/cache/pacman
%dir %{_localstatedir}/cache/pacman/pkg
%config(noreplace) %{_sysconfdir}/makepkg.conf
%config(noreplace) %{_sysconfdir}/makepkg.conf.d/fortran.conf
%config(noreplace) %{_sysconfdir}/makepkg.conf.d/rust.conf
%config(noreplace) %{_sysconfdir}/pacman.conf
%config(noreplace) %{_sysconfdir}/pacman.d/mirrorlist
%{_bindir}/makepkg
%{_bindir}/makepkg-template
%{_bindir}/pacman
%{_bindir}/pacman-conf
%{_bindir}/pacman-db-upgrade
%{_bindir}/pacman-key
%{_bindir}/repo-add
%{_bindir}/repo-elephant
%{_bindir}/repo-remove
%{_bindir}/testpkg
%{_bindir}/vercmp
%{_libexecdir}/sysusers.d/alpm.conf
%{_datadir}/makepkg
%{_datadir}/pacman
%{_mandir}/man*/*
%{_datadir}/bash-completion/completions/pacman
%{_datadir}/bash-completion/completions/makepkg_archlinux
%{_datadir}/bash-completion/completions/pacman-key
%{_datadir}/zsh/site-functions/_pacman
%ghost %{_localstatedir}/lib/pacman/local/AlPM_DB_VERSION

%changelog
openSUSE Build Service is sponsored by