Accepting request 590397 from devel:tools:building

OBS-URL: https://build.opensuse.org/request/show/590397
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/meson?expand=0&rev=31
This commit is contained in:
Dominique Leuenberger 2018-03-24 15:10:24 +00:00 committed by Git OBS Bridge
commit 7b1a9c16cd
7 changed files with 257 additions and 24 deletions

View File

@ -1,20 +1,55 @@
Index: meson-0.44.0/mesonbuild/compilers/cpp.py --- a/mesonbuild/compilers/cpp.py
=================================================================== +++ b/mesonbuild/compilers/cpp.py
--- meson-0.44.0.orig/mesonbuild/compilers/cpp.py @@ -102,9 +102,11 @@ class GnuCPPCompiler(GnuCompiler, CPPCom
+++ meson-0.44.0/mesonbuild/compilers/cpp.py
@@ -75,9 +75,13 @@ class ClangCPPCompiler(ClangCompiler, CP
'3': default_warn_args + ['-Wextra', '-Wpedantic']} '3': default_warn_args + ['-Wextra', '-Wpedantic']}
def get_options(self): def get_options(self):
+ c_stds = ['c++98', 'c++03', 'c++11'] + cpp_stds = ['c++98', 'c++03', 'c++11', 'c++1y', 'gnu++03', 'gnu++11', 'gnu++1y']
+ g_stds = ['gnu++11']
+ if version_compare(self.version, '>=5.0.0'): + if version_compare(self.version, '>=5.0.0'):
+ c_stds += ['c++14', 'c++17', 'c++1z'] + cpp_stds += ['c++14', 'c++17', 'c++1z', 'gnu++14', 'gnu++17', 'gnu++1z']
+ g_stds += ['gnu++14', 'gnu++17', 'gnu++1z'] opts = {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
return {'cpp_std': coredata.UserComboOption('cpp_std', 'C++ language standard to use',
- ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', - ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z',
- 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'], - 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z'],
+ ['none'] + c_stds + g_stds, + ['none'] + cpp_stds,
'none')} 'none'),
'cpp_debugstl': coredata.UserBooleanOption('cpp_debugstl',
'STL debug mode',
--- a/mesonbuild/minit.py
+++ b/mesonbuild/minit.py
@@ -123,8 +123,7 @@ int main(int argc, char **argv) {{
def get_option_compile_args(self, options): hello_c_meson_template = '''project('{project_name}', 'c',
version : '{version}',
- default_options : ['warning_level=3',
- 'cpp_std=c++14'])
+ default_options : ['warning_level=3'])
exe = executable('{exe_name}', '{source_name}',
install : true)
@@ -148,7 +147,8 @@ int main(int argc, char **argv) {{
hello_cpp_meson_template = '''project('{project_name}', 'cpp',
version : '{version}',
- default_options : ['warning_level=3'])
+ default_options : ['warning_level=3',
+ 'cpp_std=c++1y'])
exe = executable('{exe_name}', '{source_name}',
install : true)
@@ -219,7 +219,7 @@ int main(int argc, char **argv) {{
lib_cpp_meson_template = '''project('{project_name}', 'cpp',
version : '{version}',
- default_options : ['warning_level=3', 'cpp_std=c++14'])
+ default_options : ['warning_level=3', 'cpp_std=c++1y'])
# These arguments are only used to build the shared library
# not the executables that use the library.
--- "a/test cases/unit/16 prebuilt shared/patron.c"
+++ "b/test cases/unit/16 prebuilt shared/patron.c"
@@ -5,4 +5,5 @@ int main(int argc, char **argv) {
printf("You are standing outside the Great Library of Alexandria.\n");
printf("You decide to go inside.\n\n");
alexandria_visit();
+ return 0;
}

View File

@ -0,0 +1,115 @@
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -26,7 +26,7 @@ from .. import compilers
from ..compilers import CompilerArgs
from ..linkers import ArLinker
from ..mesonlib import File, MesonException, OrderedSet
-from ..mesonlib import get_compiler_for_source
+from ..mesonlib import get_compiler_for_source, commonpath
from .backends import CleanTrees, InstallData
from ..build import InvalidArguments
@@ -1166,8 +1166,8 @@ int dummy;
# Check if the vala file is in a subdir of --basedir
abs_srcbasedir = os.path.join(self.environment.get_source_dir(), target.get_subdir())
abs_vala_file = os.path.join(self.environment.get_build_dir(), vala_file)
- if PurePath(os.path.commonpath((abs_srcbasedir, abs_vala_file))) == PurePath(abs_srcbasedir):
- vala_c_subdir = PurePath(abs_vala_file).parent.relative_to(abs_srcbasedir)
+ if PurePath(commonpath((abs_srcbasedir, abs_vala_file))) == PurePath(abs_srcbasedir):
+ vala_c_subdir = str(PurePath(abs_vala_file).parent.relative_to(abs_srcbasedir))
vala_c_file = os.path.join(vala_c_subdir, vala_c_file)
else:
path_to_target = os.path.join(self.build_to_src, target.get_subdir())
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -17,7 +17,7 @@ import pickle, os, uuid
import sys
from pathlib import PurePath
from collections import OrderedDict
-from .mesonlib import MesonException
+from .mesonlib import MesonException, commonpath
from .mesonlib import default_libdir, default_libexecdir, default_prefix
import ast
@@ -286,7 +286,7 @@ class CoreData:
# commonpath will always return a path in the native format, so we
# must use pathlib.PurePath to do the same conversion before
# comparing.
- if os.path.commonpath([value, prefix]) != str(PurePath(prefix)):
+ if commonpath([value, prefix]) != str(PurePath(prefix)):
m = 'The value of the {!r} option is {!r} which must be a ' \
'subdir of the prefix {!r}.\nNote that if you pass a ' \
'relative path, it is assumed to be a subdir of prefix.'
--- a/mesonbuild/mesonlib.py
+++ b/mesonbuild/mesonlib.py
@@ -935,6 +935,30 @@ def detect_subprojects(spdir_name, curre
result[basename] = [trial]
return result
+def commonpath(paths):
+ '''
+ For use on Python 3.4 where os.path.commonpath is not available.
+ '''
+ if sys.version_info >= (3, 5):
+ return os.path.commonpath(paths)
+
+ import pathlib
+ if not paths:
+ raise ValueError('commonpath() arg is an empty sequence')
+ common = pathlib.PurePath(paths[0])
+ for path in paths[1:]:
+ new = []
+ path = pathlib.PurePath(path)
+ for c, p in zip(common.parts, path.parts):
+ if c != p:
+ break
+ new.append(c)
+ if not new:
+ raise ValueError("Can't mix absolute and relative paths") from None
+ new = os.path.join(*new)
+ common = pathlib.PurePath(new)
+ return str(common)
+
class OrderedSet(collections.MutableSet):
"""A set that preserves the order in which items are added, by first
insertion.
--- a/mesonbuild/mesonmain.py
+++ b/mesonbuild/mesonmain.py
@@ -274,8 +274,8 @@ def run_script_command(args):
return cmdfunc(cmdargs)
def run(original_args, mainfile=None):
- if sys.version_info < (3, 5):
- print('Meson works correctly only with python 3.5+.')
+ if sys.version_info < (3, 4):
+ print('Meson works correctly only with python 3.4+.')
print('You have python %s.' % sys.version)
print('Please update your environment')
return 1
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -427,6 +427,24 @@ class InternalTests(unittest.TestCase):
kwargs = {'sources': [1, 2, 3], 'pch_sources': [4, 5, 6]}
self.assertEqual([[1, 2, 3], [4, 5, 6]], extract(kwargs, 'sources', 'pch_sources'))
+ def test_commonpath(self):
+ from os.path import sep
+ commonpath = mesonbuild.mesonlib.commonpath
+ self.assertRaises(ValueError, commonpath, [])
+ self.assertEqual(commonpath(['/usr', '/usr']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr', '/usr/']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr', '/usr/bin']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr/', '/usr/bin']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr/./', '/usr/bin']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr/bin', '/usr/bin']), sep + 'usr' + sep + 'bin')
+ self.assertEqual(commonpath(['/usr//bin', '/usr/bin']), sep + 'usr' + sep + 'bin')
+ self.assertEqual(commonpath(['/usr/./bin', '/usr/bin']), sep + 'usr' + sep + 'bin')
+ self.assertEqual(commonpath(['/usr/local', '/usr/lib']), sep + 'usr')
+ self.assertEqual(commonpath(['/usr', '/bin']), sep)
+ prefix = '/some/path/to/prefix'
+ libdir = '/some/path/to/prefix/libdir'
+ self.assertEqual(commonpath([prefix, libdir]), str(PurePath(prefix)))
+
class BasePlatformTests(unittest.TestCase):
def setUp(self):

View File

@ -0,0 +1,25 @@
--- a/mesonbuild/dependencies/dev.py
+++ b/mesonbuild/dependencies/dev.py
@@ -205,10 +205,10 @@ class LLVMDependency(ConfigToolDependenc
not for shared-linnking, we have to figure those out ourselves, because
of course we do.
"""
- if self.static:
- self.link_args = self.get_config_value(
- ['--libs', '--ldflags', '--system-libs'] + list(self.required_modules),
- 'link_args')
+ self.link_args = self.get_config_value(
+ ['--libs', '--ldflags', '--system-libs'] + list(self.required_modules),
+ 'link_args')
+ """
else:
# llvm-config will provide arguments for static linking, so we get
# to figure out for ourselves what to link with. We'll do that by
@@ -227,6 +227,7 @@ class LLVMDependency(ConfigToolDependenc
else:
raise DependencyException(
'Could not find a dynamically linkable library for LLVM.')
+ """
def check_components(self, modules, required=True):
"""Check for llvm components (modules in meson terms).

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Wed Mar 21 23:46:12 UTC 2018 - sor.alexei@meowr.ru
- Only apply meson-suse-fix-llvm-3.8.patch,
meson-restore-python3.4.patch, meson-fix-gcc48.patch on Leap 42.x
or older.
-------------------------------------------------------------------
Wed Mar 21 10:20:37 UTC 2018 - sor.alexei@meowr.ru
- Fix meson-fix-gcc48.patch.
- Add meson-restore-python3.4.patch: Restore Python 3.4 support for
SLE 12 and openSUSE Leap 42.x.
- Add meson-suse-fix-llvm-3.8.patch: Fix LLVM 3.8 tests for SLE 12
and openSUSE Leap 42.x..
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 12 22:04:53 UTC 2018 - dimstar@opensuse.org Mon Mar 12 22:04:53 UTC 2018 - dimstar@opensuse.org

View File

@ -29,17 +29,21 @@ Release: 0
Summary: Python-based build system Summary: Python-based build system
License: Apache-2.0 License: Apache-2.0
Group: Development/Tools/Building Group: Development/Tools/Building
URL: http://mesonbuild.com/ Url: http://mesonbuild.com/
Source: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz Source: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz
Source1: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz.asc Source1: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz.asc
Source2: meson.keyring Source2: meson.keyring
# PATCH-FIX-OPENSUSE meson-suse-ify-macros.patch dimstar@opensuse.org -- Make the macros non-RedHat specific: so far there are no separate {C,CXX,F}FLAGS. # PATCH-FIX-OPENSUSE meson-suse-ify-macros.patch dimstar@opensuse.org -- Make the macros non-RedHat specific: so far there are no separate {C,CXX,F}FLAGS.
Patch0: meson-suse-ify-macros.patch Patch0: meson-suse-ify-macros.patch
# PATCH-FIX-OPENSUSE meson-suse-fix-llvm-3.8.patch -- Fix LLVM 3.8 tests.
Patch1: meson-suse-fix-llvm-3.8.patch
# PATCH-FIX-OPENSUSE meson-restore-python3.4.patch -- Restore Python 3.4 support (reverts commit 0538009).
Patch2: meson-restore-python3.4.patch
# PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x. # PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x.
Patch1: meson-fix-gcc48.patch Patch3: meson-fix-gcc48.patch
# PATCH-FIX-OPENSUSE meson-test-installed-bin.patch dimstar@opensuse.org -- We want the test suite to run against /usr/bin/meson coming from our meson package. # PATCH-FIX-OPENSUSE meson-test-installed-bin.patch dimstar@opensuse.org -- We want the test suite to run against /usr/bin/meson coming from our meson package.
Patch100: meson-test-installed-bin.patch Patch100: meson-test-installed-bin.patch
BuildRequires: python3 >= 3.4 BuildRequires: python3
BuildArch: noarch BuildArch: noarch
%if %{testsuite} %if %{testsuite}
BuildRequires: bison BuildRequires: bison
@ -64,7 +68,7 @@ BuildRequires: ncurses-devel
BuildRequires: ninja BuildRequires: ninja
BuildRequires: openmpi-devel BuildRequires: openmpi-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: python3-devel BuildRequires: python3-devel >= 3.4
BuildRequires: python3-gobject BuildRequires: python3-gobject
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: vala BuildRequires: vala
@ -79,7 +83,7 @@ BuildRequires: pkgconfig(gobject-introspection-1.0)
BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(sdl2) BuildRequires: pkgconfig(sdl2)
BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(zlib)
%if 0%{?suse_version} > 1320 %if 0%{?suse_version} >= 1500
BuildRequires: libboost_log-devel BuildRequires: libboost_log-devel
BuildRequires: libboost_system-devel BuildRequires: libboost_system-devel
BuildRequires: libboost_test-devel BuildRequires: libboost_test-devel
@ -124,8 +128,13 @@ This package provides support for meson.build files in Vim.
%prep %prep
%setup -q -n meson-%{version} %setup -q -n meson-%{version}
%patch0 -p1 %patch0 -p1
%if 0%{?suse_version} < 1500
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%endif
%patch100 -p1 %patch100 -p1
# Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname) # Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname)
sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build
@ -141,7 +150,7 @@ sed -i '1{/\/usr\/bin\/env/d;}' ./mesonbuild/rewriter.py
%build %build
# If this is the test suite, we don't need anything else but the meson package # If this is the test suite, we don't need anything else but the meson package
%if ! %{testsuite} %if !%{testsuite}
python3 setup.py build python3 setup.py build
%else %else
# Ensure we have no mesonbuild / meson in CWD, thus guaranteeing we use meson in $PATH # Ensure we have no mesonbuild / meson in CWD, thus guaranteeing we use meson in $PATH
@ -175,7 +184,11 @@ python3 run_tests.py
%endif %endif
%files %files
%if 0%{?suse_version} >= 1500
%license COPYING %license COPYING
%else
%doc COPYING
%endif
%if !%{testsuite} %if !%{testsuite}
%{_bindir}/meson %{_bindir}/meson
%{_bindir}/mesonconf %{_bindir}/mesonconf

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Wed Mar 21 23:46:12 UTC 2018 - sor.alexei@meowr.ru
- Only apply meson-suse-fix-llvm-3.8.patch,
meson-restore-python3.4.patch, meson-fix-gcc48.patch on Leap 42.x
or older.
-------------------------------------------------------------------
Wed Mar 21 10:20:37 UTC 2018 - sor.alexei@meowr.ru
- Fix meson-fix-gcc48.patch.
- Add meson-restore-python3.4.patch: Restore Python 3.4 support for
SLE 12 and openSUSE Leap 42.x.
- Add meson-suse-fix-llvm-3.8.patch: Fix LLVM 3.8 tests for SLE 12
and openSUSE Leap 42.x..
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Mar 12 22:04:53 UTC 2018 - dimstar@opensuse.org Mon Mar 12 22:04:53 UTC 2018 - dimstar@opensuse.org

View File

@ -1,5 +1,5 @@
# #
# spec file for package meson # spec file for package meson-testsuite
# #
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# #
@ -29,14 +29,18 @@ Release: 0
Summary: Python-based build system Summary: Python-based build system
License: Apache-2.0 License: Apache-2.0
Group: Development/Tools/Building Group: Development/Tools/Building
URL: http://mesonbuild.com/ Url: http://mesonbuild.com/
Source: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz Source: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz
Source1: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz.asc Source1: https://github.com/%{_name}/meson/releases/download/%{version}/meson-%{version}.tar.gz.asc
Source2: meson.keyring Source2: meson.keyring
# PATCH-FIX-OPENSUSE meson-suse-ify-macros.patch dimstar@opensuse.org -- Make the macros non-RedHat specific: so far there are no separate {C,CXX,F}FLAGS. # PATCH-FIX-OPENSUSE meson-suse-ify-macros.patch dimstar@opensuse.org -- Make the macros non-RedHat specific: so far there are no separate {C,CXX,F}FLAGS.
Patch0: meson-suse-ify-macros.patch Patch0: meson-suse-ify-macros.patch
# PATCH-FIX-OPENSUSE meson-suse-fix-llvm-3.8.patch -- Fix LLVM 3.8 tests.
Patch1: meson-suse-fix-llvm-3.8.patch
# PATCH-FIX-OPENSUSE meson-restore-python3.4.patch -- Restore Python 3.4 support (reverts commit 0538009).
Patch2: meson-restore-python3.4.patch
# PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x. # PATCH-FIX-OPENSUSE meson-fix-gcc48.patch sor.alexei@meowr.ru -- Fix GCC 4.8 handling for openSUSE Leap 42.x.
Patch1: meson-fix-gcc48.patch Patch3: meson-fix-gcc48.patch
# PATCH-FIX-OPENSUSE meson-test-installed-bin.patch dimstar@opensuse.org -- We want the test suite to run against /usr/bin/meson coming from our meson package. # PATCH-FIX-OPENSUSE meson-test-installed-bin.patch dimstar@opensuse.org -- We want the test suite to run against /usr/bin/meson coming from our meson package.
Patch100: meson-test-installed-bin.patch Patch100: meson-test-installed-bin.patch
BuildRequires: python3 BuildRequires: python3
@ -64,7 +68,7 @@ BuildRequires: ncurses-devel
BuildRequires: ninja BuildRequires: ninja
BuildRequires: openmpi-devel BuildRequires: openmpi-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: python3-devel BuildRequires: python3-devel >= 3.4
BuildRequires: python3-gobject BuildRequires: python3-gobject
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
BuildRequires: vala BuildRequires: vala
@ -124,8 +128,13 @@ This package provides support for meson.build files in Vim.
%prep %prep
%setup -q -n meson-%{version} %setup -q -n meson-%{version}
%patch0 -p1 %patch0 -p1
%if 0%{?suse_version} < 1500
%patch1 -p1 %patch1 -p1
%patch2 -p1
%patch3 -p1
%endif
%patch100 -p1 %patch100 -p1
# Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname) # Remove static boost tests from test cases/frameworks/1 boost (can't use patch due to spaces in dirname)
sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build sed -i "/static/d" test\ cases/frameworks/1\ boost/meson.build
@ -175,7 +184,11 @@ python3 run_tests.py
%endif %endif
%files %files
%if 0%{?suse_version} >= 1500
%license COPYING %license COPYING
%else
%doc COPYING
%endif
%if !%{testsuite} %if !%{testsuite}
%{_bindir}/meson %{_bindir}/meson
%{_bindir}/mesonconf %{_bindir}/mesonconf