File netatalk.spec of Package netatalk

#
# spec file for package netatalk
#
# 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:           netatalk
Version:        4.3.2
Release:        0
Summary:        AFP Fileserver for Macintosh Clients
License:        GPL-2.0-or-later
Group:          Productivity/Networking/System
URL:            https://github.com/Netatalk/netatalk
Source:         netatalk-%{version}.tar.xz

BuildRequires:  bison
BuildRequires:  cracklib-devel
BuildRequires:  dbus-1-devel
BuildRequires:  dbus-1-glib-devel
BuildRequires:  file
BuildRequires:  flex
BuildRequires:  gawk
BuildRequires:  gcc
BuildRequires:  fdupes
BuildRequires:  libacl-devel
BuildRequires:  libdb-4_8-devel
BuildRequires:  libevent-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libmariadb-devel
BuildRequires:  libtalloc-devel
BuildRequires:  libtdb-devel
BuildRequires:  libtracker-sparql-3_0-0
BuildRequires:  libxslt-tools
BuildRequires:  meson
BuildRequires:  ninja
BuildRequires:  cmake
BuildRequires:  sqlite3-devel
BuildRequires:  openldap2-devel
BuildRequires:  pam-devel
BuildRequires:  perl
BuildRequires:  pkg-config
BuildRequires:  systemd
BuildRequires:  systemtap-sdt-devel
BuildRequires:  tcpd-devel
BuildRequires:  tracker
BuildRequires:  unicode-ucd
BuildRequires:  libiniparser-devel
BuildRequires:  libbstring1-devel
BuildRequires:  libbstring1

Requires:     dconf
Requires:     libbstring1
%{?systemd_requires}

%description
Netatalk is an AFP fileserver. A system running Netatalk is capable
of serving many Macintosh clients simultaneously as an AppleShare
file server (AFP).

%package        devel
Summary:        Development files for %{name}

%description    devel
This package contains libraries and header files for
developing applications that use %{name}.

%package        afptest
Summary:        Afp test suite for %{name}

%description    afptest
Apple Filing Protocol service test tools.

This package contains the following AFP functional test runners,
benchmarks, and supporting tools:
 * afp_lantest   - AFP benchmark akin to HELIOS LanTest
 * afp_logintest - test authentication over DSI
 * afp_spectest  - AFP specification functional test suite
 * afp_speedtest - AFP read/write/copy benchmark
 * afparg        - AFP CLI client

%package        appletalk
Summary:        Appletalk support for classic macintoshes
Requires:       kernel-modules-extra

%description    appletalk
This package contains Netatalk's services and tools for networking
with very old Macs and Apple IIs.

This package contains the daemon and utility programs
for the Netatalk AppleTalk network suite, which can be used
with the Netatalk AFP file server, and other services.

In addition to the atalkd network management daemon,
the following utility programs are installed:
 * aecho      - send AppleTalk Echo Protocol pings
 * getzones   - list available AppleTalk zones
 * nbplkup    - list registered AppleTalk entities
 * nbprgstr   - register an AppleTalk entity
 * nbpunrgstr - release a registered AppleTalk entity
 * a2boot     - allows you to boot an Apple II over the network
                from an AFP volume
 * macipgw    - MacIP gateway which enables pre-TCP/IP Macs to browse the web
                and use other TCP/IP resources
 * papd       - allows Mac OS and Apple II clients to print to modern
                AirPrint / CUPS enabled printers
 * pap        - print from the host to a LocalTalk printer
 * papstatus  - inquire the status of a LocalTalk printer
 * timelord   - time server for Mac OS and Apple II

%package doc
Summary:        HTML Documentation for %{name}
BuildArch:      noarch

%description doc
Netatalk is a freely-available Open Source AFP file server. A *NIX/*BSD
system running Netatalk is capable of serving many Macintosh clients
simultaneously as an AppleShare file server (AFP).
This package contains the HTML documentation for %{name}.

%prep
%autosetup -p1 -n netatalk-%{version}

%build

# TODO: build html documentation with:
# -Dwith-docbook-path=#{_datadir}/sgml/docbook/xsl-stylesheets-#{xslver} \

%meson \
        --localstatedir=%{_localstatedir}/lib                                  \
        -Ddefault_library=shared                                               \
        -Dwith-rpath=false                                                     \
        -Dwith-overwrite=true                                                  \
        -Dwith-tcp-wrappers=false                                              \
        -Dwith-dbus-sysconf-path=%{_sysconfdir}/dbus-1/system.d                \
        -Dwith-pkgconfdir-path=%{_sysconfdir}/netatalk                         \
        -Dwith-init-style=systemd                                              \
        -Dwith-init-hooks=false                                                \
        -Dwith-uams-path=%{_libdir}/netatalk                                   \
        -Dwith-cups=true                                                       \
        -Dwith-tests=true                                                      \
        -Dwith-testsuite=true                                                  \
        -Dwith-cnid-default-backend=dbd

%meson_build

%install
%meson_install

%fdupes -s %{buildroot}%{_mandir}
%fdupes -s %{buildroot}%{_localstatedir}/lib

### Move pam.d from /etc to /usr/lib
mkdir -p %{buildroot}/%{_distconfdir}/pam.d/
mv %{buildroot}%{_sysconfdir}/pam.d/* %{buildroot}/%{_distconfdir}/pam.d/
rmdir %{buildroot}%{_sysconfdir}/pam.d

%check
%meson_test

%post
%systemd_post %{name}.service

%preun
%systemd_preun %{name}.service

%postun
%systemd_postun_with_restart %{name}.service

%post appletalk
%systemd_post a2boot.service atalkd.service macipgw.service papd.service timelord.service

%preun appletalk
%systemd_preun a2boot.service atalkd.service macipgw.service papd.service timelord.service

%postun appletalk
%systemd_postun_with_restart a2boot.service atalkd.service macipgw.service papd.service timelord.service

%files
%license COPYING COPYRIGHT
%doc CONTRIBUTORS.md NEWS.md INSTALL.md README.md SECURITY.md

%dir %{_sysconfdir}/netatalk
# TODO XXX: Is this safe to do?
%dir %{_distconfdir}/pam.d
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/netatalk-dbus.conf
%config(noreplace) %{_sysconfdir}/netatalk/afp.conf
#%config(noreplace) %{_sysconfdir}/netatalk/dbus-session.conf
%config(noreplace) %{_sysconfdir}/netatalk/extmap.conf
%config(noreplace) %{_distconfdir}/pam.d/netatalk

%{_sbindir}/afpd
%{_sbindir}/cnid_dbd
%{_sbindir}/cnid_metad
%{_sbindir}/netatalk

%{_bindir}/ad
%{_bindir}/afpldaptest
%{_bindir}/afppasswd
%{_bindir}/afpstats
%{_bindir}/addump
%{_bindir}/asip-status
%{_bindir}/dbd
%{_bindir}/macusers

%dir %{_libdir}/netatalk
%{_libdir}/netatalk/uams_*.so
%{_libdir}/libatalk.so.19{,.*}

## FIXME: man are not yet working
#%{_mandir}/man1/ad.1*
#%{_mandir}/man1/afpldaptest.1*
#%{_mandir}/man1/afppasswd.1*
#%{_mandir}/man1/afpstats.1*
#%{_mandir}/man1/addump.1*
#%{_mandir}/man1/asip-status.1*
#%{_mandir}/man1/dbd.1*
#%{_mandir}/man1/macusers.1*
#
#%{_mandir}/man5/afp.conf.5*
#%{_mandir}/man5/afp_signature.conf.5*
#%{_mandir}/man5/afp_voluuid.conf.5*
#%{_mandir}/man5/extmap.conf.5*
#
#%{_mandir}/man8/afpd.8*
#%{_mandir}/man8/cnid_dbd.8*
#%{_mandir}/man8/cnid_metad.8*
#%{_mandir}/man8/netatalk.8*

%{_unitdir}/netatalk.service

%dir %{_localstatedir}/lib/netatalk
%{_localstatedir}/lib/netatalk/CNID

%files devel
%dir %{_includedir}/atalk
%{_includedir}/atalk/*.h
%{_libdir}/libatalk.so

## FIXME: Doen't work yet ...
#%dir %{_includedir}/netatalk
#%{_includedir}/netatalk/*.h

#%{_mandir}/man3/atalk_aton.3*
#%{_mandir}/man3/nbp_name.3*

#%{_mandir}/man4/atalk.4*


%files afptest
%license test/testsuite/COPYING
## FIXME: Doen't work yet ...
#%doc test/testsuite/README
%{_bindir}/afp_lantest
%{_bindir}/afp_logintest
%{_bindir}/afp_spectest
%{_bindir}/afp_speedtest
%{_bindir}/afparg
%{_bindir}/fce_listen

%dir %{_datarootdir}/netatalk
%{_datarootdir}/netatalk/test-data/test431_data
%dir %{_datarootdir}/netatalk/test-data

## FIXME: Doen't work yet ...
#%{_mandir}/man1/afp_lantest.1*
#%{_mandir}/man1/afp_logintest.1*
#%{_mandir}/man1/afp_spectest.1*
#%{_mandir}/man1/afp_speedtest.1*
#%{_mandir}/man1/afptest.1*
#%{_mandir}/man1/afparg.1*

%if 0
%files appletalk
#doc README.AppleTalk
%config(noreplace) %{_sysconfdir}/netatalk/atalkd.conf
%config(noreplace) %{_sysconfdir}/netatalk/papd.conf

%{_sbindir}/a2boot
%{_sbindir}/atalkd
%{_sbindir}/macipgw
%{_sbindir}/papd
%{_sbindir}/timelord

%{_bindir}/aecho
%{_bindir}/getzones
%{_bindir}/nbplkup
%{_bindir}/nbprgstr
%{_bindir}/nbpunrgstr
%{_bindir}/pap
%{_bindir}/papstatus

%{_mandir}/man1/aecho.1*
%{_mandir}/man1/getzones.1*
%{_mandir}/man1/nbplkup.1*
%{_mandir}/man1/nbp.1*
%{_mandir}/man1/nbprgstr.1*
%{_mandir}/man1/nbpunrgstr.1*
%{_mandir}/man1/pap.1*

%{_mandir}/man5/atalkd.conf.5*
%{_mandir}/man5/papd.conf.5*

%{_mandir}/man8/a2boot.8*
%{_mandir}/man8/atalkd.8*
%{_mandir}/man8/macipgw.8*
%{_mandir}/man8/papd.8*
%{_mandir}/man8/papstatus.8*
%{_mandir}/man8/timelord.8*

%{_unitdir}/a2boot.service
%{_unitdir}/atalkd.service
%{_unitdir}/macipgw.service
%{_unitdir}/papd.service
%{_unitdir}/timelord.service
%endif

%files doc
%license COPYING COPYRIGHT
%doc %{_datadir}/doc/netatalk/*
%dir %{_datadir}/doc/netatalk
# TODO: Add the htmldoc
#doc #{_pkgdocdir}/htmldoc

%changelog
openSUSE Build Service is sponsored by