diff --git a/0001-rpm-use-meson-s-syntax-to-specify-sourcedir-and-buil.patch b/0001-rpm-use-meson-s-syntax-to-specify-sourcedir-and-buil.patch new file mode 100644 index 0000000..53f5ffd --- /dev/null +++ b/0001-rpm-use-meson-s-syntax-to-specify-sourcedir-and-buil.patch @@ -0,0 +1,66 @@ +From dcd3c217121fbb09be8acecd2d866219e85ad9bd Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 13 Dec 2016 11:59:52 +0100 +Subject: [PATCH 1/2] rpm: use meson's syntax to specify sourcedir and builddir + +When user uses %meson -Denable_cool_feature=true current macro fails +because RPM adds flag after popd: +... +pushd x86_64-redhat-linux-gnu + /usr/bin/meson ... $OLDPWD/. +popd -Denable_cool_feature + +Since meson can accept $srcdir and $builddir arugments we don't have +this problem with pushd/popd. It also simplifies things a bit. + +Reported-by: Richard Hughes +References: https://bugzilla.redhat.com/show_bug.cgi?id=1401062 +Signed-off-by: Igor Gnatenko +--- + data/macros.meson | 30 ++++++++++++++---------------- + 1 file changed, 14 insertions(+), 16 deletions(-) + +diff --git a/data/macros.meson b/data/macros.meson +index 97d8a23f..5250c348 100644 +--- a/data/macros.meson ++++ b/data/macros.meson +@@ -8,22 +8,20 @@ + export FFLAGS="%{optflags} -I%{_fmoddir}" \ + export FCFLAGS="%{optflags} -I%{_fmoddir}" \ + export LDFLAGS="%{?__global_ldflags}" \ +- mkdir -p %{__builddir} \ +- pushd %{__builddir} \ +- %{__meson} \\\ +- --buildtype=plain \\\ +- --prefix=%{_prefix} \\\ +- --libdir=%{_libdir} \\\ +- --libexecdir=%{_libexecdir} \\\ +- --bindir=%{_bindir} \\\ +- --includedir=%{_includedir} \\\ +- --datadir=%{_datadir} \\\ +- --mandir=%{_mandir} \\\ +- --localedir=%{_datadir}/locale \\\ +- --sysconfdir=%{_sysconfdir} \\\ +- --localstatedir=%{_localstatedir} \\\ +- $OLDPWD/%{__sourcedir} \ +- popd ++ %{__meson} \\\ ++ --buildtype=plain \\\ ++ --prefix=%{_prefix} \\\ ++ --libdir=%{_libdir} \\\ ++ --libexecdir=%{_libexecdir} \\\ ++ --bindir=%{_bindir} \\\ ++ --includedir=%{_includedir} \\\ ++ --datadir=%{_datadir} \\\ ++ --mandir=%{_mandir} \\\ ++ --localedir=%{_datadir}/locale \\\ ++ --sysconfdir=%{_sysconfdir} \\\ ++ --localstatedir=%{_localstatedir} \\\ ++ %{__sourcedir} %{__builddir} \\\ ++ %{nil} + + %meson_build \ + %ninja_build -C %{__builddir} +-- +2.11.0 + diff --git a/0002-rpm-use-__global_-flags.patch b/0002-rpm-use-__global_-flags.patch new file mode 100644 index 0000000..7471d0a --- /dev/null +++ b/0002-rpm-use-__global_-flags.patch @@ -0,0 +1,44 @@ +From 0121faf16873b500274b36955a08c6994e7f6f76 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Tue, 13 Dec 2016 12:29:28 +0100 +Subject: [PATCH 2/2] rpm: use __global_*flags + +Using RPM's %{optflags} is definitely nice, but not enough. LDFLAGS +are not there, and idea of optflags is too generic. It is supposed +to work under CC and CXX, but apparently someone forgot that there +is difference between these two. + +%__global_*flags is not part of RPM itself, it's coming within +redhat-rpm-config which makes our macros file not that portable, +but anyway we already have %__global_ldflags and %ninja_build and +no one complained. + +Signed-off-by: Igor Gnatenko +--- + data/macros.meson | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/data/macros.meson b/data/macros.meson +index 5250c348..4eb1ab9a 100644 +--- a/data/macros.meson ++++ b/data/macros.meson +@@ -3,11 +3,11 @@ + %__builddir %{_target_platform} + + %meson \ +- export CFLAGS="%{optflags}" \ +- export CXXFLAGS="%{optflags}" \ +- export FFLAGS="%{optflags} -I%{_fmoddir}" \ +- export FCFLAGS="%{optflags} -I%{_fmoddir}" \ +- export LDFLAGS="%{?__global_ldflags}" \ ++ export CFLAGS="${CFLAGS:-%__global_cflags}" \ ++ export CXXFLAGS="${CXXFLAGS:-%__global_cxxflags}" \ ++ export FFLAGS="${FFLAGS:-%__global_fflags}" \ ++ export FCFLAGS="${FCFLAGS:-%__global_fcflags}" \ ++ export LDFLAGS="${LDFLAGS:-%__global_ldflags}" \ + %{__meson} \\\ + --buildtype=plain \\\ + --prefix=%{_prefix} \\\ +-- +2.11.0 + diff --git a/meson.spec b/meson.spec index 4c52c3c..4052b7f 100644 --- a/meson.spec +++ b/meson.spec @@ -2,12 +2,14 @@ Name: meson Version: 0.36.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: High productivity build system License: ASL 2.0 URL: http://mesonbuild.com/ Source0: https://github.com/mesonbuild/meson/archive/%{version}/%{name}-%{version}.tar.gz +Patch0001: 0001-rpm-use-meson-s-syntax-to-specify-sourcedir-and-buil.patch +Patch0002: 0002-rpm-use-__global_-flags.patch BuildArch: noarch Obsoletes: %{name}-gui < 0.31.0-3 @@ -90,6 +92,9 @@ export MESON_PRINT_TEST_OUTPUT=1 %{rpmmacrodir}/macros.%{name} %changelog +* Tue Dec 13 2016 Igor Gnatenko - 0.36.0-3 +- Backport fixes to RPM macros + * Sat Dec 03 2016 Igor Gnatenko - 0.36.0-2 - Print test output during build