%epoch 0
%x8664 x86_64 amd64 ia32e
-%arm armv3l armv4b armv4l armv5teb armv5tel
# compiler version
%cc_version %{expand:%%global cc_version %(%{__cc} -dumpversion 2>/dev/null || echo 0.0)}%cc_version
%__make /usr/bin/make %{?_make_opts} %{?_smp_mflags}
%__scons /usr/bin/scons %{?_smp_mflags}
%__waf /usr/bin/waf %{?_smp_mflags}
-%__cmake /usr/bin/cmake
+%__cmake /usr/bin/cmake -Wno-dev
+%__meson /usr/bin/meson
+%__meson_wrap_mode nodownload
+%__ninja /usr/bin/ninja
+%__ninja_common_opts -v %{?_smp_mflags}
%__gettextize { \
if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
)}%_topdir
# if %{_topdir}/SPECS exists, it's old style structure
-%_specdir %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
+%_specdir %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
%_sourcedir %{expand:%%global _sourcedir %([ ! -d %{_topdir}/SOURCES ] && echo %{_specdir} || echo %{_topdir}/SOURCES)}%_sourcedir
# BUILD/RPMS/SRPMS are on same level by default as packages dir, if these exist
%{__waf} \
}
+# meson
+%meson { \
+%{?__cc:CC="${CC:-%{__cc}}"} \
+%{?__cxx:CXX="${CXX:-%{__cxx}}"} \
+CFLAGS="${CFLAGS:-%{rpmcflags}}" \
+CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \
+CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \
+LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \
+LC_ALL=C.UTF-8 %{__meson} \
+ --buildtype=plain \
+ --bindir=%{_bindir} \
+ --datadir=%{_datadir} \
+ --includedir=%{_includedir} \
+ --infodir=%{_infodir} \
+ --libdir=%{_libdir} \
+ --libexecdir=%{_libexecdir} \
+ --localedir=%{_localedir} \
+ --localstatedir=%{_localstatedir} \
+ --mandir=%{_mandir} \
+ --prefix=%{_prefix} \
+ --sbindir=%{_sbindir} \
+ --sharedstatedir=%{_sharedstatedir} \
+ --sysconfdir=%{_sysconfdir} \
+ --wrap-mode=%{__meson_wrap_mode} \
+ --default-library='both' \
+}
+
+%___meson_deprecate() {echo >&2 "DEPRECATED: %%%1 must be replaced with %%%2"; %{expand:%%%2} }
+%meson_build %___meson_deprecate meson_build ninja_build
+%meson_install %___meson_deprecate meson_install ninja_install
+%meson_test %___meson_deprecate meson_test ninja_test
+
+# ninja
+%ninja_build LC_ALL=C.UTF-8 %{__ninja} %{__ninja_common_opts}
+%ninja_install LC_ALL=C.UTF-8 DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts}
+%ninja_test LC_ALL=C.UTF-8 %{__ninja} test %{__ninja_common_opts}
+
#----------------------------------------------------------------
#%configure_cache 0
%configure_cache_file %{buildroot}.configure.cache
%__without_if() %{expand:%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
%__with_without_not() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
+# expands to true or false based on bcond; for use with meson or cmake
+%__true_false() %{expand:%%{?with_%{1}:true}%%{!?with_%{1}:false}}
+%__true_false_not() %{expand:%%{?with_%{1}:false}%%{!?with_%{1}:true}}
+
+# for use with cmake:
+# Usage: cmake_on_off BCOND_NAME [OPTION_NAME]
+# BuildRequires: rpmbuild(macros) >= 1.742
+%cmake_on_off() -D%{?2}%{!?2:%{1}}:BOOL=%{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
+
#-----------------------------------------------------------------
# overload to insert debuginfo package
'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
' -- hacks for opensp --' \
'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
-'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
+'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
'' \
; do echo $l; done >> %1 \
}
for i in /usr/share/man /usr/X11R6/man; do \
if [ -d "$RPM_BUILD_ROOT$i" ]; then \
echo "Compress man pages: $i"; \
- find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
- find "$RPM_BUILD_ROOT$i" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
+ find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \
+ find "$RPM_BUILD_ROOT$i" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \
find $RPM_BUILD_ROOT$i -type l | while read a; do \
m=$(readlink "$a"); \
if [[ "$m" = */* ]]; then \
test -e $RPM_BUILD_ROOT$i/$l || test -e $d/$(basename $l) || echo " ${doc#$RPM_BUILD_ROOT} points to inexistent manpage: $l"; \
done); \
test "$err" != "" && { echo >&2 "Man page link errors:"; echo >&2 "$err"; exit 1; }; \
- find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
+ find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \
fi; \
done; \
if [ -d "$RPM_BUILD_ROOT%{_infodir}" ]; then \
echo "Compress info pages: %{_infodir}"; \
- find "$RPM_BUILD_ROOT%{_infodir}" -name '*.bz2' -print | xargs -r %{__bzip2} -df; \
- find "$RPM_BUILD_ROOT%{_infodir}" -name '*.gz' -print | xargs -r %{__gzip} -dnf; \
- find "$RPM_BUILD_ROOT%{_infodir}" -name '*.info*' -type f -size +%{_min_compress_bytes}c -print | xargs -r %{__gzip} -9nf; \
+ find "$RPM_BUILD_ROOT%{_infodir}" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \
+ find "$RPM_BUILD_ROOT%{_infodir}" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \
+ find "$RPM_BUILD_ROOT%{_infodir}" -name '*.info*' -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \
fi; \
}; __spec_install_post_compress_docs } }
echo "DONE"; \
fi; \
fi; \
- filelist=$(find $RPM_BUILD_ROOT -type f ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"} %{?_autostripall:! -regex "%{_autostripall}"} %{?_autostripunneeded:! -regex "%{_autostripunneeded}"} %{?_autostripdebug:! -regex "%{_autostripdebug}"}); \
+ filelist=$(find $RPM_BUILD_ROOT -type f ! -regex ".*/usr/lib[x0-9]*/debug/.*\.debug" ! -regex ".*/usr/lib[x0-9]*.*/guile/.*\.go" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautostrip:! -regex "%{_noautostrip}"} %{?_autostripall:! -regex "%{_autostripall}"} %{?_autostripunneeded:! -regex "%{_autostripunneeded}"} %{?_autostripdebug:! -regex "%{_autostripdebug}"}); \
if [ -n "$filelist" ]; then \
filetypes=`echo "$filelist" | xargs -r -d'\\n' file`; \
elfexelist=`echo "$filetypes" | awk -F: '/ELF.*executable/ {print $1}'`; \
fail=0; \
printf "Searching for shared objects with unresolved symbols..."; \
for f in $(find $RPM_BUILD_ROOT -type f -name '*.so.*' -print); do \
- LC_ALL=C objdump -T $f 2> /dev/null | LC_ALL=C awk -v "file=$f" 'BEGIN { found=0; skip["program_name"]=1; symbols = "" } /^[0-9a-z]+ +D +\*UND\*/ { if ($NF in skip) { next; }; found = 1; symbols = symbols "\n\t" $NF } END { if (found) { print "\nUnresolved symbols found in: " file symbols; %{?skip_post_check_so:split("%{skip_post_check_so}", R); for (i=1; i in R; i++) { if (file ~ "(^|/)" R[i] "$") { print "Library marked with skip_post_check_so, ignoring errors.\n"; exit(0); } } } exit(1); } } ' || fail=1 ; \
+ LC_ALL=C objdump -T $f 2> /dev/null | LC_ALL=C awk -v "file=$f" 'BEGIN { found=0; skip["program_name"]=1; skip["_ZSt15__once_callable"]=1; skip["_ZSt11__once_call"]=1; symbols = "" } /^[0-9a-z]+ +D +\*UND\*/ { if ($NF in skip) { next; }; found = 1; symbols = symbols "\n\t" $NF } END { if (found) { print "\nUnresolved symbols found in: " file symbols; %{?skip_post_check_so:split("%{skip_post_check_so}", R); for (i=1; i in R; i++) { if (file ~ "(^|/)" R[i] "$") { print "Library marked with skip_post_check_so, ignoring errors.\n"; exit(0); } } } exit(1); } } ' || fail=1 ; \
done ; \
echo " DONE"; \
%{!?no_install_post_check_so:return $fail;} \
}; __spec_install_post_check_so }}
+#-----------------------------------------------------------------
+# Find all ELF files with executable stac. Warn and terminate if any found
+# (termination can be turned off by define).
+# Details: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
+#%no_install_post_check_stackexec 1
+#%skip_post_check_stackexec libwithexecstackok.so.*
+#
+# NOTE: define skip_post_check_stackexec only if such program or library
+# really requires executable stack and always leave a comment why
+# it is required:
+# # Programs full of nested functions that cannot be fixed
+# %define skip_post_check_execstack /bin/foo libwithexecstack.so.*
+#
+%__spec_install_post_check_execstack { \
+__spec_install_post_check_execstack() { \
+%{!?debug:set +x;} \
+ fail=0; \
+ printf "Searching for ELF programs with executable stack..."; \
+ for f in $(find $RPM_BUILD_ROOT -type f -print) ; do \
+ LC_ALL=C readelf -lW $f 2>/dev/null | \
+ LC_ALL=C awk -v "file=$f" 'BEGIN { found=0; } /GNU_STACK/ { if ($7 ~ "E") { found=1 } } END { if (found) { print "\nExecutable stack found in: " file; %{?skip_post_check_execstack:split("%{skip_post_check_execstack}", R); for (i=1; i in R; i++) { if (file ~ "(^|/)" R[i] "$") { print "File marked with skip_post_check_execstack, ignoring errors.\n"; exit(0); } } } exit(1); } }' || fail=1 ; \
+ done ; \
+ echo " DONE"; \
+ %{!?no_install_post_check_execstack:return $fail;} \
+}; __spec_install_post_check_execstack }}
+
#-----------------------------------------------------------------
# Verify that for each directory under /var/run package contains
# tmpfiles.d configuration. Warn and terminate build if config is
[ -d "$d" ] || continue; \
d=${d##$RPM_BUILD_ROOT}; \
if ! grep -qsF "$d" $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/*.conf $RPM_BUILD_ROOT/etc/tmpfiles.d/*.conf; then\
- echo "No tmpfiles configuration for '$d'";\
+ echo "No tmpfiles configuration for '$d'";\
fail=1 ; \
fi \
done ; \
%{!?no_install_post_check_tmpfiles:return $fail;} \
}; __spec_install_post_check_tmpfiles }}
+#-----------------------------------------------------------------
+# Verify that scripts have reasonable shebangs
+# Test spec: see "test/spec_install_post_check_shebangs" branch on packages/test.spec
+#
+#%no_install_post_check_shebangs 1
+#
+%__spec_install_post_check_shebangs { \
+__spec_install_post_check_shebangs() { \
+%{!?debug:set +x;} \
+ fail=0; \
+ echo "Checking script shebangs..."; \
+ find $RPM_BUILD_ROOT -type f -perm -500 -print | \
+ while read f ; do \
+ shebang="$(sed -e'1s/#! *\(.*\)/\1/;t;d;q' "$f")" ; \
+ f="${f##$RPM_BUILD_ROOT}"; \
+ case "$shebang" in \
+ "%{__python}"|"%{__python3}"|"%{__python} "*|"%{__python3} "* \
+ |"/usr/bin/python%{py_ver}"|"/usr/bin/python%{py_ver} "* \
+ |"/usr/bin/python%{py3_ver}"|"/usr/bin/python%{py3_ver} "*) \
+ ;; \
+ "/usr/bin/env python"*|"/usr/bin/python"|"/usr/bin/python "*) \
+ echo "$f starts with '#!$shebang', should be '#!%{__python}' or '#!%{__python3}'" >&2;\
+ fail=1 ; \
+ ;; \
+ "/usr/bin/env "*) \
+ echo "$f starts with '#!$shebang', should be explicit interpreter path" >&2;\
+ fail=1 ; \
+ ;; \
+ *) ;;\
+ esac ; \
+ done ; \
+ echo " DONE" ; \
+}; %{!?no_install_post_check_shebangs:__spec_install_post_check_shebangs} }
+
# Remove common Perl files we don't package
%__spec_install_post_perl_clean {\
%{!?no_install_post_perl_clean: \
%{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
} }
+# Helpers to specify SONAME depdendencies, e.g.:
+# Requires: %{_soname_prov libfoo.so.1}
+# Requires: %{_soname_prov libfoo.so.1(SOME_SYMVER)}
+#
+# BuildRequires: rpmbuild(macros) >= 1.721
+#
+%_soname_tag %(echo %{_lib} | sed -e 's/^lib//' -e 's/^\\(.\\+\\)$/(\\1bit)/')
+%_soname_prov() %(echo "%{1}()%{_soname_tag}" | sed -e 's/^\\([^(]*([^)]\\+)\\)()%{_soname_tag}$/\\1%{_soname_tag}/;s/()$//')
+
#-----------------------------------------------------------------
# Update GConf2 schemas
#
#-----------------------------------------------------------------
# Update shared MIME info database
# requires: shared-mime-info
+# Note: https://bugs.freedesktop.org/show_bug.cgi?id=70366#c19
+# https://bugzilla.redhat.com/show_bug.cgi?id=1052173
+# TODO: if you want this running with fdatasync(), make sure it's:
+# 1. announcing ~minute delay by echoing appropriate message,
+# 2. running only once after rpm transaction.
#
%update_mime_database() {{ \
umask 022; \
+ PKGSYSTEM_ENABLE_FSYNC=0 \
/usr/bin/update-mime-database %{_datadir}/mime; \
};} \
%{nil}
#-----------------------------------------------------------------
# Update icon cache
-# BuildRequires: rpmbuild(macros) >= 1.596
-# Requires: hicolor-icon-theme
+# BuildRequires: rpmbuild(macros) >= 1.596
+# Requires: hicolor-icon-theme
#
%update_icon_cache() {{ \
%{!?1:%{error:%{0}: Required theme name missing}} \
%__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
%__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
%__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
-%__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
+%__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov) \
+ %{?_noautoprov: %{_noautoprov}} \
+ %{?_noautoprov_java: %{__noauto_regexp_helper -p java %{_noautoprov_java}}} \
+ %{?_noautoprov_mono: %{__noauto_regexp_helper -p mono %{_noautoprov_mono}}} \
+ %{?_noautoprov_pear: %{__noauto_regexp_helper -p pear %{_noautoprov_pear}}} \
+ %{?_noautoprov_perl: %{__noauto_regexp_helper -p perl %{_noautoprov_perl}}} \
+ %{?_noautoprov_pyegg: %{__noauto_regexp_helper -p pythonegg %{_noautoprov_pyegg}}} \
+ %{?_noautoprov_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoprov_py3egg}}} \
+ %{nil}
%__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq) \
%{?_noautoreq: %{_noautoreq}} \
+ %{?_noautoreq_java: %{__noauto_regexp_helper -p java %{_noautoreq_java}}} \
+ %{?_noautoreq_mono: %{__noauto_regexp_helper -p mono %{_noautoreq_mono}}} \
%{?_noautoreq_pear: %{__noauto_regexp_helper -p pear %{_noautoreq_pear}}} \
%{?_noautoreq_perl: %{__noauto_regexp_helper -p perl %{_noautoreq_perl}}} \
- %{?_noautoreq_java: %{__noauto_regexp_helper -p java %{_noautoreq_java}}} \
+ %{?_noautoreq_pyegg: %{__noauto_regexp_helper -p pythonegg %{_noautoreq_pyegg}}} \
+ %{?_noautoreq_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoreq_py3egg}}} \
%{nil}
# helper for wrapping _noautoreq between perl() or pear()
# %define _noautoreq_perl Apache::.*
# BuildRequires: rpmbuild(macros) >= 1.672
# %define _noautoreq_java ClassDataVersion
+# BuildRequires: rpmbuild(macros) >= 1.709
+# %define _noautoreq_pyegg argparse
+# %define _noautoreq_py3egg backports.ssl-match-hostname ipaddress
+# BuildRequires: rpmbuild(macros) >= 1.730
+# %define _noautoreq_mono Gendarme.Framework
+# BuildRequires: rpmbuild(macros) >= 1.737
+# %define _noautoprov_java Class
+# %define _noautoprov_mono Excluded.Provide
+# %define _noautoprov_pear Excluded.php
+# %define _noautoprov_perl Excluded::Module
+# %define _noautoprov_pyegg excluded
+# %define _noautoprov_py3egg excluded3
#
%__noauto_regexp_helper(p:) %(echo "%*" | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}')
# detect quote character runtime
%_missing_doc_files_terminate_build 1%{nil}
%_unpackaged_files_terminate_build %{nil}
# (X)emacs support
-%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}'
+%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}'
%_emacs_lispdir %{expand:%%global _emacs_lispdir %(Z=$(emacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_emacs_lispdir
%_xemacs_lispdir %{expand:%%global _xemacs_lispdir %(Z=$(xemacs %___emacs_lispdir_helper); echo ${Z:-ERROR})}%_xemacs_lispdir
%ruby_archdir %{expand:%%global ruby_archdir %{__ruby_rbconfig_path archdir}}%ruby_archdir
%ruby_libdir %{expand:%%global ruby_libdir %{__ruby_rbconfig rubylibdir}}%ruby_libdir
-%ruby_ridir %{expand:%%global ruby_ridir %(%{__ruby} -r rbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", RbConfig::CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)}%ruby_ridir
+%ruby_ridir %{expand:%%global ruby_ridir %(%{__ruby} -r rbconfig -e 'print File.join(RbConfig::CONFIG["datadir"], "ri", "system")' 2>/dev/null || echo ERROR)}%ruby_ridir
%ruby_rubylibdir %{expand:%%global ruby_rubylibdir %{__ruby_rbconfig_path rubylibdir}}%ruby_rubylibdir
%ruby_vendorarchdir %{expand:%%global ruby_vendorarchdir %{__ruby_rbconfig vendorarchdir}}%ruby_vendorarchdir
%ruby_vendorlibdir %{expand:%%global ruby_vendorlibdir %{__ruby_rbconfig_path vendorlibdir}}%ruby_vendorlibdir
%__php /usr/bin/php%{php_versuffix}
# helper macro
-%__php_api_requires(v:) Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
+%__php_api_requires() Requires: %{php_name}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
# macros for public use
# for php extensions (php-pecl)
# directories
%py3_prefix %{expand:%%global py3_prefix %(%{__python3} -c "import sys; print(sys.prefix)" 2>/dev/null || echo ERROR)}%py3_prefix
-%py3_libdir %{expand:%%global py3_libdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platstdlib'))" 2>/dev/null || echo ERROR)}%py3_libdir
%py3_incdir %{expand:%%global py3_incdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('include'))" 2>/dev/null || echo ERROR)}%py3_incdir
-%py3_sitedir %{expand:%%global py3_sitedir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('platlib'))" 2>/dev/null || echo ERROR)}%py3_sitedir
-%py3_sitescriptdir %{expand:%%global py3_sitescriptdir %(%{__python3} -c "import sysconfig; print(sysconfig.get_path('purelib'))" 2>/dev/null || echo ERROR)}%py3_sitescriptdir
-%py3_scriptdir %{py3_prefix}/share/python%{py3_ver}
+%py3_libdir %{py3_prefix}/%{_lib}/python%{py3_ver}
+%py3_sitedir %{py3_libdir}/site-packages
+%py3_sitescriptdir %{py3_prefix}/share/python%{py3_ver}/site-packages
%py3_dyndir %{py3_libdir}/lib-dynload
# pure python modules compilation
%py3_ocomp %{__python3} -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
+%py_build { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python} setup.py \
+ build --build-base=build-2 \
+}
+
+# "shrink" filter to keep this macro without newlines,
+# so it could be used as make arguments
+%py_install_opts() %{shrink: \
+ --prefix=%{_prefix} \
+ --install-purelib=%{py_sitescriptdir} \
+ --install-platlib=%{py_sitedir} \
+ --optimize=2 \
+}
+
+%py_install { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python} setup.py \
+ build --build-base=build-2 \
+ install --skip-build \
+ %{py_install_opts} \
+ --root=$RPM_BUILD_ROOT \
+}
+
+%py3_build { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python3} setup.py build --build-base=build-3 \
+}
+
+# "shrink" filter to keep this macro without newlines,
+# so it could be used as make arguments
+%py3_install_opts() %{shrink: \
+ --prefix=%{_prefix} \
+ --install-purelib=%{py3_sitescriptdir} \
+ --install-platlib=%{py3_sitedir} \
+ --optimize=2 \
+}
+
+%py3_install { \
+ LDFLAGS="${LDFLAGS:-%rpmldflags}"; export LDFLAGS; \
+ CFLAGS="${CFLAGS:-%rpmcppflags %rpmcflags}"; export CFLAGS; \
+ CXXFLAGS="${CXXFLAGS:-%rpmcppflags %rpmcxxflags}"; export CXXFLAGS; \
+ %{?__cc:CC="%{__cc}"; export CC;} \
+ %{?__cxx:CXX="%{__cxx}"; export CXX;} \
+ %{__python3} setup.py \
+ build --build-base=build-3 \
+ install --skip-build \
+ %{py3_install_opts} \
+ --root=$RPM_BUILD_ROOT \
+}
+
# node.js libdir
# Requirements:
# BuildRequires: rpmbuild(macros) >= 1.634
# bash-completion 2.0 completions dir
# Requirements:
-# BuildRequires: rpmbuild(macros) >= 1.673
+# BuildRequires: rpmbuild(macros) >= 1.673
# Requires: bash-completion >= 2.0
%bash_compdir /usr/share/bash-completion/completions
+# fish completions dir
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.720
+%fish_compdir /usr/share/fish/vendor_completions.d
+
+# zsh completions dir
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.719
+%zsh_compdir /usr/share/zsh/site-functions
+
# Hardlink binary identical .pyc and .pyo files
%__spec_install_post_py_hardlink {\
%{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
# You can use any form of here-document, <<'EOF' <<-EOT will do.
# NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
#
-# -a - append to the banner
-# -e - send to stderr instead of stdout
-# -n - no show banner (overrides -t)
-# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
-# -o - show only once, i.e when package is installed for the first time
+# -a - append to the banner
+# -e - send to stderr instead of stdout
+# -n - don't show banner (overrides -t)
+# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
+# -o - show only once, i.e when package is installed for the first time
#
# Tests:
# (rpm -E '%banner -e banner <<EOF'; echo -e 'hi\nEOF') > m; sh -x m
#
%webapp_register(f) \
%{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
-if [ -n "%{-f:1}" ] || [ "$1" = "1" ] && [ "$2" = "1" ]; then\
+if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]); then\
/usr/sbin/webapp register %1 %2\
fi\
# reload webserver if the config symlink is there and skip reload if webserver is upgraded\
%webapp_unregister(f) \
%{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
# remove link if either of the packages are gone \
-if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]; then \
+if [ -n "%{-f:1}" ] || ([ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%(echo "%2" | tr '/' '-').conf ]); then \
/usr/sbin/webapp unregister %1 %2\
%{expand:%service -q %%1 reload}\
fi \
# calls usual service restart on package %post, but skips the restart if
# administrator has disabled automatic service restarts in either global
# /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
+# NOTE: systemd_booted machines do not print
+# Run "{command}" to restart {service}.
+# message for packages without native systemd unit (not here, no %systemd_post).
#
# Usage:
# %service [-q] [-n] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
\
# Source system prefs\
if [ -f %{_sysconfdir}/java/%{name}.conf ]; then\
- . %{_sysconfdir}/java/%{name}.conf\
+ . %{_sysconfdir}/java/%{name}.conf\
fi\
\
# Source user prefs\
if [ -f $HOME/.%{name}rc ]; then\
- . $HOME/.%{name}rc\
+ . $HOME/.%{name}rc\
fi\
\
# Configuration\
%{nil}
# Haskell Macros
-# BuildRequires: rpmbuild(macros) >= 1.608
+# BuildRequires: rpmbuild(macros) >= 1.608
%ghcdir ghc-%(/usr/bin/ghc --numeric-version 2>/dev/null || echo ERROR)
# update /usr/lib*/ghc-*/package.conf.d/package.cache
# Requires: ghc
-# BuildRequires: rpmbuild(macros) >= 1.607
+# BuildRequires: rpmbuild(macros) >= 1.607
#
%ghc_pkg_recache() {{ \
umask 022; \
# pre/post script for packages supporting systemd units
#
-# Author: Bartlomiej Zimon <uzi18@o2.pl>
-# Jan Rękorajski <baggins@mimuw.edu.pl>
+# Authors: Bartlomiej Zimon <uzi18@o2.pl>
+# Jan Rękorajski <baggins@mimuw.edu.pl>
#
# Usage:
# %systemd_reload
# BuildRequires: rpmbuild(macros) >= 1.671
# Requires: systemd-units >= 38
-%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl --quiet daemon-reload || :
+%systemd_reload /bin/systemd_booted && SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog /bin/systemctl daemon-reload || :
%systemd_service_enable() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemctl --quiet enable %{*} || : \
+ /bin/systemctl preset --preset-mode=enable-only %{*} || : \
/bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \
%{nil}
%systemd_service() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet %{*} || : \
+ /bin/systemd_booted && /bin/systemctl %{*} || : \
%{nil}
%systemd_service_start() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet start %{*} || : \
+ /bin/systemd_booted && /bin/systemctl start %{*} || : \
%{nil}
%systemd_service_stop() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet stop %{*} || : \
+ /bin/systemd_booted && /bin/systemctl stop %{*} || : \
%{nil}
+# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
%systemd_service_restart() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet try-restart %{*} || : \
+ /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \
%{nil}
+# NOTE: doesn't honour RPM_SKIP_AUTO_RESTART, avoid using
%systemd_service_reload() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet reload %{*} || : \
+ /bin/systemd_booted && /bin/systemctl reload %{*} || : \
%{nil}
+# NOTE: this trigger disobeys systemd.preset in favour of RPM_ENABLE_SYSTEMD_SERVICE
%systemd_trigger() \
want_enable_service() { \
[ -f /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
for s in %{*}; do \
if want_enable_service $s; then \
- /bin/systemctl --quiet enable $s || : \
+ /bin/systemctl enable $s || : \
fi \
done \
%{nil}
%systemd_post() \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet daemon-reload || : \
+ /bin/systemd_booted && /bin/systemctl daemon-reload || : \
if [ $1 -eq 1 ]; then \
- /bin/systemctl --quiet enable %{*} || : \
+ /bin/systemctl preset --preset-mode=enable-only %{*} >/dev/null || : \
/bin/systemd_booted && echo 'Run "/bin/systemctl start %{*}" to start %{*}.' || : \
elif [ -z "$NORESTART" ]; then \
- /bin/systemd_booted && /bin/systemctl --quiet try-restart %{*} || : \
+ /bin/systemd_booted && /bin/systemctl try-restart %{*} || : \
else \
/bin/systemd_booted && echo 'Run "/bin/systemctl restart %{*}" to restart %{*}.' || : \
fi \
%systemd_preun() \
if [ $1 -eq 0 ]; then \
export SYSTEMD_LOG_LEVEL=warning SYSTEMD_LOG_TARGET=syslog \
- /bin/systemd_booted && /bin/systemctl --quiet stop %{*} || : \
+ /bin/systemd_booted && /bin/systemctl stop %{*} || : \
/bin/systemctl --quiet disable %{*} || : \
fi \
%{nil}
%systemduserunitdir /usr/lib/systemd/user
%systemdtmpfilesdir /usr/lib/tmpfiles.d
+# BuildRequires: rpmbuild(macros) >= 1.721
+%journal_catalog_update() [ ! -x /bin/journalctl ] || /bin/journalctl --update-catalog >/dev/null 2>&1 || :
+
#-----------------------------------------------------------------
# Update hardware database index
#
/sbin/udevadm hwdb --update >/dev/null 2>&1 || : \
%{nil}
+# Generate vim help tags file
+#
+# Requirements:
+# BuildRequires: rpmbuild(macros) >= 1.718
+# Requires(post,postun): /usr/bin/vim
+# Requires(post,postun): vim-rt >= 4:7.4.2054-2
+%vim_doc_helptags() \
+umask 022; \
+/usr/bin/vim -c ':helptags /usr/share/vim/doc' -c ':q' 2>/dev/null \
+%{nil}
+
# EOF