Re: Static linking considered harmful

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alan Cox wrote:

Far simpler, cleaner and more friendly will be to dump the static libraries
into libfoo-devel-static packages which are not in the default install. That
ensures people who need to can do static links and the default behaviour is
that they are not there. The -static packages could even get dropped off the
CD easily enough once the mechanisms for handling one srpm spitting out
binary components for extras and core are sorted
BTW, such a "-static" subpackages might be handled the same way as "-debuginfo". Consider some example of needed rpm macros (attached below), written one year ago when similar topic was discussed at fedore-extras-devel list.

Dmitry Butskoy
http://www.fedoraproject.org/wiki/DmitryButskoy
#  
#  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}
-- 
fedora-devel-list mailing list
fedora-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-devel-list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux