Browse Source

WIP gtk3

zrythm
alex 3 years ago committed by Alexandros Theodotou
parent
commit
ccc59adc93
Signed by: alex
GPG Key ID: 022EAE42313D70F3
  1. 2
      cerbero/bootstrap/build_tools.py
  2. 8
      cerbero/build/build.py
  3. 10
      recipes/build-tools/meson.recipe
  4. 32
      recipes/build-tools/meson/0001-Add-UNIX-large-file-support-for-MinGW.patch
  5. 85
      recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch
  6. 38
      recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler2.patch
  7. 71
      recipes/build-tools/meson/0001-qt-dependency-Pick-debug-libraries-based-on-b_vscrt.patch
  8. 55
      recipes/build-tools/meson/0001-ui-qt-use-new-directory-layout-for-qt-on-android.patch
  9. 11
      recipes/gdk-pixbuf.recipe
  10. 12
      recipes/gtk3.recipe
  11. 4
      recipes/zrythm.recipe

2
cerbero/bootstrap/build_tools.py

@ -31,7 +31,7 @@ from cerbero.enums import Platform, Architecture, DistroVersion @@ -31,7 +31,7 @@ from cerbero.enums import Platform, Architecture, DistroVersion
class BuildTools (BootstrapperBase, Fetch):
BUILD_TOOLS = ['automake', 'autoconf', 'libtool', 'pkg-config',
'orc-tool', 'gettext-m4', 'meson', 'cmake']
'orc-tool', 'gettext-m4', 'meson']
PLAT_BUILD_TOOLS = {
Platform.DARWIN: ['intltool', 'gettext-m4', 'gperf', 'bison', 'flex',
'moltenvk-tools', 'gettext-tools', 'm4'],

8
cerbero/build/build.py

@ -884,8 +884,8 @@ class Meson (Build, ModifyEnvBase) : @@ -884,8 +884,8 @@ class Meson (Build, ModifyEnvBase) :
props[key] += value
# We do not use cmake dependency files, speed up the build by disabling it
#binaries = {'cmake': ['false']}
binaries = {'cmake': '\'cmake\''}
binaries = {'cmake': ['false']}
#binaries = {'cmake': '\'cmake\''}
#'exe_wrapper': '\'wine\''}
# Get qmake and moc paths
if self.config.qt5_qmake_path:
@ -979,8 +979,8 @@ class Meson (Build, ModifyEnvBase) : @@ -979,8 +979,8 @@ class Meson (Build, ModifyEnvBase) :
# Tell meson to not use a native compiler for anything
false = ['false']
# We do not use cmake dependency files, speed up the build by disabling it
#extra_binaries = 'cmake = {}'.format(str(false))
extra_binaries = ''
extra_binaries = 'cmake = {}'.format(str(false))
#extra_binaries = ''
contents = MESON_FILE_TPL.format(
system=self.config.platform,
cpu=self.config.arch,

10
recipes/build-tools/meson.recipe

@ -12,14 +12,8 @@ class Recipe(recipe.Recipe): @@ -12,14 +12,8 @@ class Recipe(recipe.Recipe):
url = 'https://github.com/mesonbuild/meson/releases/download/%(version)s/meson-%(version)s.tar.gz'
tarball_checksum = '6bed2a25a128bbabe97cf40f63165ebe800e4fcb46db8ab7ef5c2b5789f092a5'
patches = [
# Remove this on bump to 0.54.1, https://github.com/mesonbuild/meson/pull/6896
#'meson/0001-qt-dependency-Pick-debug-libraries-based-on-b_vscrt.patch',
# https://github.com/mesonbuild/meson/pull/7138
#'meson/0001-ui-qt-use-new-directory-layout-for-qt-on-android.patc',
# https://github.com/mesonbuild/meson/pull/7021
'meson/0001-meson-Allow-cross-compile-without-a-native-compiler2.patch',
# https://github.com/mesonbuild/meson/pull/7272
#'meson/0001-Add-UNIX-large-file-support-for-MinGW.patch',
# Remove on bump to 0.56, https://github.com/mesonbuild/meson/pull/7021
'meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch',
]
deps = ['ninja']

32
recipes/build-tools/meson/0001-Add-UNIX-large-file-support-for-MinGW.patch

@ -1,32 +0,0 @@ @@ -1,32 +0,0 @@
From b259e432f70c7cb86d121986d9a3a8a6143d9023 Mon Sep 17 00:00:00 2001
From: Seungha Yang <seungha@centricular.com>
Date: Mon, 8 Jun 2020 21:24:54 +0900
Subject: [PATCH] Add UNIX large file support for MinGW
MinGW gcc supports _FILE_OFFSET_BITS=64 and we need to set it for
MinGW as well
---
mesonbuild/compilers/compilers.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 4b286fe4..50e21883 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1246,10 +1246,10 @@ def get_largefile_args(compiler):
'''
Enable transparent large-file-support for 32-bit UNIX systems
'''
- if not (compiler.info.is_windows() or compiler.info.is_darwin()):
+ if not (compiler.get_argument_syntax() == 'msvc' or compiler.info.is_darwin()):
# Enable large-file support unconditionally on all platforms other
- # than macOS and Windows. macOS is now 64-bit-only so it doesn't
- # need anything special, and Windows doesn't have automatic LFS.
+ # than macOS and MSVC. macOS is now 64-bit-only so it doesn't
+ # need anything special, and MSVC doesn't have automatic LFS.
# You must use the 64-bit counterparts explicitly.
# glibc, musl, and uclibc, and all BSD libcs support this. On Android,
# support for transparent LFS is available depending on the version of
--
2.17.1

85
recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch

@ -1,13 +1,12 @@ @@ -1,13 +1,12 @@
From a6aa905f2c580a34e6bb1c547b20ec6ecd4011d0 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Thu, 23 Apr 2020 08:32:15 +0530
Subject: [PATCH 1/2] Allow cross-compile without a native compiler
Subject: Allow cross-compile without a native compiler
---
mesonbuild/backend/ninjabackend.py | 2 +-
mesonbuild/environment.py | 2 +-
mesonbuild/interpreter.py | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 03ccd196..aeffc80a 100644
@ -19,22 +18,9 @@ index 03ccd196..aeffc80a 100644 @@ -19,22 +18,9 @@ index 03ccd196..aeffc80a 100644
if static_linker is None:
- return
+ continue
rule = 'STATIC_LINKER%s' % self.get_rule_suffix(for_machine)
rule = 'STATIC_LINKER{}'.format(self.get_rule_suffix(for_machine))
cmdlist = []
args = ['$in']
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 11bc76c9..fd375571 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -899,7 +899,7 @@ class Environment:
def _detect_c_or_cpp_compiler(self, lang: str, for_machine: MachineChoice) -> Compiler:
popen_exceptions = {}
compilers, ccache, exe_wrap = self._get_compilers(lang, for_machine)
- is_cross = not self.machines.matches_build_machine(for_machine)
+ is_cross = not self.machines.matches_build_machine(for_machine) or self.need_exe_wrapper(for_machine)
info = self.machines[for_machine]
for compiler in compilers:
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 214b1eb5..c8473cb6 100644
--- a/mesonbuild/interpreter.py
@ -48,69 +34,6 @@ index 214b1eb5..c8473cb6 100644 @@ -48,69 +34,6 @@ index 214b1eb5..c8473cb6 100644
self.add_languages(proj_langs, True, MachineChoice.HOST)
self.set_backend()
if not self.is_subproject():
--
2.26.1.windows.1
From 4efad015b9377710a15507083bb12ad2830fde80 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Thu, 23 Apr 2020 09:38:21 +0530
Subject: [PATCH 2/2] windows linker: Only guess if we don't know target
cpu_family
Unlike `cl.exe, MSVC `link.exe` has a 'default' target machine, and
the actual target machine can be selected with `/MACHINE:`. The
'default' is `X86` if you use the x86 native or cross toolchain and
it's `X64` if you use the x64 native or cross toolchain.
So, if you call `vcvarsall.bat x86_arm64` which is the x86 cross
toolchain for arm64, `link.exe` will default to `X86`, not `ARM64`.
It has to be selected by the build system by passing `/MACHINE:ARM64`
So that's what we do now. In the native build case when a native file
is not passed, the auto-detect will always be correct, and in the
cross build case we will always know the `cpu_family`, so this fixes
it for all cases.
---
mesonbuild/environment.py | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index fd375571..ca6208c9 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -804,14 +804,26 @@ class Environment:
return OptlinkDynamicLinker(compiler, for_machine, version=search_version(o))
elif o.startswith('Microsoft') or e.startswith('Microsoft'):
out = o or e
- match = re.search(r'.*(X86|X64|ARM|ARM64).*', out)
- if match:
- target = str(match.group(1))
+
+ target_arch = self.machines[for_machine].cpu_family
+ if target_arch is None:
+ match = re.search(r'.*(X86|X64|ARM|ARM64)\s+', out)
+ if match:
+ target_arch = str(match.group(1))
+ else:
+ target_arch = 'X86'
+ elif target_arch in ('x86', 'arm'):
+ target_arch = target_arch.upper()
+ elif target_arch == 'x86_64':
+ target_arch = 'X64'
+ elif target_arch == 'aarch64':
+ target_arch = 'ARM64'
else:
- target = 'x86'
+ raise EnvironmentException('Unknown target arch {!r} for MSVC linker '
+ '`link.exe`'.format(target_arch))
return MSVCDynamicLinker(
- for_machine, [], machine=target, exelist=compiler,
+ for_machine, [], machine=target_arch, exelist=compiler,
prefix=comp_class.LINKER_PREFIX if use_linker_prefix else [],
version=search_version(out), direct=invoked_directly)
elif 'GNU coreutils' in o:
--
--
2.26.1.windows.1

38
recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler2.patch

@ -1,38 +0,0 @@ @@ -1,38 +0,0 @@
From a6aa905f2c580a34e6bb1c547b20ec6ecd4011d0 Mon Sep 17 00:00:00 2001
From: Alexandros Theodotou <alex@zrythm.org>
Date: Thu, 23 Apr 2020 08:32:15 +0530
Subject: [PATCH 1/2] Allow cross-compile without a native compiler
---
mesonbuild/backend/ninjabackend.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index 8afb80e..3cb26b2 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -1747,7 +1747,7 @@ int dummy;
for for_machine in MachineChoice:
static_linker = self.build.static_linker[for_machine]
if static_linker is None:
- return
+ continue
rule = 'STATIC_LINKER{}'.format(self.get_rule_suffix(for_machine))
cmdlist = []
args = ['$in']
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index b2b43f3..0d7cc33 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -3080,7 +3080,7 @@ external dependencies (including libraries) must go to "dependencies".''')
self.build.projects[self.subproject] = proj_name
mlog.log('Project name:', mlog.bold(proj_name))
mlog.log('Project version:', mlog.bold(self.project_version))
- self.add_languages(proj_langs, True, MachineChoice.BUILD)
+ self.add_languages(proj_langs, False, MachineChoice.BUILD)
self.add_languages(proj_langs, True, MachineChoice.HOST)
self.set_backend()
if not self.is_subproject():
--
2.26.1.windows.1

71
recipes/build-tools/meson/0001-qt-dependency-Pick-debug-libraries-based-on-b_vscrt.patch

@ -1,71 +0,0 @@ @@ -1,71 +0,0 @@
From 5a8c70cbcfb492ea3f916b7a4be0496d3c524573 Mon Sep 17 00:00:00 2001
From: Cerbero <cerbero@gstreamer.freedesktop.org>
Date: Sat, 4 Apr 2020 00:41:17 +0530
Subject: [PATCH] qt dependency: Pick debug libraries based on b_vscrt
`b_vscrt` has existed forever, and is the canonical source for
which CRT to link to, and hence whether to use the debug libraries
or not.
---
mesonbuild/dependencies/ui.py | 5 +++++
run_unittests.py | 27 +++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index da411ef..1d2ca1e 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -385,7 +385,12 @@ class QtBaseDependency(ExternalDependency):
self.bindir = self.get_qmake_host_bins(qvars)
self.is_found = True
+ # Use the buildtype by default, but look at the b_vscrt option if the
+ # compiler supports it.
is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
+ if 'b_vscrt' in self.env.coredata.base_options:
+ if self.env.coredata.base_options['b_vscrt'].value in ('mdd', 'mtd'):
+ is_debug = True
modules_lib_suffix = self._get_modules_lib_suffix(is_debug)
for module in mods:
diff --git a/run_unittests.py b/run_unittests.py
index b42b9db..abc1c5f 100644
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -4696,6 +4696,33 @@ class WindowsTests(BasePlatformTests):
# Verify that a valid checksum was written by all other compilers
self.assertTrue(pe.verify_checksum(), msg=msg)
+ def test_qt5dependency_vscrt(self):
+ '''
+ Test that qt5 dependencies use the debug module suffix when b_vscrt is
+ set to 'mdd'
+ '''
+ # Verify that the `b_vscrt` option is available
+ env = get_fake_env()
+ cc = env.detect_c_compiler(MachineChoice.HOST)
+ if 'b_vscrt' not in cc.base_options:
+ raise unittest.SkipTest('Compiler does not support setting the VS CRT')
+ # Verify that qmake is for Qt5
+ if not shutil.which('qmake-qt5'):
+ if not shutil.which('qmake') and not is_ci():
+ raise unittest.SkipTest('QMake not found')
+ output = subprocess.getoutput('qmake --version')
+ if 'Qt version 5' not in output and not is_ci():
+ raise unittest.SkipTest('Qmake found, but it is not for Qt 5.')
+ # Setup with /MDd
+ testdir = os.path.join(self.framework_test_dir, '4 qt')
+ self.init(testdir, extra_args=['-Db_vscrt=mdd'])
+ # Verify that we're linking to the debug versions of Qt DLLs
+ build_ninja = os.path.join(self.builddir, 'build.ninja')
+ with open(build_ninja, 'r', encoding='utf-8') as f:
+ contents = f.read()
+ m = re.search('build qt5core.exe: cpp_LINKER.*Qt5Cored.lib', contents)
+ self.assertIsNotNone(m, msg=contents)
+
@unittest.skipUnless(is_osx(), "requires Darwin")
class DarwinTests(BasePlatformTests):
--
2.26.0.windows.1

55
recipes/build-tools/meson/0001-ui-qt-use-new-directory-layout-for-qt-on-android.patch

@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
From f73687d64d49ba9b291910c75bd1ddf6379d257d Mon Sep 17 00:00:00 2001
From: Matthew Waters <matthew@centricular.com>
Date: Thu, 14 May 2020 13:07:26 +1000
Subject: [PATCH] ui/qt: use new directory layout for qt on android
---
mesonbuild/dependencies/ui.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 4cec814..cdb517c 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -18,6 +18,7 @@ import os
import re
import subprocess
import typing as T
+import textwrap
from collections import OrderedDict
from .. import mlog
@@ -406,6 +407,9 @@ class QtBaseDependency(ExternalDependency):
if libfile:
libfile = libfile[0]
else:
+ mlog.log("Could not find:", module,
+ self.qtpkgname + module + modules_lib_suffix,
+ 'in', libdir)
self.is_found = False
break
self.link_args.append(libfile)
@@ -426,6 +430,20 @@ class QtBaseDependency(ExternalDependency):
if self.env.machines[self.for_machine].is_darwin():
if is_debug:
suffix += '_debug'
+ if mesonlib.version_compare(self.version, '>= 5.14.0'):
+ if self.env.machines[self.for_machine].is_android():
+ cpu_family = self.env.machines[self.for_machine].cpu_family
+ if cpu_family == 'x86':
+ suffix += '_x86'
+ elif cpu_family == 'x86_64':
+ suffix += '_x86_64'
+ elif cpu_family == 'arm':
+ suffix += '_armeabi-v7a'
+ elif cpu_family == 'aarch64':
+ suffix += '_arm64-v8a'
+ else:
+ mlog.warning(textwrap.dedent('''cpu_family {} is not known
+ to be available with Qt {} on Android'''.format(cpu_family, self.version)))
return suffix
def _link_with_qtmain(self, is_debug, libdir):
--
2.26.2

11
recipes/gdk-pixbuf.recipe

@ -13,7 +13,7 @@ class Recipe(recipe.Recipe): @@ -13,7 +13,7 @@ class Recipe(recipe.Recipe):
meson_options = {'docs' : 'false',
'man' : 'false',
'installed_tests' : 'false',
'builtin_loaders' : 'all',
'builtin_loaders' : 'none',
'gio_sniffing' : 'false',
'x11' : 'false'}
deps = ['libjpeg-turbo', 'glib', 'libpng', 'tiff', 'zlib' ]
@ -21,16 +21,17 @@ class Recipe(recipe.Recipe): @@ -21,16 +21,17 @@ class Recipe(recipe.Recipe):
files_libs = ['libgdk_pixbuf-2.0']
files_bins = ['gdk-pixbuf-query-loaders', 'gdk-pixbuf-csource']
files_devel = ['lib/pkgconfig/gdk-pixbuf-2.0.pc', 'include/gdk-pixbuf-2.0']
files_misc = ['lib/gdk-pixbuf-2.0/2.10.0/loaders.cache']
files_lang = ['gdk-pixbuf']
files_typelibs = ['GdkPixbuf-2.0']
def prepare(self):
if self.config.target_platform == Platform.WINDOWS:
self.meson_options['native_windows_loaders'] = 'false'
if self.config.prefix_is_executable():
self.files_misc = ['lib/gdk-pixbuf-2.0/2.10.0/loaders.cache']
else:
self.meson_options['tests'] = 'false'
#if self.config.prefix_is_executable():
self.files_misc = ['lib/gdk-pixbuf-2.0/2.10.0/loaders.cache']
#else:
#self.meson_options['tests'] = 'false'
def post_install (self):
if self.config.platform == Platform.WINDOWS and\

12
recipes/gtk3.recipe

@ -3,15 +3,19 @@ from cerbero.tools.libtool import LibtoolLibrary @@ -3,15 +3,19 @@ from cerbero.tools.libtool import LibtoolLibrary
class Recipe(recipe.Recipe):
name = 'gtk3'
version = '3.24.22'
version = '3.24.23'
stype = SourceType.TARBALL
url = 'https://download.gnome.org/sources/gtk+/%(maj_ver)s/gtk+-%(version)s.tar.xz'
tarball_dirname = 'gtk+-%(version)s'
tarball_checksum = 'bf18a4a5dff28a7b02aaef1b949c2d09c96c18387eddab152bb4cd55a5b67dda'
tarball_checksum = '5d864d248357a2251545b3387b35942de5f66e4c66013f0962eb5cb6f8dae2b1'
licenses = [License.LGPLv2Plus]
btype = BuildType.MESON
meson_options = {'installed_tests': False, 'builtin_immodules': 'yes'}
deps = ['glib', 'gdk-pixbuf', 'libepoxy', 'atk', 'cairo', 'pango',
meson_options = {
'installed_tests': False,
'builtin_immodules': 'yes',
'demos': False}
deps = ['glib',# 'gdk-pixbuf',
'libepoxy', 'atk', 'cairo', 'pango',
'fribidi', 'freetype', 'harfbuzz']
patches = ['gtk3/0001-meson-Fix-post-install-when-cross-compiling-to-Windo.patch']

4
recipes/zrythm.recipe

@ -12,7 +12,9 @@ class Recipe(recipe.Recipe): @@ -12,7 +12,9 @@ class Recipe(recipe.Recipe):
url = 'https://git.zrythm.org/cgit/zrythm/snapshot/zrythm-%(version)s.tar.gz'
tarball_checksum = '6a926b25367fc4ecac0443c772a3581a96404a443dbac6a65286f6df7c9a6021'
deps = ['cairo', 'libyaml', 'libsndfile', 'libsamplerate', 'fftw']
deps = [#'gtk3',
'libyaml', 'libsndfile', 'libsamplerate', 'fftw']
deps += ['atk', 'cairo', 'fribidi', 'freetype', 'libjpeg-turbo', 'glib', 'gdk-pixbuf', 'libepoxy', 'libpng', 'pango', 'proxy-libintl', 'tiff', 'zlib' ]
meson_options = {'manpage': 'false', }

Loading…
Cancel
Save