File libpri.spec of Package libpri

#
# spec file for package libpri
#
# 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 http://bugs.opensuse.org/
#


Name:           libpri
%define lname	libpri1_4
Version:        1.6.1
Release:        0
Summary:        An implementation of Primary Rate ISDN
License:        GPL-2.0
Group:          Development/Libraries/C and C++
Url:            http://asterisk.org/
Source:         http://downloads.asterisk.org/pub/telephony/libpri/%name-%version.tar.gz
Source2:        http://downloads.asterisk.org/pub/telephony/libpri/%name-%version.tar.gz.asc
Source3:        %name.keyring
BuildRequires:  dahdi-linux-devel
BuildRequires:  libtonezone-devel

%description
libpri is a C implementation of the Primary Rate ISDN specification.
It was based on the Bellcore specification SR-NWT-002343 for National
ISDN. It has been tested work with NI-2, Nortel DMS-100, and Lucent
5E Custom protocols on switches from Nortel and Lucent.

%package -n %lname
Summary:        An implementation of Primary Rate ISDN
Group:          System/Libraries

%description -n %lname
libpri is a C implementation of the Primary Rate ISDN specification.
It was based on the Bellcore specification SR-NWT-002343 for National
ISDN. It has been tested work with NI-2, Nortel DMS-100, and Lucent
5E Custom protocols on switches from Nortel and Lucent.

%package devel
Summary:        Development Library of Primary Rate ISDN
Group:          Development/Libraries/C and C++
Requires:       %lname = %version

%description devel
libpri is a C implementation of the Primary Rate ISDN specification.
It was based on the Bellcore specification SR-NWT-002343 for National
ISDN. It has been tested work with NI-2, Nortel DMS-100, and Lucent
5E Custom protocols on switches from Nortel and Lucent.

This package contains the header files and libraries necessary for
developing applications which use libpri.

%prep
%autosetup -p1

# change harcoded /usr/lib path to %_libdir so libs are placed properly
# on 64 bit arches too
perl -pi -e's,\$\(INSTALL_BASE\)/lib,%_libdir,g' Makefile

# if building as non-root make sure the location of restorecon is known
perl -pi -e's,restorecon,/sbin/restorecon,g' Makefile

# use $(RPM_OPT_FLAGS)
perl -pi -e 's,CFLAGS=(.*),CFLAGS=\$(RPM_OPT_FLAGS) $1,' Makefile
perl -pi -e 's{ -Werror }{ }' Makefile

%build
# The developers have added functions in the past (for example, between 1.4.12
# and 1.4.13) without one of: (a) bumping SO version, or (b) ELF symbol
# versioning. Therefore, tag all symbols now to make updates/downgrades
# guarantee working.
echo 'V_%version { global: *; };' >libpri.sym
%make_build LDFLAGS="-Wl,--version-script=libpri.sym"

%install
%make_install
rm -fv "%buildroot/%_libdir"/*.a

%ldconfig_scriptlets -n %lname

%files -n %lname
%license LICENSE
%_libdir/libpri.so.1.4*

%files devel
%doc README TODO
%_libdir/libpri.so
%_includedir/libpri.h

%changelog
openSUSE Build Service is sponsored by