Accepting request 455042 from home:rwill:branches:Base:System

- Fix building for SLE11SP4, SLE12SP2, and Tumbleweed
  (fate#322108, bnc#1012765)

Note: this submission is not meant to be forwarded to Tumbleweed/Factory,
but to provide a fallback-revision for older products.  

A subsequent update (which I'm working on) will update this package to
(at least) 30, but this forces gcc >= 5 (not available everywhere).

OBS-URL: https://build.opensuse.org/request/show/455042
OBS-URL: https://build.opensuse.org/package/show/Base:System/efivar?expand=0&rev=22
This commit is contained in:
Gary Ching-Pang Lin 2017-02-09 03:37:29 +00:00 committed by Git OBS Bridge
parent f1a3b3de2f
commit 5fa45300b3
2 changed files with 63 additions and 4 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 6 14:40:25 UTC 2017 - rw@suse.com
- Fix building for SLE11SP4, SLE12SP2, and Tumbleweed
(fate#322108, bnc#1012765)
-------------------------------------------------------------------
Wed Jul 13 03:54:20 UTC 2016 - glin@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package efivar
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -16,6 +16,17 @@
#
%if 0%{?suse_version} <= 1320
# Allow building on older products (SLE11SP4, SLES12, and Leap 42.2)
%bcond_without forced_lto
%if 0%{?suse_version} == 1110
%define gcc 48
%define gcc_v 4.8
%endif
%else
%bcond_with forced_lto
%endif
Name: efivar
Version: 0.24
Release: 0
@ -26,9 +37,16 @@ Url: https://github.com/rhinstaller/efivar
Source0: https://github.com/rhinstaller/efivar/releases/download/%{version}/%{name}-%{version}.tar.bz2
Patch1: efivar-no-static.patch
Patch2: deprecated-readdir_r.patch
%if "0%{?buildroot}" == "0"
# set a sane value for buildroot, unless it's already there!
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
BuildRequires: fdupes
BuildRequires: pkg-config
BuildRequires: popt-devel
%if 0%{?gcc} != 0
BuildRequires: gcc%{gcc}
%endif
Requires: libefivar0 = %{version}-%{release}
%description
@ -47,21 +65,56 @@ Group: Development/Libraries/Other
Requires: libefivar0 = %{version}-%{release}
%description devel
development headers required to use libefivar.
Development headers required to use libefivar.
%prep
%setup -q
%patch1 -p1
%patch2 -p1
# gcc6-update breaks building with -Werror
perl -pi -e 's{-Werror}{}' gcc.specs
%if 0%{?suse_version} == 1110
# Instead of conditional patching:
# - 'popt.pc' missing in 'popt-devel' on SLE11
perl -pi -e 's{^.*PKGS=popt.*$}{}; s{(efivar\S* : LIBS=.*)dl}{$1popt dl}' \
src/Makefile
# - 'uchar.h' missing in both 'glibc-devel' and 'gcc-5' packages on SLE11
perl -pi -e 's{\#include \<uchar\.h\>}{typedef __CHAR16_TYPE__ char16_t;}' \
src/export.c
%endif
%build
export CFLAGS="%{optflags} -Wno-nonnull"
# SUSE multi-dist building effort
if [ "0%{?gcc}" != "0" ]||[ ! -x /usr/bin/gcc-ar ]; then
mkdir bin
if [ "0%{?gcc}" != "0" ]; then
for p in "" -ar -nm -ranlib; do
ln -s /usr/bin/gcc$p-%{gcc_v} bin/gcc$p
done
else
ln -s /usr/bin/ar bin/gcc-ar
fi
PATH=$PWD/bin:$PATH
fi
CFLAGS="%{optflags} -Wno-nonnull"
%if %{with forced_lto}
CFLAGS="$CFLAGS -flto"
%endif
%ifarch ia64
CFLAGS="${CFLAGS//-fstack-protector/}"
%endif
export CFLAGS
make \
libdir=%{_libdir} \
bindir=%{_bindir}
%install
make DESTDIR=%{buildroot} libdir=%{_libdir} install
make DESTDIR=%{buildroot} \
libdir=%{_libdir} \
bindir=%{_bindir} \
install
%fdupes -s %{buildroot}
%post -n libefivar0 -p /sbin/ldconfig