X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=rpm.macros;h=cec3abb326e8f7546ade1fb1a57d40e40370ee26;hb=e2329ed5e3880f908d164c82ce6cd8ceead37e6f;hp=17973281771f0c44653664276e778e267af0201a;hpb=261c16b908f43dd09d9de7293014241d8f6a8ee8;p=packages%2Frpm-build-macros.git diff --git a/rpm.macros b/rpm.macros index 1797328..cec3abb 100644 --- a/rpm.macros +++ b/rpm.macros @@ -8,7 +8,6 @@ %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 @@ -35,6 +34,10 @@ %__scons /usr/bin/scons %{?_smp_mflags} %__waf /usr/bin/waf %{?_smp_mflags} %__cmake /usr/bin/cmake +%__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 \ @@ -82,7 +85,7 @@ )}%_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 @@ -320,6 +323,40 @@ LINKFLAGS="%{rpmldflags}" \ %{__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} \ +} +%meson_build LC_ALL=C.UTF-8 %ninja_build +%meson_install LC_ALL=C.UTF-8 %ninja_install +%meson_test LC_ALL=C.UTF-8 %ninja_test + +# ninja +%ninja_build %{__ninja} %{__ninja_common_opts} +%ninja_install DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts} +%ninja_test %{__ninja} test %{__ninja_common_opts} + #---------------------------------------------------------------- #%configure_cache 0 %configure_cache_file %{buildroot}.configure.cache @@ -486,7 +523,7 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} '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 \ } @@ -513,8 +550,8 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} 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 \ @@ -544,14 +581,14 @@ Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release} 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 } } @@ -719,7 +756,7 @@ __spec_install_post_check_tmpfiles() { \ [ -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 ; \ @@ -767,6 +804,15 @@ __spec_install_post_check_shebangs() { \ %{?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 # @@ -807,17 +853,23 @@ fi; \ #----------------------------------------------------------------- # 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}} \ @@ -885,6 +937,9 @@ fi; \ # %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 # %__noauto_regexp_helper(p:) %(echo "%*" | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}') # detect quote character runtime @@ -897,7 +952,7 @@ fi; \ %_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 @@ -1177,10 +1232,20 @@ fi \ # 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() { \ @@ -1285,11 +1350,11 @@ fi; \ # 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 < m; sh -x m @@ -1418,6 +1483,9 @@ 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"] @@ -1501,12 +1569,12 @@ cat > $RPM_BUILD_ROOT%{_bindir}/%5 << 'EOF' \ \ # 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\ @@ -2123,12 +2191,12 @@ fi; \ %{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; \ @@ -2139,8 +2207,8 @@ fi; \ # pre/post script for packages supporting systemd units # -# Author: Bartlomiej Zimon -# Jan Rękorajski +# Authors: Bartlomiej Zimon +# Jan Rękorajski # # Usage: # %systemd_reload @@ -2173,11 +2241,11 @@ fi; \ # 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} @@ -2188,29 +2256,32 @@ fi; \ %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 \ @@ -2221,19 +2292,19 @@ want_enable_service() { \ 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 \ @@ -2242,7 +2313,7 @@ want_enable_service() { \ %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} @@ -2251,6 +2322,9 @@ want_enable_service() { \ %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 #