Add -fPIC for static objects

Adding the -fPIC also for static objects, so it can
be used in builds with shared libraries.

There's old guide (draft) for Fedora (only one I could find):
  https://fedoraproject.org/wiki/User:Ajax/Static_Library_PICness_Guidelines

saying:
  Packages that install static library archives (.a files) must do exactly one of:
   - build them as PIC objects
   - document why the static libraries are not built PIC AND receive explicit approval from FESCo.
   - build both PIC and non-PIC libraries, with a .pc file for each for dependent packages to use

If we ever want/need nonpic archive, we will go with 3rd option above,
for now just enabling fPIC in libbpf.a
This commit is contained in:
Jiri Olsa 2019-11-28 16:09:56 +01:00
parent 3d15ee1efc
commit 9a27792ebb

View File

@ -39,7 +39,7 @@ Requires: %{name}-devel = 2:%{version}-%{release}
The %{name}-static package contains static library for
developing applications that use %{name}
%global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags}" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1
%global make_flags DESTDIR=%{buildroot} OBJDIR=%{_builddir} CFLAGS="%{build_cflags} -fPIC" LDFLAGS="%{build_ldflags} -Wl,--no-as-needed" LIBDIR=/%{_libdir} NO_PKG_CONFIG=1
%prep
%autosetup -n %{githubfull}