SPEC.yast2-core/yast2-core.spec
2025-02-07 13:21:11 +08:00

309 lines
8.7 KiB
RPMSpec

# built-in perl-macro
# macros.perl file
# macros for perl module building. handle with care.
# Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
#
%define perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
%define perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
%define perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
%define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
%define perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
%define perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
# More useful perl macros (from Raul Dias <rsd@swi.com.br>)
#
%define perl_version %(perl -V:version | sed "s!.*='!!;s!'.*!!")
%define perl_man1ext %(perl -V:man1ext | sed "s!.*='!!;s!'.*!!")
%define perl_man3ext %(perl -V:man3ext | sed "s!.*='!!;s!'.*!!")
%define perl_man1dir %(perl -V:man1dir | sed "s!.*='!!;s!'.*!!")
%define perl_man3dir %(perl -V:man3dir | sed "s!.*='!!;s!'.*!!")
%define perl_installman1dir %(perl -V:installman1dir | sed "s!.*='!!;s!'.*!!")
%define perl_installman3dir %(perl -V:installman3dir | sed "s!.*='!!;s!'.*!!")
%define perl_installarchlib %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")
%define perl_prefix %{buildroot}
# Macro to encapsulate perl requires (empty for fedora)
# we keep the complicated form even here to easy sync the other macros with
# perl-macros package
#
%define perl_requires() \
%if 0%{?suse_version} > 0 \
Requires: perl(:MODULE_COMPAT_%{perl_version}) \
%endif
%define libperl_requires() \
%if 0%{?suse_version} > 0 \
Requires: perl = %{perl_version} \
%endif
# suse specific macros
#
%define perl_make_install make DESTDIR=$RPM_BUILD_ROOT install_vendor
%define perl_process_packlist(n:) \
if test -n "$RPM_BUILD_ROOT" -a -d $RPM_BUILD_ROOT%perl_vendorarch/auto; then \
find $RPM_BUILD_ROOT%perl_vendorarch/auto -name .packlist -print0 | xargs -0 -r rm \
if [ %{_target_cpu} == noarch ]; then \
find $RPM_BUILD_ROOT%perl_vendorarch/auto -depth -type d -print0 | xargs -0 -r rmdir \
fi \
fi \
rm -f $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod \
%nil
# macro: perl_gen_filelist (from Christian <chris@computersalat.de>)
# do the rpmlint happy filelist generation
# with %dir in front of directories
#
%define perl_gen_filelist(n)\
FILES=%{name}.files\
# fgen_dir func\
# IN: dir\
fgen_dir(){\
%{__cat} >> $FILES << EOF\
%dir ${1}\
EOF\
}\
# fgen_file func\
# IN: file\
fgen_file(){\
%{__cat} >> $FILES << EOF\
${1}\
EOF\
}\
# check for files in %{perl_vendorlib}\
RES=`find ${RPM_BUILD_ROOT}%{perl_vendorlib} -maxdepth 1 -type f`\
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/$(basename ${file})"\
done\
fi\
\
# get all dirs into array\
base_dir="${RPM_BUILD_ROOT}%{perl_vendorlib}/"\
for dir in `find ${base_dir} -type d | sort`; do\
if [ "$dir" = "${base_dir}" ]; then\
continue\
else\
el=${dir#$base_dir}\
all_dir=(${all_dir[@]} $el)\
fi\
done\
\
# build filelist\
for i in ${all_dir[@]}; do\
# do not add "dir {perl_vendorlib/arch}/auto", included in perl package\
if [ "${i}" = "auto" ]; then\
continue\
fi\
if [ "%{perl_vendorlib}/${i}" = "%{perl_vendorarch}/auto" ]; then\
continue\
else\
if [ -d ${base_dir}/${i} ]; then\
if [ "%{perl_vendorlib}/${i}" != "%{perl_vendorarch}" ]; then\
fgen_dir "%{perl_vendorlib}/${i}"\
fi\
RES=`find "${base_dir}/${i}" -maxdepth 1 -type f`\
for file in $RES; do\
fgen_file "%{perl_vendorlib}/${i}/$(basename ${file})"\
done\
fi\
fi\
done\
# add man pages\
# if exist :)\
if [ -d "${RPM_BUILD_ROOT}%{_mandir}" ]; then\
for file in `cd "${RPM_BUILD_ROOT}%{_mandir}" && find . -type f -name "*3pm*"`; do \
if test -e "%{_mandir}/$file" -o -e "%{_mandir}/$file.gz"; then \
mv ${RPM_BUILD_ROOT}%{_mandir}/$file ${RPM_BUILD_ROOT}%{_mandir}/${file/3pm/3pmc} \
fi \
done \
fgen_file "%{_mandir}/man?/*"\
fi\
\
# add packlist file\
# generated fom perllocal.pod\
if [ -f "${RPM_BUILD_ROOT}/var/adm/perl-modules/%{name}" ]; then\
fgen_file "/var/adm/perl-modules/%{name}"\
fi\
\
# check for files in %{_bindir}\
if [ -d ${RPM_BUILD_ROOT}%{_bindir} ]; then\
RES=`find "${RPM_BUILD_ROOT}%{_bindir}" -maxdepth 1 -type f`\
if [ -n "$RES" ]; then\
for file in $RES; do\
fgen_file "%{_bindir}/$(basename ${file})"\
done\
fi\
fi
#
# spec file for package yast2-core
#
# 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/
#
%bcond_with clang
# Optionally treat C/C++ warnings as errors.
# It is off by default so that it will not block mass tests of new GCC
# but we want to enable it in a side repo
# to be able to fix newly detected problems relatively early.
%bcond_with werror
Name: yast2-core
Version: 5.0.3
Release: 0
URL: https://github.com/yast/yast-core
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Source0: %{name}-%{version}.tar.bz2
# obviously
BuildRequires: boost-devel
%if %{with clang}
BuildRequires: llvm-clang
%else
BuildRequires: gcc-c++
%endif
BuildRequires: libtool
# we have a parser
BuildRequires: bison
BuildRequires: flex
# incompatible change, parser.h -> parser.hh
BuildRequires: automake >= 1.12
# needed for all yast packages
BuildRequires: yast2-devtools >= 3.1.10
# testsuite
BuildRequires: glibc-locale
BuildRequires: dejagnu
Summary: YaST2 - Core Libraries
License: GPL-2.0-or-later
Group: System/YaST
# the definition of perl version differs
#Requires: perl = %{perl_version}
%description
This package contains the scanner, parser, and interpreter runtime
library for the YCP scripting language used in YaST2.
%package devel
Requires: yast2-core = %version
Summary: YaST2 - Core Libraries
Group: Development/Libraries
Provides: liby2util-devel = 2.16.1
Obsoletes: liby2util-devel < 2.16.1
Requires: glibc-devel
Requires: libstdc++-devel
%description devel
This package contains include and documentation files for developing
applications using the YaST2 YCP interpreter.
%prep
%setup -n %{name}-%{version}
%build
%ifarch %arm
%if 0%{?qemu_user_space_build}
# disable autodoc building on qemu-arm only
sed -i SUBDIRS -e 's/autodocs//'
%endif
%endif
export SUSE_ASNEEDED=0 # disable --as-needed until this package is fixed
%if %{with werror}
export CFLAGS="${RPM_OPT_FLAGS} -Werror"
export CXXFLAGS="${RPM_OPT_FLAGS} -Werror"
%endif
%if %{with clang}
export CC=clang CXX=clang++
# warning/error: argument unused during compilation
CFLAGS="${CFLAGS/-grecord-gcc-switches/}"
CXXFLAGS="${CXXFLAGS/-grecord-gcc-switches/}"
# "unsupported argument 'auto' to option 'flto='"
# This time it comes from RPM macro expansion
# so let's override /usr/lib/rpm/suse/macros
%define _lto_cflags %{nil}
%endif
%yast_build
%install
%yast_install
mkdir -p "$RPM_BUILD_ROOT"%{yast_logdir}
%perl_process_packlist
%post
/sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%dir %{_libdir}/YaST2
%if "%_lib" == "lib64"
%dir /usr/lib/YaST2
%endif
%dir /usr/share/YaST2
%dir %attr(0700,root,root) %{yast_logdir}
%dir %{yast_ybindir}
%dir %{yast_plugindir}
%dir %{yast_scrconfdir}
%dir %{yast_execcompdir}/servers_non_y2
/usr/bin/ycpc
%{_libdir}/lib*.so.*
%{yast_ybindir}/y2base
%{yast_ybindir}/startshell
%{yast_ybindir}/tty_wrapper
%{yast_ybindir}/md_autorun
%{yast_ybindir}/elf-arch
%{yast_plugindir}/lib*.so.*
%{yast_scrconfdir}/*.scr
%{yast_execcompdir}/servers_non_y2/ag_*
# perl part (stdio agents)
# *: regular build compresses them, debug does not
%{_mandir}/man3/ycp.3pm*
%{_mandir}/man3/YaST::SCRAgent.3pm*
%{perl_vendorlib}/ycp.pm
%dir %{perl_vendorlib}/YaST
%{perl_vendorlib}/YaST/SCRAgent.pm
%files devel
%defattr(-,root,root)
%{yast_ybindir}/ybcdump
%{_libdir}/lib*.so
%{_libdir}/lib*.la
%{yast_plugindir}/lib*.so
%{yast_plugindir}/lib*.la
%{yast_includedir}
%{_libdir}/pkgconfig/yast2-core.pc
%doc %{_datadir}/doc/packages/yast2-core
%doc %{_datadir}/doc/yastdoc
%license COPYING
%{yast_ydatadir}/devtools/bin/generateYCPWrappers
%changelog