From 5fa45300b3e01ea07f540aa13c68f344696e0d834a1bcbc06b8866798b43d74c Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Thu, 9 Feb 2017 03:37:29 +0000 Subject: [PATCH 1/3] 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 --- efivar.changes | 6 +++++ efivar.spec | 61 ++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/efivar.changes b/efivar.changes index 2f5c051..ba26c16 100644 --- a/efivar.changes +++ b/efivar.changes @@ -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 diff --git a/efivar.spec b/efivar.spec index 227abda..852dfca 100644 --- a/efivar.spec +++ b/efivar.spec @@ -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 \}{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 From 64823aaa080cf815ac203e5e4db4ccb967ee3f1e375e3e6fa37cdd4c8388b764 Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Thu, 9 Feb 2017 04:40:38 +0000 Subject: [PATCH 2/3] Accepting request 455620 from home:gary_lin:branches:Base:System - Add efivar-use-sysmacros.patch to fix the Factory/Tumbleweed build correctly. OBS-URL: https://build.opensuse.org/request/show/455620 OBS-URL: https://build.opensuse.org/package/show/Base:System/efivar?expand=0&rev=23 --- efivar-use-sysmacros.patch | 25 +++++++++++++++++++++++++ efivar.changes | 6 ++++++ efivar.spec | 4 ++-- 3 files changed, 33 insertions(+), 2 deletions(-) create mode 100644 efivar-use-sysmacros.patch diff --git a/efivar-use-sysmacros.patch b/efivar-use-sysmacros.patch new file mode 100644 index 0000000..74aec41 --- /dev/null +++ b/efivar-use-sysmacros.patch @@ -0,0 +1,25 @@ +From 3ad5aab6ec57b28e62625bf6f3e444b0bcde799a Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Wed, 10 Aug 2016 16:47:41 -0400 +Subject: [PATCH] libefivar: use sysmacros.h + +Signed-off-by: Peter Jones +--- + src/linux.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/linux.c b/src/linux.c +index 87f2284..7c644ed 100644 +--- a/src/linux.c ++++ b/src/linux.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.11.0 + diff --git a/efivar.changes b/efivar.changes index ba26c16..397f18a 100644 --- a/efivar.changes +++ b/efivar.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Feb 9 04:38:03 UTC 2017 - glin@suse.com + +- Add efivar-use-sysmacros.patch to fix the Factory/Tumbleweed + build correctly. + ------------------------------------------------------------------- Mon Feb 6 14:40:25 UTC 2017 - rw@suse.com diff --git a/efivar.spec b/efivar.spec index 852dfca..dd1c462 100644 --- a/efivar.spec +++ b/efivar.spec @@ -37,6 +37,7 @@ 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 +Patch3: efivar-use-sysmacros.patch %if "0%{?buildroot}" == "0" # set a sane value for buildroot, unless it's already there! BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -71,8 +72,7 @@ Development headers required to use libefivar. %setup -q %patch1 -p1 %patch2 -p1 -# gcc6-update breaks building with -Werror -perl -pi -e 's{-Werror}{}' gcc.specs +%patch3 -p1 %if 0%{?suse_version} == 1110 # Instead of conditional patching: # - 'popt.pc' missing in 'popt-devel' on SLE11 From 6fb2dfaf50557b7daa218b70ae81ee90a242e48212bba984281ce2e8fd0af4cf Mon Sep 17 00:00:00 2001 From: Gary Ching-Pang Lin Date: Thu, 9 Feb 2017 06:48:14 +0000 Subject: [PATCH 3/3] Accepting request 455650 from home:gary_lin:branches:Base:System Amend the spec file to specify the gcc version for SLE11SP4 OBS-URL: https://build.opensuse.org/request/show/455650 OBS-URL: https://build.opensuse.org/package/show/Base:System/efivar?expand=0&rev=24 --- efivar.changes | 3 ++- efivar.spec | 19 ++++++------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/efivar.changes b/efivar.changes index 397f18a..7ea15b9 100644 --- a/efivar.changes +++ b/efivar.changes @@ -1,8 +1,9 @@ ------------------------------------------------------------------- -Thu Feb 9 04:38:03 UTC 2017 - glin@suse.com +Thu Feb 9 06:32:10 UTC 2017 - glin@suse.com - Add efivar-use-sysmacros.patch to fix the Factory/Tumbleweed build correctly. +- Amend the spec file to specify the gcc version for SLE11SP4 ------------------------------------------------------------------- Mon Feb 6 14:40:25 UTC 2017 - rw@suse.com diff --git a/efivar.spec b/efivar.spec index dd1c462..d944b7e 100644 --- a/efivar.spec +++ b/efivar.spec @@ -84,19 +84,6 @@ perl -pi -e 's{\#include \}{typedef __CHAR16_TYPE__ char16_t;}' \ %endif %build -# 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" @@ -107,6 +94,12 @@ CFLAGS="%{optflags} -Wno-nonnull" export CFLAGS make \ +%if 0%{?suse_version} == 1110 + CC=gcc-%{gcc_v} \ + AR=gcc-ar-%{gcc_v} \ + NM=gcc-nm-%{gcc_v} \ + RANLIB=gcc-ranlib-%{gcc_v} \ +%endif libdir=%{_libdir} \ bindir=%{_bindir}