# # Additional macros to build "-static" packages automagically. # Just specify "%find_static" in the install section, and do not specify # any of "*.a" files anywhere in the files sections. # %find_static \ find %{buildroot} -type f -name "*.a" -exec file {} \\; | sed -n -e 's|^'%{buildroot}'\\(.*\\): current ar archive|\\1|p' >staticlibs.list \ %global __static_package 1 \ %{nil} %static_package \ %ifnarch noarch\ %package static\ Summary: Static libraries for package %{name}-devel\ Group: Development/Libraries\ AutoReqProv: 0\ Requires: %{name}-devel = %{version}-%{release}\ %description static\ This package provides static libraries for package %{name}-devel.\ These libraries are useful when building a static executable\ (which can be run on another Linux distros or another versions of Fedora)\ or when for some reason shared libs dependencies should be avoided.\ %files static -f staticlibs.list\ %defattr(-,root,root)\ %endif\ %{nil} # Inserting of static_package into working stuff. We very assume # that "clean" section is AFTER "install". It is needed because of # "__static_package" is defined by "find_static" macro, which is placed # in the "install" section. If "clean" section will be before "install", # the appropriate __static_package definition will be not in effect # at the time of "clean" macro expansion... # # A little bit ugly, but no more ugly than similar "debug_package" # inserting into the top of "install" section... # %clean %{?__static_package:%{static_package}}\ %%clean\ %{nil}