1 # vim:ts=4 sw=4 noet ft=spec
3 # PLD Linux rpm macros.
4 # <http://www.pld-linux.org/>
6 %distribution PLD Linux
8 %bugurl http://bugs.pld-linux.org/
9 %disturl http://www.pld-linux.org/
11 %disttag %{pld_release}
13 # can be used by builder script to check for version
14 %rpm_build_macros {Revision}
18 #==============================================================================
19 # ---- configure macros. note that most of these are inherited
22 %_sharedstatedir /var/lib
24 %_localedir %{_datadir}/locale
25 %_lispdir %{_datadir}/emacs/site-lisp
26 %_initddir %{_sysconfdir}/rc.d/init.d
28 %_metainfodir %{_datadir}/metainfo
30 %_defaultdocdir %{_usr}/share/doc
32 %_fmoddir %{_libdir}/gfortran/modules
34 # Location of autoconf macros
35 %_aclocaldir %{expand:%%global _aclocaldir %(aclocal --print-ac-dir 2>/dev/null || echo ERROR)}%_aclocaldir
37 # Location of omf files
38 %_omf_dest_dir %{expand:%%global _omf_dest_dir %(scrollkeeper-config --omfdir || echo ERROR)}%_omf_dest_dir
40 # Location of pkgconfig files
41 %_pkgconfigdir /usr/%{_lib}/pkgconfig
42 # noarch pkgconfig files
43 %_npkgconfigdir /usr/share/pkgconfig
45 # Location of desktop files
46 %_desktopdir /usr/share/applications
47 %_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
49 # Location of pixmaps for applnk/desktop files
50 %_pixmapsdir /usr/share/pixmaps
52 # Location of themable icons for applnk/desktop files
53 %_iconsdir /usr/share/icons
55 # Location of fonts directories
56 %_fontsdir /usr/share/fonts
58 # Location of Gtk and associated libraries documentation
59 %_gtkdocdir %{_defaultdocdir}/gtk-doc/html
61 # Location of KDE documentation
62 %_kdedocdir %{_defaultdocdir}/kde/HTML
65 %__unsermake /usr/share/unsermake/unsermake
68 %date %(LC_ALL=C date +"%a %b %d %Y")
70 # Example files, programs, scripts...
71 %_examplesdir /usr/src/examples
73 # SysV-style initscripts dir
74 %_initddir /etc/rc.d/init.d
76 # Executed at after copying %doc to DOCDIR, with $DOCDIR set
77 # TODO: teach rpm.org that compressed %doc is the same thing as uncompressed
78 #__compress_doc %{_rpmconfigdir}/compress-doc%{?_noautocompressdoc: --noautocompressdoc='%{_noautocompressdoc}'}
81 %{__spec_install_post_strip}\
82 %{__spec_install_post_chrpath}\
83 %{__spec_install_post_compress_modules}\
84 %{__spec_install_post_check_so}\
85 %{__spec_install_post_check_tmpfiles}\
86 %{__spec_install_post_check_shebangs}\
87 %{__spec_install_post_compress_docs}\
88 %{__spec_install_post_py_hardlink}\
89 %{__spec_install_post_perl_clean}\
90 %{__arch_install_post}\
94 %{expand:%%define __sip_%{?_enable_debug_packages} 1}%{?__sip_1:%{?__debug_package:%{__debug_install_post}}}%{expand:%%undefine __sip_%{?_enable_debug_packages}}\
95 %{__arch_install_post}\
99 #---------------------------------------------------------------------
100 # Template for debug information sub-package.
101 %_enable_debug_packages 1
103 %_debuginfo_template \
105 Summary: Debug information for package %{name}\
106 Summary(pl.UTF-8): Informacje dla debuggera dla pakietu %{name}\
107 Group: Development/Debug\
108 Requires: filesystem-debuginfo >= 3.0-16\
110 %description debuginfo\
111 This package provides debug information for package %{name}.\
112 Debug information is useful when developing applications that use this\
113 package or when debugging this package.\
114 %description debuginfo -l pl.UTF-8\
115 Ten pakiet dostarcza informacje dla debuggera dla pakietu %{name}.\
116 Informacje te są przydatne przy rozwijaniu aplikacji używających tego\
117 pakietu oraz przy odpluskwianiu samego pakietu.\
118 %files debuginfo -f debugfiles.list\
119 %defattr(-,root,root)\
122 %_debugsource_template \
123 %package debugsource\
124 Summary: Debug sources for package %{name}\
125 Summary(pl.UTF-8): Źródła dla debuggera dla pakietu %{name}\
126 Group: Development/Debug\
128 %description debugsource\
129 This package provides debug sources for package %{name}.\
130 Debug sources are useful when developing applications that use this\
131 package or when debugging this package.\
132 %description debugsource -l pl.UTF-8\
133 Ten pakiet dostarcza źródła dla debuggera dla pakietu %{name}.\
134 Źródła te są przydatne przy rozwijaniu aplikacji używających tego\
135 pakietu oraz przy odpluskwianiu samego pakietu.\
136 %files debugsource -f debugsourcefiles.list\
141 %global __debug_package 1\
142 %_debuginfo_template\
143 %if 0%{?_debugsource_packages}\
144 %_debugsource_template\
149 #---------------------------------------------------------------------
150 # Overwrite RPM macros with PLD specific one here.
152 %__find /usr/bin/find
153 %__lua %{_bindir}/lua
155 %__xar %{_bindir}/xar
157 %_source_payload w9.gzdio
158 %_binary_payload w6.xzdio
160 %_rpmfc_magic_path /usr/share/file/magic
162 # provides don't obsolete
165 # Disable automatic dependencies on symlinks for now (debuginfo packages pull too many deps)
166 %_check_symlink_deps 0
168 # Do not generate executable() dependencies for scriptlets,
169 # as it may give false positives, for example:
170 # [ ! -x /bin/prog ] || /bin/prog
171 # will generate R:/bin/prog and we don't want that as /bin/prog is optional in this case
172 # 0 - Use external generator
173 # 1 - Use internal generator if available
174 # 2 - Use __scriptlet_requires to process scriptlet dependencies
175 %_use_internal_dependency_generator 1
177 %_duplicate_files_terminate_build 1
178 %_files_listed_twice_terminate_build 1
179 %_unpackaged_files_terminate_build 0
180 %_unpackaged_subdirs_terminate_build 0
183 # Export package NEVRA (stamped with install tid) info for HRMIB on this path.
185 # XXX Note: escaped %% for use in headerSprintf()
186 %_hrmib_path /var/cache/hrmib/%{___NVRA}
188 #-----------------------------------------------------------------
189 # CFLAGS and LDFLAGS used to build
191 %debuginfocflags %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
192 # -feliminate-dwarf2-dups disabled until PR ld/3290 is fixed.
194 %debugcflags -O0 -g -Wall
195 %debugcppflags %{nil}
198 %optldflags -Wl,--as-needed -Wl,--no-copy-dt-needed-entries -Wl,-z,relro -Wl,-z,combreloc %{?use_ld:-Wl,-fuse-ld=%{use_ld}}
201 # common compilation flags
202 %_fortify_cflags -Wp,-D_FORTIFY_SOURCE=2
204 # cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments
205 %Werror_cflags -Wformat -Werror=format-security
207 # Use -Werror=trampolines to prevent GCC from generating code that require executable stack
208 %_ssp_cflags -fstack-protector-strong --param=ssp-buffer-size=4 -Werror=trampolines
209 %__common_cflags -O2 -fwrapv -pipe %{Werror_cflags} %{debuginfocflags} %{?_fortify_cflags} %{!?nospecflags:%{?specflags}}
210 %__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags}
213 %ix86 i386 i486 i586 i686 pentium3 pentium4 athlon geode
214 %x8664 x86_64 amd64 ia32e
215 %ppc ppc ppc7400 ppc7450
217 # avoid fdatasync syscall flood during database operations.
220 #---------------------------------------------------------------------
221 # Expanded at end of %prep
223 %__chown_Rhf %{__chown} -Rhf
224 %__chgrp_Rhf %{__chgrp} -Rhf
225 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
226 %_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} root
229 %cc_version %{expand:%%global cc_version %(%{__cc} -dumpversion 2>/dev/null || echo 0.0)}%cc_version
230 %cxx_version %{expand:%%global cxx_version %(%{__cxx} -dumpversion 2>/dev/null || echo 0.0)}%cxx_version
232 %__rm /bin/rm --interactive=never
234 # Build system path macros.
235 %__autoconf autoconf %{?debug:-Wall}
236 %__automake automake -a -c -f --foreign
237 %__autopoint autopoint --force
239 %__autoheader autoheader
241 # add parallel build flags: -jN
242 # jobs macro is available since 1.657
244 # if you want to disable parallel build do:
245 # echo '%__jobs %{nil}' >> ~/.rpmmacros
246 %__jobs %{expand:%%global __jobs %(_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN); [ "$_NCPUS" -gt 3 ] && echo $(($_NCPUS / 2)))%%{nil}}%__jobs
248 # expands to -jN if %__jobs has a value
249 %_smp_mflags %{expand:%%global _smp_mflags %(jobs=%{__jobs}; echo ${jobs:+-j$jobs}%%{nil})}%_smp_mflags
251 %__make /usr/bin/make %{?_make_opts} %{?_smp_mflags}
252 %__scons /usr/bin/scons %{?_smp_mflags}
253 %__waf /usr/bin/waf %{?_smp_mflags}
254 %__cmake /usr/bin/cmake
255 %__meson /usr/bin/meson
256 %__meson_wrap_mode nodownload
257 %__ninja /usr/bin/ninja
258 %__ninja_common_opts -v %{?_smp_mflags}
261 gettextize --copy --force --no-changelog; \
262 if [ ! -f po/Makevars ]; then \
263 cp -f po/Makevars{.template,}; \
267 %__glib_gettextize glib-gettextize --copy --force
268 %__gnome_doc_common gnome-doc-common --copy
269 %__gnome_doc_prepare gnome-doc-prepare --copy --force
270 %__gtkdocize gtkdocize --copy
271 %__intltoolize intltoolize --copy --force
272 %__libtoolize libtoolize --copy --force --install
274 # topdir is where builder script lives,
275 # fallback to old style if SPECS/SOURCES dirs were found.
276 %_topdir %{expand:%%global _topdir %(
277 if [ -d SPECS -a -d SOURCES ]; then
278 # old style rpmdir: in topdir
280 elif [ -d ../SPECS -a -d ../SOURCES ]; then
281 # old style rpmdir: in subdir
283 elif [ -d $HOME/rpm/SPECS -a -d $HOME/rpm/SOURCES ]; then \
284 # if old style rpm dir exist, go with it
286 elif [ -x ../builder -a ! -d ../builder ] && [ "$(realpath -s ../builder)" != "/usr/bin/builder" ]; then
287 # relative new style rpmdir: in package dir
289 elif [ -x builder -a ! -d builder ] && [ "$(realpath -s builder)" != "/usr/bin/builder" ]; then
290 # relative new style rpmdir: in packages
292 elif [ -x packages/builder -a ! -d packages/builder ]; then
293 # relative new style rpmdir: packages dir in current dir
296 # fallback to new style rpmdir
297 echo $HOME/rpm/packages
301 %_tmppath %(echo "${TMPDIR:-/var/tmp}")
304 %_buildrootdir %{_tmppath}
305 %buildroot %{_buildrootdir}/%{name}-%{version}-%{_arch}-root-%(id -u -n)
307 # if %{_topdir}/SPECS exists, it's old style structure
308 %_specdir %{expand:%%global _specdir %([ ! -d %{_topdir}/SPECS ] && echo %{_topdir}/%{name} || echo %{_topdir}/SPECS)}%_specdir
309 %_sourcedir %{expand:%%global _sourcedir %([ ! -d %{_topdir}/SOURCES ] && echo %{_specdir} || echo %{_topdir}/SOURCES)}%_sourcedir
311 # BUILD/RPMS/SRPMS are on same level by default as packages dir, if these exist
312 # if they don't exist assume we are having custom topdir (which is not named as
313 # "packages", i.e ~/rpm/kde/{kdelibs,BUILD/RPMS/SRPMS})
314 # NOTE: readlink fails if some parent dir is not readable (/home/services/builder for example can't read /home/services), therefore the extra echo
315 %_builddir %{expand:%%global _builddir %(if [ -d %{_topdir}/BUILD ]; then echo %{_topdir}/BUILD; else readlink -m %{_topdir}/../BUILD || echo %{_topdir}/../BUILD; fi)}%_builddir
316 %_rpmdir %{expand:%%global _rpmdir %(if [ -d %{_topdir}/RPMS ]; then echo %{_topdir}/RPMS; else readlink -m %{_topdir}/../RPMS || echo readlink -m %{_topdir}/../RPMS; fi)}%_rpmdir
317 %_srcrpmdir %{expand:%%global _srcrpmdir %(if [ -d %{_topdir}/SRPMS ]; then echo %{_topdir}/SRPMS; else readlink -m %{_topdir}/../SRPMS || echo readlink -m %{_topdir}/../SRPMS; fi)}%_srcrpmdir
319 # The number of cvs changelog entries kept when building package.
320 %_buildchangelogtruncate 20
322 %dependencytracking %{nil}
324 # Relations between package names that cause dependency loops
325 # with legacy packages that cannot be fixed. Relations are
328 # where package p has a Requires: on something that package q Provides:
330 # XXX Note: that there cannot be any whitespace within the string "p>q",
331 # and that both p and q are package names (i.e. no version/release).
332 %_dependency_whiteout %{nil}
334 #-----------------------------------------------------------------
336 # (re)definition of %{rpm*flags} with %filterout_* support
338 # BuildRequires: rpmbuild(macros) >= 1.315
340 # Flags specified in %filterout_* are removed from %rpm*flags, exactly:
341 # %rpmcflags = %optflags - %filterout - %filterout_c - %filterout_ld
342 # %rpmcxxflags = %optflags - %filterout - %filterout_cxx - %filterout_ld
343 # %rpmcppflags = %optcppflags - %filterout - %filterout_cpp - %filterout_ld
344 # %rpmldflags = %optldflags - %filterout_ld
346 # Regular expressions are supported, but to avoid some character be treated
347 # as regular expression it must be escaped twice.
350 for (i = 1; i in I; i++) { A=0; \
352 if (I[i] ~ "^" F[f] "$") A=1; \
354 if (!A) printf(I[i] FS); \
357 %rpmcflags %(awk 'BEGIN {
358 split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
359 split("%{?filterout} %{?filterout_c} %{?filterout_ld}",F);
363 %rpmcxxflags %(awk 'BEGIN {
364 split("%{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}",I);
365 split("%{?filterout} %{?filterout_cxx} %{?filterout_ld}",F);
369 %rpmcppflags %(awk 'BEGIN {
370 split("%{?debug:%debugcppflags}%{!?debug:%optcppflags}%{?debuginfocppflags}",I);
371 split("%{?filterout} %{?filterout_cpp} %{?filterout_cpp}",F);
375 %rpmldflags %(awk 'BEGIN {
376 split("%{?optldflags}",I);
377 split("%{?filterout_ld}",F)
381 # rpmldflags with stripped -Wl, -- in the form flags have to be passed to 'ld'
382 # but, don't use it, better use gcc as linker
383 %ld_rpmldflags %(awk 'BEGIN {
384 split("%{rpmldflags}",F);
395 #-----------------------------------------------------------------
397 # Generate a command which cleans environment, leaving only the
398 # most important variables.
399 # If any spec requires any additional environment it should
400 # redefine %_preserve_env in following manner:
402 # # ADDITIONAL_VAR is required because [a good reason here]
403 # %define _preserve_env ADDITIONAL_VAR
405 %_preserve_env_base PATH HOME TMP TMPDIR SSH_AUTH_SOCK
407 # "env -i" must end in first line of expaned macros because it's used as first line of shell script (#! env...)
408 %_clean_env env -i %(awk -vq="'" -vqq="\\"'\\"" -vq2q="'\\"'" 'BEGIN {
409 split("%{?_preserve_env:%_preserve_env %_preserve_env_base}%{!?_preserve_env:%_preserve_env_base}", P);
412 if (!ENVIRON[p] || d[p]) {
416 split(ENVIRON[p], V, "");
418 for (j = 1; j in V; j++) {
424 else if (v == "\\\\")
427 gsub("[^a-zA-Z0-9/:._-]", "\\"&\\"", v);
434 # override %__spec_build_pre and %__spec_install_pre from macros.rpmbuild
435 # adding %{_clean_env}
436 %__spec_build_pre %{_clean_env}\
439 %__spec_install_pre %{_clean_env}\
441 %{?buildroot:%{__rm} -rf '%{buildroot}'; %{__mkdir_p} '%{buildroot}'}\
444 #-----------------------------------------------------------------
446 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
447 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
448 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
449 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
450 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
451 FCFLAGS="${FCFLAGS:-%rpmcflags}" ; export FCFLAGS ; \
452 CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" ; export CPPFLAGS ; \
453 %{?__cc:CC="%{__cc}" ; export CC ; } \
454 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
455 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
456 --host=%{_target_platform} \
457 --prefix=%{_prefix} \
458 --exec-prefix=%{_exec_prefix} \
459 --bindir=%{_bindir} \
460 --sbindir=%{_sbindir} \
461 --sysconfdir=%{_sysconfdir} \
462 --datadir=%{_datadir} \
463 --includedir=%{_includedir} \
464 --libdir=%{_libdir} \
465 --libexecdir=%{_libexecdir} \
466 --localstatedir=%{_localstatedir} \
467 --sharedstatedir=%{_sharedstatedir} \
468 --mandir=%{_mandir} \
469 --infodir=%{_infodir} \
470 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
471 %{dependencytracking} \
474 # Note: pass only standard cmake macros here.
475 # The only exception is SYSCONF_INSTALL_DIR, used commonly in KDE packages,
476 # where the default (${CMAKE_INSTALL_PREFIX}/etc) is not FHS-compliant and
477 # absolute path MUST be used to comply with FHS.
478 # The other non-standard cmake macros used commonly in KDE
479 # (INCLUDE_INSTALL_DIR, LIB_INSTALL_DIR, SHARE_INSTALL_PREFIX)
480 # have sane default values in KDE, and some packages use these names
481 # in different way (e.g. expect them to be always relative or always
484 %{?__cc:CC="${CC:-%{__cc}}"} \\\
485 %{?__cxx:CXX="${CXX:-%{__cxx}}"} \\\
486 CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \\\
488 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \\\
489 -DCMAKE_BUILD_TYPE=%{!?debug:PLD}%{?debug:Debug} \\\
490 -DCMAKE_SYSTEM_NAME=Linux \\\
491 -DCMAKE_CROSSCOMPILING:BOOL=FALSE \\\
492 -DCMAKE_SYSTEM_PROCESSOR=%{_target_cpu} \\\
493 -DCMAKE_INSTALL_BINDIR:PATH=%{_bindir} \\\
494 -DCMAKE_INSTALL_SBINDIR:PATH=%{_sbindir} \\\
495 -DCMAKE_INSTALL_LIBEXECDIR:PATH=%{_libexecdir} \\\
496 -DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \\\
497 -DCMAKE_INSTALL_SHAREDSTATEDIRPATH:PATH=%{_sharedstatedir} \\\
498 -DCMAKE_INSTALL_LOCALSTATEDIRPATH:PATH=%{_localstatedir} \\\
499 -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \\\
500 -DCMAKE_INSTALL_INCLUDEDIR:PATH=%{_includedir} \\\
501 -DCMAKE_INSTALL_OLDINCLUDEDIR:PATH=%{_includedir} \\\
502 -DCMAKE_INSTALL_DATAROOTDIR:PATH=%{_datadir} \\\
503 -DCMAKE_INSTALL_DATADIR:PATH=%{_datadir} \\\
504 -DCMAKE_INSTALL_INFODIR:PATH=%{_infodir} \\\
505 -DCMAKE_INSTALL_LOCALEDIR:PATH=%{_localedir} \\\
506 -DCMAKE_INSTALL_MANDIR:PATH=%{_mandir} \\\
507 -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir} \\\
508 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \\\
509 -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \\\
510 -DCMAKE_CXX_FLAGS_PLD="${CXXFLAGS:-%{rpmcxxflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
511 -DCMAKE_C_FLAGS_PLD="${CFLAGS:-%{rpmcflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
512 -DCMAKE_Fortran_FLAGS_PLD="${CFLAGS:-%{rpmcflags} -DNDEBUG -DQT_NO_DEBUG}" \\\
513 -DCMAKE_EXE_LINKER_FLAGS_PLD="${LDFLAGS:-%{rpmldflags}}" \\\
514 -DCMAKE_SHARED_LINKER_FLAGS_PLD="${LDFLAGS:-%{rpmldflags}}" \\\
515 -DCMAKE_MODULE_LINKER_FLAGS_PLD="${LDFLAGS:-%{rpmldflags}}" \\\
516 %if "%{_lib}" == "lib64" \
519 %if "%{_lib}" == "libx32" \
522 -DBUILD_SHARED_LIBS:BOOL=ON \\\
527 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
528 CFLAGS="${CFLAGS:-%rpmcflags}" \
529 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
530 FFLAGS="${FFLAGS:-%rpmcflags}" \
531 CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \
532 %{?__cc:CC="%{__cc}"} \
533 %{?__cxx:CXX="%{__cxx}"} \
543 CFLAGS="%{rpmcflags}" \
544 CXXFLAGS="%{rpmcxxflags}" \
545 LINKFLAGS="%{rpmldflags}" \
551 %{?__cc:CC="${CC:-%{__cc}}"} \
552 %{?__cxx:CXX="${CXX:-%{__cxx}}"} \
553 CFLAGS="${CFLAGS:-%{rpmcflags}}" \
554 CPPFLAGS="${CPPFLAGS:-%{rpmcppflags}}" \
555 CXXFLAGS="${CXXFLAGS:-%{rpmcxxflags}}" \
556 LDFLAGS="${LDFLAGS:-%{rpmldflags}}" \
557 RUSTC="${RUSTC:-%{__rustc}}" \
558 RUSTFLAGS="${RUSTFLAGS:-%{rpmrustflags} --target %rust_target}" \
559 LC_ALL=C.UTF-8 %{__meson} \
561 --bindir=%{_bindir} \
562 --datadir=%{_datadir} \
563 --includedir=%{_includedir} \
564 --infodir=%{_infodir} \
565 --libdir=%{_libdir} \
566 --libexecdir=%{_libexecdir} \
567 --localedir=%{_localedir} \
568 --localstatedir=%{_localstatedir} \
569 --mandir=%{_mandir} \
570 --prefix=%{_prefix} \
571 --sbindir=%{_sbindir} \
572 --sharedstatedir=%{_sharedstatedir} \
573 --sysconfdir=%{_sysconfdir} \
574 --wrap-mode=%{__meson_wrap_mode} \
575 --default-library='both' \
578 %___meson_deprecate() {echo >&2 "DEPRECATED: %%%1 must be replaced with %%%2"; %{expand:%%%2} }
579 %meson_build %___meson_deprecate meson_build ninja_build
580 %meson_install %___meson_deprecate meson_install ninja_install
581 %meson_test %___meson_deprecate meson_test ninja_test
584 %ninja_build LC_ALL=C.UTF-8 %{__ninja} %{__ninja_common_opts}
585 %ninja_install LC_ALL=C.UTF-8 DESTDIR=%{buildroot} %{__ninja} install %{__ninja_common_opts}
586 %ninja_test LC_ALL=C.UTF-8 %{__ninja} test %{__ninja_common_opts}
588 #----------------------------------------------------------------
590 %configure_cache_file %{buildroot}.configure.cache
592 %configure {./configure \
593 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
594 CFLAGS="${CFLAGS:-%rpmcflags}" \
595 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
596 FFLAGS="${FFLAGS:-%rpmcflags}" \
597 FCFLAGS="${FCFLAGS:-%rpmcflags}" \
598 CPPFLAGS="${CPPFLAGS:-%rpmcppflags}" \
599 %{?__cc:CC="%{__cc}"} \
600 %{?__cxx:CXX="%{__cxx}"} \
601 --host=%{_target_platform} \
602 --build=%{_target_platform} \
603 --prefix=%{_prefix} \
604 --exec-prefix=%{_exec_prefix} \
605 --bindir=%{_bindir} \
606 --sbindir=%{_sbindir} \
607 --sysconfdir=%{_sysconfdir} \
608 --datadir=%{_datadir} \
609 --includedir=%{_includedir} \
610 --libdir=%{_libdir} \
611 --libexecdir=%{_libexecdir} \
612 --localstatedir=%{_localstatedir} \
613 --sharedstatedir=%{_sharedstatedir} \
614 --mandir=%{_mandir} \
615 --infodir=%{_infodir} \
616 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
617 %{dependencytracking} \
618 %{?configure_cache:--cache-file=%{configure_cache_file}} \
621 # Simple macros to simplify adding bconded options to configure scripts.
622 # Each macro requires bcond name and accepts optional option name, if option
623 # isn't specified bcond name is used as option name. Options returning
624 # --with and --enable also allow third argument which will be added as value
625 # ( --with-option=value or --enable-option=value ) in case or positive
626 # condition, but won't be added otherwise ( nothing or just --disable-option ).
629 # BuildRequires: rpmbuild(macros) >= 1.527
632 # %{__enable bcond} - returns --enable-bcond iff build condition is set
633 # %{__disable bcond option} - returns --enable-option iff bcond is not set
634 # %{__enable_disable bcond option value} - returns --enable-option=value if
635 # bcond is set, returns --disable-option otherwise
637 # expand bconds to --enable-something and --disable-something
638 %__enable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
639 %__disable() %{expand:%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
640 %__enable_disable() %{expand:%%{?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
642 # same as above, but condition inverted
643 %__enable_unless() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
644 %__disable_if() %{expand:%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
645 %__enable_disable_not() %{expand:%%{!?with_%{1}:--enable-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--disable-%{?2}%{!?2:%{1}}}}
647 # expand bconds to --with-something and --without-something
648 %__with() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
649 %__without() %{expand:%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
650 %__with_without() %{expand:%%{?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{!?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
652 # same as above, but condition inverted
653 %__with_unless() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}}
654 %__without_if() %{expand:%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
655 %__with_without_not() %{expand:%%{!?with_%{1}:--with-%{?2}%{!?2:%{1}}%{?3:=%{3}}}%%{?with_%{1}:--without-%{?2}%{!?2:%{1}}}}
657 # expands to true or false based on bcond; for use with meson or cmake
658 %__true_false() %{expand:%%{?with_%{1}:true}%%{!?with_%{1}:false}}
659 %__true_false_not() %{expand:%%{?with_%{1}:false}%%{!?with_%{1}:true}}
661 # expands to enabled or disabled based on bcond; for use with meson or cmake
662 %__enabled_disabled() %{expand:%%{?with_%{1}:enabled}%%{!?with_%{1}:disabled}}
663 %__enabled_disabled_not() %{expand:%%{?with_%{1}:disabled}%%{!?with_%{1}:enabled}}
665 # for use with cmake:
666 # Usage: cmake_on_off BCOND_NAME [OPTION_NAME]
667 # BuildRequires: rpmbuild(macros) >= 1.742
668 %cmake_on_off() -D%{?2}%{!?2:%{1}}:BOOL=%{expand:%%{?with_%{1}:ON}%%{!?with_%{1}:OFF}}
670 #-----------------------------------------------------------------
672 # overload to insert debuginfo package
674 %if 0%{?_enable_debug_packages}\
680 %_build_id_links %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1:alldebug}%{?__dic_0:none}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
682 # If non-empty "debug" macro defined, add "dbg" suffix to release number
683 %_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
685 # Bootstrap release macros.
687 # %bcond_with bootstrap
688 # Release: %{bootstrap_release 1}
690 # Package will have release 1 if built normally,
691 # and release 0.zzz.bootstrap if built with bootstrap
692 %bootstrap_release() %{!?with_bootstrap:%{1}%{?2:.%{2}}}%{?with_bootstrap:%{!?2:%(expr %{1} - 1)}%{?2:%{1}.%(expr %{2} - 1)}.zzz.bootstrap}
694 # Requires name = version-release
695 %requires_releq() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to -r %1 %1}}}
696 # Requires: name = version
697 %requires_eq() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_eq_to %1 %1}}}
698 # Requires: name = version (version based on querying package %2)
699 %requires_eq_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --whatprovides --qf 'Requires: %1 = %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}}
701 # Requires: name >= version
702 %requires_ge() %{!?1:ERROR}%{?2:ERROR}%{?1:%{!?2:%{expand:%%requires_ge_to %1 %1}}}
703 # Requires: name >= version (version based on querying package %2)
704 %requires_ge_to(r) %{!?2:ERROR}%{?3:ERROR}%{?2:%{!?3:%(if ! LC_ALL=C rpm -q --whatprovides --qf 'Requires: %1 >= %|E?{%{E}:}|%{V}%{?-r:-%{R}}\\n' %2 | grep '^Requires:'; then echo "BuildRequires: %2"; fi)}}
706 # helper for renaming packages
707 # %rename old-package
709 Obsoletes: %{1} < %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}} \
710 Provides: %{1} = %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}}
712 # for package versions comparison (incl. cc_version or _rpmversion)
713 # BuildRequires: rpmbuild(macros) >= 1.749
714 %_ver_lt() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -ne 2; echo $?)
715 %_ver_ge() %(test $(rpmvercmp "%{1}" "%{2}" >/dev/null 2>&1; echo $?) -eq 2; echo $?)
717 # noarch subpackage helper
718 # BuildRequires: rpmbuild(macros) >= 1.752
723 %apache_modules_api %{expand:%%global apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)}%apache_modules_api
726 %xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
727 %xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
728 %xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
729 %xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
730 %sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
731 %sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
732 %docbook_sgmlcat_fix() { for l in \
734 ' -- default decl --' \
735 'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
736 ' -- hacks for opensp --' \
737 'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
738 'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
740 ; do echo $l; done >> %1 \
745 # minimum file size needed for compressed documents.
746 # just smaller files than this get larger when compressed.
748 # - 0 byte file compressed was 25 bytes .gz
749 # - 39 byte file was compressed as 57
750 # - with test/test.spec@man 158 byte file was compressed also 158
751 %_min_compress_bytes 159
753 #-----------------------------------------------------------------
754 # find and gzip all files in %{_mandir} and %{infodir}
756 # Requires: xargs, find
758 #%no_install_post_compress_docs 1
759 %__spec_install_post_compress_docs { \
760 %{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
762 for i in /usr/share/man /usr/X11R6/man; do \
763 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
764 echo "Compress man pages: $i"; \
765 find "$RPM_BUILD_ROOT$i" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \
766 find "$RPM_BUILD_ROOT$i" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \
767 find $RPM_BUILD_ROOT$i -type l | while read a; do \
768 m=$(readlink "$a"); \
769 if [[ "$m" = */* ]]; then \
770 # handle links to different man section \
771 l=$(readlink -f "$a"); \
772 # full/relative paths that resolve symlink \
773 l=${l#$RPM_BUILD_ROOT/usr/share/man/}; \
774 l=${l#$RPM_BUILD_ROOT/usr/X11R6/man/}; \
775 # full paths that do not resolve symlink \
776 l=${l#/usr/share/man/}; \
777 l=${l#/usr/X11R6/man/}; \
779 l=${a#$RPM_BUILD_ROOT$i/}; \
784 echo ".so $l" > $a; \
785 echo >&2 "Converted ${a#$RPM_BUILD_ROOT} from symlink to man link: $l"; \
787 # verify that .so links point to existing files (not allowed to point to "other package") \
788 # TODO: iterate over all man dirs, but in Th there is only one true man dir \
789 err=$(grep -rl '^\.so ' "$RPM_BUILD_ROOT$i" | while read doc; do \
790 l=$(grep -r '^\.so ' "$doc"); \
793 test -e $RPM_BUILD_ROOT$i/$l || test -e $d/$(basename $l) || echo " ${doc#$RPM_BUILD_ROOT} points to inexistent manpage: $l"; \
795 test "$err" != "" && { echo >&2 "Man page link errors:"; echo >&2 "$err"; exit 1; }; \
796 find "$RPM_BUILD_ROOT$i" -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \
799 if [ -d "$RPM_BUILD_ROOT%{_infodir}" ]; then \
800 echo "Compress info pages: %{_infodir}"; \
801 find "$RPM_BUILD_ROOT%{_infodir}" -name '*.bz2' -print0 | xargs -0 -r %{__bzip2} -df; \
802 find "$RPM_BUILD_ROOT%{_infodir}" -name '*.gz' -print0 | xargs -0 -r %{__gzip} -dnf; \
803 find "$RPM_BUILD_ROOT%{_infodir}" -name '*.info*' -type f -size +%{_min_compress_bytes}c -print0 | xargs -0 -r %{__gzip} -9nf; \
805 }; __spec_install_post_compress_docs } }
807 #-----------------------------------------------------------------
808 # Strip executable binaries and shared object files
810 # Requires: find, awk, strip, cut, xargs
812 # Special macros which affect this process:
813 #%no_install_post_strip 1 # disable stripping at all
814 #%_noautostrip regexp # exclude files matching (anchored!) regex from stripping
815 #%_autostripall regexp # strip files matching (anchored!) regex using plain strip
816 #%_autostripunneeded regexp # strip files matching (anchored!) regex using strip --strip-unneeded
817 #%_autostripdebug regexp # strip files matching (anchored!) regex using strip --strip-debug
819 %__spec_install_post_strip {%{!?debug: \
820 %{!?no_install_post_strip:__spec_install_post_strip() { \
822 if [ -d "$RPM_BUILD_ROOT" ]; then \
823 if [ -d $RPM_BUILD_ROOT/lib/modules ]; then \
824 modulelist=$(find $RPM_BUILD_ROOT/lib/modules \( -name '*.o' -o -name '*.ko' \) -type f -print); \
825 if [ "$modulelist" ]; then \
826 modulecount=$(echo "$modulelist" | wc -l); \
827 printf "Stripping %d kernel modules..." $modulecount; \
828 echo "$modulelist" | xargs -l512 chmod u+w; \
829 echo "$modulelist" | xargs -l512 %{__strip} -g --remove-section=.comment --remove-section=.note.GNU-stack; \
833 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}"}); \
834 if [ -n "$filelist" ]; then \
835 filetypes=`echo "$filelist" | xargs -r -d'\\n' file`; \
836 elfexelist=`echo "$filetypes" | awk -F: '/ELF.*executable/ {print $1}'`; \
837 elfsharedlist=`echo "$filetypes" | awk -F: '/LF.*shared object/ {print $1}'`; \
838 archiveslist=`echo "$filetypes" | awk -F: '/current ar archive/ {print $1}'`; \
839 if [ -n "$elfexelist" ]; then \
840 printf "Stripping %d ELF executables..." $(echo "$elfexelist" | wc -l); \
841 echo "$elfexelist" | xargs -r -d'\n' chmod u+w; \
842 echo "$elfexelist" | xargs -r -d'\n' %{__strip} --remove-section=.note --remove-section=.comment; \
845 if [ -n "$elfsharedlist" ]; then \
846 printf "Stripping %d ELF shared libraries..." $(echo "$elfsharedlist" | wc -l); \
847 echo "$elfsharedlist" | xargs -r -d'\n' chmod u+w; \
848 echo "$elfsharedlist" | xargs -r -d'\n' %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment; \
851 if [ -n "$archiveslist" ]; then \
852 printf "Stripping %d ar archives..." $(echo "$archiveslist" | wc -l); \
853 echo "$archiveslist" | xargs -r -d'\n' chmod u+w; \
854 echo "$archiveslist" | xargs -r -d'\n' %{__strip} --strip-debug --remove-section=.note --remove-section=.comment; \
858 filelist_all=%{?_autostripall:$(find $RPM_BUILD_ROOT -type f -regex "%{_autostripall}")}; \
859 filelist_unneeded=%{?_autostripunneeded:$(find $RPM_BUILD_ROOT -type f -regex "%{_autostripunneeded}")}; \
860 filelist_debug=%{?_autostripdebug:$(find $RPM_BUILD_ROOT -type f -regex "%{_autostripdebug}")}; \
861 if [ -n "$filelist_all" ]; then \
862 printf "Stripping everything from %d additional files..." $(echo "$filelist_all" | wc -l); \
863 chmod u+w $filelist_all; \
864 %{__strip} --remove-section=.note --remove-section=.comment $filelist_all; \
867 if [ -n "$filelist_unneeded" ]; then \
868 printf "Stripping unneeded from %d additional files..." $(echo "$filelist_unneeded" | wc -l); \
869 chmod u+w $filelist_unneeded; \
870 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $filelist_unneeded; \
873 if [ -n "$filelist_debug" ]; then \
874 printf "Stripping debuginfo from %d additional files..." $(echo "$filelist_debug" | wc -l); \
875 chmod u+w $filelist_debug; \
876 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $filelist_debug; \
879 fi; }; __spec_install_post_strip } } }
881 #-----------------------------------------------------------------
882 # remove all RPATH/RUNPATH from executable binaries and shared object files
884 # Requires: find, awk, cut, xargs, chrpath, uname
886 # Special macros which affect this process
887 #%no_install_post_chrpath 1 # disable chrpath at all
888 #%_noautochrpath regex # exclude files matching (anchored!) regex from chrpath
890 %__spec_install_post_chrpath {%{!?debug: \
891 %{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
893 if [ -d "$RPM_BUILD_ROOT" ]; then \
894 files=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" ! -regex ".*/lib/modules/.*" ! -regex ".*%{_docdir}/.*" ! -regex ".*%{_includedir}/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"}`; \
895 if [ -n "$files" ]; then \
896 objs=`echo "$files" | xargs -r -d'\\n' file | awk -F: '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}'`; \
898 if [ -n "$objs" ]; then \
899 printf "Remove RPATH/RUNPATH from %d executable binaries and shared object files.\n" $(echo "$objs" | wc -l); \
901 while read file; do \
904 for dir in $(chrpath -l "$file" | awk '/(R|RUN)PATH=/ { gsub(/.*RPATH=/,""); gsub(/.*RUNPATH=/,""); gsub(/:/," "); print $0 }'); do \
907 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
908 else rpath="$rpath:$dir" ; fi ; \
912 newdir=$(readlink -m "$dir"); \
913 [ ${#newdir} -le ${#dir} ] && dir=$newdir; \
915 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
916 echo "remove-rpath: $dir in $file"; \
919 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
920 else rpath="$rpath:$dir" ; fi ; \
924 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
925 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
928 fi; }; __spec_install_post_chrpath } } }
932 #-----------------------------------------------------------------
933 # Find all shared object files with unresolved symbols. Warn
934 # and terminate if any found (termination can be turned off by define).
935 #%no_install_post_check_so 1
936 #%skip_post_check_so libwithunresolvedok.so.*
938 # NOTE: define skip_post_check_so only if such library really requires
939 # unresolved symbols and always leave a comment why it is required:
940 # # executable provides symbols foo, bar for those libraries:
941 # %define skip_post_check_so libwithoutfoo.so.* libwithoutbar.so.*
943 %__spec_install_post_check_so { \
944 __spec_install_post_check_so() { \
947 printf "Searching for shared objects with unresolved symbols..."; \
948 for f in $(find $RPM_BUILD_ROOT -type f -name '*.so.*' -print); do \
949 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 ; \
952 %{!?no_install_post_check_so:return $fail;} \
953 }; __spec_install_post_check_so }}
955 #-----------------------------------------------------------------
956 # Find all ELF files with executable stac. Warn and terminate if any found
957 # (termination can be turned off by define).
958 # Details: https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
959 #%no_install_post_check_stackexec 1
960 #%skip_post_check_stackexec libwithexecstackok.so.*
962 # NOTE: define skip_post_check_stackexec only if such program or library
963 # really requires executable stack and always leave a comment why
965 # # Programs full of nested functions that cannot be fixed
966 # %define skip_post_check_execstack /bin/foo libwithexecstack.so.*
968 %__spec_install_post_check_execstack { \
969 __spec_install_post_check_execstack() { \
972 printf "Searching for ELF programs with executable stack..."; \
973 for f in $(find $RPM_BUILD_ROOT -type f -print) ; do \
974 LC_ALL=C readelf -lW $f 2>/dev/null | \
975 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 ; \
978 %{!?no_install_post_check_execstack:return $fail;} \
979 }; __spec_install_post_check_execstack }}
981 #-----------------------------------------------------------------
982 # Verify that for each directory under /var/run package contains
983 # tmpfiles.d configuration. Warn and terminate build if config is
986 #%no_install_post_check_tmpfiles 1
988 %__spec_install_post_check_tmpfiles { \
989 __spec_install_post_check_tmpfiles() { \
992 echo "Checking /var/run <-> tmpfiles.d completeness..."; \
993 for d in $RPM_BUILD_ROOT/var/run/*; do \
994 [ -d "$d" ] || continue; \
995 d=${d##$RPM_BUILD_ROOT}; \
996 if ! grep -qsF "$d" $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/*.conf $RPM_BUILD_ROOT/etc/tmpfiles.d/*.conf; then\
997 echo "No tmpfiles configuration for '$d'";\
1002 %{!?no_install_post_check_tmpfiles:return $fail;} \
1003 }; __spec_install_post_check_tmpfiles }}
1005 #-----------------------------------------------------------------
1006 # Verify that scripts have reasonable shebangs
1007 # Test spec: see "test/spec_install_post_check_shebangs" branch on packages/test.spec
1009 #%no_install_post_check_shebangs 1
1011 %__spec_install_post_check_shebangs { \
1012 __spec_install_post_check_shebangs() { \
1013 %{!?debug:set +x;} \
1014 echo "Checking script shebangs..."; \
1016 find $RPM_BUILD_ROOT -type f -perm -500 -print | { fail=0; while IFS= read -r f; do \
1017 shebang="$(sed -e'1s/#! *\(.*\)/\1/;t;d;q' "$f")" ; \
1018 f="${f##$RPM_BUILD_ROOT}"; \
1019 case "$shebang" in \
1020 "%{__python}"|"%{__python3}"|"%{__python} "*|"%{__python3} "* \
1021 |"/usr/bin/python%{py_ver}"|"/usr/bin/python%{py_ver} "* \
1022 |"/usr/bin/python%{py3_ver}"|"/usr/bin/python%{py3_ver} "*) \
1024 "/usr/bin/env python"*|"/usr/bin/python"|"/usr/bin/python "*) \
1025 echo "$f starts with '#!$shebang', should be '#!%{__python}' or '#!%{__python3}'" >&2;\
1029 echo "$f starts with '#!$shebang', should be explicit interpreter path" >&2;\
1038 %{!?no_install_post_check_shebangs:return $fail;} \
1039 }; __spec_install_post_check_shebangs }}
1041 # Remove common Perl files we don't package
1042 %__spec_install_post_perl_clean {\
1043 %{!?no_install_post_perl_clean: \
1044 %{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
1047 # Helpers to specify SONAME depdendencies, e.g.:
1048 # Requires: %{_soname_prov libfoo.so.1}
1049 # Requires: %{_soname_prov libfoo.so.1(SOME_SYMVER)}
1051 # BuildRequires: rpmbuild(macros) >= 1.721
1053 %_soname_tag %(echo %{_lib} | sed -e 's/^lib//' -e 's/^\\(.\\+\\)$/(\\1bit)/')
1054 %_soname_prov() %(echo "%{1}()%{_soname_tag}" | sed -e 's/^\\([^(]*([^)]\\+)\\)()%{_soname_tag}$/\\1%{_soname_tag}/;s/()$//')
1056 #-----------------------------------------------------------------
1057 # Update GConf2 schemas
1061 %gconf_schema_install() \
1063 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \\\
1064 /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null; \
1067 %gconf_schema_uninstall() \
1068 if [ $1 = 0 -a -x /usr/bin/gconftool-2 ]; then \
1070 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \\\
1071 /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
1075 #-----------------------------------------------------------------
1076 # Update desktop MIME database
1077 # requires: desktop-file-utils
1078 %update_desktop_database() {{ \
1080 /usr/bin/update-desktop-database -q; \
1084 %update_desktop_database_post %update_desktop_database
1086 %update_desktop_database_postun() {{ \
1087 if [ "$1" = "0" ]; then \
1088 %update_desktop_database \
1093 #-----------------------------------------------------------------
1094 # Update shared MIME info database
1095 # requires: shared-mime-info
1096 # Note: https://bugs.freedesktop.org/show_bug.cgi?id=70366#c19
1097 # https://bugzilla.redhat.com/show_bug.cgi?id=1052173
1098 # TODO: if you want this running with fdatasync(), make sure it's:
1099 # 1. announcing ~minute delay by echoing appropriate message,
1100 # 2. running only once after rpm transaction.
1102 %update_mime_database() {{ \
1104 PKGSYSTEM_ENABLE_FSYNC=0 \
1105 /usr/bin/update-mime-database %{_datadir}/mime; \
1109 #-----------------------------------------------------------------
1111 # BuildRequires: rpmbuild(macros) >= 1.596
1112 # Requires: hicolor-icon-theme
1114 %update_icon_cache() {{ \
1115 %{!?1:%{error:%{0}: Required theme name missing}} \
1116 if [ -x /usr/bin/gtk-update-icon-cache ]; then \
1118 touch --no-create %{_iconsdir}/%1; \
1119 /usr/bin/gtk-update-icon-cache -qf %{_iconsdir}/%1; \
1124 #-----------------------------------------------------------------
1125 # Update scrollkeeper database
1126 # requires: scrollkeeper
1128 %scrollkeeper_update_post() \
1129 /usr/bin/scrollkeeper-update -q; \
1132 %scrollkeeper_update_postun() \
1133 if [ "$1" = "0" ]; then \
1134 /usr/bin/scrollkeeper-update -q; \
1138 #-----------------------------------------------------------------
1139 # Compile GSettings schemas
1140 # requires: glib2 >= 1:2.26.0
1142 %glib_compile_schemas() {{ \
1144 /usr/bin/glib-compile-schemas %{_datadir}/glib-2.0/schemas; \
1148 # BuildRequires: rpmbuild(macros) >= 1.751
1149 # Requires(post,postun): /usr/bin/texhash # if you want to ensure cache is updated
1152 /usr/bin/texhash >&2; \
1156 #-----------------------------------------------------------------
1157 # post %install sequence:
1158 # - autodeps exceptions
1159 # - compress all man and info pages,
1160 # - strip all ELF executables and ELF shared objects if not %debug.
1161 # - compress kernel modules if any
1163 ###################################################################
1164 # Requires/Provides automation
1165 # exceptions system by Jacek Konieczny <jajcus@pld-linux.org>
1167 %__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
1168 %__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
1169 %__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov) \
1170 %{?_noautoprov: %{_noautoprov}} \
1171 %{?_noautoprov_java: %{__noauto_regexp_helper -p java %{_noautoprov_java}}} \
1172 %{?_noautoprov_mono: %{__noauto_regexp_helper -p mono %{_noautoprov_mono}}} \
1173 %{?_noautoprov_pear: %{__noauto_regexp_helper -p pear %{_noautoprov_pear}}} \
1174 %{?_noautoprov_perl: %{__noauto_regexp_helper -p perl %{_noautoprov_perl}}} \
1175 %{?_noautoprov_pyegg: %{__noauto_regexp_helper -p pythonegg %{_noautoprov_pyegg}}} \
1176 %{?_noautoprov_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoprov_py3egg}}} \
1178 %__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq) \
1179 %{?_noautoreq: %{_noautoreq}} \
1180 %{?_noautoreqdep: %{_noautoreqdep}} \
1181 %{?_noautoreq_java: %{__noauto_regexp_helper -p java %{_noautoreq_java}}} \
1182 %{?_noautoreq_mono: %{__noauto_regexp_helper -p mono %{_noautoreq_mono}}} \
1183 %{?_noautoreq_pear: %{__noauto_regexp_helper -p pear %{_noautoreq_pear}}} \
1184 %{?_noautoreq_perl: %{__noauto_regexp_helper -p perl %{_noautoreq_perl}}} \
1185 %{?_noautoreq_pyegg: %{__noauto_regexp_helper -p pythonegg %{_noautoreq_pyegg}}} \
1186 %{?_noautoreq_py3egg: %{__noauto_regexp_helper -p python3egg %{_noautoreq_py3egg}}} \
1189 %__noautodep_helper() %(echo '%*' | awk 'BEGIN {
1190 RS = "\n([ \t]+\n)+";
1195 if (length(F) > 0) {
1197 for (i=1; i<=length(F); i++) {
1199 sub(/#.*/, "z&z", s);
1200 if (s ~ /^$/) { continue; };
1202 if (i != length(F)) { printf("|"); };
1207 %__requires_exclude_from %{__noautodep_helper %{__noautoreqfiles}}%{nil}
1208 %__provides_exclude_from %{__noautodep_helper %{__noautoprovfiles}}%{nil}
1209 %__requires_exclude %{__noautodep_helper %{__noautoreq}}%{nil}
1210 %__provides_exclude %{__noautodep_helper %{__noautoprov}}%{nil}
1212 # helper for wrapping _noautoreq between perl() or pear()
1213 # Author: Elan Ruusamäe <glen@pld-linux.org>
1215 # BuildRequires: rpmbuild(macros) >= 1.654
1216 # %define _noautoreq_pear Excluded.php PEAR/Something.php
1217 # %define _noautoreq_perl Apache::.*
1218 # BuildRequires: rpmbuild(macros) >= 1.672
1219 # %define _noautoreq_java ClassDataVersion
1220 # BuildRequires: rpmbuild(macros) >= 1.709
1221 # %define _noautoreq_pyegg argparse
1222 # %define _noautoreq_py3egg backports.ssl-match-hostname ipaddress
1223 # BuildRequires: rpmbuild(macros) >= 1.730
1224 # %define _noautoreq_mono Gendarme.Framework
1225 # BuildRequires: rpmbuild(macros) >= 1.737
1226 # %define _noautoprov_java Class
1227 # %define _noautoprov_mono Excluded.Provide
1228 # %define _noautoprov_pear Excluded.php
1229 # %define _noautoprov_perl Excluded::Module
1230 # %define _noautoprov_pyegg excluded
1231 # %define _noautoprov_py3egg excluded3
1233 %__noauto_regexp_helper(p:) %(echo '%*' | awk 'BEGIN{RS=" "}{printf("%{-p*}%{__qchar}(%%s%{__qchar}) ", $1)}')
1234 # detect quote character runtime
1235 %__qchar_4 \\\\%{nil}
1236 %__qchar_5 \\\\\\%{nil}
1237 %__qchar %{expand:%%global __qchar %%__qchar_%(echo %{_rpmversion} | cut -c1)}%__qchar
1239 #%_noautocompressdoc %{nil}
1241 %_missing_doc_files_terminate_build 1%{nil}
1242 %_unpackaged_files_terminate_build %{nil}
1246 # BuildRequires: rpmbuild(macros) >= 1.634
1247 %nodejs_libdir /usr/lib/node_modules
1249 # bash-completion 2.0 completions dir
1251 # BuildRequires: rpmbuild(macros) >= 1.673
1252 # Requires: bash-completion >= 2.0
1253 %bash_compdir /usr/share/bash-completion/completions
1255 # fish completions dir
1257 # BuildRequires: rpmbuild(macros) >= 1.720
1258 %fish_compdir /usr/share/fish/vendor_completions.d
1260 # zsh completions dir
1262 # BuildRequires: rpmbuild(macros) >= 1.719
1263 %zsh_compdir /usr/share/zsh/site-functions
1268 if [ -e /boot/System.map-%1 ]; then \
1269 /sbin/depmod -a -F /boot/System.map-%1 %1; \
1271 if [ -e /boot/System.map ]; then \
1272 /sbin/depmod -a -F /boot/System.map %1; \
1274 /sbin/depmod -a %1; \
1279 # user/group checking macros
1282 # %userremove myuser
1284 %userremove /usr/lib/rpm/user_group.sh user del
1285 %groupremove /usr/lib/rpm/user_group.sh group del
1288 # if %usertestrm myuser; then
1289 # /usr/sbin/userdel -r myuser
1291 # use these macros only if you need to call userdel/groupdel with
1292 # a non-standard option or take an extra action; otherwise use the
1293 # %userremove/%groupremove macros
1295 %usertestrm /usr/lib/rpm/user_group.sh user testrm
1296 %grouptestrm /usr/lib/rpm/user_group.sh group testrm
1297 # user group membership management macros
1300 # %addusertogroup [-q] myuser agroup
1302 # -q if user or group don't exist, don't make big noise of it (MISSINGOK behaviour)
1305 # BuildRequires: rpmbuild(macros) >= 1.515
1306 %addusertogroup(q) quiet=%{-q:1} /usr/lib/rpm/user_group.sh user addtogroup %*; \
1309 # banner support (useful in {pre,post}{,un} and triggers)
1312 # %banner name [-a] [-e] [-n] [-tn] [-o] <<EOF
1313 # the banner text, the banner text
1314 # the banner text, and following line
1316 # You can use any form of here-document, <<'EOF' <<-EOT will do.
1317 # NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
1319 # -a - append to the banner
1320 # -e - send to stderr instead of stdout
1321 # -n - don't show banner (overrides -t)
1322 # -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
1323 # -o - show only once, i.e when package is installed for the first time
1326 # (rpm -E '%banner -e banner <<EOF'; echo -e 'hi\nEOF') > m; sh -x m
1327 # (rpm -E '%banner -o -e banner <<EOF'; echo -e 'hi\nEOF') > m; sh -x m
1328 # (rpm -E '%banner -o -e banner <<EOF'; echo -e 'hi\nEOF') > m; sh -x m 1
1329 # rpm -E 'date | %banner -e banner' > m; sh -x m
1330 # rpm -E 'date | %banner -o -e banner' > m; sh -x m
1332 %banner(aenot:) %{-o:([ "$1" != 1 ] ||} ( \
1333 RPM_SCRIPTVERBOSITY=5 \
1334 [ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
1335 if [ -x /usr/bin/banner.sh ]; then \
1336 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
1338 CMD="cat%{-e: >&2}" \
1340 eval $CMD %{?2:%2}%{?3: %3})%{-o:)} \
1343 # useradd/groupadd macros
1344 # Author: Elan Ruusamäe <glen@pld-linux.org>
1347 # %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
1348 # [-g initial_group] [-G group[,...]] login
1351 # -g gid/group. REQUIRED
1352 # -s defaults to /bin/false
1353 # -d defaults to /usr/share/empty
1355 # -r is accepted but ignored (it's always set)
1356 # -k skeleton dir. defaults to /usr/share/empty
1357 # rpm specific flags
1358 # -P package name. defaults to %{name}
1360 %useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
1361 %{!-u:%{error:useradd: Required argument -u missing}} \
1362 %{!-g:%{error:useradd: Required argument -g missing}} \
1363 %{!?1:%{error:useradd: Required parameter login missing}} \
1364 if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
1365 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
1366 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
1370 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
1371 /usr/sbin/useradd \\\
1372 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
1375 -d %{-d*}%{!-d:/usr/share/empty} \\\
1376 -s %{-s*}%{!-s:/bin/false} \\\
1377 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
1381 %{expand:%{%{#}}} 1>&2 || exit $? \
1382 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd || : \
1387 # %groupadd [-P package] [-g gid] group
1392 # %groupadd -P %{name}-base -g %{gid} %{name}
1394 %groupadd(g:P:rfo) \
1395 %{!-g:%{error:groupadd: Required argument -g missing}} \
1396 %{!?1:%{error:groupadd: Required parameter group missing}} \
1397 if /usr/bin/getgid %{1} > /dev/null 2>&1; then \
1398 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
1399 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
1403 echo "Adding group %{1} GID=%{-g*}." \
1404 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
1405 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group || : \
1409 # Author: Elan Ruusamäe <glen@pld-linux.org>
1411 # calls usual service restart on package %post, but skips the restart if
1412 # administrator has disabled automatic service restarts in either global
1413 # /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
1414 # NOTE: systemd_booted machines do not print
1415 # Run "{command}" to restart {service}.
1416 # message for packages without native systemd unit (not here, no %systemd_post).
1419 # %service [-q] [-n] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
1421 # -q be silent when service isn't started (for scriplets restaring other package's services)
1422 # -n NOOP mode, do not actually restart service
1425 # BuildRequires: rpmbuild(macros) >= 1.268
1426 # Requires: rc-scripts
1428 # BuildRequires: rpmbuild(macros) >= 1.450
1429 %service(qn) {{%(export noop=%{-n:1} quiet=%{-q:1} RPM_BUILD_ROOT=%{buildroot}; /usr/lib/rpm/service_generator.sh %{*}) };}
1431 %env_update [ ! -x /sbin/env-update ] || /sbin/env-update -u || :
1434 # generate SourceX urls from range START STOP
1435 # Format can be SINGLE format char of %e, %f, %g, see seq(1)
1436 # The sources start from 10000
1438 # Author: Elan Ruusamäe <glen@pld-linux.org>
1441 # %patchset_source -f <seq(1) format> <start> [<end>]
1442 # %patchset_patch <start> [<end>]
1443 # If <end> is omited, it is assumed to be <start>.
1445 # For example in preamble:
1446 # %patchset_source -f ftp://ftp.vim.org/pub/editors/vim/patches/7.0/7.0.%03g 33 44
1448 # %patchset_patch 33 44
1450 # Using sources list:
1451 # BuildRequires: rpmbuild(macros) >= 1.426
1452 # %patchset_source -f <url> -s <filelist>
1453 # %patchset_patch -s <filelist>
1454 # For example (ncurses):
1455 # BuildRequires: rpmbuild(macros) >= 1.683
1456 # %patchset_source -f ftp://dickey.his.com/ncurses/%{basever}/ -s sources
1457 # %patchset_patch -s sources -p1
1460 %patchset_source(f:b:s:) %(
1461 base=%{-b*}%{!-b*:10000}
1466 while read checksum file; do
1467 printf "Patch%d: %s%s\\n" $i "$baseurl" "$file"
1472 start=$(expr $base + %1);
1473 end=$(expr $base + %{?2}%{!?2:%{1}});
1474 # we need to call seq twice as it doesn't allow two formats
1475 seq -f 'Patch%g:' $start $end > %{_tmppath}/__ps1;
1476 seq -f '%{-f*}' %1 %{?2}%{!?2:%{1}} > %{_tmppath}/__ps2;
1477 paste %{_tmppath}/__ps{1,2};
1478 rm -f %{_tmppath}/__ps{1,2};
1483 # apply sources from %patchset_source
1484 # -p specify -pX for %patch line
1485 # -b base offset: defaults to 10000
1486 # -s filelist to read files from
1487 %patchset_patch(f:p:b:s:) %(
1488 base=%{-b*}%{!-b*:10000}
1489 patchlevel=%{-p*:-p%{-p*}}
1493 while read checksum file; do
1494 printf "patch%d %s\\n" $i "$patchlevel" | sed -e s,^,%%,
1499 start=$(expr $base + %1);
1500 end=$(expr $base + %{?2}%{!?2:%{1}});
1501 echo ": patchset_patch %1%{?2: to %2}";
1502 seq -f "patch%g $patchlevel" $start $end | sed -e s,^,%%,;
1507 # return EXPANDED source url N from current spec
1508 %sourceurl(n:) %(test "$IN_RPM" = 1 && exit 1; export IN_RPM=1; rpmbuild --nodigest --nosignature --nobuild -D "prep %%dump" %{_specdir}/%{name}.spec 2>&1 | awk '$2 ~ /^SOURCEURL%{-n*}/ {print $3}')
1511 # split string separated by space into quoted list
1513 # Author: Elan Ruusamäe <glen@pld-linux.org>
1515 # %__lua_split /bin/sh /bin/pdksh -> "/bin/sh", "/bin/pdksh"
1516 %__lua_split() %(echo "%*" | awk '{for (i=1;i<=NF;i++) printf("\\"%%s\\"%%s", $i, i == NF ? "" : ", ")}')
1518 # adjust /etc/shells by adding and removing shells from there
1519 # Author: Elan Ruusamäe <glen@pld-linux.org>
1523 # %lua_add_etc_shells /bin/sh /bin/pdksh
1526 # if arg[2] == 0 then
1527 # %lua_remove_etc_shells /bin/bash /bin/rbash
1531 # BuildRequires: rpmbuild(macros) >= 1.462
1534 %lua_add_etc_shells() \
1536 f = io.open("/etc/shells", "r")\
1538 for l in f:lines() do t[l]=l; end\
1541 for _, s in ipairs({%{expand:%%__lua_split %*}}) do\
1543 print("Adding "..s.." to /etc/shells")\
1544 f = io.open("/etc/shells", "a")\
1553 %lua_remove_etc_shells() \
1555 f = io.open("/etc/shells", "r")\
1557 for l in f:lines() do t[l]=l; end\
1560 for _, l in pairs({%{expand:%%__lua_split %*}}) do\
1561 print("Removing "..l.." from /etc/shells")\
1565 for _, l in pairs(t) do\
1568 f = io.open("/etc/shells", "w")\
1575 # Backwards compat. Use of %lua_ prefixed macros is preferred as these are cleaner to read.
1577 # Author: Elan Ruusamäe <glen@pld-linux.org>
1580 # %post -p %add_etc_shells -p /bin/sh /bin/pdksh
1581 # %preun -p %remove_etc_shells -p /bin/sh /bin/pdksh
1583 # -p (optional) -- specifies that result is embeded %post script (prepends <lua> as first line)
1586 # BuildRequires: rpmbuild(macros) >= 1.429
1588 %add_etc_shells(p) %{-p:<lua>}\
1589 %{expand:%%lua_add_etc_shells %*}\
1592 %remove_etc_shells(p) %{-p:<lua>}\
1593 %{-p:if arg[2] == 0 then}\
1594 %{expand:%%lua_remove_etc_shells %*}\
1600 # Author: Paweł Zuzelski <pawelz@pld-linux.org>
1601 # Author: Elan Ruusamäe <glen@pld-linux.org>
1604 # %undos list_of_files
1605 # %undos -f EXT[,EXT]
1606 # %undos -i -f EXT[,EXT]
1608 # -f EXT[,EXT] - find(1) files by extensions
1609 # -i - case insensitive file search
1612 # Un-DOS all *.js, *.css files
1614 # Un-DOS all *.js, *.JS files
1616 # undos all Makefiles
1617 # %{__find} -name Makefile | xargs %undos
1620 # BuildRequires: sed >= 4.0
1621 # BuildRequires: rpmbuild(macros) >= 1.674
1623 # NB: make sure this macro stays on one line
1624 # NB: make sure it includes newline escape
1625 %undos(f:i) %{-f:%{__find} -type f -regextype posix-extended -%{-i:i}regex '^.+\\.(%(echo %{-f*} | tr ',' '|'))$' -print0 | xargs -0} %{__sed} -i -e 's,\\r$,,' %* \
1628 #-----------------------------------------------------------------
1629 # Update hardware database index
1632 # BuildRequires: rpmbuild(macros) >= 1.691
1633 # Requires: udev-core >= 1:196
1635 %udev_hwdb_update() \
1636 /sbin/udevadm hwdb --update >/dev/null 2>&1 || : \
1639 # Generate vim help tags file
1642 # BuildRequires: rpmbuild(macros) >= 1.718
1643 # Requires(post,postun): /usr/bin/vim
1644 # Requires(post,postun): vim-rt >= 4:7.4.2054-2
1645 %vim_doc_helptags() \
1647 /usr/bin/vim -c ':helptags /usr/share/vim/doc' -c ':q' 2>/dev/null \