From 66ccc91944a417e0b2d12d269d29550c07a80e29 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 22 Apr 2021 15:32:09 +0900 Subject: [PATCH 01/53] glib: Fix Visual Studio 2019 build error Apply upstream commit https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1428 Part-of: --- recipes/glib.recipe | 2 + ...rn-to-the-dllexport-version-of-GLIB_.patch | 46 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 recipes/glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch diff --git a/recipes/glib.recipe b/recipes/glib.recipe index e9bc0dbd5..6e85dfa54 100644 --- a/recipes/glib.recipe +++ b/recipes/glib.recipe @@ -58,6 +58,8 @@ class Recipe(recipe.Recipe): 'glib/0001-gioerror-Map-WSAENETRESET-on-Windows-to-G_IO_ERROR_C.patch', # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1836 'glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch', + # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1428 + 'glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch', ] files_libs = [ diff --git a/recipes/glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch b/recipes/glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch new file mode 100644 index 000000000..0a7d57714 --- /dev/null +++ b/recipes/glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch @@ -0,0 +1,46 @@ +From fdfadfc27604b58886d7a33cf5f78bb0617733e6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Storsj=C3=B6?= +Date: Tue, 31 Mar 2020 23:15:23 +0300 +Subject: [PATCH] Add missing 'extern' to the dllexport version of + GLIB_VAR/GOBJECT_VAR + +The __declspec(dllexport) attribute in itself doesn't imply +'extern' - thus any intended variable declaration with +GLIB_VAR/GOBJECT_VAR would actually be a variable definition. With +C compilers defaulting to -fcommon, this isn't an issue, but +upcoming compilers (GCC 10 and Clang 11) will default to -fno-common, +ending up with duplicate definitions of these variables. +--- + glib/gtypes.h | 2 +- + gobject/gparamspecs.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/glib/gtypes.h b/glib/gtypes.h +index df65836a0..23c5a1295 100644 +--- a/glib/gtypes.h ++++ b/glib/gtypes.h +@@ -565,7 +565,7 @@ G_END_DECLS + # else /* !GLIB_STATIC_COMPILATION */ + # ifdef GLIB_COMPILATION + # ifdef DLL_EXPORT +-# define GLIB_VAR __declspec(dllexport) ++# define GLIB_VAR extern __declspec(dllexport) + # else /* !DLL_EXPORT */ + # define GLIB_VAR extern + # endif /* !DLL_EXPORT */ +diff --git a/gobject/gparamspecs.h b/gobject/gparamspecs.h +index 0309f9bb3..d0e4d5953 100644 +--- a/gobject/gparamspecs.h ++++ b/gobject/gparamspecs.h +@@ -1150,7 +1150,7 @@ GParamSpec* g_param_spec_variant (const gchar *name, + # else /* !GOBJECT_STATIC_COMPILATION */ + # ifdef GOBJECT_COMPILATION + # ifdef DLL_EXPORT +-# define GOBJECT_VAR __declspec(dllexport) ++# define GOBJECT_VAR extern __declspec(dllexport) + # else /* !DLL_EXPORT */ + # define GOBJECT_VAR extern + # endif /* !DLL_EXPORT */ +-- +2.25.1 + From d872ccfd1c542eb45e6efdd0090607644bfed7a3 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 22 Apr 2021 15:36:36 +0900 Subject: [PATCH 02/53] glib: Add workaround for Visual Studio 2019 ARM build See https://developercommunity.visualstudio.com/t/vs2019-1662-c2039-wait-for-is-not-a-member-of-winr/1080777 Part-of: --- recipes/glib.recipe | 2 + ...ound-for-Visual-Studio-2019-ARM-buil.patch | 43 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 recipes/glib/uwp/0001-meson-Add-workaround-for-Visual-Studio-2019-ARM-buil.patch diff --git a/recipes/glib.recipe b/recipes/glib.recipe index 6e85dfa54..8f86494b8 100644 --- a/recipes/glib.recipe +++ b/recipes/glib.recipe @@ -176,6 +176,8 @@ class Recipe(recipe.Recipe): 'glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch', 'glib/uwp/0019-TODO-gdbus-Completely-disable-when-building-for-WinR.patch', 'glib/uwp/0022-TODO-gio-gcontenttype-Needs-porting-to-WinRT-model.patch', + # Visual Studio 2019 workaround + 'glib/uwp/0001-meson-Add-workaround-for-Visual-Studio-2019-ARM-buil.patch', ] elif self.config.target_platform in [Platform.DARWIN, Platform.IOS]: self.files_devel.append(os.path.join('lib', 'glib-2.0', 'include', '*', 'glibconfig.h')) diff --git a/recipes/glib/uwp/0001-meson-Add-workaround-for-Visual-Studio-2019-ARM-buil.patch b/recipes/glib/uwp/0001-meson-Add-workaround-for-Visual-Studio-2019-ARM-buil.patch new file mode 100644 index 000000000..f70dfb0f8 --- /dev/null +++ b/recipes/glib/uwp/0001-meson-Add-workaround-for-Visual-Studio-2019-ARM-buil.patch @@ -0,0 +1,43 @@ +From 322c2534ffc8aaf8a28aebaccac00bbdc3d13201 Mon Sep 17 00:00:00 2001 +From: Seungha Yang +Date: Thu, 22 Apr 2021 15:11:34 +0900 +Subject: [PATCH] meson: Add workaround for Visual Studio 2019 ARM build + +See https://developercommunity.visualstudio.com/t/vs2019-1662-c2039-wait-for-is-not-a-member-of-winr/1080777 +--- + glib/meson.build | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/glib/meson.build b/glib/meson.build +index 914089c..d93e745 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -306,6 +306,7 @@ else + glib_sources += 'gmain.c' + endif + ++extra_cpp_args = [] + if host_system == 'windows' + glib_win_rc = configure_file( + input: 'glib.rc.in', +@@ -317,6 +318,9 @@ if host_system == 'windows' + glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c') + if glib_conf.has('G_WINAPI_ONLY_APP') + glib_sources += files('gutils-winrt.cpp') ++ # Visual Studio 2019 ++ # https://developercommunity.visualstudio.com/t/vs2019-1662-c2039-wait-for-is-not-a-member-of-winr/1080777 ++ extra_cpp_args += ['/Zc:twoPhase-'] + endif + platform_deps = [winsock2, cc.find_library('winmm')] + if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' +@@ -369,6 +373,7 @@ libglib = library('glib-2.0', + include_directories : configinc, + dependencies : pcre_deps + [thread_dep, libintl, librt] + libiconv + platform_deps + gnulib_libm_dependency, + c_args : glib_c_args, ++ cpp_args : glib_c_args + extra_cpp_args, + objc_args : glib_c_args, + ) + +-- +2.25.1 + From 79c819cd445e993800f71b1d015a45bc8fe610d7 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 8 Jul 2021 18:37:06 +0900 Subject: [PATCH 03/53] glib: Fix hang on Windows when G_SLICE env is configured Apply upstream fix https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1698 Part-of: --- recipes/glib.recipe | 2 + ...n32-implementation-of-g_getenv-to-av.patch | 89 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 recipes/glib/0001-gslice-Inline-win32-implementation-of-g_getenv-to-av.patch diff --git a/recipes/glib.recipe b/recipes/glib.recipe index 8f86494b8..e6f3a2d50 100644 --- a/recipes/glib.recipe +++ b/recipes/glib.recipe @@ -60,6 +60,8 @@ class Recipe(recipe.Recipe): 'glib/0001-Windows-fix-FD_READ-condition-flag-still-set-on-reco.patch', # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1428 'glib/0001-Add-missing-extern-to-the-dllexport-version-of-GLIB_.patch', + # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1698 + 'glib/0001-gslice-Inline-win32-implementation-of-g_getenv-to-av.patch', ] files_libs = [ diff --git a/recipes/glib/0001-gslice-Inline-win32-implementation-of-g_getenv-to-av.patch b/recipes/glib/0001-gslice-Inline-win32-implementation-of-g_getenv-to-av.patch new file mode 100644 index 000000000..c4920a874 --- /dev/null +++ b/recipes/glib/0001-gslice-Inline-win32-implementation-of-g_getenv-to-av.patch @@ -0,0 +1,89 @@ +From b538cb0c8c829ba76d4a04be0c198e5d3b7c311c Mon Sep 17 00:00:00 2001 +From: Philip Withnall +Date: Thu, 15 Oct 2020 10:20:10 +0100 +Subject: [PATCH] gslice: Inline win32 implementation of g_getenv() to avoid + deadlock + +The win32 implementation of `g_getenv()` uses GSlice (from within +GQuark), which results in a deadlock when examining the `G_SLICE` +environment variable. + +Fix that by inlining a basic implementation of `g_getenv()` at that call +site. + +Signed-off-by: Philip Withnall + +Fixes: #2225 +--- + glib/gslice.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 44 insertions(+) + +diff --git a/glib/gslice.c b/glib/gslice.c +index e6f278539..589619080 100644 +--- a/glib/gslice.c ++++ b/glib/gslice.c +@@ -361,10 +361,52 @@ static void + slice_config_init (SliceConfig *config) + { + const gchar *val; ++ gchar *val_allocated = NULL; + + *config = slice_config; + ++ /* Note that the empty string (`G_SLICE=""`) is treated differently from the ++ * envvar being unset. In the latter case, we also check whether running under ++ * valgrind. */ ++#ifndef G_OS_WIN32 + val = g_getenv ("G_SLICE"); ++#else ++ /* The win32 implementation of g_getenv() has to do UTF-8 ↔ UTF-16 conversions ++ * which use the slice allocator, leading to deadlock. Use a simple in-place ++ * implementation here instead. ++ * ++ * Ignore references to other environment variables: only support values which ++ * are a combination of always-malloc and debug-blocks. */ ++ { ++ ++ wchar_t wvalue[128]; /* at least big enough for `always-malloc,debug-blocks` */ ++ int len; ++ ++ len = GetEnvironmentVariableW (L"G_SLICE", wvalue, G_N_ELEMENTS (wvalue)); ++ ++ if (len == 0) ++ { ++ if (GetLastError () == ERROR_ENVVAR_NOT_FOUND) ++ val = NULL; ++ else ++ val = ""; ++ } ++ else if (len >= G_N_ELEMENTS (wvalue)) ++ { ++ /* @wvalue isn’t big enough. Give up. */ ++ g_warning ("Unsupported G_SLICE value"); ++ val = NULL; ++ } ++ else ++ { ++ /* it’s safe to use g_utf16_to_utf8() here as it only allocates using ++ * malloc() rather than GSlice */ ++ val = val_allocated = g_utf16_to_utf8 (wvalue, -1, NULL, NULL, NULL); ++ } ++ ++ } ++#endif /* G_OS_WIN32 */ ++ + if (val != NULL) + { + gint flags; +@@ -392,6 +434,8 @@ slice_config_init (SliceConfig *config) + config->always_malloc = TRUE; + #endif + } ++ ++ g_free (val_allocated); + } + + static void +-- +2.25.1 + From 5d4184924ef27bb2d37a1e6e54a041a057ae70fc Mon Sep 17 00:00:00 2001 From: YoungSoo Lee Date: Fri, 2 Jul 2021 20:48:28 +0900 Subject: [PATCH 04/53] bootstrap: fix build_tools error If `setuptools.version` contains a string, an error occurs. So, it was modified to extract only semver from `version`. Part-of: --- cerbero/bootstrap/build_tools.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py index 6f5c8095f..271b2407a 100644 --- a/cerbero/bootstrap/build_tools.py +++ b/cerbero/bootstrap/build_tools.py @@ -100,8 +100,8 @@ def insert_python_site(self): except ImportError: return - version = [int(v) for v in stv.__version__.split('.')] - if len(version) < 1 or version[:1] < [49]: + version = stv.__version__.split('.', 1) + if len(version) < 1 or int(version[0]) < 49: return m.warning('detected setuptools >= 49.0.0, installing fallback site.py file. ' From 84fea3fdff10dbc6cdfcf5bcd1cc16dba14258f7 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 13 Jul 2021 13:06:27 +1000 Subject: [PATCH 05/53] config/ios: put iphone sdk version minimum into CPPFLAGS This may be important for anything produced by the C Preprocesser Part-of: --- config/ios.config | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/config/ios.config b/config/ios.config index cddbdcf15..e1a3ce117 100644 --- a/config/ios.config +++ b/config/ios.config @@ -117,15 +117,17 @@ env['NM']= 'nm' env['NMEDIT']= 'nmedit' env['RANLIB']= 'ranlib' env['CPPFLAGS'] = '{} -isysroot {} -isystem {} '.format(arch_cflags, sysroot, includedir) +if ios_platform == 'iPhoneOS': + env['CPPFLAGS'] += '-miphoneos-version-min={} '.format(ios_min_version) +else: + env['CPPFLAGS'] += '-mios-simulator-version-min={} '.format(ios_min_version) env['CFLAGS'] = env['CPPFLAGS'] env['LDFLAGS'] = env['CPPFLAGS'] + ' -L{} '.format(lib_dir) if ios_platform == 'iPhoneOS': - env['CFLAGS'] += '-miphoneos-version-min={} '.format(ios_min_version) - env['LDFLAGS'] += '-miphoneos-version-min={0} -Wl,-iphoneos_version_min,{0} '.format(ios_min_version) + env['LDFLAGS'] += '-Wl,-iphoneos_version_min,{0} '.format(ios_min_version) env['CCASFLAGS'] = '-miphoneos-version-min={} '.format(ios_min_version) else: - env['CFLAGS'] += '-mios-simulator-version-min={} '.format(ios_min_version) - env['LDFLAGS'] += '-mios-simulator-version-min={0} -Wl,-ios_simulator_version_min,{0} '.format(ios_min_version) + env['LDFLAGS'] += '-Wl,-ios_simulator_version_min,{0} '.format(ios_min_version) env['CFLAGS'] += extra_cflags env['LDFLAGS'] += extra_ldflags env['OBJCFLAGS'] = env['CFLAGS'] From 162724eb9b02b0cc4c8149cdfdf216533847916c Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Tue, 13 Jul 2021 13:07:28 +1000 Subject: [PATCH 06/53] ffmpeg: actually use gas-preprocessor on ios Also pass the necessary flags for iphone minimum target version selection so that object files are built for the correct version. This may be important if some newer code/functionality cannot be used on older devices due to hardware or software limitations. Part-of: --- recipes/ffmpeg.recipe | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/ffmpeg.recipe b/recipes/ffmpeg.recipe index 0e80cbac5..0c290098c 100644 --- a/recipes/ffmpeg.recipe +++ b/recipes/ffmpeg.recipe @@ -12,7 +12,7 @@ class Recipe(recipe.Recipe): btype = BuildType.MAKEFILE configure_tpl = './configure --prefix=%(prefix)s --libdir=%(libdir)s \ - --ar="$AR" --as="$CC" --cc="$CC" --ld="$CC" --nm="$NM" --ranlib="$RANLIB" \ + --ar="$AR" --as="$AS" --cc="$CC" --ld="$CC" --nm="$NM" --ranlib="$RANLIB" \ --strip="$STRIP" --windres="$RC" \ --enable-static --enable-pic --enable-shared \ --disable-avdevice --disable-postproc --disable-swscale \ @@ -49,6 +49,7 @@ class Recipe(recipe.Recipe): gas = self.get_env('GAS') if gas: self.set_env('AS', gas) + self.set_env('ASFLAGS', self.get_env('CPPFLAGS')) else: cc = self.get_env('CC') if cc: From 98adb45c1db2688eca25ecb7c7f8b3f1e64d4b30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Le=20Page?= Date: Fri, 9 Jul 2021 12:00:17 +0200 Subject: [PATCH 07/53] Add Linux mint platforms based on Ubuntu Focal Part-of: --- cerbero/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index 54398ac87..e8a6a46ea 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -247,7 +247,7 @@ def system_info(): distro_version = DistroVersion.UBUNTU_DISCO elif distro_version in ['eoan']: distro_version = DistroVersion.UBUNTU_EOAN - elif distro_version in ['focal', 'ulyana']: + elif distro_version in ['focal'] or (distro_version[0] == 'u' and d[1].startswith('20.')): distro_version = DistroVersion.UBUNTU_FOCAL elif d[1].startswith('6.'): distro_version = DistroVersion.DEBIAN_SQUEEZE From 98c9296bdcd606f513ac940c8ae464313bb40a8b Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 14 Jul 2021 16:10:34 +0530 Subject: [PATCH 08/53] gobject-introspection: Backport patch for Python 3.9 compat Needed on Fedora 34. Part-of: --- recipes/gobject-introspection.recipe | 3 + ...xml.etree.ElementTree.Element.getchi.patch | 71 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 recipes/gobject-introspection/0001-Drop-deprecated-xml.etree.ElementTree.Element.getchi.patch diff --git a/recipes/gobject-introspection.recipe b/recipes/gobject-introspection.recipe index c3e6cc2b4..84426255d 100644 --- a/recipes/gobject-introspection.recipe +++ b/recipes/gobject-introspection.recipe @@ -21,6 +21,9 @@ class Recipe(recipe.Recipe): # Taken from upstream, remove on bump # https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/38 name + '/0003-giscanner-Fix-shared-library-name-with-Meson-on-macO.patch', + # Taken from upstream, remove on bump + # https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/194 + name + '/0001-Drop-deprecated-xml.etree.ElementTree.Element.getchi.patch', ] files_bins = ['g-ir-annotation-tool', 'g-ir-compiler', 'g-ir-doc-tool', 'g-ir-generate', 'g-ir-scanner'] diff --git a/recipes/gobject-introspection/0001-Drop-deprecated-xml.etree.ElementTree.Element.getchi.patch b/recipes/gobject-introspection/0001-Drop-deprecated-xml.etree.ElementTree.Element.getchi.patch new file mode 100644 index 000000000..dc14fb805 --- /dev/null +++ b/recipes/gobject-introspection/0001-Drop-deprecated-xml.etree.ElementTree.Element.getchi.patch @@ -0,0 +1,71 @@ +From 1f9284228092b2a7200e8a78bc0ea6702231c6db Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= +Date: Mon, 6 Jan 2020 14:05:03 +0100 +Subject: [PATCH] Drop deprecated xml.etree.ElementTree.Element.getchildren() + calls + +The XML elements are implicitly iterable in all Python versions including +at least 2.7 and 3.2+. + +The .getchildren() method is deprecated since 2.7 and 3.2, removed in 3.9. + +Fixes https://gitlab.gnome.org/GNOME/gobject-introspection/issues/325 +--- + giscanner/girparser.py | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/giscanner/girparser.py b/giscanner/girparser.py +index 7687c35c..0a6c687b 100644 +--- a/giscanner/girparser.py ++++ b/giscanner/girparser.py +@@ -75,17 +75,17 @@ class GIRParser(object): + + def _find_first_child(self, node, name_or_names): + if isinstance(name_or_names, str): +- for child in node.getchildren(): ++ for child in node: + if child.tag == name_or_names: + return child + else: +- for child in node.getchildren(): ++ for child in node: + if child.tag in name_or_names: + return child + return None + + def _find_children(self, node, name): +- return [child for child in node.getchildren() if child.tag == name] ++ return [child for child in node if child.tag == name] + + def _get_current_file(self): + if not self._filename_stack: +@@ -103,7 +103,7 @@ class GIRParser(object): + raise SystemExit("%s: Incompatible version %s (supported: %s)" % + (self._get_current_file(), version, COMPATIBLE_GIR_VERSION)) + +- for node in root.getchildren(): ++ for node in root: + if node.tag == _corens('include'): + self._parse_include(node) + elif node.tag == _corens('package'): +@@ -145,7 +145,7 @@ class GIRParser(object): + parser_methods[_corens('constant')] = self._parse_constant + parser_methods[_corens('function')] = self._parse_function + +- for node in ns.getchildren(): ++ for node in ns: + method = parser_methods.get(node.tag) + if method is not None: + method(node) +@@ -413,7 +413,7 @@ class GIRParser(object): + def _parse_fields(self, node, obj): + res = [] + names = (_corens('field'), _corens('record'), _corens('union'), _corens('callback')) +- for child in node.getchildren(): ++ for child in node: + if child.tag in names: + fieldobj = self._parse_field(child, obj) + res.append(fieldobj) +-- +2.31.1 + From a6d6711eb98341ab51a942c6d5288ff1185b414e Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 14 Jul 2021 16:15:36 +0530 Subject: [PATCH 09/53] srt.recipe: Bump to 1.4.3, fixes build on Fedora 34 Part-of: --- recipes/srt.recipe | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/recipes/srt.recipe b/recipes/srt.recipe index 701c725aa..c359b6138 100644 --- a/recipes/srt.recipe +++ b/recipes/srt.recipe @@ -5,12 +5,13 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'srt' - version = '1.4.2' + version = '1.4.3' url = 'https://github.com/Haivision/srt/archive/v%(version)s.tar.gz' - tarball_checksum = '28a308e72dcbb50eb2f61b50cc4c393c413300333788f3a8159643536684a0c4' + tarball_checksum = 'c06e05664c71d635c37207a2b5a444f2c4a95950a3548402b3e0c524f735b33d' licenses = [License.MPLv2] stype = SourceType.TARBALL btype = BuildType.CMAKE + # CXX11 builds stuff we don't need, and causes a build failure on mingw configure_options = '-DUSE_ENCLIB=openssl -DENABLE_CXX11=OFF' # openssl on Linux use_system_libs = True From 4383951b654f7873d128a358be000643d824feb6 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 14 Jul 2021 17:44:36 +0530 Subject: [PATCH 10/53] meson: Bump to 0.58.1 Part-of: --- recipes/build-tools/meson.recipe | 11 +++-- ...ass-absolute-L-paths-to-g-ir-scanner.patch | 45 +++++++++++++++++++ ...ss-compile-without-a-native-compiler.patch | 39 ---------------- 3 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch delete mode 100644 recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch diff --git a/recipes/build-tools/meson.recipe b/recipes/build-tools/meson.recipe index f5c154079..b6c136c24 100644 --- a/recipes/build-tools/meson.recipe +++ b/recipes/build-tools/meson.recipe @@ -5,16 +5,15 @@ from pathlib import PurePath, Path class Recipe(recipe.Recipe): name = 'meson' - version = '0.55.3' + version = '0.58.1' licenses = [License.Apachev2] btype = BuildType.CUSTOM stype = SourceType.TARBALL url = 'https://github.com/mesonbuild/meson/releases/download/%(version)s/meson-%(version)s.tar.gz' - tarball_checksum = '6bed2a25a128bbabe97cf40f63165ebe800e4fcb46db8ab7ef5c2b5789f092a5' - patches = [ - # Remove on bump to 0.56, https://github.com/mesonbuild/meson/pull/7021 - 'meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch', - ] + tarball_checksum = '3144a3da662fcf79f1e5602fa929f2821cba4eba28c2c923fe0a7d3e3db04d5d' + + # https://github.com/mesonbuild/meson/pull/8993 + patches = [name + '/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch'] deps = ['ninja'] diff --git a/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch b/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch new file mode 100644 index 000000000..a1697af6c --- /dev/null +++ b/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch @@ -0,0 +1,45 @@ +From 7747a4bb8867aa87dff82584289495a52c3b38c4 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Wed, 14 Jul 2021 17:37:39 +0530 +Subject: [PATCH] gnome: Always pass absolute -L paths to g-ir-scanner + +g-ir-scanner does not convert relative -L paths to runtime paths which +are added to -Wl,-rpath and LD_LIBRARY_PATH / DYLD_LIBRARY_PATH +/ PATH. This means that the local library will either not be found at +runtime (while building introspection data), or the system-wide +library will be picked instead. + +See: giscanner/ccompiler.py:get_internal_link_flags() in +gobject-introspection for more details. +--- + mesonbuild/modules/gnome.py | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py +index 1b68f6ccd..3cc8ebdc8 100644 +--- a/mesonbuild/modules/gnome.py ++++ b/mesonbuild/modules/gnome.py +@@ -640,14 +640,18 @@ class GnomeModule(ExtensionModule): + # Because of https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/72 + # we can't use the full path until this is merged. + libpath = os.path.join(girtarget.get_subdir(), girtarget.get_filename()) ++ # Must use absolute paths here because g-ir-scanner will not ++ # add them to the runtime path list if they're relative. This ++ # means we cannot use @BUILD_ROOT@ ++ build_root = state.environment.get_build_dir() + if isinstance(girtarget, build.SharedLibrary): + # need to put our output directory first as we need to use the + # generated libraries instead of any possibly installed system/prefix + # ones. +- ret += ["-L@BUILD_ROOT@/{}".format(os.path.dirname(libpath))] ++ ret += ["-L{}/{}".format(build_root, os.path.dirname(libpath))] + libname = girtarget.get_basename() + else: +- libname = os.path.join(f"@BUILD_ROOT@/{libpath}") ++ libname = os.path.join(f"{build_root}/{libpath}") + ret += ['--library', libname] + # Needed for the following binutils bug: + # https://github.com/mesonbuild/meson/issues/1911 +-- +2.31.1 + diff --git a/recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch b/recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch deleted file mode 100644 index 584fc0975..000000000 --- a/recipes/build-tools/meson/0001-meson-Allow-cross-compile-without-a-native-compiler.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a6aa905f2c580a34e6bb1c547b20ec6ecd4011d0 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 23 Apr 2020 08:32:15 +0530 -Subject: Allow cross-compile without a native compiler - ---- - mesonbuild/backend/ninjabackend.py | 2 +- - mesonbuild/interpreter.py | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py -index 03ccd196..aeffc80a 100644 ---- a/mesonbuild/backend/ninjabackend.py -+++ b/mesonbuild/backend/ninjabackend.py -@@ -1539,7 +1539,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 214b1eb5..c8473cb6 100644 ---- a/mesonbuild/interpreter.py -+++ b/mesonbuild/interpreter.py -@@ -2954,7 +2954,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 - From bd71f936b98fa0017cb8bcb64630566c9b2086d6 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 14 Jul 2021 19:08:45 +0530 Subject: [PATCH 11/53] glib-networking: Update options and backport c_std=c99 C11 is only supported by very recent MSVC versions, and glib-networking doesn't even use C11. Part-of: --- recipes/glib-networking.recipe | 7 +++-- .../0001-meson-use-c-std-c99.patch | 27 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 recipes/glib-networking/0001-meson-use-c-std-c99.patch diff --git a/recipes/glib-networking.recipe b/recipes/glib-networking.recipe index 167ab839b..4f3e3fb44 100644 --- a/recipes/glib-networking.recipe +++ b/recipes/glib-networking.recipe @@ -11,8 +11,11 @@ class Recipe(recipe.Recipe): btype = BuildType.MESON url = 'gnome://' tarball_checksum = '8ca1f86f23a76b5c7640624f7d5490705c78e81375e1741c9a1c41ce7f8f7ff7' - meson_options = {'ca_certificates_path': '', 'libproxy_support': 'false', - 'gnome_proxy_support': 'false', 'pkcs11_support': 'false', + + # Taken from upstream remove on bump + patches = [name + '/0001-meson-use-c-std-c99.patch'] + + meson_options = {'libproxy': 'disabled', 'gnome_proxy': 'disabled', 'gnutls': 'disabled', 'openssl': 'enabled', # Also build static modules on all platforms 'static_modules': 'true'} diff --git a/recipes/glib-networking/0001-meson-use-c-std-c99.patch b/recipes/glib-networking/0001-meson-use-c-std-c99.patch new file mode 100644 index 000000000..5206f3f55 --- /dev/null +++ b/recipes/glib-networking/0001-meson-use-c-std-c99.patch @@ -0,0 +1,27 @@ +From e4e1a00e2dc4ca94301750ccbc6f605906e2a85e Mon Sep 17 00:00:00 2001 +From: Ignacio Casal Quinteiro +Date: Thu, 26 Sep 2019 16:12:05 +0200 +Subject: [PATCH] meson: use c std c99 + +c11 is not supported on centos 6 nor on Visual Studio which +does not even fully supports c99 +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index d07d7fa..eac24fd 100644 +--- a/meson.build ++++ b/meson.build +@@ -3,7 +3,7 @@ project( + version: '2.62.3', + license: 'LGPL2.1+', + meson_version: '>= 0.50.0', +- default_options: ['c_std=c11'] ++ default_options: ['c_std=c99'] + ) + + prefix = get_option('prefix') +-- +2.31.1.windows.1 + From c7138965a2501297576b3fe75c289ab9a691d924 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Thu, 15 Jul 2021 17:33:44 +1000 Subject: [PATCH 12/53] moltenvk: update to 1.2.182.0 Part-of: --- recipes/build-tools/moltenvk-tools.recipe | 15 ++++++++++++--- recipes/moltenvk.recipe | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/recipes/build-tools/moltenvk-tools.recipe b/recipes/build-tools/moltenvk-tools.recipe index 4df8063da..0acb14550 100644 --- a/recipes/build-tools/moltenvk-tools.recipe +++ b/recipes/build-tools/moltenvk-tools.recipe @@ -4,14 +4,14 @@ from cerbero.utils import shell class Recipe(recipe.Recipe): name = 'moltenvk-tools' - version = '1.2.162.1' + version = '1.2.182.0' licenses = [License.Apachev2] stype = SourceType.TARBALL tarball_dirname = "vulkansdk-macos-%(version)s" # Mirrored because lunarg.com has an extremely small download limit #url = 'https://sdk.lunarg.com/sdk/download/%(version)s/mac/' + tarball_dirname + '.dmg' url = 'https://gstreamer.freedesktop.org/data/src/mirror/' + tarball_dirname + '.dmg' - tarball_checksum = '2781c334997598c2828d8a3368aef7b7c94a25204c90d5503396e40c7a03fd5c' + tarball_checksum = '9e89291283e41d62673bf48007dac764e99a504d145ee4d70d2d32e328f7ee40' btype = BuildType.CUSTOM files_bins = [ @@ -43,7 +43,16 @@ class Recipe(recipe.Recipe): if os.path.exists(srcdir): shutil.rmtree(srcdir) - shell.copy_dir(self.build_dir, srcdir) + # https://vulkan.lunarg.com/doc/sdk/1.2.182.0/mac/getting_started.html + vulkan_installer = os.path.join(self.build_dir, 'InstallVulkan.app/Contents/MacOS/InstallVulkan') + await shell.async_call([vulkan_installer, + '--root', self.config.moltenvk_prefix, + '--accept-licenses', + '--default-answer', + '--confirm-command', + 'install', + 'copy_only=1'], + env=self.env, logfile=self.logfile) for bin in self.files_bins: shutil.copy(os.path.join(srcdir, 'macOS', 'bin', bin), os.path.join(prefix, 'bin', bin)) diff --git a/recipes/moltenvk.recipe b/recipes/moltenvk.recipe index fb96cfe02..d08e0ea2a 100644 --- a/recipes/moltenvk.recipe +++ b/recipes/moltenvk.recipe @@ -6,7 +6,7 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'moltenvk' - version = '1.2.162.1' + version = '1.2.182.0' licenses = [License.Apachev2] stype = SourceType.CUSTOM btype = BuildType.CUSTOM From edf59ba1fa377ddabfe175361294498f790d56cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 20 Jul 2021 12:36:07 +0100 Subject: [PATCH 13/53] freetype: update to 2.11.0 Part-of: --- recipes/freetype.recipe | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes/freetype.recipe b/recipes/freetype.recipe index ca667c3a2..66ba36be0 100644 --- a/recipes/freetype.recipe +++ b/recipes/freetype.recipe @@ -3,11 +3,11 @@ class Recipe(recipe.Recipe): name = 'freetype' - version = '2.10.4' + version = '2.11.0' stype = SourceType.TARBALL url = 'savannah://.tar.xz' - tarball_checksum = '86a854d8905b19698bbc8f23b860bc104246ce4854dcea8e3b0fb21284f75784' - licenses = [{License.FreeType: ['docs/LICENSE.TXT']}, License.GPLv2Plus] + tarball_checksum = '8bee39bd3968c4804b70614a0a3ad597299ad0e824bc8aad5ce8aaf48067bde7' + licenses = [{License.FreeType: ['LICENSE.TXT']}, License.GPLv2Plus] configure_tpl = "%(config-sh)s --prefix=%(prefix)s --libdir=%(libdir)s --with-harfbuzz=no" deps = ['zlib', 'bzip2', 'libpng'] From 90f0fdea4565b0f81f88f8b872439027ac7f6ee9 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 22 Jul 2021 19:17:11 +0530 Subject: [PATCH 14/53] openssl.recipe: Bump to 1.1.1k Part-of: --- recipes/openssl.recipe | 6 ++-- ...1-Add-darwin64-arm64-cc-build-target.patch | 34 ------------------- 2 files changed, 2 insertions(+), 38 deletions(-) delete mode 100644 recipes/openssl/0001-Add-darwin64-arm64-cc-build-target.patch diff --git a/recipes/openssl.recipe b/recipes/openssl.recipe index dd1827c27..db3d68e86 100644 --- a/recipes/openssl.recipe +++ b/recipes/openssl.recipe @@ -8,11 +8,11 @@ class Recipe(recipe.Recipe): # Note: openssl helpfully moves tarballs somewhere else (old/x.y.z/) # whenever a new release comes out, so make sure to mirror to fdo when # bumping the release! - version = '1.1.1h' + version = '1.1.1k' licenses = [{License.OPENSSL: ['LICENSE']}] stype = SourceType.TARBALL url = 'https://ftp.openssl.org/source/{0}-{1}.tar.gz'.format(name, version) - tarball_checksum = '5c9ca8774bd7b03e5784f26ae9e9e6d749c9da2438545077e6b3d755a06595d9' + tarball_checksum = '892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5' deps = ['ca-certificates', 'zlib'] # Parallel make fails randomly due to undefined macros, probably races allow_parallel_build = False @@ -31,8 +31,6 @@ class Recipe(recipe.Recipe): # https://github.com/openssl/openssl/pull/12400 'openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch', 'openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch', - # https://github.com/openssl/openssl/pull/13476 '1.1.1i' - 'openssl/0001-Add-darwin64-arm64-cc-build-target.patch', ] files_bins = ['openssl'] diff --git a/recipes/openssl/0001-Add-darwin64-arm64-cc-build-target.patch b/recipes/openssl/0001-Add-darwin64-arm64-cc-build-target.patch deleted file mode 100644 index 697bf6010..000000000 --- a/recipes/openssl/0001-Add-darwin64-arm64-cc-build-target.patch +++ /dev/null @@ -1,34 +0,0 @@ -From c3ff8d3f7281d613b392e6b8574da5b7cd7275b6 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Felix=20Bu=CC=88nemann?= -Date: Sun, 22 Nov 2020 23:06:06 +0100 -Subject: [PATCH] Add darwin64-arm64-cc build target - -This adds support for the Apple Silicon M1 hardware on macOS Big Sur. - -CLA: trivial ---- - Configurations/10-main.conf | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf -index eb92c24..cea4feb 100644 ---- a/Configurations/10-main.conf -+++ b/Configurations/10-main.conf -@@ -1557,6 +1557,14 @@ my %targets = ( - bn_ops => "SIXTY_FOUR_BIT_LONG", - perlasm_scheme => "macosx", - }, -+ "darwin64-arm64-cc" => { -+ inherit_from => [ "darwin-common", asm("aarch64_asm") ], -+ CFLAGS => add("-Wall"), -+ cflags => add("-arch arm64"), -+ lib_cppflags => add("-DL_ENDIAN"), -+ bn_ops => "SIXTY_FOUR_BIT_LONG", -+ perlasm_scheme => "ios64", -+ }, - - ##### GNU Hurd - "hurd-x86" => { --- -2.23.0 - From 0217c0b6793ff1430e261938d2764916b3b6d019 Mon Sep 17 00:00:00 2001 From: Steve McDaniel Date: Sat, 7 Aug 2021 22:44:26 -0400 Subject: [PATCH 15/53] Removed dash in wildcard selection of libunwind*.pc files. Extra dash prevents libunwind.pc from getting included in files_devel. Part-of: --- recipes/libunwind.recipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/libunwind.recipe b/recipes/libunwind.recipe index d6478f2e0..99ee3b8f1 100644 --- a/recipes/libunwind.recipe +++ b/recipes/libunwind.recipe @@ -14,4 +14,4 @@ class Recipe(recipe.Recipe): files_libs = ['libunwind'] files_devel = ['include/libunwind-*.h', 'include/unwind.h', - 'lib/pkgconfig/libunwind-*.pc'] + 'lib/pkgconfig/libunwind*.pc'] From 35c69db6555c0d797a76d6f64fc69b4021aa6f43 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 17 Aug 2021 15:58:41 +0530 Subject: [PATCH 16/53] cerbero: Add a dotted progress bar for urllib downloads Also add a 20s timeout (same as wget) so that we timeout on download instead of timing out the entire job on CI. The global socket timeout with CPython is apparently -1, aka never timeout. Part-of: --- cerbero/utils/shell.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 166fc2ba6..3682e2148 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -382,6 +382,8 @@ async def download_urllib2(url, destination=None, check_cert=True, overwrite=Fal @param destination: destination where the file will be saved @type destination: str ''' + # 1MiB chunk size (same as dot:giga for wget) + chunk_size = 1024 * 1024 ctx = None if not check_cert: import ssl @@ -392,12 +394,25 @@ async def download_urllib2(url, destination=None, check_cert=True, overwrite=Fal if not destination: destination = os.path.basename(url) + from datetime import datetime + start_time = datetime.now() + try: with open(destination, 'wb') as d: req = urllib.request.Request(url) req.add_header('User-Agent', USER_AGENT) - f = urllib.request.urlopen(req, context=ctx) - d.write(f.read()) + f = urllib.request.urlopen(req, timeout=20, context=ctx) + while True: + chunk = f.read(chunk_size) + if not chunk: + break + d.write(chunk) + print('.', end='', file=logfile, flush=True) + total_time = (datetime.now() - start_time).total_seconds() + size = d.tell() / 1024 + speed = size / total_time + print('\nDownloaded {:2,.2f} KiB in {:2,.2f} seconds at {:2,.2f} KiB/s' + .format(size, total_time, speed), file=logfile, flush=True) except urllib.error.HTTPError as e: if os.path.exists(destination): os.remove(destination) From 340733337527cd1b97ee1b7c55648d05b18b81e0 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Mon, 6 Sep 2021 22:30:20 +0530 Subject: [PATCH 17/53] ladspa.recipe: Add a comment about mirroring tarballs 1.15 has been mirrored. Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/341 Part-of: --- recipes/ladspa.recipe | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes/ladspa.recipe b/recipes/ladspa.recipe index 4ab9b080f..6672fd047 100644 --- a/recipes/ladspa.recipe +++ b/recipes/ladspa.recipe @@ -7,6 +7,7 @@ class Recipe(recipe.Recipe): licenses = [License.LGPLv2_1Plus] btype = BuildType.CUSTOM stype = SourceType.TARBALL + # Upstream has a bad habit of deleting source tarballs, mirror to fdo on bump url = 'https://www.ladspa.org/download/ladspa_sdk_%(version)s.tgz' tarball_dirname = 'ladspa_sdk_%(version)s' tarball_checksum = '4229959b09d20c88c8c86f4aa76427843011705df22d9c28b38359fd1829fded' From b2e6ce78201e1f176685f82474df954a1925193c Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Mon, 13 Sep 2021 12:12:37 -0400 Subject: [PATCH 18/53] openssl.recipe: upgrade to version 1.1.1l Fixes CVE-2021-3712 and CVE-2021-3711 https://www.openssl.org/news/vulnerabilities-1.1.1.html --- recipes/openssl.recipe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/openssl.recipe b/recipes/openssl.recipe index db3d68e86..8d07bbbf8 100644 --- a/recipes/openssl.recipe +++ b/recipes/openssl.recipe @@ -8,11 +8,11 @@ class Recipe(recipe.Recipe): # Note: openssl helpfully moves tarballs somewhere else (old/x.y.z/) # whenever a new release comes out, so make sure to mirror to fdo when # bumping the release! - version = '1.1.1k' + version = '1.1.1l' licenses = [{License.OPENSSL: ['LICENSE']}] stype = SourceType.TARBALL url = 'https://ftp.openssl.org/source/{0}-{1}.tar.gz'.format(name, version) - tarball_checksum = '892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5' + tarball_checksum = '0b7a3e5e59c34827fe0c3a74b7ec8baef302b98fa80088d7f9153aa16fa76bd1' deps = ['ca-certificates', 'zlib'] # Parallel make fails randomly due to undefined macros, probably races allow_parallel_build = False From bb026718461f6bd4709c1273887134f1eb016c9d Mon Sep 17 00:00:00 2001 From: Aaron Boxer Date: Mon, 13 Sep 2021 12:32:47 -0400 Subject: [PATCH 19/53] bzip2.recipe: bump version to 1.0.8 Fixes CVE-2016-3189 https://www.cvedetails.com/vulnerability-list.php?vendor_id=1198&product_id=2068&version_id=557742&page=1&hasexp=0&opdos=0&opec=0&opov=0&opcsrf=0&opgpriv=0&opsqli=0&opxss=0&opdirt=0&opmemc=0&ophttprs=0&opbyp=0&opfileinc=0&opginf=0&cvssscoremin=0&cvssscoremax=0&year=0&cweid=0&order=1&trc=1&sha=363d5eb84c8304b76236c97638b372af6fff33ce Part-of: --- recipes/bzip2.recipe | 8 +- recipes/bzip2/add-meson-build-files.patch | 153 +++++++--------------- 2 files changed, 53 insertions(+), 108 deletions(-) diff --git a/recipes/bzip2.recipe b/recipes/bzip2.recipe index f32f05c8d..3bf0a5ee7 100644 --- a/recipes/bzip2.recipe +++ b/recipes/bzip2.recipe @@ -3,14 +3,12 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'bzip2' - version = '1.0.6' + version = '1.0.8' licenses = [{License.BSD_like: ['LICENSE']}] stype = SourceType.TARBALL btype = BuildType.MESON - # bzip2.org is dead - #url = 'https://bzip.org/%(version)s/bzip2-%(version)s.tar.gz' - url = 'https://gstreamer.freedesktop.org/src/mirror/bzip2-%(version)s.tar.gz' - tarball_checksum = 'a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd' + url = 'https://sourceware.org/pub/bzip2/bzip2-%(version)s.tar.gz' + tarball_checksum = 'ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269' patches = [name + '/add-meson-build-files.patch'] diff --git a/recipes/bzip2/add-meson-build-files.patch b/recipes/bzip2/add-meson-build-files.patch index c0605939b..33b78f356 100644 --- a/recipes/bzip2/add-meson-build-files.patch +++ b/recipes/bzip2/add-meson-build-files.patch @@ -1,7 +1,7 @@ -From 6c85a583572229922ff685f353feedbeaeecf0d9 Mon Sep 17 00:00:00 2001 +From 81c4bd656cd6850fc06aabc632b4992b155bcbce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Apr 2016 11:24:29 +0100 -Subject: [PATCH 01/12] bzlib.h: don't use WINAPI and add +Subject: [PATCH 01/11] bzlib.h: don't use WINAPI and add __declspec(dllexport/dllimport) windows.h does #define WINAPI __stdcall but we want @@ -16,7 +16,7 @@ by default, but MSVC doesn't). 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bzlib.h b/bzlib.h -index 8277123..219a94f 100644 +index 8966a6c..bc0df9b 100644 --- a/bzlib.h +++ b/bzlib.h @@ -82,12 +82,12 @@ typedef @@ -37,13 +37,13 @@ index 8277123..219a94f 100644 #else # define BZ_API(func) func -- -2.19.1 +2.30.2 -From 48f1c5863d1f8ec32f682d010dbe772a9d46e0bb Mon Sep 17 00:00:00 2001 +From c5d2e53e33bb7817650fc74fe0d8470da2f3636d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Apr 2016 11:26:43 +0100 -Subject: [PATCH 02/12] meson: add meson build for bz2 +Subject: [PATCH 02/11] meson: add meson build for bz2 --- meson.build | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++++ @@ -134,13 +134,13 @@ index 0000000..7f70507 + +# FIXME: build docs -- -2.19.1 +2.30.2 -From 28dba9f327e19a9cd13a9259a1f59d65b36bd7d8 Mon Sep 17 00:00:00 2001 +From 26effe6e1b5e6649f434c4a044460feb02a04b5b Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 17 Jun 2016 15:55:36 +0530 -Subject: [PATCH 03/12] bzlib.h: Don't need to #include windows.h anymore +Subject: [PATCH 03/11] bzlib.h: Don't need to #include windows.h anymore We no longer use the WINAPI macro --- @@ -148,7 +148,7 @@ We no longer use the WINAPI macro 1 file changed, 5 deletions(-) diff --git a/bzlib.h b/bzlib.h -index 219a94f..955baf4 100644 +index bc0df9b..5fa9eb4 100644 --- a/bzlib.h +++ b/bzlib.h @@ -76,11 +76,6 @@ typedef @@ -164,13 +164,13 @@ index 219a94f..955baf4 100644 # define BZ_API(func) func # define BZ_EXTERN __declspec(dllexport) extern -- -2.19.1 +2.30.2 -From 580d70a187dab25820523e88af26dea67e047fd8 Mon Sep 17 00:00:00 2001 +From d1aaeff5784360310c615196be845f2408a95439 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 17 Jun 2016 15:57:54 +0530 -Subject: [PATCH 04/12] bzlib.h: Don't use dllimport/dllexport when +Subject: [PATCH 04/11] bzlib.h: Don't use dllimport/dllexport when BZ_STATIC_COMPILATION is defined This allows code to see the correct prototypes for linking to the static @@ -182,7 +182,7 @@ fail to find those symbols. 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bzlib.h b/bzlib.h -index 955baf4..acc6bf8 100644 +index 5fa9eb4..536375c 100644 --- a/bzlib.h +++ b/bzlib.h @@ -75,7 +75,8 @@ typedef @@ -196,13 +196,13 @@ index 955baf4..acc6bf8 100644 # define BZ_API(func) func # define BZ_EXTERN __declspec(dllexport) extern -- -2.19.1 +2.30.2 -From e51a4a15b20abf422fba043cdd5b8f2ebd537872 Mon Sep 17 00:00:00 2001 +From 3fc8638c1e9a27f6537e6f68d7e45e761f831da2 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 17 Jun 2016 15:59:11 +0530 -Subject: [PATCH 05/12] meson: soversion should be an unsigned integer +Subject: [PATCH 05/11] meson: soversion should be an unsigned integer Either as an integer, or as a string containing an integer --- @@ -223,13 +223,13 @@ index 7f70507..8146535 100644 bz2_c_args = ['-D_FILE_OFFSET_BITS=64'] -- -2.19.1 +2.30.2 -From 4d9a917d818c45a008ad20121fbdfb45ac04c5cb Mon Sep 17 00:00:00 2001 +From 708ed9bf749072b4af2eca002fe6d6e5d1a9c20b Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 17 Jun 2016 16:00:21 +0530 -Subject: [PATCH 06/12] meson: Ignore warnings about 'insecure functions' that +Subject: [PATCH 06/11] meson: Ignore warnings about 'insecure functions' that are used everywhere by bz2 --- @@ -251,13 +251,13 @@ index 8146535..bc333c5 100644 bz2_incs = include_directories('.') -- -2.19.1 +2.30.2 -From aca8425eab7095c97980d83edf3527d06617768e Mon Sep 17 00:00:00 2001 +From aeb4a9d4647df80c53f0457331d1cc2d6fe4550e Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 13 Dec 2018 20:19:18 +0530 -Subject: [PATCH 07/12] Update to latest meson, fix MSVC support, etc. +Subject: [PATCH 07/11] Update to latest meson, fix MSVC support, etc. --- meson.build | 61 ++++++++++++++++++++++++----------------------------- @@ -358,13 +358,13 @@ index bc333c5..c2cb942 100644 # FIXME: build docs -- -2.19.1 +2.30.2 -From 70ca7688f527cf17078b6e6551ef7800550a3e0a Mon Sep 17 00:00:00 2001 +From a58c851aaf85b37453b8c889c735289a5da7d056 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 13 Dec 2018 20:22:55 +0530 -Subject: [PATCH 08/12] Don't use __declspec(dllimport/export) for symbol +Subject: [PATCH 08/11] Don't use __declspec(dllimport/export) for symbol exporting This partially reverts commit 42f2a11dbe251cea54844a987ca0e0715b1d8ca9. @@ -377,7 +377,7 @@ static. 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bzlib.h b/bzlib.h -index acc6bf8..8a0363d 100644 +index 536375c..1585623 100644 --- a/bzlib.h +++ b/bzlib.h @@ -75,15 +75,14 @@ typedef @@ -400,13 +400,13 @@ index acc6bf8..8a0363d 100644 #else # define BZ_API(func) func -- -2.19.1 +2.30.2 -From ed95413aa0bd4d6f435b53429cf56dcdea98834b Mon Sep 17 00:00:00 2001 +From 1045a0b474bc3f3d94e909fae56728fa41a0d34e Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 13 Dec 2018 20:26:34 +0530 -Subject: [PATCH 09/12] libbz2.def: Don't encode the library name +Subject: [PATCH 09/11] libbz2.def: Don't encode the library name With MSVC we output bz2.dll, not libbz2.dll --- @@ -423,41 +423,13 @@ index 2dc0dd8..6e4ddf6 100644 EXPORTS BZ2_bzCompressInit -- -2.19.1 +2.30.2 -From 9984c2128e15d309a85922599d54366387265c57 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Fri, 14 Dec 2018 14:29:38 +0530 -Subject: [PATCH 10/12] Don't use \ in #include lines - -Causes a build failure with MinGW, and is also against the convention -around path separators in #include lines. ---- - bzip2.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/bzip2.c b/bzip2.c -index 6de9d1d..dc626a4 100644 ---- a/bzip2.c -+++ b/bzip2.c -@@ -128,7 +128,7 @@ - #if BZ_LCCWIN32 - # include - # include --# include -+# include - - # define NORETURN /**/ - # define PATH_SEP '\\' --- -2.19.1 - - -From 928fd716ecffa87f47d47585a9e09ff364c7689a Mon Sep 17 00:00:00 2001 +From 38dce8671edb92516eea9738298241aea520f8a2 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 15 Dec 2018 03:41:52 +0530 -Subject: [PATCH 11/12] meson: Set the dylib current_version as the project +Subject: [PATCH 10/11] meson: Set the dylib current_version as the project version Just for completeness in ABI compatibility. @@ -478,53 +450,28 @@ index c2cb942..400a1c3 100644 ) -- -2.19.1 +2.30.2 -From d98301c372c5066c22410cb8323da08badd4de64 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Sat, 15 Dec 2018 04:12:36 +0530 -Subject: [PATCH 12/12] Don't use 'small' as a function prototype parameter - -While using MinGW or targetting old Windows versions, windows.h defines -`small` as `char`, which results in a compiler error: +From 9d5f7d3c421691a3e44919cfe77544e0ac6c0711 Mon Sep 17 00:00:00 2001 +From: Aaron Boxer +Date: Mon, 13 Sep 2021 16:55:09 -0400 +Subject: [PATCH 11/11] bump version to 1.0.8 -error: two or more data types in declaration specifiers --- - bzlib.h | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/bzlib.h b/bzlib.h -index 8a0363d..5dd7461 100644 ---- a/bzlib.h -+++ b/bzlib.h -@@ -111,7 +111,7 @@ BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( - BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( - bz_stream *strm, - int verbosity, -- int small -+ int small_ - ); - - BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( -@@ -135,7 +135,7 @@ BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( - int* bzerror, - FILE* f, - int verbosity, -- int small, -+ int small_, - void* unused, - int nUnused - ); -@@ -211,7 +211,7 @@ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( - unsigned int* destLen, - char* source, - unsigned int sourceLen, -- int small, -+ int small_, - int verbosity - ); +diff --git a/meson.build b/meson.build +index 400a1c3..f0b46fb 100644 +--- a/meson.build ++++ b/meson.build +@@ -1,4 +1,4 @@ +-project('bzip2', 'c', version : '1.0.6', meson_version : '>=0.49') ++project('bzip2', 'c', version : '1.0.8', meson_version : '>=0.49') + bzip2_sources = [ + 'blocksort.c', -- -2.19.1 +2.30.2 From e5ff9a1a4e6d6fb96c2f5d9fac683cc7be2a7621 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 23 Sep 2021 02:43:12 +0100 Subject: [PATCH 20/53] Build 1.19.2 release --- cerbero/enums.py | 2 +- packages/custom.py | 2 +- recipes/custom.py | 4 ++-- recipes/gst-devtools-1.0.recipe | 2 +- recipes/gst-editing-services-1.0.recipe | 2 +- recipes/gst-libav-1.0.recipe | 2 +- recipes/gst-omx-1.0.recipe | 2 +- recipes/gst-plugins-bad-1.0.recipe | 2 +- recipes/gst-plugins-base-1.0.recipe | 2 +- recipes/gst-plugins-good-1.0.recipe | 2 +- recipes/gst-plugins-ugly-1.0.recipe | 2 +- recipes/gst-rtsp-server-1.0.recipe | 2 +- recipes/gstreamer-1.0.recipe | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cerbero/enums.py b/cerbero/enums.py index 0a480bffa..7ef014c54 100644 --- a/cerbero/enums.py +++ b/cerbero/enums.py @@ -20,7 +20,7 @@ # Safest place to define this since this file imports very few modules -CERBERO_VERSION = '1.19.1.1' +CERBERO_VERSION = '1.19.2' class Platform: ''' Enumeration of supported platforms ''' diff --git a/packages/custom.py b/packages/custom.py index b38997e13..1c3c3a4f4 100644 --- a/packages/custom.py +++ b/packages/custom.py @@ -6,7 +6,7 @@ class GStreamer: url = "http://gstreamer.freedesktop.org" - version = '1.19.1.1' + version = '1.19.2' vendor = 'GStreamer Project' licenses = [License.LGPLv2Plus] org = 'org.freedesktop.gstreamer' diff --git a/recipes/custom.py b/recipes/custom.py index c5b8a2fad..376eb4cdf 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -12,8 +12,8 @@ def running_on_cerbero_ci(): class GStreamer(recipe.Recipe): licenses = [License.LGPLv2Plus] - version = '1.19.1.1' - tagged_for_release = False + version = '1.19.2' + tagged_for_release = True # Decide what stype to use use_git = True diff --git a/recipes/gst-devtools-1.0.recipe b/recipes/gst-devtools-1.0.recipe index ae53b6ad5..9402072fe 100644 --- a/recipes/gst-devtools-1.0.recipe +++ b/recipes/gst-devtools-1.0.recipe @@ -6,7 +6,7 @@ class Recipe(custom.GStreamer): name = 'gst-devtools-1.0' btype = BuildType.MESON meson_options = {'debug_viewer': 'disabled'} - tarball_checksum = '81f31d87f5f883a93d6b642073ed1d7ab2aef3f913f2476605a28063190d42fc' + tarball_checksum = '117e1a667d83f7abfb2b1c201a4badf52eea71aaa63df3fb0539a69fd6637e8b' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'json-glib', 'gst-rtsp-server-1.0'] files_bins = ['gst-validate-1.0', 'gst-validate-transcoding-1.0', 'gst-validate-media-check-1.0', diff --git a/recipes/gst-editing-services-1.0.recipe b/recipes/gst-editing-services-1.0.recipe index 77e48af40..1a0394ff6 100644 --- a/recipes/gst-editing-services-1.0.recipe +++ b/recipes/gst-editing-services-1.0.recipe @@ -4,7 +4,7 @@ from cerbero.utils import shell class Recipe(custom.GStreamer): name = 'gst-editing-services-1.0' btype = BuildType.MESON - tarball_checksum = '6441bc22f3013798b509f3c3765d55be7772e4b8385e2b3199819ea169357383' + tarball_checksum = '8fc03e59776118d080be5b1c0e4611bebd8ce4a311a2f5be6cc6d364b769f900' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0', 'gst-devtools-1.0'] files_bins = ['ges-launch-1.0'] diff --git a/recipes/gst-libav-1.0.recipe b/recipes/gst-libav-1.0.recipe index b86a88554..96d8c6edb 100644 --- a/recipes/gst-libav-1.0.recipe +++ b/recipes/gst-libav-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-libav-1.0' licenses = [License.LGPLv2Plus] btype = BuildType.MESON - tarball_checksum = '7a36c466a0942667f5be5d427d0840d1b81c187a4b93a73dcf10e53bf9cf196c' + tarball_checksum = 'fc4f85e894fc76b2655915ea4e52d7fe05932619e931a742a588d18d73df6467' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'ffmpeg'] files_plugins_codecs_restricted = ['lib/gstreamer-1.0/libgstlibav%(mext)s'] diff --git a/recipes/gst-omx-1.0.recipe b/recipes/gst-omx-1.0.recipe index 1090c8850..bedada5b8 100644 --- a/recipes/gst-omx-1.0.recipe +++ b/recipes/gst-omx-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-omx-1.0' btype = BuildType.MESON - tarball_checksum = '77c55cea3bea26fb3d3b8f8346ac1bef0a92b372a50cbe2118cd002440e17394' + tarball_checksum = '33aa853872e3ea02d497a73e9d51879e26040c91db6e9f7776364d191cd0b2c6' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0'] files_plugins_codecs = ['lib/gstreamer-1.0/libgstomx%(mext)s'] diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 2207384a2..2676d1d95 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -5,7 +5,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-bad-1.0' btype = BuildType.MESON licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['ext/sctp/usrsctp/LICENSE.md']}] - tarball_checksum = '82d210bbfb0ecbff2121c52704e2b81660503235c54d6f4581786134137170b1' + tarball_checksum = '5382f98a9af2c92e5c0ca4fcb3911025cafd9f89b3142b206eb7b92b812e0979' # Explicitly enable plugins that we provide dependencies for to ensure that # we error out if they weren't found. meson_options = {# enabled plugins diff --git a/recipes/gst-plugins-base-1.0.recipe b/recipes/gst-plugins-base-1.0.recipe index 208e49450..b92ee2ba4 100644 --- a/recipes/gst-plugins-base-1.0.recipe +++ b/recipes/gst-plugins-base-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-base-1.0' btype = BuildType.MESON - tarball_checksum = '80da678df6274a7e63c0adc8788aaa354ec163dc94417cdd1fbd36081205430c' + tarball_checksum = 'cde304fd3c006b61a97894b5c4e6f4687edd52cab6767d536b09bdb78d31a513' meson_options = {# enabled plugins 'gl': 'enabled', 'gl-graphene': 'enabled', diff --git a/recipes/gst-plugins-good-1.0.recipe b/recipes/gst-plugins-good-1.0.recipe index e42ac5493..d2870b85f 100644 --- a/recipes/gst-plugins-good-1.0.recipe +++ b/recipes/gst-plugins-good-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-good-1.0' btype = BuildType.MESON - tarball_checksum = '2f9abf38cfb9ce4eaea80f53112f826e1d3d6d53dbe618381d55e5a139fc7a94' + tarball_checksum = '4be92e021144bc6dca5082d028275d4b6e69183c01b90791e0837173d58d4e2e' meson_options = {# enabled plugins 'cairo': 'enabled', 'dv': 'enabled', diff --git a/recipes/gst-plugins-ugly-1.0.recipe b/recipes/gst-plugins-ugly-1.0.recipe index 13884a53b..45e4b9bdc 100644 --- a/recipes/gst-plugins-ugly-1.0.recipe +++ b/recipes/gst-plugins-ugly-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-ugly-1.0' btype = BuildType.MESON - tarball_checksum = 'bdbe59de28d8902d73a02eda75de1c789c01dee5e32e5d63d259e8646e640b42' + tarball_checksum = 'f2a0fcf9fa0e74fe2598b19d25ee03b65256accccd9562a2420100f230329fdf' meson_options = {'a52dec': 'enabled', 'amrnb': 'enabled', 'amrwbdec': 'enabled', diff --git a/recipes/gst-rtsp-server-1.0.recipe b/recipes/gst-rtsp-server-1.0.recipe index 6febc057a..92f3e88ea 100644 --- a/recipes/gst-rtsp-server-1.0.recipe +++ b/recipes/gst-rtsp-server-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-rtsp-server-1.0' btype = BuildType.MESON - tarball_checksum = '54188352115c439edd1971cc01f8f75d81f44ba6d5d1667f8e86b0f6807a4466' + tarball_checksum = '473dc705a645b9d99e42e54e8d32afdd856275f55c9f2fc840468316dae2d3bf' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-bad-1.0'] files_devel = ['include/gstreamer-1.0/gst/rtsp-server', 'lib/pkgconfig/gstreamer-rtsp-server-1.0.pc'] diff --git a/recipes/gstreamer-1.0.recipe b/recipes/gstreamer-1.0.recipe index dcf1e2394..14982deef 100644 --- a/recipes/gstreamer-1.0.recipe +++ b/recipes/gstreamer-1.0.recipe @@ -4,7 +4,7 @@ import shutil class Recipe(custom.GStreamer): name = 'gstreamer-1.0' btype = BuildType.MESON - tarball_checksum = '0bdf5395a6982ae8a20c568603892877437ce3e2d206bf9ab54de29ca417dcc1' + tarball_checksum = '6e5b7ba5931e5389c21d10986615f72859b2cc8830a5ba8b5253dad1ba7e6e0d' deps = ['glib'] bash_completions = ['gst-inspect-1.0', 'gst-launch-1.0'] From 6b999a498626b021fb3d3c3764833516cec4a248 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 23 Sep 2021 18:00:51 +0530 Subject: [PATCH 21/53] recipes: Add patches to fix UWP build 1.19.2 is tagged and released, so we need to add these patches by hand. Will be removed once they've been merged upstream. Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 2 ++ ...on-Fix-build-with-Dopenjpeg-disabled.patch | 35 +++++++++++++++++++ recipes/gstreamer-1.0.recipe | 2 ++ ...01-meson-Fix-gst-launch-build-on-UWP.patch | 28 +++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch create mode 100644 recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 2676d1d95..aecd47383 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -543,6 +543,8 @@ class Recipe(custom.GStreamer): self.disable_plugin('ladspa', 'effects', dep='ladspa') self.disable_plugin('mms', 'net_restricted', option='libmms', dep='libmms') self.disable_plugin('openjpeg', 'codecs', dep='openjpeg') + # https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2545 + self.patches = [self.name + '/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch'] self.disable_plugin('rtmp', 'net_restricted', option='rtmp', dep='librtmp') self.disable_plugin('sbc', 'codecs', dep='sbc') self.disable_plugin('spandsp', 'codecs', dep='spandsp') diff --git a/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch b/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch new file mode 100644 index 000000000..354bc867f --- /dev/null +++ b/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch @@ -0,0 +1,35 @@ +From cdd8b377a9f5817228b4cf507a8f40f4032a8d9c Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Thu, 23 Sep 2021 17:36:20 +0530 +Subject: [PATCH] meson: Fix build with -Dopenjpeg=disabled + +tests/check/meson.build uses the openjpeg_dep variable +unconditionally, and the subdir_done() is useless anyway, since the +plugin is only built if openjpeg_dep.found() is true. Fixes: + +..\tests\check\meson.build:23:0: ERROR: Unknown variable "openjpeg_dep". + +In particular, this fixes the build on UWP since we disable openjpeg +explicitly in Cerbero when building for UWP. +--- + ext/openjpeg/meson.build | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/ext/openjpeg/meson.build b/ext/openjpeg/meson.build +index 822f2c94f..94597fb16 100644 +--- a/ext/openjpeg/meson.build ++++ b/ext/openjpeg/meson.build +@@ -6,10 +6,6 @@ openjpeg_sources = [ + + openjpeg_cargs = [] + +-if get_option('openjpeg').disabled() +- subdir_done() +-endif +- + openjpeg_dep = dependency('libopenjp2', version : '>=2.2', + fallback : ['libopenjp2', 'libopenjp2_dep'], + required : get_option('openjpeg')) +-- +2.33.0.windows.2 + diff --git a/recipes/gstreamer-1.0.recipe b/recipes/gstreamer-1.0.recipe index 14982deef..bf13fec32 100644 --- a/recipes/gstreamer-1.0.recipe +++ b/recipes/gstreamer-1.0.recipe @@ -72,6 +72,8 @@ class Recipe(custom.GStreamer): if self.using_msvc(): if self.config.variants.uwp: + # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/890 + self.patches = [self.name + '/0001-meson-Fix-gst-launch-build-on-UWP.patch'] # Most symbols in DbgHelp.h are not allowed for UWP self.meson_options['dbghelp'] = 'disabled' else: diff --git a/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch b/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch new file mode 100644 index 000000000..e3dce3e24 --- /dev/null +++ b/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch @@ -0,0 +1,28 @@ +From c68bfffa1aaa813763e1eb5b1ffced6ebf66a817 Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Thu, 23 Sep 2021 17:07:09 +0530 +Subject: [PATCH] meson: Fix gst-launch build on UWP + +The APIs we need from WinMM for higher timer resolution are only +available for non-UWP apps. The winmm library itself is still +available, so we need to disable the check. +--- + tools/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/meson.build b/tools/meson.build +index e22721d9d..c5bf4f9a0 100644 +--- a/tools/meson.build ++++ b/tools/meson.build +@@ -4,7 +4,7 @@ extra_launch_dep = [] + extra_launch_arg = [] + + if gst_parse +- if host_system == 'windows' ++ if host_system == 'windows' and not building_for_uwp + winmm_lib = cc.find_library('winmm', required: false) + if winmm_lib.found() and cc.has_header('timeapi.h') + extra_launch_dep += [winmm_lib] +-- +2.33.0.windows.2 + From 2e9d12adf8ea00e6fc8a31d22f55b2e17e45ae88 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 24 Sep 2021 10:45:14 -0400 Subject: [PATCH 22/53] Back to development Part-of: --- cerbero/enums.py | 2 +- packages/custom.py | 2 +- recipes/custom.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cerbero/enums.py b/cerbero/enums.py index 7ef014c54..72df32d20 100644 --- a/cerbero/enums.py +++ b/cerbero/enums.py @@ -20,7 +20,7 @@ # Safest place to define this since this file imports very few modules -CERBERO_VERSION = '1.19.2' +CERBERO_VERSION = '1.19.2.1' class Platform: ''' Enumeration of supported platforms ''' diff --git a/packages/custom.py b/packages/custom.py index 1c3c3a4f4..428f592be 100644 --- a/packages/custom.py +++ b/packages/custom.py @@ -6,7 +6,7 @@ class GStreamer: url = "http://gstreamer.freedesktop.org" - version = '1.19.2' + version = '1.19.2.1' vendor = 'GStreamer Project' licenses = [License.LGPLv2Plus] org = 'org.freedesktop.gstreamer' diff --git a/recipes/custom.py b/recipes/custom.py index 376eb4cdf..fc557fad7 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -12,8 +12,8 @@ def running_on_cerbero_ci(): class GStreamer(recipe.Recipe): licenses = [License.LGPLv2Plus] - version = '1.19.2' - tagged_for_release = True + version = '1.19.2.1' + tagged_for_release = False # Decide what stype to use use_git = True From a242e4adb8fceb4a60c4dce5057e79d04a56425f Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 3 Jun 2021 10:04:46 -0400 Subject: [PATCH 23/53] source: Take recipes_remotes value from config Config files have recipes_commits and recipes_remotes properties but only the former was actually used. Move the code handling this into the base class. Part-of: --- cerbero/build/source.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cerbero/build/source.py b/cerbero/build/source.py index 5f100024c..e970d8be2 100644 --- a/cerbero/build/source.py +++ b/cerbero/build/source.py @@ -322,6 +322,9 @@ def __init__(self): (self.config.git_root, self.name) self.repo_dir = os.path.join(self.config.local_sources, self.name) self._previous_env = None + # For forced commits in the config + self.commit = self.config.recipe_commit(self.name) or self.commit + self.remotes.update(self.config.recipes_remotes.get(self.name, {})) async def fetch(self, checkout=True): # First try to get the sources from the cached dir if there is one @@ -347,8 +350,7 @@ async def fetch(self, checkout=True): if not self.offline: await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self)) if checkout: - commit = self.config.recipe_commit(self.name) or self.commit - await git.checkout(self.repo_dir, commit, logfile=get_logfile(self)) + await git.checkout(self.repo_dir, self.commit, logfile=get_logfile(self)) await git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline, logfile=get_logfile(self)) @@ -366,8 +368,6 @@ def __init__(self): if self.commit is None: # Used by recipes in recipes/toolchain/ self.commit = 'origin/sdk-%s' % self.version - # For forced commits in the config - self.commit = self.config.recipe_commit(self.name) or self.commit async def extract(self): if os.path.exists(self.config_src_dir): From 951fcdeb2f30ce648eb09eeea51282ed0e07150d Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sat, 31 Oct 2020 18:49:07 -0400 Subject: [PATCH 24/53] Use unified GStreamer repository Since all GStreamer recipes now share the same git directory, we have to use a lock to avoid multiple recipes doing the git checkout concurrently. Part-of: --- cerbero/build/source.py | 26 ++++++++++++++++++++++++++ recipes/custom.py | 21 ++++++++++++++++++--- recipes/gst-plugins-bad-1.0.recipe | 2 +- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/cerbero/build/source.py b/cerbero/build/source.py index e970d8be2..671f2c430 100644 --- a/cerbero/build/source.py +++ b/cerbero/build/source.py @@ -21,6 +21,8 @@ import zipfile import tarfile import urllib.request, urllib.parse, urllib.error +import collections +import asyncio from hashlib import sha256 from cerbero.config import Platform, DEFAULT_MIRRORS @@ -303,6 +305,9 @@ class GitCache (Source): remotes = None commit = None + _fetch_locks = collections.defaultdict(asyncio.Lock) + _fetch_done = set() + def __init__(self): Source.__init__(self) self.remotes = {} if self.remotes is None else self.remotes.copy() @@ -327,6 +332,15 @@ def __init__(self): self.remotes.update(self.config.recipes_remotes.get(self.name, {})) async def fetch(self, checkout=True): + # Could have multiple recipes using the same repo. + lock = self._fetch_locks[self.repo_dir] + async with lock: + if self.repo_dir in self._fetch_done: + return + await self.fetch_impl(checkout) + self._fetch_done.add(self.repo_dir) + + async def fetch_impl(self, checkout): # First try to get the sources from the cached dir if there is one cached_dir = os.path.join(self.config.cached_sources, self.name) @@ -363,6 +377,9 @@ class Git (GitCache): Source handler for git repositories ''' + _extract_locks = collections.defaultdict(asyncio.Lock) + _extract_done = set() + def __init__(self): GitCache.__init__(self) if self.commit is None: @@ -370,6 +387,15 @@ def __init__(self): self.commit = 'origin/sdk-%s' % self.version async def extract(self): + # Could have multiple recipes using the same repo. + lock = self._extract_locks[self.config_src_dir] + async with lock: + if self.config_src_dir in self._extract_done: + return + await self.extract_impl() + self._extract_done.add(self.config_src_dir) + + async def extract_impl(self): if os.path.exists(self.config_src_dir): try: commit_hash = git.get_hash(self.repo_dir, self.commit, logfile=get_logfile(self)) diff --git a/recipes/custom.py b/recipes/custom.py index fc557fad7..49db912af 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -29,18 +29,33 @@ class GStreamer(recipe.Recipe): if use_git: stype = SourceType.GIT - remotes = {'origin': 'https://gitlab.freedesktop.org/gstreamer/%(name)s.git'} + remotes = {'origin': 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git'} if int(version.split('.')[1]) % 2 == 0: # Even version, use the specific branch commit = 'origin/' + '.'.join(version.split('.')[0:2]) else: - # Odd version, use git master - commit = 'origin/master' + # Odd version, use git main + commit = 'origin/main' else: stype = SourceType.TARBALL url = 'https://gstreamer.freedesktop.org/src/%(name)s/%(name)s-%(version)s.tar.xz' tarball_dirname = '%(name)s-%(version)s' + def __init__(self, config, env): + super().__init__(config, env) + if self.use_git: + # All GStreamer recipes share the same git repo, but they build a + # different subproject from it. + subproject = self.name.replace('-1.0', '') + self.repo_dir = os.path.abspath(os.path.join(self.config.local_sources, 'gstreamer-1.0')) + self.config_src_dir = os.path.abspath(os.path.join(self.config.sources, 'gstreamer-1.0')) + self.build_dir = os.path.join(self.config_src_dir, 'subprojects', subproject) + # Force using the commit/remotes from 'gstreamer-1.0' recipe, if set + # in the config, on all gstreamer recipes because they share the same + # git repository. + self.commit = self.config.recipe_commit('gstreamer-1.0') or self.commit + self.remotes.update(self.config.recipes_remotes.get('gstreamer-1.0', {})) + def enable_plugin(self, plugin, category, variant, option=None, dep=None): if option is None: option = plugin diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index aecd47383..8ab9cf232 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -4,7 +4,7 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(custom.GStreamer): name = 'gst-plugins-bad-1.0' btype = BuildType.MESON - licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['ext/sctp/usrsctp/LICENSE.md']}] + licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['subprojects/gst-plugins-bad/ext/sctp/usrsctp/LICENSE.md']}] tarball_checksum = '5382f98a9af2c92e5c0ca4fcb3911025cafd9f89b3142b206eb7b92b812e0979' # Explicitly enable plugins that we provide dependencies for to ensure that # we error out if they weren't found. From 5932e2e32d0fbc1b55e977830d15d140d7b0cb8e Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Sun, 1 Nov 2020 10:45:30 -0500 Subject: [PATCH 25/53] ci: Move needed scripts from gst-ci to cerbero Part-of: --- .gitlab-ci.yml | 481 ++++++++++++++++++++++++++++++++++++- ci/cerbero_setup.sh | 164 +++++++++++++ ci/docker_android_setup.sh | 50 ++++ ci/docker_setup.sh | 23 ++ 4 files changed, 717 insertions(+), 1 deletion(-) create mode 100755 ci/cerbero_setup.sh create mode 100755 ci/docker_android_setup.sh create mode 100755 ci/docker_setup.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c61aa7a52..dcbcb04da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1 +1,480 @@ -include: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/ci_template.yml" +include: + - remote: 'https://gitlab.freedesktop.org/freedesktop/ci-templates/-/raw/master/templates/fedora.yml' + +stages: + - 'build docker' + - 'build' + # Use the resulting binaries + - 'integrate' + +variables: + # CI_GSTREAMER_* variables are overriden by gstreamer's CI when it triggers cerbero CI. + CI_GSTREAMER_REF_NAME: 'main' + CI_GSTREAMER_URL: 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git' + GST_UPSTREAM_BRANCH: 'main' + WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v13-master' + DEFAULT_CERBERO_ARGS: > + --variants werror + --timestamps + +workflow: + rules: + - if: $CI_MERGE_REQUEST_IID + - if: $CI_COMMIT_TAG + - if: $CI_COMMIT_BRANCH + +# +# Global CI policy +# +# This can be used to configure global behaviour our our jobs. +# +default: + retry: + max: 2 + when: + - 'runner_system_failure' + - 'stuck_or_timeout_failure' + - 'scheduler_failure' + - 'api_failure' + interruptible: true + +.fedora image: + variables: + ### + # IMPORTANT + # These are the version tags for the docker images the CI runs against. + # If you are hacking on them or need a them to rebuild, its enough + # to change any part of the string of the image you want. + ### + FDO_DISTRIBUTION_TAG: '2021-09-13.0' + FDO_DISTRIBUTION_VERSION: '31' + FDO_DISTRIBUTION_PACKAGES: sudo git lbzip2 rsync wine which + FDO_DISTRIBUTION_EXEC: ci/docker_setup.sh + FDO_UPSTREAM_REPO: gstreamer/cerbero + +.android fedora image: + variables: + ### + # IMPORTANT + # These are the version tags for the docker images the CI runs against. + # If you are hacking on them or need a them to rebuild, its enough + # to change any part of the string of the image you want. + ### + FDO_DISTRIBUTION_TAG: '2021-09-13.0' + FDO_DISTRIBUTION_VERSION: '31' + FDO_DISTRIBUTION_PACKAGES: file git-core java-1.8.0-openjdk-devel lbzip2 make pkg-config unzip which xz + FDO_DISTRIBUTION_EXEC: ci/docker_android_setup.sh $ANDROID_HOME $ANDROID_NDK_HOME $GST_UPSTREAM_BRANCH + FDO_UPSTREAM_REPO: gstreamer/cerbero + FDO_REPO_SUFFIX: android + ANDROID_HOME: "/android/sdk" + ANDROID_NDK_HOME: "/android/ndk" + +.manual trigger: + rules: + # If this pipeline is triggered from gstreamer, trigger the pipeline automatically + - if: '$CI_PIPELINE_SOURCE == "pipeline"' + # If this matches, it means the pipeline is running against either the main + # or a stable branch, so make it automatic cause they need to update artifacts, + # like the docs site or cerbero deps + - if: '$CI_COMMIT_BRANCH == $GST_UPSTREAM_BRANCH' + # If the MR is assigned to the Merge bot, trigger the pipeline automatically + - if: '$CI_MERGE_REQUEST_ASSIGNEES == "gstreamer-merge-bot"' + # When the assignee isn't the merge bot, require an explicit action to trigger the pipeline + # to avoid wasting CI resources + - if: '$CI_MERGE_REQUEST_ASSIGNEES != "gstreamer-merge-bot"' + when: 'manual' + +fedora image: + stage: "build docker" + extends: + - .manual trigger + - .fedora image + - .fdo.container-build@fedora + variables: + GIT_STRATEGY: none + +android fedora image: + stage: "build docker" + extends: + - .manual trigger + - .android fedora image + - .fdo.container-build@fedora + variables: + GIT_STRATEGY: none + +# Template for Cerbero GStreamer Build +# +# Parameters: +# CONFIG: The name of the configuration file to use +# ARCH: The cerbero _ (used in cache key) +# +.cerbero: + stage: "build" + extends: + - .fedora image + - .fdo.distribution-image@fedora + rules: + - if: '$CI_PIPELINE_SOURCE == "pipeline"' + # Ensure that the runners it will be executed on + # will have plenty of space for the cache + tags: ['gstreamer'] + timeout: '3h' + variables: + CCACHE_COMPILERCHECK: "content" + CCACHE_COMPRESS: "true" + CCACHE_BASEDIR: "/cache/gstreamer/cerbero/" + CCACHE_DIR: "/cache/gstreamer/cerbero/ccache/" + # shared across everything really + CCACHE_MAXSIZE: "50G" + + CERBERO_HOME: "cerbero-build" + CERBERO_SOURCES: "cerbero-sources" + CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS}" + CERBERO: "./cerbero-uninstalled -c config/${CONFIG} -c localconf.cbc" + CERBERO_PACKAGE_ARGS: "-t" + CERBERO_RUN_WRAPPER: "" # 'wine' on cross-winXX + CERBERO_RUN_SUFFIX: "" # '.exe' on cross-winXX + HAVE_CCACHE: "yes" + # used by macos packages as we only ever install to a fixed directory + CERBERO_OVERRIDDEN_DIST_DIR: "" + # location where the cerbero git repo is stored on the image + CERBERO_HOST_DIR: "/" + before_script: + - echo $CI_PIPELINE_SOURCE + - ./ci/cerbero_setup.sh cerbero_before_script + script: + - ./ci/cerbero_setup.sh cerbero_script + cache: + key: "${CI_JOB_NAME}" + paths: + - "${CERBERO_SOURCES}" + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${CERBERO_HOME}/logs" + - "*.tar.*" + +# Template for Cerbero GStreamer Deps +# +# This template is used by cerbero/ project to pre-built the GStreamer +# dependencies. When available, the .cerbero jobs will download this artifact +# in order to speed up the build. +# +# Parameters: +# CONFIG: The name of the configuration file to use +# ARCH: The cerbero _ (used in cache key) +# +# Produce an artifact with the dist/ and .cache along +# with the associated build-tools. +.cerbero deps: + extends: .cerbero + rules: + - if: '$CI_PIPELINE_SOURCE != "pipeline"' + script: + - ./ci/cerbero_setup.sh cerbero_deps_script + +# +# Cerbero Linux X86_64 build +# +cerbero deps fedora x86_64: + extends: '.cerbero deps' + variables: + CONFIG: "linux.config" + ARCH: "linux_x86_64" + +build cerbero fedora x86_64: + extends: '.cerbero' + variables: + CONFIG: "linux.config" + +# +# Cerbero Android Universal build +# +.cerbero cross-android universal: + variables: + CONFIG: "cross-android-universal.cbc" + ARCH: "android_universal" + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${CERBERO_HOME}/logs" + - "*[0-9].tar.*" + +cerbero deps cross-android universal: + extends: + - '.cerbero deps' + - '.cerbero cross-android universal' + +build cerbero cross-android universal: + extends: + - '.cerbero' + - '.cerbero cross-android universal' + +# +# Cerbero Cross Windows builds +# +cerbero deps cross-windows x86: + extends: '.cerbero deps' + variables: + CONFIG: "cross-win32.cbc" + ARCH: "mingw_x86" + +build cerbero cross win32: + extends: '.cerbero' + variables: + CONFIG: "cross-win32.cbc" + CERBERO_RUN_WRAPPER: "wine" + CERBERO_RUN_SUFFIX: ".exe" + + +cerbero deps cross-windows x86_64: + extends: '.cerbero deps' + variables: + CONFIG: "cross-win64.cbc" + ARCH: "mingw_x86_64" + +build cerbero cross win64: + extends: '.cerbero' + variables: + CONFIG: "cross-win64.cbc" + CERBERO_RUN_WRAPPER: "wine" + CERBERO_RUN_SUFFIX: ".exe" + +# +# Build an Android App using the android binaries +# +.cross-android universal examples: + extends: + - .android fedora image + - .fdo.suffixed-image@fedora + stage: 'integrate' + variables: + EXAMPLES_HOME: ${CI_PROJECT_DIR}/gstreamer/subprojects + GSTREAMER_ROOT_ANDROID: ${CI_PROJECT_DIR}/cerbero-android-universal + script: + # Clone gstreamer repository to get gst-examples and gst-docs + - rm -rf gstreamer + - git clone $CI_GSTREAMER_URL -b $CI_GSTREAMER_REF_NAME --depth 1 + - mkdir -p ${EXAMPLES_HOME}/outputs + + # extract our binaries + - rm -f gstreamer-1.0-android-universal-*-runtime.tar.* + - mkdir ${GSTREAMER_ROOT_ANDROID} + - time tar -C ${GSTREAMER_ROOT_ANDROID} -xf gstreamer-1.0-android-universal-*.tar.* + + # gst-examples - player + - chmod +x ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew + - ${EXAMPLES_HOME}/gst-examples/playback/player/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/playback/player/android assembleDebug + - cp ${EXAMPLES_HOME}/gst-examples/playback/player/android/app/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/ + + # gst-examples - vulkan + - chmod +x ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew + - ${EXAMPLES_HOME}/gst-examples/vulkan/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-examples/vulkan/android assembleDebug + - cp ${EXAMPLES_HOME}/gst-examples/vulkan/android/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/ + + # gst-docs android tutorials + - chmod +x ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew + - ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/gradlew --no-daemon --project-dir ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android assembleDebug + - cp ${EXAMPLES_HOME}/gst-docs/examples/tutorials/android/android-tutorial-*/build/outputs/apk/debug/*.apk ${EXAMPLES_HOME}/outputs/ + after_script: + - rm -rf ${GSTREAMER_ROOT_ANDROID} gstreamer + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${EXAMPLES_HOME}/outputs" + +cross-android universal examples: + extends: ".cross-android universal examples" + rules: + - if: '$CI_PIPELINE_SOURCE == "pipeline"' + needs: + - "build cerbero cross-android universal" + +cerbero cross-android universal examples: + extends: ".cross-android universal examples" + rules: + - if: '$CI_PIPELINE_SOURCE != "pipeline"' + needs: + - "cerbero deps cross-android universal" + +# +# Cerbero macOS X86_64 build +# +.cerbero macos x86_64: + variables: + ARCH: "darwin_x86_64" + CONFIG: "osx-x86-64.cbc" + CERBERO_PACKAGE_ARGS: "" + HAVE_CCACHE: "" + CERBERO_OVERRIDDEN_DIST_DIR: "/Library/Frameworks/GStreamer.framework/Versions/1.0" + CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/" + tags: + - gst-macos-11.1 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${CERBERO_HOME}/logs" + - "gstreamer-1.0-1.*.pkg" + - "gstreamer-1.0-devel-1.*.pkg" + +cerbero deps macos x86_64: + extends: + - '.cerbero deps' + - '.cerbero macos x86_64' + +build cerbero macos x86_64: + extends: + - '.cerbero' + - '.cerbero macos x86_64' + +# +# Cerbero macOS Universal build +# +.cerbero cross-macos universal: + variables: + ARCH: "darwin_universal" + CONFIG: "cross-macos-universal.cbc" + CERBERO_PACKAGE_ARGS: "" + HAVE_CCACHE: "" + CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/" + tags: + - gst-macos-11.1 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${CERBERO_HOME}/logs" + - "gstreamer-1.0-1.*.pkg" + - "gstreamer-1.0-devel-1.*.pkg" + +cerbero deps cross-macos universal: + extends: + - '.cerbero deps' + - '.cerbero cross-macos universal' + +build cerbero cross-macos universal: + extends: + - '.cerbero' + - '.cerbero cross-macos universal' + +# +# Cerbero iOS build +# +.cerbero cross-ios universal: + variables: + ARCH: "ios_universal" + CONFIG: "cross-ios-universal.cbc" + CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v nowerror" + CERBERO_PACKAGE_ARGS: "" + HAVE_CCACHE: "" + CERBERO_HOST_DIR: "/Users/gst-ci/cerbero/" + tags: + - gst-ios-14.3 + artifacts: + name: "${CI_JOB_NAME}_${CI_COMMIT_SHA}" + expire_in: '5 days' + when: 'always' + paths: + - "${CERBERO_HOME}/logs" + - "gstreamer-1.0-*-ios-universal.pkg" + +cerbero deps cross-ios universal: + extends: + - '.cerbero deps' + - '.cerbero cross-ios universal' + +build cerbero cross-ios universal: + extends: + - '.cerbero' + - '.cerbero cross-ios universal' + +# +# Build an iOS App using the iOS binaries +# +.cross-ios universal examples: + stage: 'integrate' + variables: + EXAMPLES_HOME: gstreamer/subprojects + # disable codesigning so we don't need developer identities on the CI + # machines + XCODE_BUILD_ARGS: > + CODE_SIGNING_REQUIRED="NO" + CODE_SIGN_IDENTITY="" + CODE_SIGNING_ALLOWED="NO" + CODE_SIGN_ENTITLEMENTS="" + script: + # install the binaries + - installer -pkg gstreamer-1.0-devel-*-ios-universal.pkg -target CurrentUserHomeDirectory -verbose + + # Clone gstreamer repository to get gst-examples and gst-docs + - git clone $CI_GSTREAMER_URL -b $CI_GSTREAMER_REF_NAME --depth 1 + + # dump some useful information + - xcodebuild -version + - xcodebuild -showsdks + + # gst-docs ios tutorials + - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj + - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-docs/examples/tutorials/xcode\ iOS/GStreamer\ iOS\ Tutorials.xcodeproj ${XCODE_BUILD_ARGS} + + # gst-examples + - xcodebuild -showBuildSettings -alltargets -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj + - xcodebuild -alltargets -destination generic/platform=iOS -project ${EXAMPLES_HOME}/gst-examples/playback/player/ios/GstPlay.xcodeproj ${XCODE_BUILD_ARGS} + after_script: + - rm -rf gstreamer + tags: + - gst-ios-14.3 + +cross-ios universal examples: + extends: ".cross-ios universal examples" + rules: + - if: '$CI_PIPELINE_SOURCE == "pipeline"' + needs: + - "build cerbero cross-ios universal" + +cerbero cross-ios universal examples: + extends: ".cross-ios universal examples" + rules: + - if: '$CI_PIPELINE_SOURCE != "pipeline"' + needs: + - "cerbero deps cross-ios universal" + +# +# Cerbero Native Windows builds +# +.cerbero windows native: + image: $WINDOWS_IMAGE + tags: + - 'docker' + - 'windows' + - 'gstreamer-windows' + - '1809' + variables: + CONFIG: 'win64.cbc' + ARCH: 'msvc_x86_64' + CERBERO_HOST_DIR: "C:/cerbero" + CERBERO_ARGS: "${DEFAULT_CERBERO_ARGS} -v visualstudio -v nowerror" + CERBERO_RUN_SUFFIX: ".exe" + HAVE_CCACHE: "" + before_script: + - $env:CI_PROJECT_DIR = $env:CI_PROJECT_DIR.replace('\', '/') + - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_before_script" + +cerbero deps msvc x86_64: + extends: ['.cerbero deps', '.cerbero windows native'] + script: + - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_deps_script" + +build cerbero msvc x86_64: + extends: ['.cerbero', '.cerbero windows native'] + script: + - C:\MinGW\msys\1.0\bin\bash.exe --login -c "cd $env:CI_PROJECT_DIR && ./ci/cerbero_setup.sh cerbero_script" diff --git a/ci/cerbero_setup.sh b/ci/cerbero_setup.sh new file mode 100755 index 000000000..8f855376c --- /dev/null +++ b/ci/cerbero_setup.sh @@ -0,0 +1,164 @@ +#!/bin/bash + +set -ex + +show_ccache_sum() { + if [[ -n ${HAVE_CCACHE} ]]; then + ccache -s + fi +} + +# XXX: This is copied and modified from the cerbero-uninstalled script +# Use `mount` to get a list of MSYS mount points that the MSYS shell uses. +# That's our reference point for translating from MSYS paths to Win32 paths. +# We assume that the MSYS mount point directories are only in the filesystem +# root. This will break if people add their own custom mount points beyond what +# MSYS automatically creates, which is highly unlikely. +# +# /d -> d:/ +# /c -> c:/ +# /d/projects/cerbero -> d:/projects/cerbero/ +# /home/USERNAME/cerbero -> C:\\MinGW\\msys\\1.0/home/USERNAME/ +# /mingw -> C:\\MinGW/ +# /mingw/bin/foobar -> C:\\MinGW\\bin/foobar/ +# /tmp/baz -> C:\\Users\\USERNAME\\AppData\\Local\\Temp/baz/ +msys_dir_to_win32() { + set -e + local msys_path stripped_path mount_point path mounted_path + # If the path is already a native path, just return that + if [[ $1 == ?:/* ]] || [[ $1 == ?:\\* ]]; then + echo $1 + return + fi + # Convert /c or /mingw etc to /c/ or /mingw/ etc; gives us a necessary + # anchor to split the path into components + msys_path="$1/" + # Strip leading slash + stripped_path="${msys_path#/}" + # Get the first path component, which may be a mount point + mount_point="/${stripped_path%%/*}" + # Get the path inside the mountp oint + path="/${stripped_path#*/}" + mounted_path="$(mount | sed -n "s|\(.*\) on $mount_point type.*|\1|p")" + # If it's not a mounted path (like /c or /tmp or /mingw), then it's in the + # general MSYS root mount + if [[ -z $mounted_path ]]; then + mounted_path="$(mount | sed -n "s|\(.*\) on / type.*|\1|p")" + path="$1" + fi + echo ${mounted_path}${path%/} +} + +# Print the working directory in the native OS path format, but with forward +# slashes +pwd_native() { + if [[ -n "$MSYSTEM" ]]; then + msys_dir_to_win32 "$(pwd)" + else + pwd + fi +} + +fix_build_tools() { + if [[ $(uname) == Darwin ]]; then + # Bison needs these env vars set for the build-tools prefix to be + # relocatable, and we only build it on macOS. On Linux we install it + # using the package manager, and on Windows we use the MSYS Bison. + export M4="$(pwd)/${CERBERO_HOME}/build-tools/bin/m4" + export BISON_PKGDATADIR="$(pwd)/${CERBERO_HOME}/build-tools/share/bison" + fi +} + +# Produces runtime and devel tarball packages for linux/android or .pkg for macos +cerbero_package_and_check() { + $CERBERO $CERBERO_ARGS package --offline ${CERBERO_PACKAGE_ARGS} -o "$(pwd_native)" gstreamer-1.0 + + # Run gst-inspect-1.0 for some basic checks. Can't do this for cross-(android|ios)-universal, of course. + if [[ $CONFIG != *universal* ]]; then + $CERBERO $CERBERO_ARGS run $CERBERO_RUN_WRAPPER gst-inspect-1.0$CERBERO_RUN_SUFFIX --version + $CERBERO $CERBERO_ARGS run $CERBERO_RUN_WRAPPER gst-inspect-1.0$CERBERO_RUN_SUFFIX + fi + + show_ccache_sum +} + +cerbero_before_script() { + pwd + ls -lha + + # If there's no cerbero-sources directory in the runner cache, copy it from + # the image cache + if ! [[ -d ${CERBERO_SOURCES} ]]; then + time cp -a "${CERBERO_HOST_DIR}/${CERBERO_SOURCES}" . + fi + du -sch "${CERBERO_SOURCES}" || true + + echo "home_dir = \"$(pwd_native)/${CERBERO_HOME}\"" > localconf.cbc + echo "local_sources = \"$(pwd_native)/${CERBERO_SOURCES}\"" >> localconf.cbc + if [[ $CONFIG == win??.cbc ]]; then + # Visual Studio 2017 build tools install path + echo 'vs_install_path = "C:/BuildTools"' >> localconf.cbc + echo 'vs_install_version = "vs15"' >> localconf.cbc + fi + echo "recipes_commits = {'gstreamer-1.0': 'ci/${CI_GSTREAMER_REF_NAME}'}" >> localconf.cbc + echo "recipes_remotes = {'gstreamer-1.0': {'ci': '${CI_GSTREAMER_URL}'}}" >> localconf.cbc + cat localconf.cbc + + # GitLab runner does not always wipe the image after each job, so do that + # to ensure we don't have any leftover data from a previous job such as + # a dirty builddir, or tarballs/pkg files, leftover files from an old + # cerbero commit, etc. Skip the things we actually need to keep. + time git clean -xdf -e localconf.cbc -e "${CERBERO_SOURCES}" +} + +cerbero_script() { + show_ccache_sum + + $CERBERO $CERBERO_ARGS show-config + $CERBERO $CERBERO_ARGS fetch-bootstrap --jobs=4 + $CERBERO $CERBERO_ARGS fetch-package --jobs=4 --deps gstreamer-1.0 + du -sch "${CERBERO_SOURCES}" || true + + $CERBERO $CERBERO_ARGS fetch-cache --branch "${GST_UPSTREAM_BRANCH}" + + if [[ -n ${CERBERO_OVERRIDDEN_DIST_DIR} && -d "${CERBERO_HOME}/dist/${ARCH}" ]]; then + mkdir -p "${CERBERO_OVERRIDDEN_DIST_DIR}" + time rsync -aH "${CERBERO_HOME}/dist/${ARCH}/" "${CERBERO_OVERRIDDEN_DIST_DIR}" + fi + + $CERBERO $CERBERO_ARGS bootstrap --offline --system=no + fix_build_tools + + cerbero_package_and_check +} + +cerbero_deps_script() { + show_ccache_sum + + $CERBERO $CERBERO_ARGS show-config + $CERBERO $CERBERO_ARGS fetch-bootstrap --jobs=4 + $CERBERO $CERBERO_ARGS fetch-package --jobs=4 --deps gstreamer-1.0 + $CERBERO $CERBERO_ARGS bootstrap --offline --system=no + $CERBERO $CERBERO_ARGS build-deps --offline \ + gstreamer-1.0 gst-plugins-base-1.0 gst-plugins-good-1.0 \ + gst-plugins-bad-1.0 gst-plugins-ugly-1.0 gst-rtsp-server-1.0 \ + gst-libav-1.0 gst-devtools-1.0 gst-editing-services-1.0 libnice + + if [[ -n ${CERBERO_OVERRIDDEN_DIST_DIR} ]]; then + mkdir -p "${CERBERO_HOME}/dist/${ARCH}" + time rsync -aH "${CERBERO_OVERRIDDEN_DIST_DIR}/" "${CERBERO_HOME}/dist/${ARCH}" + fi + + # Check that the env var is set. Don't expand this protected variable by + # doing something silly like [[ -n ${CERBERO_...} ]] because it will get + # printed in the CI logs due to set -x + if env | grep -q -e CERBERO_PRIVATE_SSH_KEY; then + time $CERBERO $CERBERO_ARGS gen-cache --branch "${GST_UPSTREAM_BRANCH}" + time $CERBERO $CERBERO_ARGS upload-cache --branch "${GST_UPSTREAM_BRANCH}" + fi + + cerbero_package_and_check +} + +# Run whichever function is asked of us +eval "$1" diff --git a/ci/docker_android_setup.sh b/ci/docker_android_setup.sh new file mode 100755 index 000000000..dba648a7d --- /dev/null +++ b/ci/docker_android_setup.sh @@ -0,0 +1,50 @@ +set -eux + +export ANDROID_HOME=$1 +export ANDROID_NDK_HOME=$2 +DEFAULT_BRANCH=$3 + +mkdir -p /android/sources + +curl -o /android/sources/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r21-linux-x86_64.zip +unzip /android/sources/android-ndk.zip -d ${ANDROID_NDK_HOME}/ +# remove the intermediate versioned directory +mv ${ANDROID_NDK_HOME}/*/* ${ANDROID_NDK_HOME}/ + +curl -o /android/sources/android-sdk-tools.zip https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip +unzip /android/sources/android-sdk-tools.zip -d ${ANDROID_HOME}/ +mkdir -p ${ANDROID_HOME}/licenses + +# Accept licenses. Values taken from: +# $ANDROID_HOME/tools/bin/sdkmanager --sdk_root=$ANDROID_HOME --licenses +# cd $ANDROID_HOME +# for f in licenses/*; do echo "echo \"$(cat $f | tr -d '\n')\" > \${ANDROID_HOME}/$f"; done +echo "601085b94cd77f0b54ff86406957099ebe79c4d6" > ${ANDROID_HOME}/licenses/android-googletv-license +echo "859f317696f67ef3d7f30a50a5560e7834b43903" > ${ANDROID_HOME}/licenses/android-sdk-arm-dbt-license +echo "24333f8a63b6825ea9c5514f83c2829b004d1fee" > ${ANDROID_HOME}/licenses/android-sdk-license +echo "84831b9409646a918e30573bab4c9c91346d8abd" > ${ANDROID_HOME}/licenses/android-sdk-preview-license +echo "33b6a2b64607f11b759f320ef9dff4ae5c47d97a" > ${ANDROID_HOME}/licenses/google-gdk-license +echo "e9acab5b5fbb560a72cfaecce8946896ff6aab9d" > ${ANDROID_HOME}/licenses/mips-android-sysimage-license + +# pre-cache deps +export GSTREAMER_ROOT_ANDROID=/android/sources/gstreamer-android +curl -o /android/sources/gstreamer-android.tar.xz https://gstreamer.freedesktop.org/data/pkg/android/1.16.2/gstreamer-1.0-android-universal-1.16.2.tar.xz +mkdir $GSTREAMER_ROOT_ANDROID +tar -xvf /android/sources/gstreamer-android.tar.xz -C $GSTREAMER_ROOT_ANDROID +ls $GSTREAMER_ROOT_ANDROID + +git clone -b ${DEFAULT_BRANCH} https://gitlab.freedesktop.org/gstreamer/gstreamer.git /android/sources/gstreamer +export GSTREAMER_ROOT=/android/sources/gstreamer/subprojects + +chmod +x $GSTREAMER_ROOT/gst-examples/playback/player/android/gradlew +$GSTREAMER_ROOT/gst-examples/playback/player/android/gradlew --no-daemon --project-dir $GSTREAMER_ROOT/gst-examples/playback/player/android dependencies --refresh-dependencies + +chmod +x $GSTREAMER_ROOT/gst-examples/vulkan/android/gradlew +$GSTREAMER_ROOT/gst-examples/vulkan/android/gradlew --no-daemon --project-dir $GSTREAMER_ROOT/gst-examples/vulkan/android dependencies --refresh-dependencies + +chmod +x $GSTREAMER_ROOT/gst-docs/examples/tutorials/android/gradlew +$GSTREAMER_ROOT/gst-docs/examples/tutorials/android/gradlew --no-daemon --project-dir $GSTREAMER_ROOT/gst-docs/examples/tutorials/android dependencies --refresh-dependencies + +unset GSTREAMER_ROOT_ANDROID + +rm -rf /android/sources diff --git a/ci/docker_setup.sh b/ci/docker_setup.sh new file mode 100755 index 000000000..fae3329c2 --- /dev/null +++ b/ci/docker_setup.sh @@ -0,0 +1,23 @@ +#! /bin/bash + +set -e + +git config --global user.email "cerbero@gstreamer.freedesktop.org" +git config --global user.name "Cerbero Build System" + +mkdir $HOME/.cerbero +echo "allow_parallel_build=True" > $HOME/.cerbero/cerbero.cbc +echo "use_ccache=True" >> $HOME/.cerbero/cerbero.cbc +echo "local_sources=\"/cerbero-sources\"" >> localconf.cbc +echo "home_dir=\"/cerbero-build\"" >> localconf.cbc +./cerbero-uninstalled -t -c localconf.cbc fetch-bootstrap --jobs=4 +./cerbero-uninstalled -t -c localconf.cbc fetch-package --jobs=4 gstreamer-1.0 +./cerbero-uninstalled -t -c localconf.cbc bootstrap -y --build-tools=no --toolchains=no +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-win32.cbc fetch-bootstrap --jobs=4 +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-win32.cbc fetch-package --jobs=4 gstreamer-1.0 +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-win64.cbc fetch-bootstrap --jobs=4 +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-win64.cbc fetch-package --jobs=4 gstreamer-1.0 +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-android-universal.cbc fetch-bootstrap --jobs=4 +./cerbero-uninstalled -t -c localconf.cbc -c config/cross-android-universal.cbc fetch-package --jobs=4 gstreamer-1.0 +rm -rf /cerbero-build/{dist,logs,sources} +rm -f /cerbero-build/{linux,windows,android}*.cache From 714cdd608692bf6db2382a3b7ce1eba85bf1e9f7 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 28 Sep 2021 18:46:11 +0900 Subject: [PATCH 26/53] gst-plugins-bad: Ship libgstwinrt-1.0 when wasapi2 plugin is enabled Now wasapi2 plugin (and UWP version mediafoundation plugin) will require the library. Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 2 ++ 1 file changed, 2 insertions(+) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 8ab9cf232..6a87afbbc 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -496,6 +496,8 @@ class Recipe(custom.GStreamer): else: # requires at least Visual Studio 2017 self.enable_plugin('wasapi2', 'sys', 'visualstudio') + # This dll is used by wasapi2 and mediafoundation UWP build + self.files_libs += ['libgstwinrt-1.0'] if self.meson_options['d3d11'] == 'enabled': self.files_libs += ['libgstd3d11-1.0'] From aeed459ca3b963a553a4f709691bb4a277a6cb59 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 1 Oct 2021 11:29:38 -0400 Subject: [PATCH 27/53] Bump windows docker to lastest from gstreamer/ repo The v13 TLS cerficate are now too old for our cache server to work. As a side effect we fail to retrieve cerbero deps which makes our CI very slow. 0:00:01.547000 WARNING: Could not get cache list: Failed to download 'https://artifacts.gstreamer-foundation.net/cerbero-deps/main/windows-msvc/x86_64/cerbero-deps.log': ('https://artifacts.gstreamer-foundation.net/cerbero-deps/main/windows-msvc/x86_64/cerbero-deps.log', URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1124)'))) Part-of: --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dcbcb04da..534c5ce31 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,7 +12,7 @@ variables: CI_GSTREAMER_REF_NAME: 'main' CI_GSTREAMER_URL: 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git' GST_UPSTREAM_BRANCH: 'main' - WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v13-master' + WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gstreamer/amd64/windows:2021-10-01.0-master' DEFAULT_CERBERO_ARGS: > --variants werror --timestamps From 59bd91bbca8a1b24ead179708a7c7a89cfa843ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Thu, 23 Sep 2021 15:24:23 +0200 Subject: [PATCH 28/53] boostrap: remove sudo as root user If the user is root, no need for sudo with package manager. Part-of: --- cerbero/bootstrap/linux.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cerbero/bootstrap/linux.py b/cerbero/bootstrap/linux.py index 4ac9e0aca..e1e67dfdd 100644 --- a/cerbero/bootstrap/linux.py +++ b/cerbero/bootstrap/linux.py @@ -20,7 +20,7 @@ from cerbero.bootstrap.bootstrapper import register_system_bootstrapper from cerbero.enums import Platform, Architecture, Distro, DistroVersion from cerbero.errors import ConfigurationError -from cerbero.utils import shell +from cerbero.utils import user_is_root, shell from cerbero.utils import messages as m import shlex @@ -37,6 +37,8 @@ class UnixBootstrapper (BootstrapperBase): def __init__(self, config, offline, assume_yes): BootstrapperBase.__init__(self, config, offline) self.assume_yes = assume_yes + if user_is_root() and 'sudo' in self.tool: # no need for sudo as root user + self.tool.remove('sudo') def start(self, jobs=0): for c in self.checks: @@ -127,6 +129,8 @@ def __init__(self, config, offline, assume_yes): self.packages.append('glibc.i686') if self.config.distro_version in [DistroVersion.FEDORA_24, DistroVersion.FEDORA_25]: self.packages.append('libncurses-compat-libs.i686') + if user_is_root(): + return # Use sudo to gain root access on everything except RHEL if self.config.distro_version == DistroVersion.REDHAT_6: self.tool = ['su', '-c', shlex.join(self.tool)] From 003dd60a25e1b9391583ddc52053b0f5a208af2f Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Wed, 6 Oct 2021 15:20:37 +0530 Subject: [PATCH 29/53] cerbero: Don't close stdin for interactive bootstrap Unless -y/--assume-yes is passed to bootstrap, the package manager will prompt you to install packages. Even if you pass -y, some deb packages are interactive, such as tzdata. Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/325 Part-of: --- cerbero/bootstrap/linux.py | 2 +- cerbero/utils/shell.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cerbero/bootstrap/linux.py b/cerbero/bootstrap/linux.py index e1e67dfdd..48368850a 100644 --- a/cerbero/bootstrap/linux.py +++ b/cerbero/bootstrap/linux.py @@ -56,7 +56,7 @@ def start(self, jobs=0): tool += self.command; cmd = tool + self.packages m.message("Running command '%s'" % ' '.join(cmd)) - shell.new_call(cmd) + shell.new_call(cmd, interactive=True) class DebianBootstrapper (UnixBootstrapper): diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 3682e2148..961542d22 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -181,17 +181,21 @@ def check_output(cmd, cmd_dir=None, fail=True, logfile=None, env=None, quiet=Fal return o -def new_call(cmd, cmd_dir=None, fail=True, logfile=None, env=None, verbose=False): +def new_call(cmd, cmd_dir=None, fail=True, logfile=None, env=None, verbose=False, interactive=False): cmd = _cmd_string_to_array(cmd, env) if logfile: logfile.write('Running command {!r}\n'.format(cmd)) logfile.flush() if verbose: m.message('Running {!r}\n'.format(cmd)) + if not interactive: + stdin = subprocess.DEVNULL + else: + stdin = None try: subprocess.check_call(cmd, cwd=cmd_dir, env=env, stdout=logfile, stderr=subprocess.STDOUT, - stdin=subprocess.DEVNULL) + stdin=stdin) except SUBPROCESS_EXCEPTIONS as e: returncode = getattr(e, 'returncode', -1) if not fail: From 3adb4eefa8adb611f2e86902ab641415bd1bb129 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 23 Sep 2021 16:17:55 +0530 Subject: [PATCH 30/53] openssl.recipe: Fix crash on iOS TestFlight Don't try to look for a portable ca cert when running on anything other than macOS, since there's no portable prefix there at all. All libraries and plugins are usually linked statically into the app. Fixes https://gitlab.freedesktop.org/gstreamer/cerbero/-/issues/342 Part-of: --- ...ate.crt-from-PREFIX-etc-ssl-on-macOS.patch | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch b/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch index 421bb6b89..ebeef746d 100644 --- a/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch +++ b/recipes/openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch @@ -1,15 +1,15 @@ -From 903e3b9db2a2425a75f36df4edcc40876e9a0ada Mon Sep 17 00:00:00 2001 -From: Cerbero Build System -Date: Tue, 31 Mar 2020 12:41:07 +0530 +From 4f2c094d92bb5d16029333699dabad894e252e9b Mon Sep 17 00:00:00 2001 +From: Nirbheek Chauhan +Date: Thu, 23 Sep 2021 16:16:08 +0530 Subject: [PATCH] Load ca-certificate.crt from PREFIX/etc/ssl on macOS and Windows PREFIX is automatically detected based on the location of the crypto library. --- - crypto/dllmain.c | 31 +++++++++++++++++++++++++++++++ - crypto/x509/by_file.c | 41 ++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 71 insertions(+), 1 deletion(-) + crypto/dllmain.c | 31 +++++++++++++++++++++++++++ + crypto/x509/by_file.c | 50 ++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/crypto/dllmain.c b/crypto/dllmain.c index e821789..67568e3 100644 @@ -61,17 +61,26 @@ index e821789..67568e3 100644 case DLL_THREAD_ATTACH: break; diff --git a/crypto/x509/by_file.c b/crypto/x509/by_file.c -index 237b362..25ce782 100644 +index 237b362..5f67759 100644 --- a/crypto/x509/by_file.c +++ b/crypto/x509/by_file.c -@@ -17,6 +17,40 @@ +@@ -17,6 +17,49 @@ #include #include "x509_local.h" ++// We only want to look for portable ca certificates when running on macOS, ++// not on iPhone, watchOS, tvOS, a simulator, etc. ++#ifdef __APPLE__ ++#include "TargetConditionals.h" ++#if TARGET_OS_OSX ++#define WANT_PORTABLE_CERT_FILE_DLADDR ++#endif ++#endif ++ +#ifdef _WIN32 +/* defined in crypto/dllmain.c */ +char* _get_portable_X509_cert_file (void); -+#elif defined(__APPLE__) ++#elif defined(WANT_PORTABLE_CERT_FILE_DLADDR) +#include +char * +_get_portable_X509_cert_file (void) @@ -105,7 +114,7 @@ index 237b362..25ce782 100644 static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc, long argl, char **ret); static X509_LOOKUP_METHOD x509_file_lookup = { -@@ -46,11 +80,15 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, +@@ -46,11 +89,15 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, switch (cmd) { case X509_L_FILE_LOAD: if (argl == X509_FILETYPE_DEFAULT) { @@ -122,7 +131,7 @@ index 237b362..25ce782 100644 else ok = (X509_load_cert_crl_file (ctx, X509_get_default_cert_file(), -@@ -59,6 +97,7 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, +@@ -59,6 +106,7 @@ static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, if (!ok) { X509err(X509_F_BY_FILE_CTRL, X509_R_LOADING_DEFAULTS); } @@ -131,5 +140,5 @@ index 237b362..25ce782 100644 if (argl == X509_FILETYPE_PEM) ok = (X509_load_cert_crl_file(ctx, argp, -- -2.21.1 (Apple Git-122.3) +2.31.1 From f9c1ff37b8dc13381cde21afc35265827b2e4053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Wed, 6 Oct 2021 18:39:38 +0200 Subject: [PATCH 31/53] gstreamer: disable git submodule init To avoid to download useless test media folder, disable the submodule init during the GStreamer's recipes. Part-of: --- cerbero/build/source.py | 6 ++++-- cerbero/utils/git.py | 5 +++-- recipes/custom.py | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cerbero/build/source.py b/cerbero/build/source.py index 671f2c430..87f6c5179 100644 --- a/cerbero/build/source.py +++ b/cerbero/build/source.py @@ -304,6 +304,7 @@ class GitCache (Source): remotes = None commit = None + use_submodules = True _fetch_locks = collections.defaultdict(asyncio.Lock) _fetch_done = set() @@ -365,7 +366,8 @@ async def fetch_impl(self, checkout): await git.fetch(self.repo_dir, fail=False, logfile=get_logfile(self)) if checkout: await git.checkout(self.repo_dir, self.commit, logfile=get_logfile(self)) - await git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline, logfile=get_logfile(self)) + if self.use_submodules: + await git.submodules_update(self.repo_dir, cached_dir, fail=False, offline=self.offline, logfile=get_logfile(self)) def built_version(self): @@ -409,7 +411,7 @@ async def extract_impl(self): os.makedirs(self.config_src_dir) # checkout the current version - await git.local_checkout(self.config_src_dir, self.repo_dir, self.commit, logfile=get_logfile(self)) + await git.local_checkout(self.config_src_dir, self.repo_dir, self.commit, logfile=get_logfile(self), use_submodules=self.use_submodules) for patch in self.patches: if not os.path.isabs(patch): diff --git a/cerbero/utils/git.py b/cerbero/utils/git.py index 4b25c1e79..8807f15a1 100644 --- a/cerbero/utils/git.py +++ b/cerbero/utils/git.py @@ -208,7 +208,7 @@ def get_hash(git_dir, commit, logfile=None): fail=False, quiet=True, logfile=logfile).rstrip() -async def local_checkout(git_dir, local_git_dir, commit, logfile=None): +async def local_checkout(git_dir, local_git_dir, commit, logfile=None, use_submodules=True): ''' Clone a repository for a given commit in a different location @@ -224,7 +224,8 @@ async def local_checkout(git_dir, local_git_dir, commit, logfile=None): await shell.async_call([GIT, 'clone', local_git_dir, '-s', '-b', branch_name, '.'], git_dir, logfile=logfile) ensure_user_is_set(git_dir, logfile=logfile) - await submodules_update(git_dir, local_git_dir, logfile=logfile) + if use_submodules: + await submodules_update(git_dir, local_git_dir, logfile=logfile) def add_remote(git_dir, name, url, logfile=None): ''' diff --git a/recipes/custom.py b/recipes/custom.py index 49db912af..34a8b1f17 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -55,6 +55,9 @@ def __init__(self, config, env): # git repository. self.commit = self.config.recipe_commit('gstreamer-1.0') or self.commit self.remotes.update(self.config.recipes_remotes.get('gstreamer-1.0', {})) + # gst-integrations-testsuite medias folder is the only submodule in GStreamer repository, + # disable the submodule to avoid to download more than 500MB of test medias. + self.use_submodules = False def enable_plugin(self, plugin, category, variant, option=None, dep=None): if option is None: From ffe4f36ad275503496830fe83648a4cb3fef2248 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Thu, 23 Sep 2021 19:25:54 +0530 Subject: [PATCH 32/53] Revert "recipes: Add patches to fix UWP build" This reverts commit 6b999a498626b021fb3d3c3764833516cec4a248. The relevant patches have been merged. https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/890 https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2545 Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 2 -- ...on-Fix-build-with-Dopenjpeg-disabled.patch | 35 ------------------- recipes/gstreamer-1.0.recipe | 2 -- ...01-meson-Fix-gst-launch-build-on-UWP.patch | 28 --------------- 4 files changed, 67 deletions(-) delete mode 100644 recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch delete mode 100644 recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 6a87afbbc..b70b86152 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -545,8 +545,6 @@ class Recipe(custom.GStreamer): self.disable_plugin('ladspa', 'effects', dep='ladspa') self.disable_plugin('mms', 'net_restricted', option='libmms', dep='libmms') self.disable_plugin('openjpeg', 'codecs', dep='openjpeg') - # https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2545 - self.patches = [self.name + '/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch'] self.disable_plugin('rtmp', 'net_restricted', option='rtmp', dep='librtmp') self.disable_plugin('sbc', 'codecs', dep='sbc') self.disable_plugin('spandsp', 'codecs', dep='spandsp') diff --git a/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch b/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch deleted file mode 100644 index 354bc867f..000000000 --- a/recipes/gst-plugins-bad-1.0/0001-meson-Fix-build-with-Dopenjpeg-disabled.patch +++ /dev/null @@ -1,35 +0,0 @@ -From cdd8b377a9f5817228b4cf507a8f40f4032a8d9c Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 23 Sep 2021 17:36:20 +0530 -Subject: [PATCH] meson: Fix build with -Dopenjpeg=disabled - -tests/check/meson.build uses the openjpeg_dep variable -unconditionally, and the subdir_done() is useless anyway, since the -plugin is only built if openjpeg_dep.found() is true. Fixes: - -..\tests\check\meson.build:23:0: ERROR: Unknown variable "openjpeg_dep". - -In particular, this fixes the build on UWP since we disable openjpeg -explicitly in Cerbero when building for UWP. ---- - ext/openjpeg/meson.build | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/ext/openjpeg/meson.build b/ext/openjpeg/meson.build -index 822f2c94f..94597fb16 100644 ---- a/ext/openjpeg/meson.build -+++ b/ext/openjpeg/meson.build -@@ -6,10 +6,6 @@ openjpeg_sources = [ - - openjpeg_cargs = [] - --if get_option('openjpeg').disabled() -- subdir_done() --endif -- - openjpeg_dep = dependency('libopenjp2', version : '>=2.2', - fallback : ['libopenjp2', 'libopenjp2_dep'], - required : get_option('openjpeg')) --- -2.33.0.windows.2 - diff --git a/recipes/gstreamer-1.0.recipe b/recipes/gstreamer-1.0.recipe index bf13fec32..14982deef 100644 --- a/recipes/gstreamer-1.0.recipe +++ b/recipes/gstreamer-1.0.recipe @@ -72,8 +72,6 @@ class Recipe(custom.GStreamer): if self.using_msvc(): if self.config.variants.uwp: - # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/890 - self.patches = [self.name + '/0001-meson-Fix-gst-launch-build-on-UWP.patch'] # Most symbols in DbgHelp.h are not allowed for UWP self.meson_options['dbghelp'] = 'disabled' else: diff --git a/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch b/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch deleted file mode 100644 index e3dce3e24..000000000 --- a/recipes/gstreamer-1.0/0001-meson-Fix-gst-launch-build-on-UWP.patch +++ /dev/null @@ -1,28 +0,0 @@ -From c68bfffa1aaa813763e1eb5b1ffced6ebf66a817 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 23 Sep 2021 17:07:09 +0530 -Subject: [PATCH] meson: Fix gst-launch build on UWP - -The APIs we need from WinMM for higher timer resolution are only -available for non-UWP apps. The winmm library itself is still -available, so we need to disable the check. ---- - tools/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tools/meson.build b/tools/meson.build -index e22721d9d..c5bf4f9a0 100644 ---- a/tools/meson.build -+++ b/tools/meson.build -@@ -4,7 +4,7 @@ extra_launch_dep = [] - extra_launch_arg = [] - - if gst_parse -- if host_system == 'windows' -+ if host_system == 'windows' and not building_for_uwp - winmm_lib = cc.find_library('winmm', required: false) - if winmm_lib.found() and cc.has_header('timeapi.h') - extra_launch_dep += [winmm_lib] --- -2.33.0.windows.2 - From 37295cb1a7425affbb83ad6eb168faf456cb46b8 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Tue, 12 Oct 2021 13:07:07 +0530 Subject: [PATCH 33/53] meson.recipe: Bump to 0.59.2 Part-of: --- recipes/build-tools/meson.recipe | 7 +-- ...ass-absolute-L-paths-to-g-ir-scanner.patch | 45 ------------------- 2 files changed, 2 insertions(+), 50 deletions(-) delete mode 100644 recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch diff --git a/recipes/build-tools/meson.recipe b/recipes/build-tools/meson.recipe index b6c136c24..af6b25ba7 100644 --- a/recipes/build-tools/meson.recipe +++ b/recipes/build-tools/meson.recipe @@ -5,15 +5,12 @@ from pathlib import PurePath, Path class Recipe(recipe.Recipe): name = 'meson' - version = '0.58.1' + version = '0.59.2' licenses = [License.Apachev2] btype = BuildType.CUSTOM stype = SourceType.TARBALL url = 'https://github.com/mesonbuild/meson/releases/download/%(version)s/meson-%(version)s.tar.gz' - tarball_checksum = '3144a3da662fcf79f1e5602fa929f2821cba4eba28c2c923fe0a7d3e3db04d5d' - - # https://github.com/mesonbuild/meson/pull/8993 - patches = [name + '/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch'] + tarball_checksum = '13dee549a7ba758b7e33ce7719f28d1d337a98d10d378a4779ccc996f5a2fc49' deps = ['ninja'] diff --git a/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch b/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch deleted file mode 100644 index a1697af6c..000000000 --- a/recipes/build-tools/meson/0001-gnome-Always-pass-absolute-L-paths-to-g-ir-scanner.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7747a4bb8867aa87dff82584289495a52c3b38c4 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Wed, 14 Jul 2021 17:37:39 +0530 -Subject: [PATCH] gnome: Always pass absolute -L paths to g-ir-scanner - -g-ir-scanner does not convert relative -L paths to runtime paths which -are added to -Wl,-rpath and LD_LIBRARY_PATH / DYLD_LIBRARY_PATH -/ PATH. This means that the local library will either not be found at -runtime (while building introspection data), or the system-wide -library will be picked instead. - -See: giscanner/ccompiler.py:get_internal_link_flags() in -gobject-introspection for more details. ---- - mesonbuild/modules/gnome.py | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py -index 1b68f6ccd..3cc8ebdc8 100644 ---- a/mesonbuild/modules/gnome.py -+++ b/mesonbuild/modules/gnome.py -@@ -640,14 +640,18 @@ class GnomeModule(ExtensionModule): - # Because of https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/72 - # we can't use the full path until this is merged. - libpath = os.path.join(girtarget.get_subdir(), girtarget.get_filename()) -+ # Must use absolute paths here because g-ir-scanner will not -+ # add them to the runtime path list if they're relative. This -+ # means we cannot use @BUILD_ROOT@ -+ build_root = state.environment.get_build_dir() - if isinstance(girtarget, build.SharedLibrary): - # need to put our output directory first as we need to use the - # generated libraries instead of any possibly installed system/prefix - # ones. -- ret += ["-L@BUILD_ROOT@/{}".format(os.path.dirname(libpath))] -+ ret += ["-L{}/{}".format(build_root, os.path.dirname(libpath))] - libname = girtarget.get_basename() - else: -- libname = os.path.join(f"@BUILD_ROOT@/{libpath}") -+ libname = os.path.join(f"{build_root}/{libpath}") - ret += ['--library', libname] - # Needed for the following binutils bug: - # https://github.com/mesonbuild/meson/issues/1911 --- -2.31.1 - From 629c9308b73770697580a1d2a7bf807291747bc8 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Fri, 15 Oct 2021 19:54:20 +0900 Subject: [PATCH 34/53] cerbero: Fix for removed loop param of PriorityQueue() It's deprecated since 3.8 and causes hard error as of 3.10 Part-of: --- cerbero/build/oven.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cerbero/build/oven.py b/cerbero/build/oven.py index f1d9c5afe..e03326a44 100644 --- a/cerbero/build/oven.py +++ b/cerbero/build/oven.py @@ -316,8 +316,7 @@ async def build_recipe_steps(step): all_steps = ["init"] + [s[1] for s in next(iter(recipes)).steps] # async queues used for each step - loop = asyncio.get_event_loop() - default_queue = asyncio.PriorityQueue(loop=loop) + default_queue = asyncio.PriorityQueue() queues = {step : default_queue for step in all_steps} # find the install steps for ensuring consistency between all of them @@ -330,7 +329,7 @@ async def build_recipe_steps(step): # allocate jobs job_allocation = collections.defaultdict(lambda : 0) if self.jobs > 4: - queues[BuildSteps.COMPILE[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.COMPILE[1]] = asyncio.PriorityQueue() job_allocation[BuildSteps.COMPILE[1]] = 2 if self.jobs > 5: job_allocation[BuildSteps.COMPILE[1]] = 3 @@ -340,7 +339,7 @@ async def build_recipe_steps(step): # the job allocation since we can run more of them in parallel job_allocation[BuildSteps.COMPILE[1]] = self.jobs // 2 if self.jobs > 7: - install_queue = asyncio.PriorityQueue(loop=loop) + install_queue = asyncio.PriorityQueue() for step in install_steps: queues[step] = install_queue job_allocation[BuildSteps.INSTALL[1]] = 1 @@ -350,13 +349,13 @@ async def build_recipe_steps(step): # fast, so we shouldn't parallelize. if self.config.platform != Platform.WINDOWS: job_allocation[BuildSteps.EXTRACT[1]] = 1 - queues[BuildSteps.EXTRACT[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.EXTRACT[1]] = asyncio.PriorityQueue() if self.jobs > 9: # Two jobs is the same allocation as fetch-package/bootstrap, which # is a good idea to avoid getting bottlenecked if one of the # download mirrors is slow. job_allocation[BuildSteps.FETCH[1]] = 2 - queues[BuildSteps.FETCH[1]] = asyncio.PriorityQueue(loop=loop) + queues[BuildSteps.FETCH[1]] = asyncio.PriorityQueue() # async locks used to synchronize step execution locks = collections.defaultdict(lambda : None) From 6112a9562fd39c30890e7ef4a6ed12e2bee3971c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Oct 2021 00:48:59 +0100 Subject: [PATCH 35/53] recipe: gst-plugins-bad: assrender is not GPL The plugin is LGPL and the library is ISC these days which is BSD/MIT-like. It was relicensed from GPL to ISC in 2010, see https://github.com/libass/libass/commit/56b0b944 Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index b70b86152..335fd6dbe 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -198,6 +198,7 @@ class Recipe(custom.GStreamer): files_plugins_codecs = [ 'lib/gstreamer-1.0/libgstadpcmdec%(mext)s', 'lib/gstreamer-1.0/libgstadpcmenc%(mext)s', + 'lib/gstreamer-1.0/libgstassrender%(mext)s', 'lib/gstreamer-1.0/libgstbz2%(mext)s', 'lib/gstreamer-1.0/libgstdash%(mext)s', 'lib/gstreamer-1.0/libgstdvbsuboverlay%(mext)s', @@ -230,6 +231,7 @@ class Recipe(custom.GStreamer): files_plugins_codecs_devel = [ 'lib/gstreamer-1.0/libgstadpcmdec.a', 'lib/gstreamer-1.0/libgstadpcmdec.la', 'lib/gstreamer-1.0/libgstadpcmenc.a', 'lib/gstreamer-1.0/libgstadpcmenc.la', + 'lib/gstreamer-1.0/libgstassrender.a', 'lib/gstreamer-1.0/libgstassrender.la', 'lib/gstreamer-1.0/libgstbz2.a', 'lib/gstreamer-1.0/libgstbz2.la', 'lib/gstreamer-1.0/libgstdash.a', 'lib/gstreamer-1.0/libgstdash.la', 'lib/gstreamer-1.0/libgstdvbsuboverlay.a', 'lib/gstreamer-1.0/libgstdvbsuboverlay.la', @@ -272,11 +274,9 @@ class Recipe(custom.GStreamer): } files_plugins_codecs_gpl = [ - 'lib/gstreamer-1.0/libgstassrender%(mext)s', ] files_plugins_codecs_gpl_devel = [ - 'lib/gstreamer-1.0/libgstassrender.a', 'lib/gstreamer-1.0/libgstassrender.la', ] files_plugins_codecs_restricted = [ From a9ccba61623b112decfc5538e8d3d941b48a4cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Fri, 1 Oct 2021 12:08:33 +0200 Subject: [PATCH 36/53] libffi: use fdo meson port repository Use the meson port repository branch from FDO gitlab. Part-of: --- recipes/libffi.recipe | 5 +- .../libffi-port-to-meson-and-msvc.patch | 5040 ----------------- 2 files changed, 2 insertions(+), 5043 deletions(-) delete mode 100644 recipes/libffi/libffi-port-to-meson-and-msvc.patch diff --git a/recipes/libffi.recipe b/recipes/libffi.recipe index cbeb2f353..d33b5c85f 100644 --- a/recipes/libffi.recipe +++ b/recipes/libffi.recipe @@ -4,11 +4,10 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'libffi' version = '3.2.9999' - remotes = {'origin': 'https://github.com/{0}/{0}.git'.format(name)} - commit = '369ef49f71186fc9d6ab15614488ad466fac3fc1' + remotes = {'origin': 'https://gitlab.freedesktop.org/gstreamer/meson-ports/{0}.git'.format(name)} + commit = 'meson-3.2.9999.3' licenses = [{License.BSD_like: ['LICENSE']}] btype = BuildType.MESON - patches = [name + '/libffi-port-to-meson-and-msvc.patch'] files_libs = ['libffi'] files_devel = ['include/ffi*.h', 'lib/pkgconfig/libffi.pc'] diff --git a/recipes/libffi/libffi-port-to-meson-and-msvc.patch b/recipes/libffi/libffi-port-to-meson-and-msvc.patch deleted file mode 100644 index e52c534e8..000000000 --- a/recipes/libffi/libffi-port-to-meson-and-msvc.patch +++ /dev/null @@ -1,5040 +0,0 @@ -From 697e809e646f59b6c1a70231e74553dd1ce18b72 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Mon, 28 Mar 2016 20:34:48 +0530 -Subject: [PATCH 01/32] Port to the Meson build system - -Also fixes some inconsistency between usage of #ifdef and #if inside C macros -Include support for universal builds and multilib builds via suffixed -arch-specific headers in ${prefix}/include + various other fixes. ---- - fficonfig.h.meson | 161 +++++++++++++++++++++++++ - include/ffi_common.h | 6 +- - include/ffi_noarch.h.meson | 21 ++++ - include/meson.build | 29 +++++ - libffi.pc.in | 4 +- - meson.build | 218 ++++++++++++++++++++++++++++++++++ - meson_options.txt | 11 ++ - src/meson.build | 234 +++++++++++++++++++++++++++++++++++++ - 8 files changed, 678 insertions(+), 6 deletions(-) - create mode 100644 fficonfig.h.meson - create mode 100644 include/ffi_noarch.h.meson - create mode 100644 include/meson.build - create mode 100644 meson.build - create mode 100644 meson_options.txt - create mode 100644 src/meson.build - -diff --git a/fficonfig.h.meson b/fficonfig.h.meson -new file mode 100644 -index 0000000..a882290 ---- /dev/null -+++ b/fficonfig.h.meson -@@ -0,0 +1,161 @@ -+/* fficonfig.h.in. Generated from configure.ac by autoheader. */ -+ -+/* Define if building universal (internal helper macro) */ -+#mesondefine AC_APPLE_UNIVERSAL_BUILD -+ -+/* Define to the flags needed for the .section .eh_frame directive. */ -+#mesondefine EH_FRAME_FLAGS -+ -+/* Define this if you want extra debugging. */ -+#mesondefine FFI_DEBUG -+ -+/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ -+#mesondefine FFI_EXEC_TRAMPOLINE_TABLE -+ -+/* Define this if you want to enable pax emulated trampolines */ -+#mesondefine FFI_MMAP_EXEC_EMUTRAMP_PAX -+ -+/* Cannot use malloc on this target, so, we revert to alternative means */ -+#mesondefine FFI_MMAP_EXEC_WRIT -+ -+/* Define this if you do not want support for the raw API. */ -+#mesondefine FFI_NO_RAW_API -+ -+/* Define this if you do not want support for aggregate types. */ -+#mesondefine FFI_NO_STRUCTS -+ -+/* Define to 1 if you have `alloca', as a function or macro. */ -+#mesondefine HAVE_ALLOCA -+ -+/* Define to 1 if you have and it should be used */ -+#mesondefine HAVE_ALLOCA_H -+ -+/* Define if your assembler supports .ascii. */ -+#mesondefine HAVE_AS_ASCII_PSEUDO_OP -+ -+/* Define if your assembler supports .cfi_* directives. */ -+#mesondefine HAVE_AS_CFI_PSEUDO_OP -+ -+/* Define if your assembler supports .register. */ -+#mesondefine HAVE_AS_REGISTER_PSEUDO_OP -+ -+/* Define if your assembler and linker support unaligned PC relative relocs. -+ */ -+#mesondefine HAVE_AS_SPARC_UA_PCREL -+ -+/* Define if your assembler supports .string. */ -+#mesondefine HAVE_AS_STRING_PSEUDO_OP -+ -+/* Define if your assembler supports unwind section type. */ -+#mesondefine HAVE_AS_X86_64_UNWIND_SECTION_TYPE -+ -+/* Define if your assembler supports PC relative relocs. */ -+#mesondefine HAVE_AS_X86_PCREL -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_DLFCN_H -+ -+/* Define if __attribute__((visibility("hidden"))) is supported. */ -+#mesondefine HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_INTTYPES_H -+ -+/* Define if you have the long double type and it is bigger than a double */ -+#mesondefine HAVE_LONG_DOUBLE -+ -+/* Define if you support more than one size of the long double type */ -+#mesondefine HAVE_LONG_DOUBLE_VARIANT -+ -+/* Define to 1 if you have the `memcpy' function. */ -+#mesondefine HAVE_MEMCPY -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_MEMORY_H -+ -+/* Define to 1 if you have the `mkostemp' function. */ -+#mesondefine HAVE_MKOSTEMP -+ -+/* Define to 1 if you have the `mmap' function. */ -+#mesondefine HAVE_MMAP -+ -+/* Define if mmap with MAP_ANON(YMOUS) works. */ -+#mesondefine HAVE_MMAP_ANON -+ -+/* Define if mmap of /dev/zero works. */ -+#mesondefine HAVE_MMAP_DEV_ZERO -+ -+/* Define if read-only mmap of a plain file works. */ -+#mesondefine HAVE_MMAP_FILE -+ -+/* Define if .eh_frame sections should be read-only. */ -+#mesondefine HAVE_RO_EH_FRAME -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_STDINT_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_STDLIB_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_STRINGS_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_STRING_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_SYS_MMAN_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_SYS_STAT_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_SYS_TYPES_H -+ -+/* Define to 1 if you have the header file. */ -+#mesondefine HAVE_UNISTD_H -+ -+/* The size of `double', as computed by sizeof. */ -+#mesondefine SIZEOF_DOUBLE -+ -+/* The size of `long double', as computed by sizeof. */ -+#mesondefine SIZEOF_LONG_DOUBLE -+ -+/* The size of `size_t', as computed by sizeof. */ -+#mesondefine SIZEOF_SIZE_T -+ -+/* Define if symbols are underscored. */ -+#mesondefine SYMBOL_UNDERSCORE -+ -+/* Define this if you are using Purify and want to suppress spurious messages. -+ */ -+#mesondefine USING_PURIFY -+ -+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most -+ significant byte first (like Motorola and SPARC, unlike Intel). */ -+#if defined AC_APPLE_UNIVERSAL_BUILD -+#if defined __BIG_ENDIAN__ -+#define WORDS_BIGENDIAN 1 -+#endif -+#else -+#ifndef WORDS_BIGENDIAN -+#mesondefine WORDS_BIGENDIAN -+#endif -+#endif -+ -+/* Define to `unsigned int' if does not define. */ -+#mesondefine size_t -+ -+#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE -+#ifdef LIBFFI_ASM -+#define FFI_HIDDEN(name) .hidden name -+#else -+#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) -+#endif -+#else -+#ifdef LIBFFI_ASM -+#define FFI_HIDDEN(name) -+#else -+#define FFI_HIDDEN -+#endif -+#endif -diff --git a/include/ffi_common.h b/include/ffi_common.h -index 7fb0a64..79d71f6 100644 ---- a/include/ffi_common.h -+++ b/include/ffi_common.h -@@ -48,12 +48,10 @@ char *alloca (); - #endif - - /* Check for the existence of memcpy. */ --#if STDC_HEADERS -+#if HAVE_MEMCPY - # include - #else --# ifndef HAVE_MEMCPY --# define memcpy(d, s, n) bcopy ((s), (d), (n)) --# endif -+# define memcpy(d, s, n) bcopy ((s), (d), (n)) - #endif - - #if defined(FFI_DEBUG) -diff --git a/include/ffi_noarch.h.meson b/include/ffi_noarch.h.meson -new file mode 100644 -index 0000000..9994c8d ---- /dev/null -+++ b/include/ffi_noarch.h.meson -@@ -0,0 +1,21 @@ -+/* Include the correct @HEADER@.h automatically. This helps us create prefixes -+ * with multi-lib Linux and OSX/iOS universal builds. To avoid listing all -+ * possible architectures here, we try the configured target arch first and then -+ * include the most common multilib/universal setups in the #elif ladder */ -+#ifdef __@ARCH@__ -+#include "@HEADER@-@ARCH@.h" -+#elif defined(__i386__) || defined(_M_IX86) -+#include "@HEADER@-x86.h" -+#elif defined(__x86_64__) || defined(_M_X64) -+#include "@HEADER@-x86_64.h" -+#elif defined(__arm__) || defined(_M_ARM) -+#include "@HEADER@-arm.h" -+#elif defined(__aarch64__) -+#include "@HEADER@-aarch64.h" -+#elif defined(__powerpc__) || defined(_M_PPC) -+#include "@HEADER@-powerpc.h" -+#elif defined(__powerpc64__) -+#include "@HEADER@-powerpc64.h" -+#else -+#error "Unsupported Architecture" -+#endif -diff --git a/include/meson.build b/include/meson.build -new file mode 100644 -index 0000000..7887bf0 ---- /dev/null -+++ b/include/meson.build -@@ -0,0 +1,29 @@ -+# Install arch-specific ffi.h file as ffi-$ARCH.h -+configure_file(input : 'ffi.h.in', -+ output : 'ffi-@0@.h'.format(host_cpu_family), -+ configuration : ffi_conf, -+ install_dir : 'include') -+ -+# Install arch-specific ffitarget.h as ffitarget-$ARCH.h -+# XXX: Hack to install the header with a different name -+configure_file( -+ input : '../src/@0@/ffitarget.h'.format(arch_subdir), -+ output : 'ffitarget-@0@.h'.format(host_cpu_family), -+ configuration : configuration_data(), -+ install_dir : 'include') -+ -+# Install noarch ffi.h that includes the arch-specific ffi.h header -+ffitarget_h_noarch_conf = configuration_data() -+ffitarget_h_noarch_conf.set('ARCH', host_cpu_family) -+ffitarget_h_noarch_conf.set('HEADER', 'ffitarget') -+configure_file(input : 'ffi_noarch.h.meson', output : 'ffitarget.h', -+ configuration : ffitarget_h_noarch_conf, -+ install_dir : 'include') -+ -+# Install noarch ffitarget.h that includes the arch-specific fftarget.h -+ffi_h_noarch_conf = configuration_data() -+ffi_h_noarch_conf.set('ARCH', host_cpu_family) -+ffi_h_noarch_conf.set('HEADER', 'ffi') -+configure_file(input : 'ffi_noarch.h.meson', output : 'ffi.h', -+ configuration : ffi_h_noarch_conf, -+ install_dir : 'include') -diff --git a/libffi.pc.in b/libffi.pc.in -index 6fad83b..c511efe 100644 ---- a/libffi.pc.in -+++ b/libffi.pc.in -@@ -4,8 +4,8 @@ libdir=@libdir@ - toolexeclibdir=@toolexeclibdir@ - includedir=@includedir@ - --Name: @PACKAGE_NAME@ -+Name: libffi - Description: Library supporting Foreign Function Interfaces - Version: @PACKAGE_VERSION@ --Libs: -L${toolexeclibdir} -lffi -+Libs: -L${libdir} -lffi - Cflags: -I${includedir} -diff --git a/meson.build b/meson.build -new file mode 100644 -index 0000000..d5bb2e8 ---- /dev/null -+++ b/meson.build -@@ -0,0 +1,218 @@ -+project('libffi', 'c', version : '3.2.1', -+ meson_version : '>= 0.37.1', -+ default_options : ['buildtype=debugoptimized', -+ 'warning_level=1']) -+ -+cc = meson.get_compiler('c') -+ -+ffi_conf = configuration_data() -+ -+# NOTE: host = "cross" or "target" -+host_cpu_family = host_machine.cpu_family() -+host_system = host_machine.system() -+message('host cpu: ' + host_machine.cpu()) -+message('host cpu_family: ' + host_cpu_family) -+message('host system: ' + host_system) -+ -+# IMPORTANT: Some of these use set(), others set10(), and others only set(, 1) -+# conditionally. This is on purpose. -+# Some C code uses #ifdef HAVE_XXX and some #if !HAVE_XXX. To make things worse, -+# some symbols are also used inside .h.in headers that are configured and then -+# #include-ed at build time and installed. Each symbol has been carefully -+# checked. Please double-check before changing. -+# -+# Nothing checks for STACK_DIRECTION -+ -+if cc.symbols_have_underscore_prefix() -+ ffi_conf.set('SYMBOL_UNDERSCORE', 1) -+endif -+ -+# Assembly directive support -+if cc.compiles('asm (".cfi_startproc\n.cfi_endproc");', name : 'ASM .cfi') -+ ffi_conf.set('HAVE_AS_CFI_PSEUDO_OP', 1) -+endif -+ -+if host_cpu_family == 'sparc' -+ if cc.compiles('asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");', name : 'ASM SPARC UA PCREL') -+ ffi_conf.set('HAVE_AS_SPARC_UA_PCREL', 1) -+ endif -+ if cc.compiles('asm (".register %g2, #scratch");', name : 'ASM .register') -+ ffi_conf.set('HAVE_AS_REGISTER_PSEUDO_OP', 1) -+ endif -+endif -+ -+if host_cpu_family == 'x86' or host_cpu_family == 'x86_64' -+ if cc.compiles('asm (".text; foo: nop; .data; .long foo-.; .text");', name : 'ASM x86 PCREL') -+ ffi_conf.set('HAVE_AS_X86_PCREL', 1) -+ endif -+ if cc.compiles('asm (".ascii \\"string\\"");', name : 'ASM .ascii') -+ ffi_conf.set('HAVE_AS_ASCII_PSEUDO_OP', 1) -+ endif -+ if cc.compiles('asm (".string \\"string\\"");', name : 'ASM .string') -+ ffi_conf.set('HAVE_AS_STRING_PSEUDO_OP', 1) -+ endif -+endif -+ -+# If not defined, define it as unsigned int -+size_t = cc.sizeof('size_t') -+if size_t > 0 -+ ffi_conf.set('SIZEOF_SIZE_T', size_t) -+else -+ message('"size_t" is not defined, using fallback') -+ ffi_conf.set('size_t', 'unsigned int') -+endif -+ -+# Checking for long double is important -+size_long_double = cc.sizeof('long double') -+size_double = cc.sizeof('double') -+ffi_conf.set('SIZEOF_LONG_DOUBLE', size_long_double) -+ffi_conf.set('SIZEOF_DOUBLE', size_double) -+ffi_conf.set('HAVE_LONG_DOUBLE', 0) -+ffi_conf.set('HAVE_LONG_DOUBLE_VARIANT', 0) -+if host_cpu_family == 'alpha' -+ message('"long double" support is detected at compile-time') -+ ffi_conf.set('HAVE_LONG_DOUBLE', 'defined(__LONG_DOUBLE_128__)') -+elif host_cpu_family == 'mips' -+ message('"long double" support is detected at compile-time') -+ ffi_conf.set('HAVE_LONG_DOUBLE', 'defined(__mips64)') -+else -+ if size_long_double > 0 -+ if size_long_double > size_double -+ message('sizeof "long double" is greater than "double"') -+ ffi_conf.set('HAVE_LONG_DOUBLE', 1) -+ if host_cpu_family == 'powerpc' and host_system != 'darwin' -+ message('"long double" size can be different') -+ ffi_conf.set('HAVE_LONG_DOUBLE_VARIANT', 1) -+ endif -+ endif -+ endif -+endif -+ -+# Exception handling frame -+if cc.get_id() == 'gcc' or cc.get_id() == 'llvm' -+ # FIXME: Actually check for this instead of hard-coding it -+ # Also, check if this is actually correct -+ if host_cpu_family == 'x86_64' -+ message('.eh_frame is hard-coded to not be ro') -+ ffi_conf.set('EH_FRAME_FLAGS', '"aw"') -+ else -+ message('.eh_frame is hard-coded to ro') -+ ffi_conf.set('HAVE_RO_EH_FRAME', 1) -+ ffi_conf.set('EH_FRAME_FLAGS', '"a"') -+ endif -+endif -+ -+if host_cpu_family == 'arm' and host_system == 'darwin' -+ message('Cannot use PROT_EXEC on this target, using fallback') -+ ffi_conf.set('FFI_EXEC_TRAMPOLINE_TABLE', 1) -+else -+ ffi_conf.set('FFI_EXEC_TRAMPOLINE_TABLE', 0) -+endif -+ -+if host_system == 'darwin' or host_system == 'openbsd' or host_system == 'freebsd' or host_system == 'solaris' -+ message('Cannot use malloc on this target, using fallback') -+ ffi_conf.set('FFI_MMAP_EXEC_WRIT', 1) -+endif -+ -+if host_cpu_family == 'x86_64' and cc.get_id() != 'msvc' -+ # FIXME: Actually check for this instead of hard-coding it -+ message('Assembler supports .unwind section type') -+ ffi_conf.set('HAVE_AS_X86_64_UNWIND_SECTION_TYPE', 1) -+endif -+ -+# Check mmap() -+if cc.has_function('mmap') -+ ffi_conf.set('HAVE_MMAP', 1) -+endif -+ffi_conf.set('HAVE_MMAP_FILE', 1) # Works everywhere -+ffi_conf.set('HAVE_MMAP_DEV_ZERO', -+ host_system != 'windows' and host_system != 'darwin') -+mmap_anon = '''#include -+#include -+#include -+ -+#ifndef MAP_ANONYMOUS -+#define MAP_ANONYMOUS MAP_ANON -+#endif -+ -+int n = MAP_ANONYMOUS; -+''' -+ffi_conf.set('HAVE_MMAP_ANON', -+ cc.compiles(mmap_anon, name : 'mmap anonymous')) -+ -+# Misc functions -+ffi_conf.set('HAVE_ALLOCA', cc.has_function('alloca')) -+ffi_conf.set10('HAVE_MEMCPY', cc.has_function('memcpy')) -+ffi_conf.set('HAVE_MKOSTEMP', cc.has_function('mkostemp')) -+ -+# Misc headers -+ffi_conf.set10('HAVE_ALLOCA_H', cc.has_header('alloca.h')) -+ffi_conf.set('HAVE_INTTYPES_H', cc.has_header('inttypes.h')) -+ffi_conf.set('HAVE_STDINT_H', cc.has_header('stdint.h')) -+# Checks in the configure file that aren't used -+#ffi_conf.set10('HAVE_DLFCN_H', cc.has_header('dlfcn.h')) -+#ffi_conf.set10('HAVE_MEMORY_H', cc.has_header('memory.h')) -+#ffi_conf.set10('HAVE_STDLIB_H', cc.has_header('stdlib.h')) -+#ffi_conf.set10('HAVE_STRING_H', cc.has_header('string.h')) -+#ffi_conf.set10('HAVE_STRINGS_H', cc.has_header('strings.h')) -+#ffi_conf.set10('HAVE_SYS_MMAN_H', cc.has_header('sys/mman.h')) -+#ffi_conf.set10('HAVE_SYS_STAT_H', cc.has_header('sys/stat.h')) -+#ffi_conf.set10('HAVE_SYS_TYPES_H', cc.has_header('sys/types.h')) -+#ffi_conf.set10('HAVE_UNISTD_H', cc.has_header('unistd.h')) -+ -+# Misc defines -+# FIXME: Check if this is compiler-specific check is correct -+if host_system != 'windows' -+ message('Host system is not Windows; assuming .hidden pseudo-op is available') -+ ffi_conf.set('HAVE_HIDDEN_VISIBILITY_ATTRIBUTE', 1) -+endif -+ -+# User options -+if get_option('debug') -+ ffi_conf.set('FFI_DEBUG') -+endif -+if not get_option('raw_api') -+ ffi_conf.set('FFI_NO_RAW_API', 1) -+endif -+if not get_option('structs') -+ ffi_conf.set('FFI_NO_STRUCTS', 1) -+endif -+if get_option('purify_safety') -+ ffi_conf.set('USING_PURIFY', 1) -+endif -+if get_option('pax_emutramp') -+ ffi_conf.set('FFI_MMAP_EXEC_EMUTRAMP_PAX', 1) -+endif -+ -+msvcc = find_program('msvcc.sh') -+ -+# pkg-config file -+ffi_pc_conf = configuration_data() -+ffi_pc_conf.set('prefix', get_option('prefix')) -+ffi_pc_conf.set('exec_prefix', get_option('prefix')) -+ffi_pc_conf.set('libdir', '@0@/@1@'.format(get_option('prefix'), get_option('libdir'))) -+ffi_pc_conf.set('includedir', '@0@/include'.format(get_option('prefix'))) -+ffi_pc_conf.set('PACKAGE_VERSION', meson.project_version()) -+pkgconfigdir = get_option('libdir') + '/pkgconfig' -+configure_file(input : 'libffi.pc.in', output : 'libffi.pc', -+ configuration : ffi_pc_conf, -+ install_dir : pkgconfigdir) -+ -+ffiinc = [include_directories('.'), include_directories('include')] -+ -+# Configure ffi_conf some more and declare libffi.so -+subdir('src') -+ -+# Configure and install headers -+subdir('include') -+ -+# Configure fficonfig.h (not installed) -+configure_file(input : 'fficonfig.h.meson', output : 'fficonfig.h', -+ configuration : ffi_conf) -+ -+# TODO: Install texinfo files -+install_man([ -+ 'man/ffi.3', -+ 'man/ffi_call.3', -+ 'man/ffi_prep_cif.3', -+ 'man/ffi_prep_cif_var.3']) -diff --git a/meson_options.txt b/meson_options.txt -new file mode 100644 -index 0000000..7e5bede ---- /dev/null -+++ b/meson_options.txt -@@ -0,0 +1,11 @@ -+# Toggle this if you want extra debugging -+option('debug', type : 'boolean', value : false) -+# Toggle this if you do not want support for aggregate types -+option('structs', type : 'boolean', value : true) -+# Toggle this if you do not want support for the raw API -+option('raw_api', type : 'boolean', value : true) -+# Toggle this if you are using Purify and want to suppress spurious messages -+option('purify_safety', type : 'boolean', value : false) -+# Toggle this if you want to enable pax emulated trampolines for PaX kernels -+# On PaX enable kernels that have MPROTECT enabled we can't use PROT_EXEC -+option('pax_emutramp', type : 'boolean', value : false) -diff --git a/src/meson.build b/src/meson.build -new file mode 100644 -index 0000000..de53c42 ---- /dev/null -+++ b/src/meson.build -@@ -0,0 +1,234 @@ -+ffi_c_sources = [ -+ 'prep_cif.c', -+ 'types.c', -+ 'raw_api.c', -+ 'java_raw_api.c', -+ 'closures.c', -+] -+ -+ffi_asm_sources = [] -+ -+if get_option('debug') -+ ffi_c_sources += ['debug.c'] -+endif -+ -+arch_subdir = host_cpu_family -+if host_cpu_family == 'mips' -+ ffi_conf.set('TARGET', 'MIPS') -+ ffi_c_sources += ['mips/ffi.c'] -+ ffi_asm_sources += ['mips/o32.S', 'mips/n32.S'] -+elif host_cpu_family == 'blackfin' -+ ffi_conf.set('TARGET', 'BFIN') -+ arch_subdir = 'bfin' -+ ffi_c_sources += ['bfin/ffi.c'] -+ ffi_asm_sources += ['bfin/sysv.S'] -+elif host_cpu_family == 'x86_64' -+ arch_subdir = 'x86' -+ ffi_c_sources += ['x86/ffi.c'] -+ if host_system == 'windows' -+ ffi_conf.set('TARGET', 'X86_WIN64') -+ ffi_asm_sources += ['x86/win64.S'] -+ elif host_system == 'darwin' -+ ffi_conf.set('TARGET', 'X86_DARWIN') -+ ffi_c_sources += ['x86/ffi64.c'] -+ ffi_asm_sources += ['x86/darwin.S', 'x86/darwin64.S'] -+ elif size_t == 4 -+ ffi_conf.set('TARGET', 'X86') -+ ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -+ else -+ ffi_conf.set('TARGET', 'X86_64') -+ ffi_c_sources += ['x86/ffi64.c'] -+ ffi_asm_sources += ['x86/unix64.S', 'x86/sysv.S'] -+ # FIXME: Doesn't support x32 -+ endif -+elif host_cpu_family == 'x86' -+ ffi_c_sources += ['x86/ffi.c'] -+ # FIXME: This isn't quite correct. Compare with configure.ac -+ if host_system == 'freebsd' -+ ffi_conf.set('TARGET', 'X86_FREEBSD') -+ ffi_asm_sources += ['x86/freebsd.S', 'x86/win32.S'] -+ elif host_system == 'windows' -+ ffi_conf.set('TARGET', 'X86_WIN32') -+ ffi_asm_sources += ['x86/win32.S'] -+ elif host_system == 'darwin' -+ ffi_conf.set('TARGET', 'X86_DARWIN') -+ ffi_c_sources += ['x86/ffi64.c'] -+ ffi_asm_sources += ['x86/darwin.S', 'x86/darwin64.S'] -+ if size_t == 4 -+ ffi_conf.set('TARGET', 'X86_DARWIN32') -+ ffi_asm_sources += ['x86/win32.S'] -+ else -+ ffi_conf.set('TARGET', 'X86_DARWIN64') -+ endif -+ elif host_system == 'solaris' -+ if size_t == 4 -+ ffi_conf.set('TARGET', 'X86') -+ ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -+ else -+ ffi_conf.set('TARGET', 'X86_64') -+ ffi_c_sources += ['x86/ffi64.c', 'x86/unix64.c', 'x86/ffi.c'] -+ ffi_asm_sources += ['x86/sysv.S'] -+ endif -+ elif size_t == 4 -+ ffi_conf.set('TARGET', 'X86') -+ ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -+ else -+ error('Unsupported cpu/host/size_t combination: x86 but size_t != 4') -+ # FIXME: Doesn't support x32 -+ endif -+elif host_cpu_family == 'sparc' -+ ffi_conf.set('TARGET', 'SPARC') -+ ffi_c_sources += ['sparc/ffi.c'] -+ ffi_asm_sources += ['sparc/v8.S', 'sparc/v9.S'] -+elif host_cpu_family == 'alpha' -+ ffi_conf.set('TARGET', 'ALPHA') -+ ffi_c_sources += ['alpha/ffi.c'] -+ ffi_asm_sources += ['alpha/osf.S'] -+elif host_cpu_family == 'ia64' -+ ffi_conf.set('TARGET', 'IA64') -+ ffi_c_sources += ['ia64/ffi.c'] -+ ffi_asm_sources += ['ia64/unix.S'] -+elif host_cpu_family == 'm32r' -+ ffi_conf.set('TARGET', 'M32R') -+ ffi_c_sources += ['m32r/ffi.c'] -+ ffi_asm_sources += ['m32r/sysv.S'] -+elif host_cpu_family == 'm68k' -+ ffi_conf.set('TARGET', 'M68K') -+ ffi_c_sources += ['m68k/ffi.c'] -+ ffi_asm_sources += ['m68k/sysv.S'] -+elif host_cpu_family == 'm88k' -+ ffi_conf.set('TARGET', 'M88K') -+ ffi_c_sources += ['m88k/ffi.c'] -+ ffi_asm_sources += ['m88k/obsd.S'] -+elif host_cpu_family == 'moxie' -+ ffi_conf.set('TARGET', 'MOXIE') -+ ffi_c_sources += ['moxie/ffi.c'] -+ ffi_asm_sources += ['moxie/eabi.S'] -+elif host_cpu_family == 'microblaze' -+ ffi_conf.set('TARGET', 'MICROBLAZE') -+ ffi_c_sources += ['microblaze/ffi.c'] -+ ffi_asm_sources += ['microblaze/sysv.S'] -+elif host_cpu_family == 'nios2' -+ ffi_conf.set('TARGET', 'NIOS2') -+ ffi_c_sources += ['nios2/ffi.c'] -+ ffi_asm_sources += ['nios2/sysv.S'] -+elif host_cpu_family == 'or1k' -+ ffi_conf.set('TARGET', 'OR1K') -+ ffi_c_sources += ['or1k/ffi.c'] -+ ffi_asm_sources += ['or1k/sysv.S'] -+elif host_cpu_family == 'powerpc' -+ if host_system == 'aix' -+ ffi_conf.set('TARGET', 'POWERPC_AIX') -+ ffi_c_sources += ['powerpc/ffi_darwin.c'] -+ ffi_asm_sources += ['powerpc/aix.S', 'powerpc/aix_closure.S'] -+ elif host_system == 'freebsd' -+ ffi_conf.set('TARGET', 'POWERPC_FREEBSD') -+ ffi_c_sources += ['powerpc/ffi.c', 'powerpc/ffi_sysv.c'] -+ ffi_asm_sources += ['powerpc/sysv.S', 'powerpc/ppc_closure.S'] -+ elif host_system == 'darwin' -+ ffi_conf.set('TARGET', 'POWERPC_DARWIN') -+ ffi_c_sources += ['powerpc/ffi_darwin.c'] -+ ffi_asm_sources += ['powerpc/darwin.S', 'powerpc/darwin_closure.S'] -+ else -+ ffi_conf.set('TARGET', 'POWERPC') -+ ffi_c_sources += ['powerpc/ffi.c', 'powerpc/ffi_sysv.c', 'powerpc/ffi_linux64.c'] -+ ffi_asm_sources += ['powerpc/sysv.S', 'powerpc/ppc_closure.S', 'powerpc/linux64.S', 'powerpc/linux64_closure.S'] -+ endif -+elif host_cpu_family == 'aarch64' -+ ffi_conf.set('TARGET', 'AARCH64') -+ ffi_c_sources += ['aarch64/ffi.c'] -+ ffi_asm_sources += ['aarch64/sysv.S'] -+elif host_cpu_family == 'arc' -+ ffi_conf.set('TARGET', 'ARC') -+ ffi_c_sources += ['arc/ffi.c'] -+ ffi_asm_sources += ['arc/arcompact.S'] -+elif host_cpu_family == 'arm' -+ ffi_conf.set('TARGET', 'ARM') -+ ffi_c_sources += ['arm/ffi.c'] -+ ffi_asm_sources += ['arm/sysv.S'] -+ if host_system == 'darwin' -+ ffi_asm_sources += ['arm/trampoline.S'] -+ endif -+elif host_cpu_family == 'avr32' -+ ffi_conf.set('TARGET', 'AVR32') -+ ffi_c_sources += ['avr32/ffi.c'] -+ ffi_asm_sources += ['avr32/sysv.S'] -+elif host_cpu_family == 'cris' -+ ffi_conf.set('TARGET', 'LIBFFI_CRIS') -+ ffi_c_sources += ['cris/ffi.c'] -+ ffi_asm_sources += ['cris/sysv.S'] -+elif host_cpu_family == 'frv' -+ ffi_conf.set('TARGET', 'FRV') -+ ffi_c_sources += ['frv/ffi.c'] -+ ffi_asm_sources += ['frv/eabi.S'] -+elif host_cpu_family == 's390' -+ ffi_conf.set('TARGET', 'S390') -+ ffi_c_sources += ['s390/ffi.c'] -+ ffi_asm_sources += ['s390/sysv.S'] -+elif host_cpu_family == 'sh' -+ ffi_conf.set('TARGET', 'SH') -+ ffi_c_sources += ['sh/ffi.c'] -+ ffi_asm_sources += ['sh/sysv.S'] -+elif host_cpu_family == 'sh64' -+ ffi_conf.set('TARGET', 'SH64') -+ ffi_c_sources += ['sh64/ffi.c'] -+ ffi_asm_sources += ['sh64/sysv.S'] -+elif host_cpu_family == 'pa' -+ if host_system == 'hpux' -+ ffi_conf.set('TARGET', 'PA_HPUX') -+ ffi_c_sources += ['pa/ffi.c'] -+ ffi_asm_sources += ['pa/hpux32.S'] -+ else -+ ffi_conf.set('TARGET', 'PA_LINUX') -+ ffi_c_sources += ['pa/ffi.c'] -+ ffi_asm_sources += ['pa/linux.S'] -+ endif -+elif host_cpu_family == 'tile' -+ ffi_conf.set('TARGET', 'TILE') -+ ffi_c_sources += ['tile/ffi.c'] -+ ffi_asm_sources += ['tile/tile.S'] -+elif host_cpu_family == 'xtensa' -+ ffi_conf.set('TARGET', 'XTENSA') -+ ffi_c_sources += ['xtensa/ffi.c'] -+ ffi_asm_sources += ['xtensa/sysv.S'] -+elif host_cpu_family == 'metag' -+ ffi_conf.set('TARGET', 'METAG') -+ ffi_c_sources += ['metag/ffi.c'] -+ ffi_asm_sources += ['metag/sysv.S'] -+elif host_cpu_family == 'vax' -+ ffi_conf.set('TARGET', 'VAX') -+ ffi_c_sources += ['vax/ffi.c'] -+ ffi_asm_sources += ['vax/elfbsd.S'] -+else -+ error('Unsupported cpu family: ' + host_cpu_family) -+endif -+ -+if cc.get_id() == 'msvc' -+ # FIXME: Meson doesn't have built-in support for compiling assembly files. -+ # Use the msvcc.sh script to compile the ASM sources. -+ # -+ # GCC and Clang accept assembly files directly, but MSVC's cl.exe does not. -+ # You need to manually pass the files through the pre-processor first and -+ # then through the assembler. I tried a whole bunch of things including -+ # generators for both (didn't work because generators can't take generator -+ # output as input), custom_target() for both (didn't work because the format -+ # required is very specific, custom_target is processed during configure, -+ # etc). Finally, I gave up and did this. -+ args = ['-c', '-I.', '-Iinclude'] -+ if host_cpu_family == 'x86_64' -+ args += ['-m64'] # msvcc.sh checks this gcc flag to switch to 64-bit mode -+ endif -+ compiler = generator(msvcc, -+ output : '@BASENAME@.obj', -+ arguments : ['@INPUT@'] + args + ['-o', '@OUTPUT0@']) -+ ffi_asm_sources = compiler.process(ffi_asm_sources) -+endif -+ -+ffi_lib = library('ffi', ffi_c_sources, ffi_asm_sources, -+ include_directories : ffiinc, -+ # Taken from the libtool-version file -+ # current.revision.age -+ version : '6.0.4', -+ # current -+ soversion : '6', -+ install : true) --- -2.26.1.windows.1 - - -From edaa2f7f5726efa2efe33335493e81e6715d7a82 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Sat, 16 Apr 2016 02:57:14 +0530 -Subject: [PATCH 02/32] Export all public function symbols when building on - MSVC - ---- - include/ffi.h.in | 70 +++++++++++++++++++++++++++--------------------- - meson.build | 3 +++ - 2 files changed, 43 insertions(+), 30 deletions(-) - -diff --git a/include/ffi.h.in b/include/ffi.h.in -index d76d8e6..ac79f2f 100644 ---- a/include/ffi.h.in -+++ b/include/ffi.h.in -@@ -57,6 +57,23 @@ extern "C" { - - #include - -+/* Need minimal decorations for DLLs to works on Windows. GCC has -+ autoimport and autoexport. Rely on Libtool to help MSVC export -+ from a DLL, but always declare data to be imported for MSVC -+ clients. This costs an extra indirection for MSVC clients using -+ the static version of the library, but don't worry about that. -+ Besides, as a workaround, they can define FFI_BUILDING if they -+ *know* they are going to link with the static library. */ -+#if defined _WIN32 && !defined FFI_STATIC_BUILD -+#ifdef FFI_BUILDING -+#define FFI_EXTERN __declspec(dllexport) -+#else -+#define FFI_EXTERN __declspec(dllimport) -+#endif -+#else -+#define FFI_EXTERN extern -+#endif -+ - #ifndef LIBFFI_ASM - - #if defined(_MSC_VER) && !defined(__clang__) -@@ -157,19 +174,6 @@ typedef struct _ffi_type - #error "long size not supported" - #endif - --/* Need minimal decorations for DLLs to works on Windows. GCC has -- autoimport and autoexport. Rely on Libtool to help MSVC export -- from a DLL, but always declare data to be imported for MSVC -- clients. This costs an extra indirection for MSVC clients using -- the static version of the library, but don't worry about that. -- Besides, as a workaround, they can define FFI_BUILDING if they -- *know* they are going to link with the static library. */ --#if defined _MSC_VER && !defined FFI_BUILDING --#define FFI_EXTERN extern __declspec(dllimport) --#else --#define FFI_EXTERN extern --#endif -- - /* These are defined in types.c. */ - FFI_EXTERN ffi_type ffi_type_void; - FFI_EXTERN ffi_type ffi_type_uint8; -@@ -255,28 +259,28 @@ typedef union { - typedef ffi_raw ffi_java_raw; - #endif - -- -+FFI_EXTERN - void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - --void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); --void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); --size_t ffi_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -+FFI_EXTERN void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -+FFI_EXTERN size_t ffi_raw_size (ffi_cif *cif); - - /* This is analogous to the raw API, except it uses Java parameter - packing, even on 64-bit machines. I.e. on 64-bit machines longs - and doubles are followed by an empty 64-bit word. */ -- -+FFI_EXTERN - void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - --void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); --void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); --size_t ffi_java_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -+FFI_EXTERN void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -+FFI_EXTERN size_t ffi_java_raw_size (ffi_cif *cif); - - /* ---- Definitions for closures ----------------------------------------- */ - -@@ -307,10 +311,10 @@ typedef struct { - # endif - #endif - --void *ffi_closure_alloc (size_t size, void **code); --void ffi_closure_free (void *); -+FFI_EXTERN void *ffi_closure_alloc (size_t size, void **code); -+FFI_EXTERN void ffi_closure_free (void *); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), -@@ -322,7 +326,7 @@ ffi_prep_closure (ffi_closure*, - #endif - ; - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), -@@ -383,26 +387,26 @@ typedef struct { - - } ffi_java_raw_closure; - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), -@@ -419,9 +423,11 @@ typedef struct { - void (*fun)(ffi_cif*,void*,void**,void*); - } ffi_go_closure; - -+FFI_EXTERN - ffi_status ffi_prep_go_closure (ffi_go_closure*, ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*)); - -+FFI_EXTERN - void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure); - -@@ -429,12 +435,14 @@ void ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue, - - /* ---- Public interface definition -------------------------------------- */ - -+FFI_EXTERN - ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - -+FFI_EXTERN - ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, -@@ -442,11 +450,13 @@ ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_type *rtype, - ffi_type **atypes); - -+FFI_EXTERN - void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); - -+FFI_EXTERN - ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, - size_t *offsets); - -@@ -455,7 +465,7 @@ ffi_status ffi_get_struct_offsets (ffi_abi abi, ffi_type *struct_type, - - /* ---- Definitions shared with assembly code ---------------------------- */ - --#endif -+#endif /* !LIBFFI_ASM */ - - /* If these change, update src/mips/ffitarget.h. */ - #define FFI_TYPE_VOID 0 -diff --git a/meson.build b/meson.build -index d5bb2e8..f137bc4 100644 ---- a/meson.build -+++ b/meson.build -@@ -5,6 +5,9 @@ project('libffi', 'c', version : '3.2.1', - - cc = meson.get_compiler('c') - -+# For FFI_EXTERN symbol exporting -+add_global_arguments('-DFFI_BUILDING', language : 'c') -+ - ffi_conf = configuration_data() - - # NOTE: host = "cross" or "target" --- -2.26.1.windows.1 - - -From faa2744c7f05a742dd972d38564d89a74cb8a802 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Mon, 27 Feb 2017 17:42:55 +0530 -Subject: [PATCH 03/32] Rebase against latest master, and fix MSVC support - -* Reinstate win32 MSVC support from the last-known-good commit: - 20562ac0427c3578250d04c6e34fb0127d4551cf - This is in the form of ffiold_msvc.c and win32_msvc.S - -* Upstream has MSVC support now, via win64_intel.S which is - a translation of win64.S from GAS to Intel syntax. - -* Nuke "support" archs that we aren't testing gstreamer meson builds on. - At present this is just Linux/Windows, x86/x86_64. - -* Use custom_targets instead of msvcc.sh for building assembly sources - with MSVC ---- - src/meson.build | 257 +++--------- - src/x86/ffiold-msvc.c | 931 ++++++++++++++++++++++++++++++++++++++++++ - src/x86/win32_msvc.S | 519 +++++++++++++++++++++++ - 3 files changed, 1506 insertions(+), 201 deletions(-) - create mode 100644 src/x86/ffiold-msvc.c - create mode 100644 src/x86/win32_msvc.S - -diff --git a/src/meson.build b/src/meson.build -index de53c42..b747948 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -12,223 +12,78 @@ if get_option('debug') - ffi_c_sources += ['debug.c'] - endif - --arch_subdir = host_cpu_family --if host_cpu_family == 'mips' -- ffi_conf.set('TARGET', 'MIPS') -- ffi_c_sources += ['mips/ffi.c'] -- ffi_asm_sources += ['mips/o32.S', 'mips/n32.S'] --elif host_cpu_family == 'blackfin' -- ffi_conf.set('TARGET', 'BFIN') -- arch_subdir = 'bfin' -- ffi_c_sources += ['bfin/ffi.c'] -- ffi_asm_sources += ['bfin/sysv.S'] --elif host_cpu_family == 'x86_64' -- arch_subdir = 'x86' -- ffi_c_sources += ['x86/ffi.c'] -- if host_system == 'windows' -- ffi_conf.set('TARGET', 'X86_WIN64') -- ffi_asm_sources += ['x86/win64.S'] -- elif host_system == 'darwin' -- ffi_conf.set('TARGET', 'X86_DARWIN') -- ffi_c_sources += ['x86/ffi64.c'] -- ffi_asm_sources += ['x86/darwin.S', 'x86/darwin64.S'] -- elif size_t == 4 -- ffi_conf.set('TARGET', 'X86') -- ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -- else -- ffi_conf.set('TARGET', 'X86_64') -- ffi_c_sources += ['x86/ffi64.c'] -- ffi_asm_sources += ['x86/unix64.S', 'x86/sysv.S'] -- # FIXME: Doesn't support x32 -- endif --elif host_cpu_family == 'x86' -- ffi_c_sources += ['x86/ffi.c'] -- # FIXME: This isn't quite correct. Compare with configure.ac -- if host_system == 'freebsd' -- ffi_conf.set('TARGET', 'X86_FREEBSD') -- ffi_asm_sources += ['x86/freebsd.S', 'x86/win32.S'] -- elif host_system == 'windows' -- ffi_conf.set('TARGET', 'X86_WIN32') -- ffi_asm_sources += ['x86/win32.S'] -- elif host_system == 'darwin' -- ffi_conf.set('TARGET', 'X86_DARWIN') -- ffi_c_sources += ['x86/ffi64.c'] -- ffi_asm_sources += ['x86/darwin.S', 'x86/darwin64.S'] -- if size_t == 4 -- ffi_conf.set('TARGET', 'X86_DARWIN32') -- ffi_asm_sources += ['x86/win32.S'] -+# We only support x86 on Windows and Linux right now -+arch_subdir = 'x86' -+if host_system == 'windows' -+ # No ARM support for Windows in libffi -+ if size_t == 4 -+ TARGET = 'X86_WIN32' -+ if cc.get_id() == 'msvc' -+ ffi_c_sources += ['x86/ffiold-msvc.c'] -+ ffi_asm_sources += ['x86/win32_msvc.S'] - else -- ffi_conf.set('TARGET', 'X86_DARWIN64') -+ ffi_c_sources += ['x86/ffi.c'] -+ ffi_asm_sources += ['x86/sysv.S'] - endif -- elif host_system == 'solaris' -- if size_t == 4 -- ffi_conf.set('TARGET', 'X86') -- ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -+ else -+ TARGET = 'X86_WIN64' -+ ffi_c_sources += ['x86/ffiw64.c'] -+ if cc.get_id() == 'msvc' -+ ffi_asm_sources += ['x86/win64_intel.S'] - else -- ffi_conf.set('TARGET', 'X86_64') -- ffi_c_sources += ['x86/ffi64.c', 'x86/unix64.c', 'x86/ffi.c'] -- ffi_asm_sources += ['x86/sysv.S'] -+ ffi_asm_sources += ['x86/win64.S'] - endif -- elif size_t == 4 -- ffi_conf.set('TARGET', 'X86') -- ffi_asm_sources += ['x86/sysv.S', 'x86/win32.S'] -- else -- error('Unsupported cpu/host/size_t combination: x86 but size_t != 4') -- # FIXME: Doesn't support x32 - endif --elif host_cpu_family == 'sparc' -- ffi_conf.set('TARGET', 'SPARC') -- ffi_c_sources += ['sparc/ffi.c'] -- ffi_asm_sources += ['sparc/v8.S', 'sparc/v9.S'] --elif host_cpu_family == 'alpha' -- ffi_conf.set('TARGET', 'ALPHA') -- ffi_c_sources += ['alpha/ffi.c'] -- ffi_asm_sources += ['alpha/osf.S'] --elif host_cpu_family == 'ia64' -- ffi_conf.set('TARGET', 'IA64') -- ffi_c_sources += ['ia64/ffi.c'] -- ffi_asm_sources += ['ia64/unix.S'] --elif host_cpu_family == 'm32r' -- ffi_conf.set('TARGET', 'M32R') -- ffi_c_sources += ['m32r/ffi.c'] -- ffi_asm_sources += ['m32r/sysv.S'] --elif host_cpu_family == 'm68k' -- ffi_conf.set('TARGET', 'M68K') -- ffi_c_sources += ['m68k/ffi.c'] -- ffi_asm_sources += ['m68k/sysv.S'] --elif host_cpu_family == 'm88k' -- ffi_conf.set('TARGET', 'M88K') -- ffi_c_sources += ['m88k/ffi.c'] -- ffi_asm_sources += ['m88k/obsd.S'] --elif host_cpu_family == 'moxie' -- ffi_conf.set('TARGET', 'MOXIE') -- ffi_c_sources += ['moxie/ffi.c'] -- ffi_asm_sources += ['moxie/eabi.S'] --elif host_cpu_family == 'microblaze' -- ffi_conf.set('TARGET', 'MICROBLAZE') -- ffi_c_sources += ['microblaze/ffi.c'] -- ffi_asm_sources += ['microblaze/sysv.S'] --elif host_cpu_family == 'nios2' -- ffi_conf.set('TARGET', 'NIOS2') -- ffi_c_sources += ['nios2/ffi.c'] -- ffi_asm_sources += ['nios2/sysv.S'] --elif host_cpu_family == 'or1k' -- ffi_conf.set('TARGET', 'OR1K') -- ffi_c_sources += ['or1k/ffi.c'] -- ffi_asm_sources += ['or1k/sysv.S'] --elif host_cpu_family == 'powerpc' -- if host_system == 'aix' -- ffi_conf.set('TARGET', 'POWERPC_AIX') -- ffi_c_sources += ['powerpc/ffi_darwin.c'] -- ffi_asm_sources += ['powerpc/aix.S', 'powerpc/aix_closure.S'] -- elif host_system == 'freebsd' -- ffi_conf.set('TARGET', 'POWERPC_FREEBSD') -- ffi_c_sources += ['powerpc/ffi.c', 'powerpc/ffi_sysv.c'] -- ffi_asm_sources += ['powerpc/sysv.S', 'powerpc/ppc_closure.S'] -- elif host_system == 'darwin' -- ffi_conf.set('TARGET', 'POWERPC_DARWIN') -- ffi_c_sources += ['powerpc/ffi_darwin.c'] -- ffi_asm_sources += ['powerpc/darwin.S', 'powerpc/darwin_closure.S'] -+elif host_system == 'linux' and host_cpu_family.startswith('x86') -+ if size_t == 4 -+ # FIXME: gnux32 support? -+ TARGET = 'X86' -+ ffi_c_sources += ['x86/ffi.c'] -+ ffi_asm_sources += ['x86/sysv.S'] - else -- ffi_conf.set('TARGET', 'POWERPC') -- ffi_c_sources += ['powerpc/ffi.c', 'powerpc/ffi_sysv.c', 'powerpc/ffi_linux64.c'] -- ffi_asm_sources += ['powerpc/sysv.S', 'powerpc/ppc_closure.S', 'powerpc/linux64.S', 'powerpc/linux64_closure.S'] -- endif --elif host_cpu_family == 'aarch64' -- ffi_conf.set('TARGET', 'AARCH64') -- ffi_c_sources += ['aarch64/ffi.c'] -- ffi_asm_sources += ['aarch64/sysv.S'] --elif host_cpu_family == 'arc' -- ffi_conf.set('TARGET', 'ARC') -- ffi_c_sources += ['arc/ffi.c'] -- ffi_asm_sources += ['arc/arcompact.S'] --elif host_cpu_family == 'arm' -- ffi_conf.set('TARGET', 'ARM') -- ffi_c_sources += ['arm/ffi.c'] -- ffi_asm_sources += ['arm/sysv.S'] -- if host_system == 'darwin' -- ffi_asm_sources += ['arm/trampoline.S'] -+ TARGET = 'X86_64' -+ ffi_c_sources += ['x86/ffi64.c', 'x86/ffiw64.c'] -+ ffi_asm_sources += ['x86/unix64.S', 'x86/win64.S'] - endif --elif host_cpu_family == 'avr32' -- ffi_conf.set('TARGET', 'AVR32') -- ffi_c_sources += ['avr32/ffi.c'] -- ffi_asm_sources += ['avr32/sysv.S'] --elif host_cpu_family == 'cris' -- ffi_conf.set('TARGET', 'LIBFFI_CRIS') -- ffi_c_sources += ['cris/ffi.c'] -- ffi_asm_sources += ['cris/sysv.S'] --elif host_cpu_family == 'frv' -- ffi_conf.set('TARGET', 'FRV') -- ffi_c_sources += ['frv/ffi.c'] -- ffi_asm_sources += ['frv/eabi.S'] --elif host_cpu_family == 's390' -- ffi_conf.set('TARGET', 'S390') -- ffi_c_sources += ['s390/ffi.c'] -- ffi_asm_sources += ['s390/sysv.S'] --elif host_cpu_family == 'sh' -- ffi_conf.set('TARGET', 'SH') -- ffi_c_sources += ['sh/ffi.c'] -- ffi_asm_sources += ['sh/sysv.S'] --elif host_cpu_family == 'sh64' -- ffi_conf.set('TARGET', 'SH64') -- ffi_c_sources += ['sh64/ffi.c'] -- ffi_asm_sources += ['sh64/sysv.S'] --elif host_cpu_family == 'pa' -- if host_system == 'hpux' -- ffi_conf.set('TARGET', 'PA_HPUX') -- ffi_c_sources += ['pa/ffi.c'] -- ffi_asm_sources += ['pa/hpux32.S'] -- else -- ffi_conf.set('TARGET', 'PA_LINUX') -- ffi_c_sources += ['pa/ffi.c'] -- ffi_asm_sources += ['pa/linux.S'] -- endif --elif host_cpu_family == 'tile' -- ffi_conf.set('TARGET', 'TILE') -- ffi_c_sources += ['tile/ffi.c'] -- ffi_asm_sources += ['tile/tile.S'] --elif host_cpu_family == 'xtensa' -- ffi_conf.set('TARGET', 'XTENSA') -- ffi_c_sources += ['xtensa/ffi.c'] -- ffi_asm_sources += ['xtensa/sysv.S'] --elif host_cpu_family == 'metag' -- ffi_conf.set('TARGET', 'METAG') -- ffi_c_sources += ['metag/ffi.c'] -- ffi_asm_sources += ['metag/sysv.S'] --elif host_cpu_family == 'vax' -- ffi_conf.set('TARGET', 'VAX') -- ffi_c_sources += ['vax/ffi.c'] -- ffi_asm_sources += ['vax/elfbsd.S'] - else -- error('Unsupported cpu family: ' + host_cpu_family) -+ error('Unsupported system "@0@" or cpu family "@1@"'.format(host_system, host_cpu_family)) - endif - -+# Used in ffi.h.in to generate ffi-$arch.h -+ffi_conf.set('TARGET', TARGET) -+ - if cc.get_id() == 'msvc' -- # FIXME: Meson doesn't have built-in support for compiling assembly files. -- # Use the msvcc.sh script to compile the ASM sources. -- # - # GCC and Clang accept assembly files directly, but MSVC's cl.exe does not. - # You need to manually pass the files through the pre-processor first and -- # then through the assembler. I tried a whole bunch of things including -- # generators for both (didn't work because generators can't take generator -- # output as input), custom_target() for both (didn't work because the format -- # required is very specific, custom_target is processed during configure, -- # etc). Finally, I gave up and did this. -- args = ['-c', '-I.', '-Iinclude'] -- if host_cpu_family == 'x86_64' -- args += ['-m64'] # msvcc.sh checks this gcc flag to switch to 64-bit mode -- endif -- compiler = generator(msvcc, -- output : '@BASENAME@.obj', -- arguments : ['@INPUT@'] + args + ['-o', '@OUTPUT0@']) -- ffi_asm_sources = compiler.process(ffi_asm_sources) -+ # then through the assembler, and then link the objects into the target. -+ # FIXME: Add native support in Meson for this. -+ cl = find_program('cl') -+ ml = find_program('ml', 'ml64') -+ ffi_asm_objs = [] -+ foreach asm_source : ffi_asm_sources -+ preproc_name = asm_source.underscorify() + '.i' -+ obj_name = asm_source.underscorify() + '.obj' -+ preproc = custom_target(preproc_name, -+ input : asm_source, -+ output : preproc_name, -+ command : [cl, '/nologo', '/EP', '/P', '/Fi@OUTPUT@', -+ '/I.', '/I..', '/Iinclude', '/I..\\include', -+ '/DTARGET=' + TARGET, '/DFFI_BUILDING', -+ '@INPUT@']) -+ ffi_asm_objs += custom_target(obj_name, -+ input : preproc, -+ output : obj_name, -+ command : [ml, '/Fo', '@OUTPUT@', '/c', '@INPUT@']) -+ endforeach -+ ffi_asm_sources = ffi_asm_objs - endif - - ffi_lib = library('ffi', ffi_c_sources, ffi_asm_sources, -+ c_args : '-DTARGET=' + TARGET, - include_directories : ffiinc, - # Taken from the libtool-version file -- # current.revision.age -- version : '6.0.4', -- # current -- soversion : '6', -+ # current - age . age . revision -+ version : '7.1.0', -+ # current - age -+ soversion : '7', - install : true) -diff --git a/src/x86/ffiold-msvc.c b/src/x86/ffiold-msvc.c -new file mode 100644 -index 0000000..006c95d ---- /dev/null -+++ b/src/x86/ffiold-msvc.c -@@ -0,0 +1,931 @@ -+/* ----------------------------------------------------------------------- -+ ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. -+ Copyright (c) 2002 Ranjit Mathew -+ Copyright (c) 2002 Bo Thorsen -+ Copyright (c) 2002 Roger Sayle -+ Copyright (C) 2008, 2010 Free Software Foundation, Inc. -+ -+ x86 Foreign Function Interface -+ -+ Permission is hereby granted, free of charge, to any person obtaining -+ a copy of this software and associated documentation files (the -+ ``Software''), to deal in the Software without restriction, including -+ without limitation the rights to use, copy, modify, merge, publish, -+ distribute, sublicense, and/or sell copies of the Software, and to -+ permit persons to whom the Software is furnished to do so, subject to -+ the following conditions: -+ -+ The above copyright notice and this permission notice shall be included -+ in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+ DEALINGS IN THE SOFTWARE. -+ ----------------------------------------------------------------------- */ -+ -+#if !defined(__x86_64__) || defined(_WIN64) || defined(__CYGWIN__) -+ -+#ifdef _WIN64 -+#include -+#endif -+ -+#include -+#include -+ -+#include -+ -+ -+/* ffi_prep_args is called by the assembly routine once stack space -+ has been allocated for the function's arguments */ -+ -+unsigned int ffi_prep_args(char *stack, extended_cif *ecif); -+unsigned int ffi_prep_args(char *stack, extended_cif *ecif) -+{ -+ register unsigned int i; -+ register void **p_argv; -+ register char *argp; -+ register ffi_type **p_arg; -+#ifndef X86_WIN64 -+ const int cabi = ecif->cif->abi; -+ const int dir = (cabi == FFI_PASCAL || cabi == FFI_REGISTER) ? -1 : +1; -+ unsigned int stack_args_count = 0; -+ void *p_stack_data[3]; -+ char *argp2 = stack; -+#else -+ #define dir 1 -+#endif -+ -+ argp = stack; -+ -+ if ((ecif->cif->flags == FFI_TYPE_STRUCT -+ || ecif->cif->flags == FFI_TYPE_MS_STRUCT) -+#ifdef X86_WIN64 -+ && ((ecif->cif->rtype->size & (1 | 2 | 4 | 8)) == 0) -+#endif -+ ) -+ { -+#ifndef X86_WIN64 -+ /* For fastcall/thiscall/register this is first register-passed -+ argument. */ -+ if (cabi == FFI_THISCALL || cabi == FFI_FASTCALL || cabi == FFI_REGISTER) -+ { -+ p_stack_data[stack_args_count] = argp; -+ ++stack_args_count; -+ } -+#endif -+ -+ *(void **) argp = ecif->rvalue; -+ argp += sizeof(void*); -+ } -+ -+ p_arg = ecif->cif->arg_types; -+ p_argv = ecif->avalue; -+ if (dir < 0) -+ { -+ const int nargs = ecif->cif->nargs - 1; -+ if (nargs > 0) -+ { -+ p_arg += nargs; -+ p_argv += nargs; -+ } -+ } -+ -+ for (i = ecif->cif->nargs; -+ i != 0; -+ i--, p_arg += dir, p_argv += dir) -+ { -+ /* Align if necessary */ -+ if ((sizeof(void*) - 1) & (size_t) argp) -+ argp = (char *) ALIGN(argp, sizeof(void*)); -+ -+ size_t z = (*p_arg)->size; -+ -+#ifdef X86_WIN64 -+ if (z > FFI_SIZEOF_ARG -+ || ((*p_arg)->type == FFI_TYPE_STRUCT -+ && (z & (1 | 2 | 4 | 8)) == 0) -+#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE -+ || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) -+#endif -+ ) -+ { -+ z = FFI_SIZEOF_ARG; -+ *(void **)argp = *p_argv; -+ } -+ else if ((*p_arg)->type == FFI_TYPE_FLOAT) -+ { -+ memcpy(argp, *p_argv, z); -+ } -+ else -+#endif -+ if (z < FFI_SIZEOF_ARG) -+ { -+ z = FFI_SIZEOF_ARG; -+ switch ((*p_arg)->type) -+ { -+ case FFI_TYPE_SINT8: -+ *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_UINT8: -+ *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_SINT16: -+ *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_UINT16: -+ *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_SINT32: -+ *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_UINT32: -+ *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); -+ break; -+ -+ case FFI_TYPE_STRUCT: -+ *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); -+ break; -+ -+ default: -+ FFI_ASSERT(0); -+ } -+ } -+ else -+ { -+ memcpy(argp, *p_argv, z); -+ } -+ -+#ifndef X86_WIN64 -+ /* For thiscall/fastcall/register convention register-passed arguments -+ are the first two none-floating-point arguments with a size -+ smaller or equal to sizeof (void*). */ -+ if ((z == FFI_SIZEOF_ARG) -+ && ((cabi == FFI_REGISTER) -+ || (cabi == FFI_THISCALL && stack_args_count < 1) -+ || (cabi == FFI_FASTCALL && stack_args_count < 2)) -+ && ((*p_arg)->type != FFI_TYPE_FLOAT && (*p_arg)->type != FFI_TYPE_STRUCT) -+ ) -+ { -+ if (dir < 0 && stack_args_count > 2) -+ { -+ /* Iterating arguments backwards, so first register-passed argument -+ will be passed last. Shift temporary values to make place. */ -+ p_stack_data[0] = p_stack_data[1]; -+ p_stack_data[1] = p_stack_data[2]; -+ stack_args_count = 2; -+ } -+ -+ p_stack_data[stack_args_count] = argp; -+ ++stack_args_count; -+ } -+#endif -+ -+#ifdef X86_WIN64 -+ argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); -+#else -+ argp += z; -+#endif -+ } -+ -+#ifndef X86_WIN64 -+ /* We need to move the register-passed arguments for thiscall/fastcall/register -+ on top of stack, so that those can be moved to registers by call-handler. */ -+ if (stack_args_count > 0) -+ { -+ if (dir < 0 && stack_args_count > 1) -+ { -+ /* Reverse order if iterating arguments backwards */ -+ ffi_arg tmp = *(ffi_arg*) p_stack_data[0]; -+ *(ffi_arg*) p_stack_data[0] = *(ffi_arg*) p_stack_data[stack_args_count - 1]; -+ *(ffi_arg*) p_stack_data[stack_args_count - 1] = tmp; -+ } -+ -+ int i; -+ for (i = 0; i < stack_args_count; i++) -+ { -+ if (p_stack_data[i] != argp2) -+ { -+ ffi_arg tmp = *(ffi_arg*) p_stack_data[i]; -+ memmove (argp2 + FFI_SIZEOF_ARG, argp2, (size_t) ((char*) p_stack_data[i] - (char*)argp2)); -+ *(ffi_arg *) argp2 = tmp; -+ } -+ -+ argp2 += FFI_SIZEOF_ARG; -+ } -+ } -+ -+ return stack_args_count; -+#endif -+ return 0; -+} -+ -+/* Perform machine dependent cif processing */ -+ffi_status ffi_prep_cif_machdep(ffi_cif *cif) -+{ -+ unsigned int i; -+ ffi_type **ptr; -+ -+ /* Set the return type flag */ -+ switch (cif->rtype->type) -+ { -+ case FFI_TYPE_VOID: -+ case FFI_TYPE_UINT8: -+ case FFI_TYPE_UINT16: -+ case FFI_TYPE_SINT8: -+ case FFI_TYPE_SINT16: -+#ifdef X86_WIN64 -+ case FFI_TYPE_UINT32: -+ case FFI_TYPE_SINT32: -+#endif -+ case FFI_TYPE_SINT64: -+ case FFI_TYPE_FLOAT: -+ case FFI_TYPE_DOUBLE: -+#ifndef X86_WIN64 -+#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE -+ case FFI_TYPE_LONGDOUBLE: -+#endif -+#endif -+ cif->flags = (unsigned) cif->rtype->type; -+ break; -+ -+ case FFI_TYPE_UINT64: -+#ifdef X86_WIN64 -+ case FFI_TYPE_POINTER: -+#endif -+ cif->flags = FFI_TYPE_SINT64; -+ break; -+ -+ case FFI_TYPE_STRUCT: -+#ifndef X86 -+ if (cif->rtype->size == 1) -+ { -+ cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ -+ } -+ else if (cif->rtype->size == 2) -+ { -+ cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ -+ } -+ else if (cif->rtype->size == 4) -+ { -+#ifdef X86_WIN64 -+ cif->flags = FFI_TYPE_SMALL_STRUCT_4B; -+#else -+ cif->flags = FFI_TYPE_INT; /* same as int type */ -+#endif -+ } -+ else if (cif->rtype->size == 8) -+ { -+ cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ -+ } -+ else -+#endif -+ { -+#ifdef X86_WIN32 -+ if (cif->abi == FFI_MS_CDECL) -+ cif->flags = FFI_TYPE_MS_STRUCT; -+ else -+#endif -+ cif->flags = FFI_TYPE_STRUCT; -+ /* allocate space for return value pointer */ -+ cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); -+ } -+ break; -+ -+ default: -+#ifdef X86_WIN64 -+ cif->flags = FFI_TYPE_SINT64; -+ break; -+ case FFI_TYPE_INT: -+ cif->flags = FFI_TYPE_SINT32; -+#else -+ cif->flags = FFI_TYPE_INT; -+#endif -+ break; -+ } -+ -+ for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) -+ { -+ if (((*ptr)->alignment - 1) & cif->bytes) -+ cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); -+ cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG); -+ } -+ -+#ifdef X86_WIN64 -+ /* ensure space for storing four registers */ -+ cif->bytes += 4 * FFI_SIZEOF_ARG; -+#endif -+ -+#ifndef X86_WIN32 -+#ifndef X86_WIN64 -+ if (cif->abi == FFI_SYSV || cif->abi == FFI_UNIX64) -+#endif -+ cif->bytes = (cif->bytes + 15) & ~0xF; -+#endif -+ -+ return FFI_OK; -+} -+ -+#ifdef X86_WIN64 -+extern int -+ffi_call_win64(unsigned int (*)(char *, extended_cif *), extended_cif *, -+ unsigned, unsigned, unsigned *, void (*fn)(void)); -+#else -+extern void -+ffi_call_win32(unsigned int (*)(char *, extended_cif *), extended_cif *, -+ unsigned, unsigned, unsigned, unsigned *, void (*fn)(void)); -+extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, -+ unsigned, unsigned, unsigned *, void (*fn)(void)); -+#endif -+ -+void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) -+{ -+ extended_cif ecif; -+ -+ ecif.cif = cif; -+ ecif.avalue = avalue; -+ -+ /* If the return value is a struct and we don't have a return */ -+ /* value address then we need to make one */ -+ -+#ifdef X86_WIN64 -+ if (rvalue == NULL -+ && cif->flags == FFI_TYPE_STRUCT -+ && ((cif->rtype->size & (1 | 2 | 4 | 8)) == 0)) -+ { -+ ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); -+ } -+#else -+ if (rvalue == NULL -+ && (cif->flags == FFI_TYPE_STRUCT -+ || cif->flags == FFI_TYPE_MS_STRUCT)) -+ { -+ ecif.rvalue = alloca(cif->rtype->size); -+ } -+#endif -+ else -+ ecif.rvalue = rvalue; -+ -+ -+ switch (cif->abi) -+ { -+#ifdef X86_WIN64 -+ case FFI_WIN64: -+ ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, -+ cif->flags, ecif.rvalue, fn); -+ break; -+#else -+#ifndef X86_WIN32 -+ case FFI_SYSV: -+ ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, -+ fn); -+ break; -+#else -+ case FFI_SYSV: -+ case FFI_MS_CDECL: -+#endif -+ case FFI_STDCALL: -+ case FFI_THISCALL: -+ case FFI_FASTCALL: -+ case FFI_PASCAL: -+ case FFI_REGISTER: -+ ffi_call_win32(ffi_prep_args, &ecif, cif->abi, cif->bytes, cif->flags, -+ ecif.rvalue, fn); -+ break; -+#endif -+ default: -+ FFI_ASSERT(0); -+ break; -+ } -+} -+ -+ -+/** private members **/ -+ -+/* The following __attribute__((regparm(1))) decorations will have no effect -+ on MSVC or SUNPRO_C -- standard conventions apply. */ -+static unsigned int ffi_prep_incoming_args (char *stack, void **ret, -+ void** args, ffi_cif* cif); -+void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) -+ __attribute__ ((regparm(1))); -+unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) -+ __attribute__ ((regparm(1))); -+unsigned int FFI_HIDDEN ffi_closure_WIN32_inner (ffi_closure *, void **, void *) -+ __attribute__ ((regparm(1))); -+void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) -+ __attribute__ ((regparm(1))); -+#ifdef X86_WIN32 -+void FFI_HIDDEN ffi_closure_raw_THISCALL (ffi_raw_closure *) -+ __attribute__ ((regparm(1))); -+#endif -+#ifndef X86_WIN64 -+void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *); -+void FFI_HIDDEN ffi_closure_THISCALL (ffi_closure *); -+void FFI_HIDDEN ffi_closure_FASTCALL (ffi_closure *); -+void FFI_HIDDEN ffi_closure_REGISTER (ffi_closure *); -+#else -+void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); -+#endif -+ -+/* This function is jumped to by the trampoline */ -+ -+#ifdef X86_WIN64 -+void * FFI_HIDDEN -+ffi_closure_win64_inner (ffi_closure *closure, void *args) { -+ ffi_cif *cif; -+ void **arg_area; -+ void *result; -+ void *resp = &result; -+ -+ cif = closure->cif; -+ arg_area = (void**) alloca (cif->nargs * sizeof (void*)); -+ -+ /* this call will initialize ARG_AREA, such that each -+ * element in that array points to the corresponding -+ * value on the stack; and if the function returns -+ * a structure, it will change RESP to point to the -+ * structure return address. */ -+ -+ ffi_prep_incoming_args(args, &resp, arg_area, cif); -+ -+ (closure->fun) (cif, resp, arg_area, closure->user_data); -+ -+ /* The result is returned in rax. This does the right thing for -+ result types except for floats; we have to 'mov xmm0, rax' in the -+ caller to correct this. -+ TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! -+ */ -+ return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; -+} -+ -+#else -+unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) -+ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) -+{ -+ /* our various things... */ -+ ffi_cif *cif; -+ void **arg_area; -+ -+ cif = closure->cif; -+ arg_area = (void**) alloca (cif->nargs * sizeof (void*)); -+ -+ /* this call will initialize ARG_AREA, such that each -+ * element in that array points to the corresponding -+ * value on the stack; and if the function returns -+ * a structure, it will change RESP to point to the -+ * structure return address. */ -+ -+ ffi_prep_incoming_args(args, respp, arg_area, cif); -+ -+ (closure->fun) (cif, *respp, arg_area, closure->user_data); -+ -+ return cif->flags; -+} -+ -+unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) -+ffi_closure_WIN32_inner (ffi_closure *closure, void **respp, void *args) -+{ -+ /* our various things... */ -+ ffi_cif *cif; -+ void **arg_area; -+ unsigned int ret; -+ -+ cif = closure->cif; -+ arg_area = (void**) alloca (cif->nargs * sizeof (void*)); -+ -+ /* this call will initialize ARG_AREA, such that each -+ * element in that array points to the corresponding -+ * value on the stack; and if the function returns -+ * a structure, it will change RESP to point to the -+ * structure return address. */ -+ -+ ret = ffi_prep_incoming_args(args, respp, arg_area, cif); -+ -+ (closure->fun) (cif, *respp, arg_area, closure->user_data); -+ -+ return ret; -+} -+#endif /* !X86_WIN64 */ -+ -+static unsigned int -+ffi_prep_incoming_args(char *stack, void **rvalue, void **avalue, -+ ffi_cif *cif) -+{ -+ register unsigned int i; -+ register void **p_argv; -+ register char *argp; -+ register ffi_type **p_arg; -+#ifndef X86_WIN64 -+ const int cabi = cif->abi; -+ const int dir = (cabi == FFI_PASCAL || cabi == FFI_REGISTER) ? -1 : +1; -+ const unsigned int max_stack_count = (cabi == FFI_THISCALL) ? 1 -+ : (cabi == FFI_FASTCALL) ? 2 -+ : (cabi == FFI_REGISTER) ? 3 -+ : 0; -+ unsigned int passed_regs = 0; -+ void *p_stack_data[3] = { stack - 1 }; -+#else -+ #define dir 1 -+#endif -+ -+ argp = stack; -+#ifndef X86_WIN64 -+ argp += max_stack_count * FFI_SIZEOF_ARG; -+#endif -+ -+ if ((cif->flags == FFI_TYPE_STRUCT -+ || cif->flags == FFI_TYPE_MS_STRUCT) -+#ifdef X86_WIN64 -+ && ((cif->rtype->size & (1 | 2 | 4 | 8)) == 0) -+#endif -+ ) -+ { -+#ifndef X86_WIN64 -+ if (passed_regs < max_stack_count) -+ { -+ *rvalue = *(void**) (stack + (passed_regs*FFI_SIZEOF_ARG)); -+ ++passed_regs; -+ } -+ else -+#endif -+ { -+ *rvalue = *(void **) argp; -+ argp += sizeof(void *); -+ } -+ } -+ -+#ifndef X86_WIN64 -+ /* Do register arguments first */ -+ for (i = 0, p_arg = cif->arg_types; -+ i < cif->nargs && passed_regs < max_stack_count; -+ i++, p_arg++) -+ { -+ if ((*p_arg)->type == FFI_TYPE_FLOAT -+ || (*p_arg)->type == FFI_TYPE_STRUCT) -+ continue; -+ -+ size_t sz = (*p_arg)->size; -+ if(sz == 0 || sz > FFI_SIZEOF_ARG) -+ continue; -+ -+ p_stack_data[passed_regs] = avalue + i; -+ avalue[i] = stack + (passed_regs*FFI_SIZEOF_ARG); -+ ++passed_regs; -+ } -+#endif -+ -+ p_arg = cif->arg_types; -+ p_argv = avalue; -+ if (dir < 0) -+ { -+ const int nargs = cif->nargs - 1; -+ if (nargs > 0) -+ { -+ p_arg += nargs; -+ p_argv += nargs; -+ } -+ } -+ -+ for (i = cif->nargs; -+ i != 0; -+ i--, p_arg += dir, p_argv += dir) -+ { -+ /* Align if necessary */ -+ if ((sizeof(void*) - 1) & (size_t) argp) -+ argp = (char *) ALIGN(argp, sizeof(void*)); -+ -+ size_t z = (*p_arg)->size; -+ -+#ifdef X86_WIN64 -+ if (z > FFI_SIZEOF_ARG -+ || ((*p_arg)->type == FFI_TYPE_STRUCT -+ && (z & (1 | 2 | 4 | 8)) == 0) -+#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE -+ || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) -+#endif -+ ) -+ { -+ z = FFI_SIZEOF_ARG; -+ *p_argv = *(void **)argp; -+ } -+ else -+#else -+ if (passed_regs > 0 -+ && z <= FFI_SIZEOF_ARG -+ && (p_argv == p_stack_data[0] -+ || p_argv == p_stack_data[1] -+ || p_argv == p_stack_data[2])) -+ { -+ /* Already assigned a register value */ -+ continue; -+ } -+ else -+#endif -+ { -+ /* because we're little endian, this is what it turns into. */ -+ *p_argv = (void*) argp; -+ } -+ -+#ifdef X86_WIN64 -+ argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); -+#else -+ argp += z; -+#endif -+ } -+ -+ return (size_t)argp - (size_t)stack; -+} -+ -+#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ -+{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ -+ void* __fun = (void*)(FUN); \ -+ void* __ctx = (void*)(CTX); \ -+ *(unsigned char*) &__tramp[0] = 0x41; \ -+ *(unsigned char*) &__tramp[1] = 0xbb; \ -+ *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ -+ *(unsigned char*) &__tramp[6] = 0x48; \ -+ *(unsigned char*) &__tramp[7] = 0xb8; \ -+ *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ -+ *(unsigned char *) &__tramp[16] = 0x49; \ -+ *(unsigned char *) &__tramp[17] = 0xba; \ -+ *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ -+ *(unsigned char *) &__tramp[26] = 0x41; \ -+ *(unsigned char *) &__tramp[27] = 0xff; \ -+ *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ -+ } -+ -+/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ -+ -+#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ -+{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ -+ unsigned int __fun = (unsigned int)(FUN); \ -+ unsigned int __ctx = (unsigned int)(CTX); \ -+ unsigned int __dis = __fun - (__ctx + 10); \ -+ *(unsigned char*) &__tramp[0] = 0xb8; \ -+ *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ -+ *(unsigned char*) &__tramp[5] = 0xe9; \ -+ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ -+ } -+ -+#define FFI_INIT_TRAMPOLINE_RAW_THISCALL(TRAMP,FUN,CTX,SIZE) \ -+{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ -+ unsigned int __fun = (unsigned int)(FUN); \ -+ unsigned int __ctx = (unsigned int)(CTX); \ -+ unsigned int __dis = __fun - (__ctx + 49); \ -+ unsigned short __size = (unsigned short)(SIZE); \ -+ *(unsigned int *) &__tramp[0] = 0x8324048b; /* mov (%esp), %eax */ \ -+ *(unsigned int *) &__tramp[4] = 0x4c890cec; /* sub $12, %esp */ \ -+ *(unsigned int *) &__tramp[8] = 0x04890424; /* mov %ecx, 4(%esp) */ \ -+ *(unsigned char*) &__tramp[12] = 0x24; /* mov %eax, (%esp) */ \ -+ *(unsigned char*) &__tramp[13] = 0xb8; \ -+ *(unsigned int *) &__tramp[14] = __size; /* mov __size, %eax */ \ -+ *(unsigned int *) &__tramp[18] = 0x08244c8d; /* lea 8(%esp), %ecx */ \ -+ *(unsigned int *) &__tramp[22] = 0x4802e8c1; /* shr $2, %eax ; dec %eax */ \ -+ *(unsigned short*) &__tramp[26] = 0x0b74; /* jz 1f */ \ -+ *(unsigned int *) &__tramp[28] = 0x8908518b; /* 2b: mov 8(%ecx), %edx */ \ -+ *(unsigned int *) &__tramp[32] = 0x04c18311; /* mov %edx, (%ecx) ; add $4, %ecx */ \ -+ *(unsigned char*) &__tramp[36] = 0x48; /* dec %eax */ \ -+ *(unsigned short*) &__tramp[37] = 0xf575; /* jnz 2b ; 1f: */ \ -+ *(unsigned char*) &__tramp[39] = 0xb8; \ -+ *(unsigned int*) &__tramp[40] = __ctx; /* movl __ctx, %eax */ \ -+ *(unsigned char *) &__tramp[44] = 0xe8; \ -+ *(unsigned int*) &__tramp[45] = __dis; /* call __fun */ \ -+ *(unsigned char*) &__tramp[49] = 0xc2; /* ret */ \ -+ *(unsigned short*) &__tramp[50] = (__size + 8); /* ret (__size + 8) */ \ -+ } -+ -+#define FFI_INIT_TRAMPOLINE_WIN32(TRAMP,FUN,CTX) \ -+{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ -+ unsigned int __fun = (unsigned int)(FUN); \ -+ unsigned int __ctx = (unsigned int)(CTX); \ -+ unsigned int __dis = __fun - (__ctx + 10); \ -+ *(unsigned char*) &__tramp[0] = 0x68; \ -+ *(unsigned int*) &__tramp[1] = __ctx; /* push __ctx */ \ -+ *(unsigned char*) &__tramp[5] = 0xe9; \ -+ *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ -+ } -+ -+/* the cif must already be prep'ed */ -+ -+ffi_status -+ffi_prep_closure_loc (ffi_closure* closure, -+ ffi_cif* cif, -+ void (*fun)(ffi_cif*,void*,void**,void*), -+ void *user_data, -+ void *codeloc) -+{ -+#ifdef X86_WIN64 -+#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) -+#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) -+ if (cif->abi == FFI_WIN64) -+ { -+ int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); -+ FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], -+ &ffi_closure_win64, -+ codeloc, mask); -+ /* make sure we can execute here */ -+ } -+#else -+ if (cif->abi == FFI_SYSV) -+ { -+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], -+ &ffi_closure_SYSV, -+ (void*)codeloc); -+ } -+ else if (cif->abi == FFI_REGISTER) -+ { -+ FFI_INIT_TRAMPOLINE_WIN32 (&closure->tramp[0], -+ &ffi_closure_REGISTER, -+ (void*)codeloc); -+ } -+ else if (cif->abi == FFI_FASTCALL) -+ { -+ FFI_INIT_TRAMPOLINE_WIN32 (&closure->tramp[0], -+ &ffi_closure_FASTCALL, -+ (void*)codeloc); -+ } -+ else if (cif->abi == FFI_THISCALL) -+ { -+ FFI_INIT_TRAMPOLINE_WIN32 (&closure->tramp[0], -+ &ffi_closure_THISCALL, -+ (void*)codeloc); -+ } -+ else if (cif->abi == FFI_STDCALL || cif->abi == FFI_PASCAL) -+ { -+ FFI_INIT_TRAMPOLINE_WIN32 (&closure->tramp[0], -+ &ffi_closure_STDCALL, -+ (void*)codeloc); -+ } -+#ifdef X86_WIN32 -+ else if (cif->abi == FFI_MS_CDECL) -+ { -+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], -+ &ffi_closure_SYSV, -+ (void*)codeloc); -+ } -+#endif /* X86_WIN32 */ -+#endif /* !X86_WIN64 */ -+ else -+ { -+ return FFI_BAD_ABI; -+ } -+ -+ closure->cif = cif; -+ closure->user_data = user_data; -+ closure->fun = fun; -+ -+ return FFI_OK; -+} -+ -+/* ------- Native raw API support -------------------------------- */ -+ -+#if !FFI_NO_RAW_API -+ -+ffi_status -+ffi_prep_raw_closure_loc (ffi_raw_closure* closure, -+ ffi_cif* cif, -+ void (*fun)(ffi_cif*,void*,ffi_raw*,void*), -+ void *user_data, -+ void *codeloc) -+{ -+ int i; -+ -+ if (cif->abi != FFI_SYSV -+#ifdef X86_WIN32 -+ && cif->abi != FFI_THISCALL -+#endif -+ ) -+ return FFI_BAD_ABI; -+ -+ /* we currently don't support certain kinds of arguments for raw -+ closures. This should be implemented by a separate assembly -+ language routine, since it would require argument processing, -+ something we don't do now for performance. */ -+ -+ for (i = cif->nargs-1; i >= 0; i--) -+ { -+ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); -+ FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); -+ } -+ -+#ifdef X86_WIN32 -+ if (cif->abi == FFI_SYSV) -+ { -+#endif -+ FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, -+ codeloc); -+#ifdef X86_WIN32 -+ } -+ else if (cif->abi == FFI_THISCALL) -+ { -+ FFI_INIT_TRAMPOLINE_RAW_THISCALL (&closure->tramp[0], &ffi_closure_raw_THISCALL, codeloc, cif->bytes); -+ } -+#endif -+ closure->cif = cif; -+ closure->user_data = user_data; -+ closure->fun = fun; -+ -+ return FFI_OK; -+} -+ -+static unsigned int -+ffi_prep_args_raw(char *stack, extended_cif *ecif) -+{ -+ const ffi_cif *cif = ecif->cif; -+ unsigned int i, passed_regs = 0; -+ -+#ifndef X86_WIN64 -+ const unsigned int abi = cif->abi; -+ const unsigned int max_regs = (abi == FFI_THISCALL) ? 1 -+ : (abi == FFI_FASTCALL) ? 2 -+ : (abi == FFI_REGISTER) ? 3 -+ : 0; -+ -+ if (cif->flags == FFI_TYPE_STRUCT) -+ ++passed_regs; -+ -+ for (i = 0; i < cif->nargs && passed_regs <= max_regs; i++) -+ { -+ if (cif->arg_types[i]->type == FFI_TYPE_FLOAT -+ || cif->arg_types[i]->type == FFI_TYPE_STRUCT) -+ continue; -+ -+ size_t sz = cif->arg_types[i]->size; -+ if (sz == 0 || sz > FFI_SIZEOF_ARG) -+ continue; -+ -+ ++passed_regs; -+ } -+#endif -+ -+ memcpy (stack, ecif->avalue, cif->bytes); -+ return passed_regs; -+} -+ -+/* we borrow this routine from libffi (it must be changed, though, to -+ * actually call the function passed in the first argument. as of -+ * libffi-1.20, this is not the case.) -+ */ -+ -+void -+ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) -+{ -+ extended_cif ecif; -+ void **avalue = (void **)fake_avalue; -+ -+ ecif.cif = cif; -+ ecif.avalue = avalue; -+ -+ /* If the return value is a struct and we don't have a return */ -+ /* value address then we need to make one */ -+ -+ if (rvalue == NULL -+ && (cif->flags == FFI_TYPE_STRUCT -+ || cif->flags == FFI_TYPE_MS_STRUCT)) -+ { -+ ecif.rvalue = alloca(cif->rtype->size); -+ } -+ else -+ ecif.rvalue = rvalue; -+ -+ -+ switch (cif->abi) -+ { -+#ifndef X86_WIN32 -+ case FFI_SYSV: -+ ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, -+ ecif.rvalue, fn); -+ break; -+#else -+ case FFI_SYSV: -+ case FFI_MS_CDECL: -+#endif -+#ifndef X86_WIN64 -+ case FFI_STDCALL: -+ case FFI_THISCALL: -+ case FFI_FASTCALL: -+ case FFI_PASCAL: -+ case FFI_REGISTER: -+ ffi_call_win32(ffi_prep_args_raw, &ecif, cif->abi, cif->bytes, cif->flags, -+ ecif.rvalue, fn); -+ break; -+#endif -+ default: -+ FFI_ASSERT(0); -+ break; -+ } -+} -+ -+#endif -+ -+#endif /* !__x86_64__ || X86_WIN64 */ -+ -diff --git a/src/x86/win32_msvc.S b/src/x86/win32_msvc.S -new file mode 100644 -index 0000000..4d20de4 ---- /dev/null -+++ b/src/x86/win32_msvc.S -@@ -0,0 +1,519 @@ -+/* ----------------------------------------------------------------------- -+ win32.S - Copyright (c) 2014 Anthony Green -+ Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. -+ Copyright (c) 2001 John Beniton -+ Copyright (c) 2002 Ranjit Mathew -+ Copyright (c) 2009 Daniel Witte -+ -+ -+ X86 Foreign Function Interface -+ -+ Permission is hereby granted, free of charge, to any person obtaining -+ a copy of this software and associated documentation files (the -+ ``Software''), to deal in the Software without restriction, including -+ without limitation the rights to use, copy, modify, merge, publish, -+ distribute, sublicense, and/or sell copies of the Software, and to -+ permit persons to whom the Software is furnished to do so, subject to -+ the following conditions: -+ -+ The above copyright notice and this permission notice shall be included -+ in all copies or substantial portions of the Software. -+ -+ THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -+ DEALINGS IN THE SOFTWARE. -+ ----------------------------------------------------------------------- -+ */ -+ -+#define LIBFFI_ASM -+#include -+#include -+ -+#define CIF_BYTES_OFFSET 16 -+#define CIF_FLAGS_OFFSET 20 -+ -+#ifndef _MSC_VER -+#error "Invalid configuration, this file needs to be built with msvc" -+#endif -+ -+#define CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) -+ -+.386 -+.MODEL FLAT, C -+ -+EXTRN ffi_closure_SYSV_inner:NEAR -+EXTRN ffi_closure_WIN32_inner:NEAR -+ -+_TEXT SEGMENT -+ -+ffi_call_win32 PROC NEAR, -+ ffi_prep_args : NEAR PTR DWORD, -+ ecif : NEAR PTR DWORD, -+ cif_abi : DWORD, -+ cif_bytes : DWORD, -+ cif_flags : DWORD, -+ rvalue : NEAR PTR DWORD, -+ fn : NEAR PTR DWORD -+ -+ ;; Make room for all of the new args. -+ mov ecx, cif_bytes -+ sub esp, ecx -+ -+ mov eax, esp -+ -+ ;; Call ffi_prep_args -+ push ecif -+ push eax -+ call ffi_prep_args -+ add esp, 8 -+ -+ ;; Prepare registers -+ ;; EAX stores the number of register arguments -+ cmp eax, 0 -+ je fun -+ cmp eax, 3 -+ jl prepr_two_cmp -+ -+ mov ecx, esp -+ add esp, 12 -+ mov eax, DWORD PTR [ecx+8] -+ jmp prepr_two -+prepr_two_cmp: -+ cmp eax, 2 -+ jl prepr_one_prep -+ mov ecx, esp -+ add esp, 8 -+prepr_two: -+ mov edx, DWORD PTR [ecx+4] -+ jmp prepr_one -+prepr_one_prep: -+ mov ecx, esp -+ add esp, 4 -+prepr_one: -+ mov ecx, DWORD PTR [ecx] -+ cmp cif_abi, 7 ;; FFI_REGISTER -+ jne fun -+ -+ xchg ecx, eax -+ -+fun: -+ ;; Call function -+ call fn -+ -+ ;; Load ecx with the return type code -+ mov ecx, cif_flags -+ -+ ;; If the return value pointer is NULL, assume no return value. -+ cmp rvalue, 0 -+ jne ca_jumptable -+ -+ ;; Even if there is no space for the return value, we are -+ ;; obliged to handle floating-point values. -+ cmp ecx, FFI_TYPE_FLOAT -+ jne ca_epilogue -+ fstp st(0) -+ -+ jmp ca_epilogue -+ -+ca_jumptable: -+ jmp [ca_jumpdata + 4 * ecx] -+ca_jumpdata: -+ ;; Do not insert anything here between label and jump table. -+ dd offset ca_epilogue ;; FFI_TYPE_VOID -+ dd offset ca_retint ;; FFI_TYPE_INT -+ dd offset ca_retfloat ;; FFI_TYPE_FLOAT -+ dd offset ca_retdouble ;; FFI_TYPE_DOUBLE -+ dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE -+ dd offset ca_retuint8 ;; FFI_TYPE_UINT8 -+ dd offset ca_retsint8 ;; FFI_TYPE_SINT8 -+ dd offset ca_retuint16 ;; FFI_TYPE_UINT16 -+ dd offset ca_retsint16 ;; FFI_TYPE_SINT16 -+ dd offset ca_retint ;; FFI_TYPE_UINT32 -+ dd offset ca_retint ;; FFI_TYPE_SINT32 -+ dd offset ca_retint64 ;; FFI_TYPE_UINT64 -+ dd offset ca_retint64 ;; FFI_TYPE_SINT64 -+ dd offset ca_epilogue ;; FFI_TYPE_STRUCT -+ dd offset ca_retint ;; FFI_TYPE_POINTER -+ dd offset ca_retstruct1b ;; FFI_TYPE_SMALL_STRUCT_1B -+ dd offset ca_retstruct2b ;; FFI_TYPE_SMALL_STRUCT_2B -+ dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B -+ dd offset ca_epilogue ;; FFI_TYPE_MS_STRUCT -+ -+ /* Sign/zero extend as appropriate. */ -+ca_retuint8: -+ movzx eax, al -+ jmp ca_retint -+ -+ca_retsint8: -+ movsx eax, al -+ jmp ca_retint -+ -+ca_retuint16: -+ movzx eax, ax -+ jmp ca_retint -+ -+ca_retsint16: -+ movsx eax, ax -+ jmp ca_retint -+ -+ca_retint: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ mov [ecx + 0], eax -+ jmp ca_epilogue -+ -+ca_retint64: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ mov [ecx + 0], eax -+ mov [ecx + 4], edx -+ jmp ca_epilogue -+ -+ca_retfloat: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ fstp DWORD PTR [ecx] -+ jmp ca_epilogue -+ -+ca_retdouble: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ fstp QWORD PTR [ecx] -+ jmp ca_epilogue -+ -+ca_retlongdouble: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ fstp TBYTE PTR [ecx] -+ jmp ca_epilogue -+ -+ca_retstruct1b: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ mov [ecx + 0], al -+ jmp ca_epilogue -+ -+ca_retstruct2b: -+ ;; Load %ecx with the pointer to storage for the return value -+ mov ecx, rvalue -+ mov [ecx + 0], ax -+ jmp ca_epilogue -+ -+ca_epilogue: -+ ;; Epilogue code is autogenerated. -+ ret -+ffi_call_win32 ENDP -+ -+ffi_closure_THISCALL PROC NEAR -+ ;; Insert the register argument on the stack as the first argument -+ xchg DWORD PTR [esp+4], ecx -+ xchg DWORD PTR [esp], ecx -+ push ecx -+ jmp ffi_closure_STDCALL -+ffi_closure_THISCALL ENDP -+ -+ffi_closure_FASTCALL PROC NEAR -+ ;; Insert the 2 register arguments on the stack as the first argument -+ xchg DWORD PTR [esp+4], edx -+ xchg DWORD PTR [esp], ecx -+ push edx -+ push ecx -+ jmp ffi_closure_STDCALL -+ffi_closure_FASTCALL ENDP -+ -+ffi_closure_REGISTER PROC NEAR -+ ;; Insert the 3 register arguments on the stack as the first argument -+ push eax -+ xchg DWORD PTR [esp+8], ecx -+ xchg DWORD PTR [esp+4], edx -+ push ecx -+ push edx -+ jmp ffi_closure_STDCALL -+ffi_closure_REGISTER ENDP -+ -+ffi_closure_SYSV PROC NEAR FORCEFRAME -+ ;; the ffi_closure ctx is passed in eax by the trampoline. -+ -+ sub esp, 40 -+ lea edx, [ebp - 24] -+ mov [ebp - 12], edx ;; resp -+ lea edx, [ebp + 8] -+stub:: -+ mov [esp + 8], edx ;; args -+ lea edx, [ebp - 12] -+ mov [esp + 4], edx ;; &resp -+ mov [esp], eax ;; closure -+ call ffi_closure_SYSV_inner -+ mov ecx, [ebp - 12] -+ -+cs_jumptable: -+ jmp [cs_jumpdata + 4 * eax] -+cs_jumpdata: -+ ;; Do not insert anything here between the label and jump table. -+ dd offset cs_epilogue ;; FFI_TYPE_VOID -+ dd offset cs_retint ;; FFI_TYPE_INT -+ dd offset cs_retfloat ;; FFI_TYPE_FLOAT -+ dd offset cs_retdouble ;; FFI_TYPE_DOUBLE -+ dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE -+ dd offset cs_retuint8 ;; FFI_TYPE_UINT8 -+ dd offset cs_retsint8 ;; FFI_TYPE_SINT8 -+ dd offset cs_retuint16 ;; FFI_TYPE_UINT16 -+ dd offset cs_retsint16 ;; FFI_TYPE_SINT16 -+ dd offset cs_retint ;; FFI_TYPE_UINT32 -+ dd offset cs_retint ;; FFI_TYPE_SINT32 -+ dd offset cs_retint64 ;; FFI_TYPE_UINT64 -+ dd offset cs_retint64 ;; FFI_TYPE_SINT64 -+ dd offset cs_retstruct ;; FFI_TYPE_STRUCT -+ dd offset cs_retint ;; FFI_TYPE_POINTER -+ dd offset cs_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B -+ dd offset cs_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B -+ dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B -+ dd offset cs_retmsstruct ;; FFI_TYPE_MS_STRUCT -+ -+cs_retuint8: -+ movzx eax, BYTE PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retsint8: -+ movsx eax, BYTE PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retuint16: -+ movzx eax, WORD PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retsint16: -+ movsx eax, WORD PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retint: -+ mov eax, [ecx] -+ jmp cs_epilogue -+ -+cs_retint64: -+ mov eax, [ecx + 0] -+ mov edx, [ecx + 4] -+ jmp cs_epilogue -+ -+cs_retfloat: -+ fld DWORD PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retdouble: -+ fld QWORD PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retlongdouble: -+ fld TBYTE PTR [ecx] -+ jmp cs_epilogue -+ -+cs_retstruct: -+ ;; Caller expects us to pop struct return value pointer hidden arg. -+ ;; Epilogue code is autogenerated. -+ ret 4 -+ -+cs_retmsstruct: -+ ;; Caller expects us to return a pointer to the real return value. -+ mov eax, ecx -+ ;; Caller doesn't expects us to pop struct return value pointer hidden arg. -+ jmp cs_epilogue -+ -+cs_epilogue: -+ ;; Epilogue code is autogenerated. -+ ret -+ffi_closure_SYSV ENDP -+ -+#if !FFI_NO_RAW_API -+ -+#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) -+#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) -+#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) -+ -+ffi_closure_raw_THISCALL PROC NEAR USES esi FORCEFRAME -+ sub esp, 36 -+ mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif -+ mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data -+ mov [esp + 12], edx -+ lea edx, [ebp + 12] -+ jmp stubraw -+ffi_closure_raw_THISCALL ENDP -+ -+ffi_closure_raw_SYSV PROC NEAR USES esi FORCEFRAME -+ ;; the ffi_closure ctx is passed in eax by the trampoline. -+ -+ sub esp, 40 -+ mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif -+ mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data -+ mov [esp + 12], edx ;; user_data -+ lea edx, [ebp + 8] -+stubraw:: -+ mov [esp + 8], edx ;; raw_args -+ lea edx, [ebp - 24] -+ mov [esp + 4], edx ;; &res -+ mov [esp], esi ;; cif -+ call DWORD PTR [eax + RAW_CLOSURE_FUN_OFFSET] ;; closure->fun -+ mov eax, [esi + CIF_FLAGS_OFFSET] ;; cif->flags -+ lea ecx, [ebp - 24] -+ -+cr_jumptable: -+ jmp [cr_jumpdata + 4 * eax] -+cr_jumpdata: -+ ;; Do not insert anything here between the label and jump table. -+ dd offset cr_epilogue ;; FFI_TYPE_VOID -+ dd offset cr_retint ;; FFI_TYPE_INT -+ dd offset cr_retfloat ;; FFI_TYPE_FLOAT -+ dd offset cr_retdouble ;; FFI_TYPE_DOUBLE -+ dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE -+ dd offset cr_retuint8 ;; FFI_TYPE_UINT8 -+ dd offset cr_retsint8 ;; FFI_TYPE_SINT8 -+ dd offset cr_retuint16 ;; FFI_TYPE_UINT16 -+ dd offset cr_retsint16 ;; FFI_TYPE_SINT16 -+ dd offset cr_retint ;; FFI_TYPE_UINT32 -+ dd offset cr_retint ;; FFI_TYPE_SINT32 -+ dd offset cr_retint64 ;; FFI_TYPE_UINT64 -+ dd offset cr_retint64 ;; FFI_TYPE_SINT64 -+ dd offset cr_epilogue ;; FFI_TYPE_STRUCT -+ dd offset cr_retint ;; FFI_TYPE_POINTER -+ dd offset cr_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B -+ dd offset cr_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B -+ dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B -+ dd offset cr_epilogue ;; FFI_TYPE_MS_STRUCT -+ -+cr_retuint8: -+ movzx eax, BYTE PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retsint8: -+ movsx eax, BYTE PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retuint16: -+ movzx eax, WORD PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retsint16: -+ movsx eax, WORD PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retint: -+ mov eax, [ecx] -+ jmp cr_epilogue -+ -+cr_retint64: -+ mov eax, [ecx + 0] -+ mov edx, [ecx + 4] -+ jmp cr_epilogue -+ -+cr_retfloat: -+ fld DWORD PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retdouble: -+ fld QWORD PTR [ecx] -+ jmp cr_epilogue -+ -+cr_retlongdouble: -+ fld TBYTE PTR [ecx] -+ jmp cr_epilogue -+ -+cr_epilogue: -+ ;; Epilogue code is autogenerated. -+ ret -+ffi_closure_raw_SYSV ENDP -+ -+#endif /* !FFI_NO_RAW_API */ -+ -+ffi_closure_STDCALL PROC NEAR FORCEFRAME -+ mov eax, [esp] ;; the ffi_closure ctx passed by the trampoline. -+ -+ sub esp, 40 -+ lea edx, [ebp - 24] -+ mov [ebp - 12], edx ;; resp -+ lea edx, [ebp + 12] ;; account for stub return address on stack -+ mov [esp + 8], edx ;; args -+ lea edx, [ebp - 12] -+ mov [esp + 4], edx ;; &resp -+ mov [esp], eax ;; closure -+ call ffi_closure_WIN32_inner -+ mov ecx, [ebp - 12] -+ -+ xchg [ebp + 4], eax ;;xchg size of stack parameters and ffi_closure ctx -+ mov eax, DWORD PTR [eax + CLOSURE_CIF_OFFSET] -+ mov eax, DWORD PTR [eax + CIF_FLAGS_OFFSET] -+ -+cd_jumptable: -+ jmp [cd_jumpdata + 4 * eax] -+cd_jumpdata: -+ ;; Do not insert anything here between the label and jump table. -+ dd offset cd_epilogue ;; FFI_TYPE_VOID -+ dd offset cd_retint ;; FFI_TYPE_INT -+ dd offset cd_retfloat ;; FFI_TYPE_FLOAT -+ dd offset cd_retdouble ;; FFI_TYPE_DOUBLE -+ dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE -+ dd offset cd_retuint8 ;; FFI_TYPE_UINT8 -+ dd offset cd_retsint8 ;; FFI_TYPE_SINT8 -+ dd offset cd_retuint16 ;; FFI_TYPE_UINT16 -+ dd offset cd_retsint16 ;; FFI_TYPE_SINT16 -+ dd offset cd_retint ;; FFI_TYPE_UINT32 -+ dd offset cd_retint ;; FFI_TYPE_SINT32 -+ dd offset cd_retint64 ;; FFI_TYPE_UINT64 -+ dd offset cd_retint64 ;; FFI_TYPE_SINT64 -+ dd offset cd_epilogue ;; FFI_TYPE_STRUCT -+ dd offset cd_retint ;; FFI_TYPE_POINTER -+ dd offset cd_retsint8 ;; FFI_TYPE_SMALL_STRUCT_1B -+ dd offset cd_retsint16 ;; FFI_TYPE_SMALL_STRUCT_2B -+ dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B -+ -+cd_retuint8: -+ movzx eax, BYTE PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retsint8: -+ movsx eax, BYTE PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retuint16: -+ movzx eax, WORD PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retsint16: -+ movsx eax, WORD PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retint: -+ mov eax, [ecx] -+ jmp cd_epilogue -+ -+cd_retint64: -+ mov eax, [ecx + 0] -+ mov edx, [ecx + 4] -+ jmp cd_epilogue -+ -+cd_retfloat: -+ fld DWORD PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retdouble: -+ fld QWORD PTR [ecx] -+ jmp cd_epilogue -+ -+cd_retlongdouble: -+ fld TBYTE PTR [ecx] -+ jmp cd_epilogue -+ -+cd_epilogue: -+ mov esp, ebp -+ pop ebp -+ mov ecx, [esp + 4] ;; Return address -+ add esp, [esp] ;; Parameters stack size -+ add esp, 8 -+ jmp ecx -+ffi_closure_STDCALL ENDP -+ -+_TEXT ENDS -+END --- -2.26.1.windows.1 - - -From a8d87e3694f65c03afc80048f8a76ea9405553a9 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 28 Feb 2017 03:09:47 +0530 -Subject: [PATCH 04/32] meson: Use add_project_arguments for global args - -Allows use as a subproject ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index f137bc4..5eaae56 100644 ---- a/meson.build -+++ b/meson.build -@@ -6,7 +6,7 @@ project('libffi', 'c', version : '3.2.1', - cc = meson.get_compiler('c') - - # For FFI_EXTERN symbol exporting --add_global_arguments('-DFFI_BUILDING', language : 'c') -+add_project_arguments('-DFFI_BUILDING', language : 'c') - - ffi_conf = configuration_data() - --- -2.26.1.windows.1 - - -From 8394da157611b992fe6f666b324fb56b92deed27 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 28 Feb 2017 03:18:59 +0530 -Subject: [PATCH 05/32] meson: Declare a dependency for ffi_lib - -Allows usage of the library via subprojects ---- - src/meson.build | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/meson.build b/src/meson.build -index b747948..bebd3e6 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -87,3 +87,6 @@ ffi_lib = library('ffi', ffi_c_sources, ffi_asm_sources, - # current - age - soversion : '7', - install : true) -+ -+ffi_dep = declare_dependency(link_with : ffi_lib, -+ include_directories : ffiinc) --- -2.26.1.windows.1 - - -From 28c32ffe5944ec06778c93ab815e82b198a67a50 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Wed, 1 Mar 2017 12:45:54 +0530 -Subject: [PATCH 06/32] meson: Fix include paths when used as a subproject - -We can't just blindly assume that everything will be relative to the -build root. Must use paths relative to the current source/build dir. ---- - src/meson.build | 7 +++++-- - 1 file changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/meson.build b/src/meson.build -index bebd3e6..9a9feba 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -61,15 +61,18 @@ if cc.get_id() == 'msvc' - ml = find_program('ml', 'ml64') - ffi_asm_objs = [] - foreach asm_source : ffi_asm_sources -+ incflags = ['/I' + join_paths(meson.current_source_dir(), '..'), -+ '/I' + join_paths(meson.current_build_dir(), '..'), -+ '/I' + join_paths(meson.current_source_dir(), '..', 'include'), -+ '/I' + join_paths(meson.current_build_dir(), '..', 'include')] - preproc_name = asm_source.underscorify() + '.i' - obj_name = asm_source.underscorify() + '.obj' - preproc = custom_target(preproc_name, - input : asm_source, - output : preproc_name, - command : [cl, '/nologo', '/EP', '/P', '/Fi@OUTPUT@', -- '/I.', '/I..', '/Iinclude', '/I..\\include', - '/DTARGET=' + TARGET, '/DFFI_BUILDING', -- '@INPUT@']) -+ '@INPUT@'] + incflags) - ffi_asm_objs += custom_target(obj_name, - input : preproc, - output : obj_name, --- -2.26.1.windows.1 - - -From ef501d66033d3d7e83cbb6e0f7c4c90a0d9b69b8 Mon Sep 17 00:00:00 2001 -From: Ignacio Casal Quinteiro -Date: Sat, 30 Dec 2017 06:57:44 +0530 -Subject: [PATCH 07/32] Use C89 declarations for x86 MSVC code - -Fixes building with VS2013 which only supports C89. - -See: https://github.com/wingtk/gvsbuild/issues/206 ---- - src/x86/ffiold-msvc.c | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/x86/ffiold-msvc.c b/src/x86/ffiold-msvc.c -index 006c95d..939642f 100644 ---- a/src/x86/ffiold-msvc.c -+++ b/src/x86/ffiold-msvc.c -@@ -99,11 +99,13 @@ unsigned int ffi_prep_args(char *stack, extended_cif *ecif) - i != 0; - i--, p_arg += dir, p_argv += dir) - { -+ size_t z; -+ - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) - argp = (char *) ALIGN(argp, sizeof(void*)); - -- size_t z = (*p_arg)->size; -+ z = (*p_arg)->size; - - #ifdef X86_WIN64 - if (z > FFI_SIZEOF_ARG -@@ -599,11 +601,13 @@ ffi_prep_incoming_args(char *stack, void **rvalue, void **avalue, - i != 0; - i--, p_arg += dir, p_argv += dir) - { -+ size_t z; -+ - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) - argp = (char *) ALIGN(argp, sizeof(void*)); - -- size_t z = (*p_arg)->size; -+ z = (*p_arg)->size; - - #ifdef X86_WIN64 - if (z > FFI_SIZEOF_ARG --- -2.26.1.windows.1 - - -From 86cdeb020ef91331ecd22a03f5f9fe325945a721 Mon Sep 17 00:00:00 2001 -From: Mathieu Duponchelle -Date: Thu, 15 Mar 2018 19:08:30 +0100 -Subject: [PATCH 08/32] ffiold_msvc.c: ALIGN was renamed to FFI_ALIGN - ---- - src/x86/ffiold-msvc.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/src/x86/ffiold-msvc.c b/src/x86/ffiold-msvc.c -index 939642f..fa8ef5d 100644 ---- a/src/x86/ffiold-msvc.c -+++ b/src/x86/ffiold-msvc.c -@@ -103,7 +103,7 @@ unsigned int ffi_prep_args(char *stack, extended_cif *ecif) - - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) -- argp = (char *) ALIGN(argp, sizeof(void*)); -+ argp = (char *) FFI_ALIGN(argp, sizeof(void*)); - - z = (*p_arg)->size; - -@@ -299,7 +299,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) - #endif - cif->flags = FFI_TYPE_STRUCT; - /* allocate space for return value pointer */ -- cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); -+ cif->bytes += FFI_ALIGN(sizeof(void*), FFI_SIZEOF_ARG); - } - break; - -@@ -318,8 +318,8 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) - for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) - { - if (((*ptr)->alignment - 1) & cif->bytes) -- cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); -- cif->bytes += (unsigned)ALIGN((*ptr)->size, FFI_SIZEOF_ARG); -+ cif->bytes = FFI_ALIGN(cif->bytes, (*ptr)->alignment); -+ cif->bytes += (unsigned)FFI_ALIGN((*ptr)->size, FFI_SIZEOF_ARG); - } - - #ifdef X86_WIN64 -@@ -605,7 +605,7 @@ ffi_prep_incoming_args(char *stack, void **rvalue, void **avalue, - - /* Align if necessary */ - if ((sizeof(void*) - 1) & (size_t) argp) -- argp = (char *) ALIGN(argp, sizeof(void*)); -+ argp = (char *) FFI_ALIGN(argp, sizeof(void*)); - - z = (*p_arg)->size; - --- -2.26.1.windows.1 - - -From 53291b332b1bc061a3409d3b60c38f313609b98e Mon Sep 17 00:00:00 2001 -From: Matthew Waters -Date: Fri, 16 Mar 2018 15:10:04 +1100 -Subject: [PATCH 09/32] x86/win64: disable runtime stack frame checks with msvc - around built assembly - -MSVC can add truntime code that checks if a stack frame is mismanaged -however our custom assembly delibrately accesses and modifies the parent -stack frame. Fortunately we can disable that specific check for the -function call so do that. ---- - src/x86/ffiw64.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c -index f787525..88bb3a3 100644 ---- a/src/x86/ffiw64.c -+++ b/src/x86/ffiw64.c -@@ -106,6 +106,14 @@ EFI64(ffi_prep_cif_machdep)(ffi_cif *cif) - return FFI_OK; - } - -+/* we perform some black magic here to use some of the parent's -+ * stack frame in ff_call_win64() that breaks with the msvc compiler -+ * with the /RTCs or /GZ flags. Disable the 'Stack frame run time -+ * error checking' for this function so we don't hit weird exceptions -+ * in debug builds */ -+#if defined(_MSVC_VER) -+#pragma runtime_checks("s", off) -+#endif - static void - ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - void **avalue, void *closure) -@@ -170,6 +178,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - - ffi_call_win64 (stack, frame, closure); - } -+#if defined(_MSVC_VER) -+#pragma runtime_checks("s", restore) -+#endif - - void - EFI64(ffi_call)(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) --- -2.26.1.windows.1 - - -From f8aff9ca61424f3b1ad6efef927eef49323e6306 Mon Sep 17 00:00:00 2001 -From: Matthew Waters -Date: Fri, 16 Mar 2018 22:33:35 +1100 -Subject: [PATCH 10/32] win64: fix msvc specific compiler check - -It's _MSC_VER not _MSVC_VER ---- - src/x86/ffiw64.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/x86/ffiw64.c b/src/x86/ffiw64.c -index 88bb3a3..c91c72a 100644 ---- a/src/x86/ffiw64.c -+++ b/src/x86/ffiw64.c -@@ -111,7 +111,7 @@ EFI64(ffi_prep_cif_machdep)(ffi_cif *cif) - * with the /RTCs or /GZ flags. Disable the 'Stack frame run time - * error checking' for this function so we don't hit weird exceptions - * in debug builds */ --#if defined(_MSVC_VER) -+#if defined(_MSC_VER) - #pragma runtime_checks("s", off) - #endif - static void -@@ -178,7 +178,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue, - - ffi_call_win64 (stack, frame, closure); - } --#if defined(_MSVC_VER) -+#if defined(_MSC_VER) - #pragma runtime_checks("s", restore) - #endif - --- -2.26.1.windows.1 - - -From 464b3a6dd294910fec84f3d139431926e1d0927f Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 28 Aug 2018 12:27:02 +0530 -Subject: [PATCH 11/32] meson: Rename 'debug' to 'ffi-debug' - -'debug' is a reserved keyword and starting with meson 0.48 using it as -a user option causes an error: - -> meson_options.txt:2: Option name debug is reserved. ---- - meson.build | 2 +- - meson_options.txt | 2 +- - src/meson.build | 2 +- - 3 files changed, 3 insertions(+), 3 deletions(-) - -diff --git a/meson.build b/meson.build -index 5eaae56..b31cb64 100644 ---- a/meson.build -+++ b/meson.build -@@ -171,7 +171,7 @@ if host_system != 'windows' - endif - - # User options --if get_option('debug') -+if get_option('ffi-debug') - ffi_conf.set('FFI_DEBUG') - endif - if not get_option('raw_api') -diff --git a/meson_options.txt b/meson_options.txt -index 7e5bede..2c7f517 100644 ---- a/meson_options.txt -+++ b/meson_options.txt -@@ -1,5 +1,5 @@ - # Toggle this if you want extra debugging --option('debug', type : 'boolean', value : false) -+option('ffi-debug', type : 'boolean', value : false) - # Toggle this if you do not want support for aggregate types - option('structs', type : 'boolean', value : true) - # Toggle this if you do not want support for the raw API -diff --git a/src/meson.build b/src/meson.build -index 9a9feba..ed5c184 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -8,7 +8,7 @@ ffi_c_sources = [ - - ffi_asm_sources = [] - --if get_option('debug') -+if get_option('ffi-debug') - ffi_c_sources += ['debug.c'] - endif - --- -2.26.1.windows.1 - - -From 51d74d8af8844bfc11e4b753cbfa8d0941af0daf Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Wed, 29 Aug 2018 15:19:46 +0530 -Subject: [PATCH 12/32] meson: Use same library versioning on macOS as - Autotools - -Requires Meson 0.48, but that isn't released yet. It will just be -ignored on older meson versions. ---- - src/meson.build | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/meson.build b/src/meson.build -index ed5c184..2e12d5e 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -89,6 +89,8 @@ ffi_lib = library('ffi', ffi_c_sources, ffi_asm_sources, - version : '7.1.0', - # current - age - soversion : '7', -+ # current + 1 -+ darwin_versions : '9', - install : true) - - ffi_dep = declare_dependency(link_with : ffi_lib, --- -2.26.1.windows.1 - - -From 28b2a0c1f9dc594fcd11a3556cd3b95b035e76fd Mon Sep 17 00:00:00 2001 -From: Xavier Claessens -Date: Fri, 28 Sep 2018 21:58:24 -0400 -Subject: [PATCH 13/32] Meson: Add support for aarch64 - ---- - include/meson.build | 4 ++-- - src/meson.build | 8 +++++++- - 2 files changed, 9 insertions(+), 3 deletions(-) - -diff --git a/include/meson.build b/include/meson.build -index 7887bf0..63bf3e9 100644 ---- a/include/meson.build -+++ b/include/meson.build -@@ -12,7 +12,7 @@ configure_file( - configuration : configuration_data(), - install_dir : 'include') - --# Install noarch ffi.h that includes the arch-specific ffi.h header -+# Install noarch ffitarget.h that includes the arch-specific ffitarget.h - ffitarget_h_noarch_conf = configuration_data() - ffitarget_h_noarch_conf.set('ARCH', host_cpu_family) - ffitarget_h_noarch_conf.set('HEADER', 'ffitarget') -@@ -20,7 +20,7 @@ configure_file(input : 'ffi_noarch.h.meson', output : 'ffitarget.h', - configuration : ffitarget_h_noarch_conf, - install_dir : 'include') - --# Install noarch ffitarget.h that includes the arch-specific fftarget.h -+# Install noarch ffi.h that includes the arch-specific ffi.h header - ffi_h_noarch_conf = configuration_data() - ffi_h_noarch_conf.set('ARCH', host_cpu_family) - ffi_h_noarch_conf.set('HEADER', 'ffi') -diff --git a/src/meson.build b/src/meson.build -index 2e12d5e..1f5fd25 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -13,9 +13,9 @@ if get_option('ffi-debug') - endif - - # We only support x86 on Windows and Linux right now --arch_subdir = 'x86' - if host_system == 'windows' - # No ARM support for Windows in libffi -+ arch_subdir = 'x86' - if size_t == 4 - TARGET = 'X86_WIN32' - if cc.get_id() == 'msvc' -@@ -35,6 +35,7 @@ if host_system == 'windows' - endif - endif - elif host_system == 'linux' and host_cpu_family.startswith('x86') -+ arch_subdir = 'x86' - if size_t == 4 - # FIXME: gnux32 support? - TARGET = 'X86' -@@ -45,6 +46,11 @@ elif host_system == 'linux' and host_cpu_family.startswith('x86') - ffi_c_sources += ['x86/ffi64.c', 'x86/ffiw64.c'] - ffi_asm_sources += ['x86/unix64.S', 'x86/win64.S'] - endif -+elif host_system == 'linux' and host_cpu_family.startswith('aarch64') -+ arch_subdir = 'aarch64' -+ TARGET = 'AARCH64' -+ ffi_c_sources += ['aarch64/ffi.c'] -+ ffi_asm_sources += ['aarch64/sysv.S'] - else - error('Unsupported system "@0@" or cpu family "@1@"'.format(host_system, host_cpu_family)) - endif --- -2.26.1.windows.1 - - -From 337e1e84365a2adfbb46f278327d8ad75fd3aa3d Mon Sep 17 00:00:00 2001 -From: Xavier Claessens -Date: Sun, 21 Oct 2018 13:43:26 -0400 -Subject: [PATCH 14/32] meson: Fix warnings with more recent version of meson - ---- - include/meson.build | 4 ++-- - meson.build | 14 +------------- - src/meson.build | 6 ++++++ - 3 files changed, 9 insertions(+), 15 deletions(-) - -diff --git a/include/meson.build b/include/meson.build -index 63bf3e9..72288cd 100644 ---- a/include/meson.build -+++ b/include/meson.build -@@ -9,8 +9,8 @@ configure_file(input : 'ffi.h.in', - configure_file( - input : '../src/@0@/ffitarget.h'.format(arch_subdir), - output : 'ffitarget-@0@.h'.format(host_cpu_family), -- configuration : configuration_data(), -- install_dir : 'include') -+ install_dir : 'include', -+ copy : true) - - # Install noarch ffitarget.h that includes the arch-specific ffitarget.h - ffitarget_h_noarch_conf = configuration_data() -diff --git a/meson.build b/meson.build -index b31cb64..ce14cb8 100644 ---- a/meson.build -+++ b/meson.build -@@ -1,5 +1,5 @@ - project('libffi', 'c', version : '3.2.1', -- meson_version : '>= 0.37.1', -+ meson_version : '>= 0.47.0', - default_options : ['buildtype=debugoptimized', - 'warning_level=1']) - -@@ -189,18 +189,6 @@ endif - - msvcc = find_program('msvcc.sh') - --# pkg-config file --ffi_pc_conf = configuration_data() --ffi_pc_conf.set('prefix', get_option('prefix')) --ffi_pc_conf.set('exec_prefix', get_option('prefix')) --ffi_pc_conf.set('libdir', '@0@/@1@'.format(get_option('prefix'), get_option('libdir'))) --ffi_pc_conf.set('includedir', '@0@/include'.format(get_option('prefix'))) --ffi_pc_conf.set('PACKAGE_VERSION', meson.project_version()) --pkgconfigdir = get_option('libdir') + '/pkgconfig' --configure_file(input : 'libffi.pc.in', output : 'libffi.pc', -- configuration : ffi_pc_conf, -- install_dir : pkgconfigdir) -- - ffiinc = [include_directories('.'), include_directories('include')] - - # Configure ffi_conf some more and declare libffi.so -diff --git a/src/meson.build b/src/meson.build -index 1f5fd25..a2117b3 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -57,6 +57,7 @@ endif - - # Used in ffi.h.in to generate ffi-$arch.h - ffi_conf.set('TARGET', TARGET) -+ffi_conf.set('VERSION', meson.project_version()) - - if cc.get_id() == 'msvc' - # GCC and Clang accept assembly files directly, but MSVC's cl.exe does not. -@@ -99,5 +100,10 @@ ffi_lib = library('ffi', ffi_c_sources, ffi_asm_sources, - darwin_versions : '9', - install : true) - -+pkgconf = import('pkgconfig') -+pkgconf.generate(ffi_lib, -+ description : 'Library supporting Foreign Function Interfaces', -+ filebase : 'libffi') -+ - ffi_dep = declare_dependency(link_with : ffi_lib, - include_directories : ffiinc) --- -2.26.1.windows.1 - - -From 7c5bab255f685a9574eff2ca7a99e169066f7ee8 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Sun, 21 Oct 2018 23:19:46 +0530 -Subject: [PATCH 15/32] meson: Bump version to 3.2.9999 for release - -Let's make a release so people can use a tarball instead of a git -repository. - -https://github.com/centricular/libffi/pull/3#issuecomment-431688881 - -Upstream is at 3.3rc, and we're behind at this point, so 3.2.9999 -sounds best. ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index ce14cb8..0f090e3 100644 ---- a/meson.build -+++ b/meson.build -@@ -1,4 +1,4 @@ --project('libffi', 'c', version : '3.2.1', -+project('libffi', 'c', version : '3.2.9999', - meson_version : '>= 0.47.0', - default_options : ['buildtype=debugoptimized', - 'warning_level=1']) --- -2.26.1.windows.1 - - -From 478c22a6716f603fc6a63c865bed957564039d79 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 23 Oct 2018 02:01:58 +0530 -Subject: [PATCH 16/32] meson: Add support for Linux and Android ARM - ---- - meson.build | 13 ++++++------- - src/meson.build | 50 +++++++++++++++++++++++++++++-------------------- - 2 files changed, 36 insertions(+), 27 deletions(-) - -diff --git a/meson.build b/meson.build -index 0f090e3..e03cfc4 100644 ---- a/meson.build -+++ b/meson.build -@@ -92,7 +92,7 @@ else - endif - - # Exception handling frame --if cc.get_id() == 'gcc' or cc.get_id() == 'llvm' -+if cc.get_id() == 'gcc' or cc.get_id() == 'clang' - # FIXME: Actually check for this instead of hard-coding it - # Also, check if this is actually correct - if host_cpu_family == 'x86_64' -@@ -105,16 +105,15 @@ if cc.get_id() == 'gcc' or cc.get_id() == 'llvm' - endif - endif - --if host_cpu_family == 'arm' and host_system == 'darwin' -+if ['arm', 'aarch64'].contains(host_cpu_family) and host_system == 'darwin' - message('Cannot use PROT_EXEC on this target, using fallback') - ffi_conf.set('FFI_EXEC_TRAMPOLINE_TABLE', 1) - else - ffi_conf.set('FFI_EXEC_TRAMPOLINE_TABLE', 0) --endif -- --if host_system == 'darwin' or host_system == 'openbsd' or host_system == 'freebsd' or host_system == 'solaris' -- message('Cannot use malloc on this target, using fallback') -- ffi_conf.set('FFI_MMAP_EXEC_WRIT', 1) -+ if ['android', 'darwin', 'openbsd', 'freebsd', 'solaris'].contains(host_system) -+ message('Cannot use malloc on this target, using fallback') -+ ffi_conf.set('FFI_MMAP_EXEC_WRIT', 1) -+ endif - endif - - if host_cpu_family == 'x86_64' and cc.get_id() != 'msvc' -diff --git a/src/meson.build b/src/meson.build -index a2117b3..d0575fb 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -12,8 +12,9 @@ if get_option('ffi-debug') - ffi_c_sources += ['debug.c'] - endif - --# We only support x86 on Windows and Linux right now --if host_system == 'windows' -+# This if/else ladder is based on the configure.host file -+TARGET = '' -+if host_system == 'windows' and host_cpu_family.startswith('x86') - # No ARM support for Windows in libffi - arch_subdir = 'x86' - if size_t == 4 -@@ -34,25 +35,34 @@ if host_system == 'windows' - ffi_asm_sources += ['x86/win64.S'] - endif - endif --elif host_system == 'linux' and host_cpu_family.startswith('x86') -- arch_subdir = 'x86' -- if size_t == 4 -- # FIXME: gnux32 support? -- TARGET = 'X86' -- ffi_c_sources += ['x86/ffi.c'] -- ffi_asm_sources += ['x86/sysv.S'] -- else -- TARGET = 'X86_64' -- ffi_c_sources += ['x86/ffi64.c', 'x86/ffiw64.c'] -- ffi_asm_sources += ['x86/unix64.S', 'x86/win64.S'] -+elif ['linux', 'android'].contains(host_system) -+ if host_cpu_family.startswith('x86') -+ arch_subdir = 'x86' -+ if size_t == 4 -+ # FIXME: gnux32 support? -+ TARGET = 'X86' -+ ffi_c_sources += ['x86/ffi.c'] -+ ffi_asm_sources += ['x86/sysv.S'] -+ else -+ TARGET = 'X86_64' -+ ffi_c_sources += ['x86/ffi64.c', 'x86/ffiw64.c'] -+ ffi_asm_sources += ['x86/unix64.S', 'x86/win64.S'] -+ endif -+ elif host_cpu_family == 'aarch64' -+ arch_subdir = 'aarch64' -+ TARGET = 'AARCH64' -+ ffi_c_sources += ['aarch64/ffi.c'] -+ ffi_asm_sources += ['aarch64/sysv.S'] -+ elif host_cpu_family == 'arm' -+ arch_subdir = 'arm' -+ TARGET = 'ARM' -+ ffi_c_sources += ['arm/ffi.c'] -+ ffi_asm_sources += ['arm/sysv.S'] - endif --elif host_system == 'linux' and host_cpu_family.startswith('aarch64') -- arch_subdir = 'aarch64' -- TARGET = 'AARCH64' -- ffi_c_sources += ['aarch64/ffi.c'] -- ffi_asm_sources += ['aarch64/sysv.S'] --else -- error('Unsupported system "@0@" or cpu family "@1@"'.format(host_system, host_cpu_family)) -+endif -+ -+if TARGET == '' -+ error('Unsupported pair: system "@0@", cpu family "@1@"'.format(host_system, host_cpu_family)) - endif - - # Used in ffi.h.in to generate ffi-$arch.h --- -2.26.1.windows.1 - - -From 06b1b10db3946d3a0803374609c40a1810820485 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 23 Oct 2018 02:23:09 +0530 -Subject: [PATCH 17/32] meson: Whitespace fix - ---- - meson.build | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/meson.build b/meson.build -index e03cfc4..481902e 100644 ---- a/meson.build -+++ b/meson.build -@@ -84,8 +84,8 @@ else - message('sizeof "long double" is greater than "double"') - ffi_conf.set('HAVE_LONG_DOUBLE', 1) - if host_cpu_family == 'powerpc' and host_system != 'darwin' -- message('"long double" size can be different') -- ffi_conf.set('HAVE_LONG_DOUBLE_VARIANT', 1) -+ message('"long double" size can be different') -+ ffi_conf.set('HAVE_LONG_DOUBLE_VARIANT', 1) - endif - endif - endif --- -2.26.1.windows.1 - - -From b71dd59c0188d93543d595a423635d6466a11bc4 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 23 Oct 2018 02:46:58 +0530 -Subject: [PATCH 18/32] meson: Rework target detection if/else ladder - -Most arches other than x86 actually have the same code for all OSes, -f.ex., arm and aarch64, so invert the ladder. ---- - src/meson.build | 78 ++++++++++++++++++++++++++----------------------- - 1 file changed, 42 insertions(+), 36 deletions(-) - -diff --git a/src/meson.build b/src/meson.build -index d0575fb..6b7a668 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -14,57 +14,63 @@ endif - - # This if/else ladder is based on the configure.host file - TARGET = '' --if host_system == 'windows' and host_cpu_family.startswith('x86') -- # No ARM support for Windows in libffi -+if host_cpu_family.startswith('x86') - arch_subdir = 'x86' -- if size_t == 4 -- TARGET = 'X86_WIN32' -- if cc.get_id() == 'msvc' -- ffi_c_sources += ['x86/ffiold-msvc.c'] -- ffi_asm_sources += ['x86/win32_msvc.S'] -- else -- ffi_c_sources += ['x86/ffi.c'] -- ffi_asm_sources += ['x86/sysv.S'] -- endif -- else -- TARGET = 'X86_WIN64' -- ffi_c_sources += ['x86/ffiw64.c'] -- if cc.get_id() == 'msvc' -- ffi_asm_sources += ['x86/win64_intel.S'] -+ if host_system == 'windows' -+ if size_t == 4 -+ TARGET = 'X86_WIN32' -+ if cc.get_id() == 'msvc' -+ c_sources = ['ffiold-msvc.c'] -+ asm_sources = ['win32_msvc.S'] -+ else -+ c_sources = ['ffi.c'] -+ asm_sources = ['sysv.S'] -+ endif - else -- ffi_asm_sources += ['x86/win64.S'] -+ TARGET = 'X86_WIN64' -+ c_sources = ['ffiw64.c'] -+ if cc.get_id() == 'msvc' -+ asm_sources = ['win64_intel.S'] -+ else -+ asm_sources = ['win64.S'] -+ endif - endif -- endif --elif ['linux', 'android'].contains(host_system) -- if host_cpu_family.startswith('x86') -- arch_subdir = 'x86' -+ elif ['linux', 'android'].contains(host_system) - if size_t == 4 -- # FIXME: gnux32 support? - TARGET = 'X86' -- ffi_c_sources += ['x86/ffi.c'] -- ffi_asm_sources += ['x86/sysv.S'] -+ # FIXME: TARGET_X32 support -+ c_sources = ['ffi.c'] -+ asm_sources = ['sysv.S'] - else - TARGET = 'X86_64' -- ffi_c_sources += ['x86/ffi64.c', 'x86/ffiw64.c'] -- ffi_asm_sources += ['x86/unix64.S', 'x86/win64.S'] -+ c_sources = ['ffi64.c', 'ffiw64.c'] -+ asm_sources = ['unix64.S', 'win64.S'] - endif -- elif host_cpu_family == 'aarch64' -- arch_subdir = 'aarch64' -- TARGET = 'AARCH64' -- ffi_c_sources += ['aarch64/ffi.c'] -- ffi_asm_sources += ['aarch64/sysv.S'] -- elif host_cpu_family == 'arm' -- arch_subdir = 'arm' -- TARGET = 'ARM' -- ffi_c_sources += ['arm/ffi.c'] -- ffi_asm_sources += ['arm/sysv.S'] - endif -+elif host_cpu_family == 'aarch64' -+ arch_subdir = 'aarch64' -+ TARGET = 'AARCH64' -+ c_sources = ['ffi.c'] -+ asm_sources = ['sysv.S'] -+elif host_cpu_family == 'arm' -+ arch_subdir = 'arm' -+ TARGET = 'ARM' -+ c_sources = ['ffi.c'] -+ asm_sources = ['sysv.S'] - endif - - if TARGET == '' - error('Unsupported pair: system "@0@", cpu family "@1@"'.format(host_system, host_cpu_family)) - endif - -+# Translate source files to source paths -+foreach c : c_sources -+ ffi_c_sources += arch_subdir + '/' + c -+endforeach -+foreach asm : asm_sources -+ ffi_asm_sources += arch_subdir + '/' + asm -+endforeach -+ - # Used in ffi.h.in to generate ffi-$arch.h - ffi_conf.set('TARGET', TARGET) - ffi_conf.set('VERSION', meson.project_version()) --- -2.26.1.windows.1 - - -From 8546ef68ec11c4aa64e44c44c74729b2c2171e8e Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 23 Oct 2018 02:49:59 +0530 -Subject: [PATCH 19/32] meson: Add support for macOS - -iOS is already supported through the arm/aarch64 codepaths. ---- - src/meson.build | 8 ++++++-- - 1 file changed, 6 insertions(+), 2 deletions(-) - -diff --git a/src/meson.build b/src/meson.build -index 6b7a668..e2e0a2e 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -35,10 +35,14 @@ if host_cpu_family.startswith('x86') - asm_sources = ['win64.S'] - endif - endif -- elif ['linux', 'android'].contains(host_system) -+ elif ['darwin', 'linux', 'android'].contains(host_system) - if size_t == 4 -- TARGET = 'X86' -+ if host_system == 'darwin' -+ TARGET = 'X86_DARWIN' -+ else -+ TARGET = 'X86' - # FIXME: TARGET_X32 support -+ endif - c_sources = ['ffi.c'] - asm_sources = ['sysv.S'] - else --- -2.26.1.windows.1 - - -From 067e0bdc4ca2d5db40c004f3c81ca5a75d1232dd Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Sat, 27 Oct 2018 23:37:36 +0100 -Subject: [PATCH 20/32] meson: Check for hidden visibility support in the - compiler - ---- - meson.build | 15 ++++++++++----- - test-cc-supports-hidden-visibility.py | 26 ++++++++++++++++++++++++++ - 2 files changed, 36 insertions(+), 5 deletions(-) - create mode 100644 test-cc-supports-hidden-visibility.py - -diff --git a/meson.build b/meson.build -index 481902e..475b8dd 100644 ---- a/meson.build -+++ b/meson.build -@@ -1,5 +1,5 @@ - project('libffi', 'c', version : '3.2.9999', -- meson_version : '>= 0.47.0', -+ meson_version : '>= 0.48.0', - default_options : ['buildtype=debugoptimized', - 'warning_level=1']) - -@@ -163,10 +163,15 @@ ffi_conf.set('HAVE_STDINT_H', cc.has_header('stdint.h')) - #ffi_conf.set10('HAVE_UNISTD_H', cc.has_header('unistd.h')) - - # Misc defines --# FIXME: Check if this is compiler-specific check is correct --if host_system != 'windows' -- message('Host system is not Windows; assuming .hidden pseudo-op is available') -- ffi_conf.set('HAVE_HIDDEN_VISIBILITY_ATTRIBUTE', 1) -+if cc.has_function_attribute('visibility') -+ t = find_program('test-cc-supports-hidden-visibility.py') -+ res = run_command(t, cc.cmd_array()) -+ if res.returncode() == 0 -+ message('.hidden pseudo-op is available') -+ ffi_conf.set('HAVE_HIDDEN_VISIBILITY_ATTRIBUTE', 1) -+ else -+ message('.hidden pseudo-op is NOT available: ' + res.stdout() + res.stderr()) -+ endif - endif - - # User options -diff --git a/test-cc-supports-hidden-visibility.py b/test-cc-supports-hidden-visibility.py -new file mode 100644 -index 0000000..1a1b76b ---- /dev/null -+++ b/test-cc-supports-hidden-visibility.py -@@ -0,0 +1,26 @@ -+#!/usr/bin/env python3 -+ -+import os -+import re -+import sys -+import subprocess -+ -+# Put output files in the builddir -+os.chdir(os.environ['MESON_BUILD_ROOT']) -+ -+infile = 'visibility-conftest.c' -+outfile = 'visibility-conftest.S' -+ -+with open(infile, 'w') as f: -+ f.write('int __attribute__ ((visibility ("hidden"))) foo (void) { return 1; }') -+ -+args = sys.argv[1:] -+args += ['-Werror', '-S', infile, '-o', outfile] -+res = subprocess.run(args, stdout=subprocess.PIPE, universal_newlines=True, check=True) -+ -+regex = re.compile('\.hidden.*foo') -+with open(outfile, 'r') as f: -+ if regex.search(f.read()): -+ sys.exit(0) -+print('.hidden not found in the outputted assembly') -+sys.exit(1) --- -2.26.1.windows.1 - - -From 69454167fa9b1719854416e9df482b9232a51c93 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Sun, 28 Oct 2018 15:07:17 +0000 -Subject: [PATCH 21/32] meson: Add iOS x86, x86_64, and armv7 support - -x86* are used by the iPhone simulator - -armv7 wrapper is taken from the aarch64/ffi.c iOS code ---- - src/arm/ffi.c | 21 +++++++++++++++++++-- - src/meson.build | 4 ++-- - 2 files changed, 21 insertions(+), 4 deletions(-) - -diff --git a/src/arm/ffi.c b/src/arm/ffi.c -index d838271..ba22c1d 100644 ---- a/src/arm/ffi.c -+++ b/src/arm/ffi.c -@@ -43,8 +43,25 @@ - - #else - extern unsigned int ffi_arm_trampoline[2] FFI_HIDDEN; -+ -+#if defined (__clang__) && defined (__APPLE__) -+extern void sys_icache_invalidate (void *start, size_t len); - #endif - -+static inline void -+ffi_clear_cache (void *start, void *end) -+{ -+#if defined (__clang__) && defined (__APPLE__) -+ sys_icache_invalidate (start, (char *)end - (char *)start); -+#elif defined (__GNUC__) -+ __builtin___clear_cache (start, end); -+#else -+#error "Missing builtin to flush instruction cache" -+#endif -+} -+ -+#endif /* __MACH__ */ -+ - /* Forward declares. */ - static int vfp_type_p (const ffi_type *); - static void layout_vfp_args (ffi_cif *); -@@ -576,8 +593,8 @@ ffi_prep_closure_loc (ffi_closure * closure, - msync(closure->tramp, 8, 0x1000000); /* clear data map */ - msync(codeloc, 8, 0x1000000); /* clear insn map */ - #else -- __clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */ -- __clear_cache(codeloc, codeloc + 8); /* clear insn map */ -+ ffi_clear_cache(closure->tramp, closure->tramp + 8); /* clear data map */ -+ ffi_clear_cache(codeloc, codeloc + 8); /* clear insn map */ - #endif - *(void (**)(void))(closure->tramp + 8) = closure_func; - #endif -diff --git a/src/meson.build b/src/meson.build -index e2e0a2e..a1cad36 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -35,9 +35,9 @@ if host_cpu_family.startswith('x86') - asm_sources = ['win64.S'] - endif - endif -- elif ['darwin', 'linux', 'android'].contains(host_system) -+ elif ['darwin', 'ios', 'linux', 'android'].contains(host_system) - if size_t == 4 -- if host_system == 'darwin' -+ if ['darwin', 'ios'].contains(host_system) - TARGET = 'X86_DARWIN' - else - TARGET = 'X86' --- -2.26.1.windows.1 - - -From 952b8f9bdde8f748347318ac5e7439ab22e1f3e3 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Fri, 8 Mar 2019 13:35:56 +0530 -Subject: [PATCH 22/32] ffi.h: Support cross-building to Windows ARM64 - ---- - include/ffi_noarch.h.meson | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/ffi_noarch.h.meson b/include/ffi_noarch.h.meson -index 9994c8d..23bcd9c 100644 ---- a/include/ffi_noarch.h.meson -+++ b/include/ffi_noarch.h.meson -@@ -10,7 +10,7 @@ - #include "@HEADER@-x86_64.h" - #elif defined(__arm__) || defined(_M_ARM) - #include "@HEADER@-arm.h" --#elif defined(__aarch64__) -+#elif defined(__aarch64__) || defined(_M_ARM64) - #include "@HEADER@-aarch64.h" - #elif defined(__powerpc__) || defined(_M_PPC) - #include "@HEADER@-powerpc.h" --- -2.26.1.windows.1 - - -From 33c6ec3e0e54e97bfaf67e41f2e7d9a2464057ed Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Wed, 17 Jul 2019 14:20:23 +0530 -Subject: [PATCH 23/32] meson: ffi-debug option was broken - ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/meson.build b/meson.build -index 475b8dd..9a8edf7 100644 ---- a/meson.build -+++ b/meson.build -@@ -176,7 +176,7 @@ endif - - # User options - if get_option('ffi-debug') -- ffi_conf.set('FFI_DEBUG') -+ ffi_conf.set('FFI_DEBUG', 1) - endif - if not get_option('raw_api') - ffi_conf.set('FFI_NO_RAW_API', 1) --- -2.26.1.windows.1 - - -From 5d9a19f90d1af20f3e4e744cde73ae547bfafa00 Mon Sep 17 00:00:00 2001 -From: Jordan Petridis -Date: Thu, 11 Jul 2019 07:11:07 +0300 -Subject: [PATCH 24/32] Add Windows CI for msvc 2017 and msys2 - -Currently the container is based upon a windows 1607 image -and requires a runner with a server/hyper-v 1607 host -to be able to execute. - -There are plan on moving the runner to a 1807 later. ---- - .gitlab-ci.yml | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 53 insertions(+) - create mode 100644 .gitlab-ci.yml - -diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml -new file mode 100644 -index 0000000..b39770c ---- /dev/null -+++ b/.gitlab-ci.yml -@@ -0,0 +1,53 @@ -+variables: -+ WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v6' -+ -+.build windows: -+ image: $WINDOWS_IMAGE -+ stage: 'build' -+ tags: -+ - 'docker' -+ - 'windows' -+ - '1607' -+ variables: -+ # Uncomment the following key if need to pass custom args, as well with the -+ # $env:MESON_ARGS line in the `script:` blocks -+ # MESON_ARGS: >- -+ # -Dfoo=enabled -+ # -Dbar=false -+ # Make sure any failure in PowerShell scripts is fatal -+ ErrorActionPreference: 'Stop' -+ WarningPreference: 'Stop' -+ before_script: -+ - pip3 install -U meson -+ script: -+ # For some reason, options are separated by newline instead of space, so we -+ # have to replace them first. -+ # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") -+ -+ # Gitlab executes PowerShell in docker, but VsDevCmd.bat is a batch script. -+ # Environment variables substitutions is done by PowerShell before calling -+ # cmd.exe, that's why we use $env:FOO instead of %FOO% -+ - cmd.exe /C "C:\BuildTools\Common7\Tools\VsDevCmd.bat -host_arch=amd64 -arch=$env:ARCH && -+ meson build $env:MESON_ARGS && -+ ninja -C build" -+ -+vs2017 amd64: -+ extends: '.build windows' -+ variables: -+ ARCH: 'amd64' -+ -+vs2017 x86: -+ extends: '.build windows' -+ variables: -+ ARCH: 'x86' -+ -+msys2: -+ extends: '.build windows' -+ script: -+ # For some reason, options are separated by newline instead of space, so we -+ # have to replace them first. -+ # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") -+ -+ - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin" -+ - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS && -+ ninja -C build" -\ No newline at end of file --- -2.26.1.windows.1 - - -From 6fec0c2044f7559f95cd908c089d8ed1b7dc0f40 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 16 May 2019 04:13:54 +0530 -Subject: [PATCH 25/32] meson: Fix ASM visibility attribute for Darwin - ---- - fficonfig.h.meson | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/fficonfig.h.meson b/fficonfig.h.meson -index a882290..f6001a2 100644 ---- a/fficonfig.h.meson -+++ b/fficonfig.h.meson -@@ -148,7 +148,11 @@ - - #ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE - #ifdef LIBFFI_ASM -+#ifdef __APPLE__ -+#define FFI_HIDDEN(name) .private_extern name -+#else - #define FFI_HIDDEN(name) .hidden name -+#endif - #else - #define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) - #endif --- -2.26.1.windows.1 - - -From e3616c3292d3321b127ee3877ce89f53c64e0977 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 16 May 2019 04:16:54 +0530 -Subject: [PATCH 26/32] meson: Disable some unused mmap and alloca checks - ---- - meson.build | 37 +++++++++++++++++++------------------ - 1 file changed, 19 insertions(+), 18 deletions(-) - -diff --git a/meson.build b/meson.build -index 9a8edf7..71fb2a8 100644 ---- a/meson.build -+++ b/meson.build -@@ -123,27 +123,28 @@ if host_cpu_family == 'x86_64' and cc.get_id() != 'msvc' - endif - - # Check mmap() --if cc.has_function('mmap') -- ffi_conf.set('HAVE_MMAP', 1) --endif --ffi_conf.set('HAVE_MMAP_FILE', 1) # Works everywhere --ffi_conf.set('HAVE_MMAP_DEV_ZERO', -- host_system != 'windows' and host_system != 'darwin') --mmap_anon = '''#include --#include --#include -- --#ifndef MAP_ANONYMOUS --#define MAP_ANONYMOUS MAP_ANON -+# XXX: All these are unused -+#if cc.has_function('mmap') -+# ffi_conf.set('HAVE_MMAP', 1) - #endif -- --int n = MAP_ANONYMOUS; --''' --ffi_conf.set('HAVE_MMAP_ANON', -- cc.compiles(mmap_anon, name : 'mmap anonymous')) -+#ffi_conf.set('HAVE_MMAP_FILE', 1) # Works everywhere -+#ffi_conf.set('HAVE_MMAP_DEV_ZERO', -+# host_system != 'windows' and host_system != 'darwin') -+#mmap_anon = '''#include -+##include -+##include -+# -+##ifndef MAP_ANONYMOUS -+##define MAP_ANONYMOUS MAP_ANON -+##endif -+# -+#int n = MAP_ANONYMOUS; -+#''' -+#ffi_conf.set('HAVE_MMAP_ANON', -+# cc.compiles(mmap_anon, name : 'mmap anonymous')) - - # Misc functions --ffi_conf.set('HAVE_ALLOCA', cc.has_function('alloca')) -+#ffi_conf.set('HAVE_ALLOCA', cc.has_function('alloca')) # XXX: unused - ffi_conf.set10('HAVE_MEMCPY', cc.has_function('memcpy')) - ffi_conf.set('HAVE_MKOSTEMP', cc.has_function('mkostemp')) - --- -2.26.1.windows.1 - - -From 98eef3ec08dd7d101b96569fed48ed9188ae0423 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 16 May 2019 04:18:06 +0530 -Subject: [PATCH 27/32] meson: Fix some MSVC assembly feature checks - -These should really be configure checks, but they require inspecting -the compiled output, which we can't with meson. ---- - meson.build | 20 +++++++++----------- - 1 file changed, 9 insertions(+), 11 deletions(-) - -diff --git a/meson.build b/meson.build -index 71fb2a8..2711e9c 100644 ---- a/meson.build -+++ b/meson.build -@@ -92,17 +92,15 @@ else - endif - - # Exception handling frame --if cc.get_id() == 'gcc' or cc.get_id() == 'clang' -- # FIXME: Actually check for this instead of hard-coding it -- # Also, check if this is actually correct -- if host_cpu_family == 'x86_64' -- message('.eh_frame is hard-coded to not be ro') -- ffi_conf.set('EH_FRAME_FLAGS', '"aw"') -- else -- message('.eh_frame is hard-coded to ro') -- ffi_conf.set('HAVE_RO_EH_FRAME', 1) -- ffi_conf.set('EH_FRAME_FLAGS', '"a"') -- endif -+# FIXME: Actually check for this instead of hard-coding it -+# Also, check if this is actually correct -+if host_cpu_family == 'x86_64' -+ message('.eh_frame is hard-coded to not be ro') -+ ffi_conf.set('EH_FRAME_FLAGS', '"aw"') -+else -+ message('.eh_frame is hard-coded to ro') -+ ffi_conf.set('HAVE_RO_EH_FRAME', 1) -+ ffi_conf.set('EH_FRAME_FLAGS', '"a"') - endif - - if ['arm', 'aarch64'].contains(host_cpu_family) and host_system == 'darwin' --- -2.26.1.windows.1 - - -From b3e5c93de44f9724470e7463d8594f40b3dcb310 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 16 May 2019 04:19:45 +0530 -Subject: [PATCH 28/32] aarch64: Fix some MSVC compiler warnings with explicit - casts - ---- - src/aarch64/ffi.c | 10 +++++----- - src/prep_cif.c | 2 +- - 2 files changed, 6 insertions(+), 6 deletions(-) - -diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c -index 4400b61..5966753 100644 ---- a/src/aarch64/ffi.c -+++ b/src/aarch64/ffi.c -@@ -588,8 +588,8 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - /* Allocate consectutive stack for everything we'll need. */ - context = alloca (sizeof(struct call_context) + stack_bytes + 32 + rsize); - stack = context + 1; -- frame = stack + stack_bytes; -- rvalue = (rsize ? frame + 32 : orig_rvalue); -+ frame = (void*)((uintptr_t)stack + (uintptr_t)stack_bytes); -+ rvalue = (rsize ? (void*)((uintptr_t)frame + 32) : orig_rvalue); - - arg_init (&state); - for (i = 0, nargs = cif->nargs; i < nargs; i++) -@@ -681,7 +681,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - X registers, then the argument is copied into - consecutive X registers. */ - dest = &context->x[state.ngrn]; -- state.ngrn += n; -+ state.ngrn += (unsigned int)n; - } - else - { -@@ -874,7 +874,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif, - if (state.nsrn + n <= N_V_ARG_REG) - { - void *reg = &context->v[state.nsrn]; -- state.nsrn += n; -+ state.nsrn += (unsigned int)n; - - /* Eeek! We need a pointer to the structure, however the - homogeneous float elements are being passed in individual -@@ -906,7 +906,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif, - if (state.ngrn + n <= N_X_ARG_REG) - { - avalue[i] = &context->x[state.ngrn]; -- state.ngrn += n; -+ state.ngrn += (unsigned int)n; - } - else - { -diff --git a/src/prep_cif.c b/src/prep_cif.c -index fe05453..702ca27 100644 ---- a/src/prep_cif.c -+++ b/src/prep_cif.c -@@ -199,7 +199,7 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, - bytes = 6*4; - #endif - -- bytes += STACK_ARG_SIZE((*ptr)->size); -+ bytes += (unsigned int)STACK_ARG_SIZE((*ptr)->size); - } - #endif - } --- -2.26.1.windows.1 - - -From b7b98d1883987367f23b4fe4a817b8d0b2279c8d Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Thu, 16 May 2019 04:20:41 +0530 -Subject: [PATCH 29/32] aarch64: Add support for the arm64 WinRT target - -Code copied from https://github.com/libffi/libffi/pull/486, cleaned -up and split into separate commits with Meson support. - -Author is ossdev07 ---- - include/ffi.h.in | 1 + - src/aarch64/ffi.c | 56 +++++ - src/aarch64/ffitarget.h | 11 +- - src/aarch64/win64_armasm.S | 504 +++++++++++++++++++++++++++++++++++++ - src/closures.c | 12 +- - src/meson.build | 22 +- - src/prep_cif.c | 3 + - 7 files changed, 598 insertions(+), 11 deletions(-) - create mode 100644 src/aarch64/win64_armasm.S - -diff --git a/include/ffi.h.in b/include/ffi.h.in -index ac79f2f..1fca797 100644 ---- a/include/ffi.h.in -+++ b/include/ffi.h.in -@@ -218,6 +218,7 @@ typedef struct { - ffi_type *rtype; - unsigned bytes; - unsigned flags; -+ unsigned isVariadic; - #ifdef FFI_EXTRA_CIF_FIELDS - FFI_EXTRA_CIF_FIELDS; - #endif -diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c -index 5966753..ea04f27 100644 ---- a/src/aarch64/ffi.c -+++ b/src/aarch64/ffi.c -@@ -26,6 +26,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #include - #include - #include "internal.h" -+#ifdef _M_ARM64 -+#include /* FlushInstructionCache */ -+#endif - - /* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; - all further uses in this file will refer to the 128-bit type. */ -@@ -74,6 +77,8 @@ ffi_clear_cache (void *start, void *end) - sys_icache_invalidate (start, (char *)end - (char *)start); - #elif defined (__GNUC__) - __builtin___clear_cache (start, end); -+#elif defined (_M_ARM64) -+ FlushInstructionCache(GetCurrentProcess(), start, (char*)end - (char*)start); - #else - #error "Missing builtin to flush instruction cache" - #endif -@@ -315,6 +320,9 @@ extend_integer_type (void *source, int type) - } - } - -+#if defined(_MSC_VER) -+void extend_hfa_type (void *dest, void *src, int h); -+#else - static void - extend_hfa_type (void *dest, void *src, int h) - { -@@ -368,7 +376,11 @@ extend_hfa_type (void *dest, void *src, int h) - : "r"(f * 12), "r"(dest), "r"(src) - : "memory", "v16", "v17", "v18", "v19"); - } -+#endif - -+#if defined(_MSC_VER) -+void* compress_hfa_type (void *dest, void *src, int h); -+#else - static void * - compress_hfa_type (void *dest, void *reg, int h) - { -@@ -437,6 +449,7 @@ compress_hfa_type (void *dest, void *reg, int h) - } - return dest; - } -+#endif - - /* Either allocate an appropriate register for the argument type, or if - none are available, allocate a stack slot and return a pointer -@@ -651,6 +664,22 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - if (h) - { - int elems = 4 - (h & 3); -+#ifdef _M_ARM64 /* for handling armasm calling convention */ -+ if (cif->isVariadic) -+ { -+ if (state.ngrn + elems <= N_X_ARG_REG) -+ { -+ dest = &context->x[state.ngrn]; -+ state.ngrn += elems; -+ extend_hfa_type(dest, a, h); -+ break; -+ } -+ state.nsrn = N_X_ARG_REG; -+ dest = allocate_to_stack(&state, stack, ty->alignment, s); -+ } -+ else -+ { -+#endif /* for handling armasm calling convention */ - if (state.nsrn + elems <= N_V_ARG_REG) - { - dest = &context->v[state.nsrn]; -@@ -660,6 +689,9 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *orig_rvalue, - } - state.nsrn = N_V_ARG_REG; - dest = allocate_to_stack (&state, stack, ty->alignment, s); -+#ifdef _M_ARM64 /* for handling armasm calling convention */ -+ } -+#endif /* for handling armasm calling convention */ - } - else if (s > 16) - { -@@ -871,6 +903,27 @@ ffi_closure_SYSV_inner (ffi_cif *cif, - if (h) - { - n = 4 - (h & 3); -+#ifdef _M_ARM64 /* for handling armasm calling convention */ -+ if (cif->isVariadic) -+ { -+ if (state.ngrn + n <= N_X_ARG_REG) -+ { -+ void *reg = &context->x[state.ngrn]; -+ state.ngrn += (unsigned int)n; -+ /* Eeek! See below. */ -+ avalue[i] = compress_hfa_type(reg, reg, h); -+ } -+ else -+ { -+ state.ngrn = N_X_ARG_REG; -+ state.nsrn = N_V_ARG_REG; -+ avalue[i] = allocate_to_stack(&state, stack, -+ ty->alignment, s); -+ } -+ } -+ else -+ { -+#endif /* for handling armasm calling convention */ - if (state.nsrn + n <= N_V_ARG_REG) - { - void *reg = &context->v[state.nsrn]; -@@ -891,6 +944,9 @@ ffi_closure_SYSV_inner (ffi_cif *cif, - avalue[i] = allocate_to_stack (&state, stack, - ty->alignment, s); - } -+#ifdef _M_ARM64 /* for handling armasm calling convention */ -+ } -+#endif /* for handling armasm calling convention */ - } - else if (s > 16) - { -diff --git a/src/aarch64/ffitarget.h b/src/aarch64/ffitarget.h -index 65086cd..32c4f08 100644 ---- a/src/aarch64/ffitarget.h -+++ b/src/aarch64/ffitarget.h -@@ -32,6 +32,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - #define FFI_SIZEOF_JAVA_RAW 4 - typedef unsigned long long ffi_arg; - typedef signed long long ffi_sarg; -+#elif defined(_M_ARM64) -+#define FFI_SIZEOF_ARG 8 -+typedef unsigned long long ffi_arg; -+typedef signed long long ffi_sarg; - #else - typedef unsigned long ffi_arg; - typedef signed long ffi_sarg; -@@ -70,12 +74,15 @@ typedef enum ffi_abi - #if defined (__APPLE__) - #define FFI_TARGET_SPECIFIC_VARIADIC - #define FFI_EXTRA_CIF_FIELDS unsigned aarch64_nfixedargs --#else --/* iOS reserves x18 for the system. Disable Go closures until -+#elif !defined(_M_ARM64) -+/* iOS and Windows reserve x18 for the system. Disable Go closures until - a new static chain is chosen. */ - #define FFI_GO_CLOSURES 1 - #endif - -+#ifndef _M_ARM64 -+/* No complex type on Windows */ - #define FFI_TARGET_HAS_COMPLEX_TYPE -+#endif - - #endif -diff --git a/src/aarch64/win64_armasm.S b/src/aarch64/win64_armasm.S -new file mode 100644 -index 0000000..2ea9250 ---- /dev/null -+++ b/src/aarch64/win64_armasm.S -@@ -0,0 +1,504 @@ -+/* Copyright (c) 2009, 2010, 2011, 2012 ARM Ltd. -+Permission is hereby granted, free of charge, to any person obtaining -+a copy of this software and associated documentation files (the -+``Software''), to deal in the Software without restriction, including -+without limitation the rights to use, copy, modify, merge, publish, -+distribute, sublicense, and/or sell copies of the Software, and to -+permit persons to whom the Software is furnished to do so, subject to -+the following conditions: -+The above copyright notice and this permission notice shall be -+included in all copies or substantial portions of the Software. -+THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, -+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -+ -+#define LIBFFI_ASM -+#include -+#include -+#include -+#include "internal.h" -+ -+ OPT 2 /*disable listing */ -+/* For some macros to add unwind information */ -+#include "ksarm64.h" -+ OPT 1 /*re-enable listing */ -+ -+#define BE(X) 0 -+#define PTR_REG(n) x##n -+#define PTR_SIZE 8 -+ -+ IMPORT ffi_closure_SYSV_inner -+ EXPORT ffi_call_SYSV -+ EXPORT ffi_closure_SYSV_V -+ EXPORT ffi_closure_SYSV -+ EXPORT extend_hfa_type -+ EXPORT compress_hfa_type -+#ifdef FFI_GO_CLOSURES -+ EXPORT ffi_go_closure_SYSV_V -+ EXPORT ffi_go_closure_SYSV -+#endif -+ -+ TEXTAREA, ALLIGN=8 -+ -+/* ffi_call_SYSV -+ extern void ffi_call_SYSV (void *stack, void *frame, -+ void (*fn)(void), void *rvalue, -+ int flags, void *closure); -+ Therefore on entry we have: -+ x0 stack -+ x1 frame -+ x2 fn -+ x3 rvalue -+ x4 flags -+ x5 closure -+*/ -+ -+ NESTED_ENTRY ffi_call_SYSV -+ /* Use a stack frame allocated by our caller. */ -+ PROLOG_NOP stp x29, x30, [x1, #32] -+ /* For unwind information, Windows has to store fp and lr */ -+ PROLOG_SAVE_REG_PAIR x29, x30, #-32! -+ -+ mov x29, x1 -+ mov sp, x0 -+ -+ mov x9, x2 /* save fn */ -+ mov x8, x3 /* install structure return */ -+#ifdef FFI_GO_CLOSURES -+ /*mov x18, x5 install static chain */ -+#endif -+ stp x3, x4, [x29, #16] /* save rvalue and flags */ -+ -+ /* Load the vector argument passing registers, if necessary. */ -+ tbz x4, #AARCH64_FLAG_ARG_V_BIT, ffi_call_SYSV_L1 -+ ldp q0, q1, [sp, #0] -+ ldp q2, q3, [sp, #32] -+ ldp q4, q5, [sp, #64] -+ ldp q6, q7, [sp, #96] -+ -+ffi_call_SYSV_L1 -+ /* Load the core argument passing registers, including -+ the structure return pointer. */ -+ ldp x0, x1, [sp, #16*N_V_ARG_REG + 0] -+ ldp x2, x3, [sp, #16*N_V_ARG_REG + 16] -+ ldp x4, x5, [sp, #16*N_V_ARG_REG + 32] -+ ldp x6, x7, [sp, #16*N_V_ARG_REG + 48] -+ -+ /* Deallocate the context, leaving the stacked arguments. */ -+ add sp, sp, #CALL_CONTEXT_SIZE -+ -+ blr x9 /* call fn */ -+ -+ ldp x3, x4, [x29, #16] /* reload rvalue and flags */ -+ -+ /* Partially deconstruct the stack frame. */ -+ mov sp, x29 -+ ldp x29, x30, [x29, #32] -+ -+ /* Save the return value as directed. */ -+ adr x5, ffi_call_SYSV_return -+ and w4, w4, #AARCH64_RET_MASK -+ add x5, x5, x4, lsl #3 -+ br x5 -+ -+ /* Note that each table entry is 2 insns, and thus 8 bytes. -+ For integer data, note that we're storing into ffi_arg -+ and therefore we want to extend to 64 bits; these types -+ have two consecutive entries allocated for them. */ -+ ALIGN 4 -+ffi_call_SYSV_return -+ ret /* VOID */ -+ nop -+ str x0, [x3] /* INT64 */ -+ ret -+ stp x0, x1, [x3] /* INT128 */ -+ ret -+ brk #1000 /* UNUSED */ -+ ret -+ brk #1000 /* UNUSED */ -+ ret -+ brk #1000 /* UNUSED */ -+ ret -+ brk #1000 /* UNUSED */ -+ ret -+ brk #1000 /* UNUSED */ -+ ret -+ st4 { v0.s, v1.s, v2.s, v3.s }[0], [x3] /* S4 */ -+ ret -+ st3 { v0.s, v1.s, v2.s }[0], [x3] /* S3 */ -+ ret -+ stp s0, s1, [x3] /* S2 */ -+ ret -+ str s0, [x3] /* S1 */ -+ ret -+ st4 { v0.d, v1.d, v2.d, v3.d }[0], [x3] /* D4 */ -+ ret -+ st3 { v0.d, v1.d, v2.d }[0], [x3] /* D3 */ -+ ret -+ stp d0, d1, [x3] /* D2 */ -+ ret -+ str d0, [x3] /* D1 */ -+ ret -+ str q3, [x3, #48] /* Q4 */ -+ nop -+ str q2, [x3, #32] /* Q3 */ -+ nop -+ stp q0, q1, [x3] /* Q2 */ -+ ret -+ str q0, [x3] /* Q1 */ -+ ret -+ uxtb w0, w0 /* UINT8 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ uxth w0, w0 /* UINT16 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ mov w0, w0 /* UINT32 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ sxtb x0, w0 /* SINT8 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ sxth x0, w0 /* SINT16 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ sxtw x0, w0 /* SINT32 */ -+ str x0, [x3] -+ ret /* reserved */ -+ nop -+ -+ -+ NESTED_END ffi_call_SYSV -+ -+ -+/* ffi_closure_SYSV -+ Closure invocation glue. This is the low level code invoked directly by -+ the closure trampoline to setup and call a closure. -+ On entry x17 points to a struct ffi_closure, x16 has been clobbered -+ all other registers are preserved. -+ We allocate a call context and save the argument passing registers, -+ then invoked the generic C ffi_closure_SYSV_inner() function to do all -+ the real work, on return we load the result passing registers back from -+ the call context. -+*/ -+ -+#define ffi_closure_SYSV_FS (8*2 + CALL_CONTEXT_SIZE + 64) -+ -+ NESTED_ENTRY ffi_closure_SYSV_V -+ PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS! -+ -+ /* Save the argument passing vector registers. */ -+ stp q0, q1, [sp, #16 + 0] -+ stp q2, q3, [sp, #16 + 32] -+ stp q4, q5, [sp, #16 + 64] -+ stp q6, q7, [sp, #16 + 96] -+ -+ b ffi_closure_SYSV_save_argument -+ NESTED_END ffi_closure_SYSV_V -+ -+ NESTED_ENTRY ffi_closure_SYSV -+ PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS! -+ -+ffi_closure_SYSV_save_argument -+ /* Save the argument passing core registers. */ -+ stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0] -+ stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16] -+ stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32] -+ stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48] -+ -+ /* Load ffi_closure_inner arguments. */ -+ ldp PTR_REG(0), PTR_REG(1), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET] /* load cif, fn */ -+ ldr PTR_REG(2), [x17, #FFI_TRAMPOLINE_CLOSURE_OFFSET+PTR_SIZE*2] /* load user_data */ -+ -+do_closure -+ add x3, sp, #16 /* load context */ -+ add x4, sp, #ffi_closure_SYSV_FS /* load stack */ -+ add x5, sp, #16+CALL_CONTEXT_SIZE /* load rvalue */ -+ mov x6, x8 /* load struct_rval */ -+ -+ bl ffi_closure_SYSV_inner -+ -+ /* Load the return value as directed. */ -+ adr x1, ffi_closure_SYSV_return_base -+ and w0, w0, #AARCH64_RET_MASK -+ add x1, x1, x0, lsl #3 -+ add x3, sp, #16+CALL_CONTEXT_SIZE -+ br x1 -+ -+ /* Note that each table entry is 2 insns, and thus 8 bytes. */ -+ ALIGN 8 -+ffi_closure_SYSV_return_base -+ b ffi_closure_SYSV_epilog /* VOID */ -+ nop -+ ldr x0, [x3] /* INT64 */ -+ b ffi_closure_SYSV_epilog -+ ldp x0, x1, [x3] /* INT128 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* UNUSED */ -+ nop -+ brk #1000 /* UNUSED */ -+ nop -+ brk #1000 /* UNUSED */ -+ nop -+ brk #1000 /* UNUSED */ -+ nop -+ brk #1000 /* UNUSED */ -+ nop -+ ldr s3, [x3, #12] /* S4 */ -+ nop -+ ldr s2, [x3, #8] /* S3 */ -+ nop -+ ldp s0, s1, [x3] /* S2 */ -+ b ffi_closure_SYSV_epilog -+ ldr s0, [x3] /* S1 */ -+ b ffi_closure_SYSV_epilog -+ ldr d3, [x3, #24] /* D4 */ -+ nop -+ ldr d2, [x3, #16] /* D3 */ -+ nop -+ ldp d0, d1, [x3] /* D2 */ -+ b ffi_closure_SYSV_epilog -+ ldr d0, [x3] /* D1 */ -+ b ffi_closure_SYSV_epilog -+ ldr q3, [x3, #48] /* Q4 */ -+ nop -+ ldr q2, [x3, #32] /* Q3 */ -+ nop -+ ldp q0, q1, [x3] /* Q2 */ -+ b ffi_closure_SYSV_epilog -+ ldr q0, [x3] /* Q1 */ -+ b ffi_closure_SYSV_epilog -+ ldrb w0, [x3, #BE(7)] /* UINT8 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* reserved */ -+ nop -+ ldrh w0, [x3, #BE(6)] /* UINT16 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* reserved */ -+ nop -+ ldr w0, [x3, #BE(4)] /* UINT32 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* reserved */ -+ nop -+ ldrsb x0, [x3, #BE(7)] /* SINT8 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* reserved */ -+ nop -+ ldrsh x0, [x3, #BE(6)] /* SINT16 */ -+ b ffi_closure_SYSV_epilog -+ brk #1000 /* reserved */ -+ nop -+ ldrsw x0, [x3, #BE(4)] /* SINT32 */ -+ nop -+ /* reserved */ -+ -+ffi_closure_SYSV_epilog -+ EPILOG_RESTORE_REG_PAIR x29, x30, #ffi_closure_SYSV_FS! -+ EPILOG_RETURN -+ NESTED_END ffi_closure_SYSV -+ -+ -+#ifdef FFI_GO_CLOSURES -+ NESTED_ENTRY ffi_go_closure_SYSV_V -+ PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS! -+ -+ /* Save the argument passing vector registers. */ -+ stp q0, q1, [sp, #16 + 0] -+ stp q2, q3, [sp, #16 + 32] -+ stp q4, q5, [sp, #16 + 64] -+ stp q6, q7, [sp, #16 + 96] -+ b ffi_go_closure_SYSV_save_argument -+ NESTED_END ffi_go_closure_SYSV_V -+ -+ NESTED_ENTRY ffi_go_closure_SYSV -+ PROLOG_SAVE_REG_PAIR x29, x30, #-ffi_closure_SYSV_FS! -+ -+ffi_go_closure_SYSV_save_argument -+ /* Save the argument passing core registers. */ -+ stp x0, x1, [sp, #16 + 16*N_V_ARG_REG + 0] -+ stp x2, x3, [sp, #16 + 16*N_V_ARG_REG + 16] -+ stp x4, x5, [sp, #16 + 16*N_V_ARG_REG + 32] -+ stp x6, x7, [sp, #16 + 16*N_V_ARG_REG + 48] -+ -+ /* Load ffi_closure_inner arguments. */ -+ ldp PTR_REG(0), PTR_REG(1), [x18, #PTR_SIZE]/* load cif, fn */ -+ mov x2, x18 /* load user_data */ -+ b do_closure -+ NESTED_END ffi_go_closure_SYSV -+ -+#endif /* FFI_GO_CLOSURES */ -+ -+ -+/* void extend_hfa_type (void *dest, void *src, int h) */ -+ -+ LEAF_ENTRY extend_hfa_type -+ -+ adr x3, extend_hfa_type_jump_base -+ and w2, w2, #AARCH64_RET_MASK -+ sub x2, x2, #AARCH64_RET_S4 -+ add x3, x3, x2, lsl #4 -+ br x3 -+ -+ ALIGN 4 -+extend_hfa_type_jump_base -+ ldp s16, s17, [x1] /* S4 */ -+ ldp s18, s19, [x1, #8] -+ b extend_hfa_type_store_4 -+ nop -+ -+ ldp s16, s17, [x1] /* S3 */ -+ ldr s18, [x1, #8] -+ b extend_hfa_type_store_3 -+ nop -+ -+ ldp s16, s17, [x1] /* S2 */ -+ b extend_hfa_type_store_2 -+ nop -+ nop -+ -+ ldr s16, [x1] /* S1 */ -+ b extend_hfa_type_store_1 -+ nop -+ nop -+ -+ ldp d16, d17, [x1] /* D4 */ -+ ldp d18, d19, [x1, #16] -+ b extend_hfa_type_store_4 -+ nop -+ -+ ldp d16, d17, [x1] /* D3 */ -+ ldr d18, [x1, #16] -+ b extend_hfa_type_store_3 -+ nop -+ -+ ldp d16, d17, [x1] /* D2 */ -+ b extend_hfa_type_store_2 -+ nop -+ nop -+ -+ ldr d16, [x1] /* D1 */ -+ b extend_hfa_type_store_1 -+ nop -+ nop -+ -+ ldp q16, q17, [x1] /* Q4 */ -+ ldp q18, q19, [x1, #16] -+ b extend_hfa_type_store_4 -+ nop -+ -+ ldp q16, q17, [x1] /* Q3 */ -+ ldr q18, [x1, #16] -+ b extend_hfa_type_store_3 -+ nop -+ -+ ldp q16, q17, [x1] /* Q2 */ -+ b extend_hfa_type_store_2 -+ nop -+ nop -+ -+ ldr q16, [x1] /* Q1 */ -+ b extend_hfa_type_store_1 -+ -+extend_hfa_type_store_4 -+ str q19, [x0, #48] -+extend_hfa_type_store_3 -+ str q18, [x0, #32] -+extend_hfa_type_store_2 -+ str q17, [x0, #16] -+extend_hfa_type_store_1 -+ str q16, [x0] -+ ret -+ -+ LEAF_END extend_hfa_type -+ -+ -+/* void compress_hfa_type (void *dest, void *reg, int h) */ -+ -+ LEAF_ENTRY compress_hfa_type -+ -+ adr x3, compress_hfa_type_jump_base -+ and w2, w2, #AARCH64_RET_MASK -+ sub x2, x2, #AARCH64_RET_S4 -+ add x3, x3, x2, lsl #4 -+ br x3 -+ -+ ALIGN 4 -+compress_hfa_type_jump_base -+ ldp q16, q17, [x1] /* S4 */ -+ ldp q18, q19, [x1, #32] -+ st4 { v16.s, v17.s, v18.s, v19.s }[0], [x0] -+ ret -+ -+ ldp q16, q17, [x1] /* S3 */ -+ ldr q18, [x1, #32] -+ st3 { v16.s, v17.s, v18.s }[0], [x0] -+ ret -+ -+ ldp q16, q17, [x1] /* S2 */ -+ st2 { v16.s, v17.s }[0], [x0] -+ ret -+ nop -+ -+ ldr q16, [x1] /* S1 */ -+ st1 { v16.s }[0], [x0] -+ ret -+ nop -+ -+ ldp q16, q17, [x1] /* D4 */ -+ ldp q18, q19, [x1, #32] -+ st4 { v16.d, v17.d, v18.d, v19.d }[0], [x0] -+ ret -+ -+ ldp q16, q17, [x1] /* D3 */ -+ ldr q18, [x1, #32] -+ st3 { v16.d, v17.d, v18.d }[0], [x0] -+ ret -+ -+ ldp q16, q17, [x1] /* D2 */ -+ st2 { v16.d, v17.d }[0], [x0] -+ ret -+ nop -+ -+ ldr q16, [x1] /* D1 */ -+ st1 { v16.d }[0], [x0] -+ ret -+ nop -+ -+ ldp q16, q17, [x1] /* Q4 */ -+ ldp q18, q19, [x1, #32] -+ b compress_hfa_type_store_q4 -+ nop -+ -+ ldp q16, q17, [x1] /* Q3 */ -+ ldr q18, [x1, #32] -+ b compress_hfa_type_store_q3 -+ nop -+ -+ ldp q16, q17, [x1] /* Q2 */ -+ stp q16, q17, [x0] -+ ret -+ nop -+ -+ ldr q16, [x1] /* Q1 */ -+ str q16, [x0] -+ ret -+ -+compress_hfa_type_store_q4 -+ str q19, [x0, #48] -+compress_hfa_type_store_q3 -+ str q18, [x0, #32] -+ stp q16, q17, [x0] -+ ret -+ -+ LEAF_END compress_hfa_type -+ -+ END -\ No newline at end of file -diff --git a/src/closures.c b/src/closures.c -index 15e6e0f..ae97524 100644 ---- a/src/closures.c -+++ b/src/closures.c -@@ -122,7 +122,7 @@ ffi_closure_free (void *ptr) - # define FFI_MMAP_EXEC_WRIT 1 - # define HAVE_MNTENT 1 - # endif --# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) -+# if defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__) - /* Windows systems may have Data Execution Protection (DEP) enabled, - which requires the use of VirtualMalloc/VirtualFree to alloc/free - executable memory. */ -@@ -385,7 +385,7 @@ ffi_closure_free (void *ptr) - #endif - #include - #include --#if !defined(X86_WIN32) && !defined(X86_WIN64) -+#if !defined(X86_WIN32) && !defined(X86_WIN64) && !defined(_M_ARM64) - #ifdef HAVE_MNTENT - #include - #endif /* HAVE_MNTENT */ -@@ -511,11 +511,11 @@ static int dlmalloc_trim(size_t) MAYBE_UNUSED; - static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; - static void dlmalloc_stats(void) MAYBE_UNUSED; - --#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) -+#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) - /* Use these for mmap and munmap within dlmalloc.c. */ - static void *dlmmap(void *, size_t, int, int, int, off_t); - static int dlmunmap(void *, size_t); --#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ -+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ - - #define mmap dlmmap - #define munmap dlmunmap -@@ -525,7 +525,7 @@ static int dlmunmap(void *, size_t); - #undef mmap - #undef munmap - --#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) -+#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) - - /* A mutex used to synchronize access to *exec* variables in this file. */ - static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; -@@ -896,7 +896,7 @@ segment_holding_code (mstate m, char* addr) - } - #endif - --#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ -+#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(_M_ARM64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ - - /* Allocate a chunk of memory with the given size. Returns a pointer - to the writable address, and sets *CODE to the executable -diff --git a/src/meson.build b/src/meson.build -index a1cad36..19e71da 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -55,7 +55,11 @@ elif host_cpu_family == 'aarch64' - arch_subdir = 'aarch64' - TARGET = 'AARCH64' - c_sources = ['ffi.c'] -- asm_sources = ['sysv.S'] -+ if cc.get_id() == 'msvc' -+ asm_sources = ['win64_armasm.S'] -+ else -+ asm_sources = ['sysv.S'] -+ endif - elif host_cpu_family == 'arm' - arch_subdir = 'arm' - TARGET = 'ARM' -@@ -85,7 +89,19 @@ if cc.get_id() == 'msvc' - # then through the assembler, and then link the objects into the target. - # FIXME: Add native support in Meson for this. - cl = find_program('cl') -- ml = find_program('ml', 'ml64') -+ if host_cpu_family.startswith('x86') -+ assembler_args = [find_program('ml', 'ml64'), '/Fo', '@OUTPUT@', '/c', '@INPUT@'] -+ if get_option('buildtype').startswith('debug') -+ assembler_args += ['/Zi', '/Zd'] -+ endif -+ elif host_cpu_family == 'aarch64' -+ assembler_args = [find_program('armasm64'), '-o', '@OUTPUT@', '@INPUT@'] -+ if get_option('buildtype').startswith('debug') -+ assembler_args += ['-g'] -+ endif -+ else -+ error('Unsupported MSVC target: ' + host_cpu_family) -+ endif - ffi_asm_objs = [] - foreach asm_source : ffi_asm_sources - incflags = ['/I' + join_paths(meson.current_source_dir(), '..'), -@@ -103,7 +119,7 @@ if cc.get_id() == 'msvc' - ffi_asm_objs += custom_target(obj_name, - input : preproc, - output : obj_name, -- command : [ml, '/Fo', '@OUTPUT@', '/c', '@INPUT@']) -+ command : assembler_args) - endforeach - ffi_asm_sources = ffi_asm_objs - endif -diff --git a/src/prep_cif.c b/src/prep_cif.c -index 702ca27..528f07d 100644 ---- a/src/prep_cif.c -+++ b/src/prep_cif.c -@@ -130,6 +130,9 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi, - - cif->flags = 0; - -+#ifdef _M_ARM64 -+ cif->isVariadic = isvariadic; -+#endif - #if HAVE_LONG_DOUBLE_VARIANT - ffi_prep_types (abi); - #endif --- -2.26.1.windows.1 - - -From f348bfb7217784aa2fc95a3f823a09ba297b35e7 Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Wed, 15 Jan 2020 00:43:44 +0530 -Subject: [PATCH 30/32] gitlab ci: Update windows runner tag - -And the image being used. ---- - .gitlab-ci.yml | 13 +++++++++---- - 1 file changed, 9 insertions(+), 4 deletions(-) - -diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml -index b39770c..4bd39f7 100644 ---- a/.gitlab-ci.yml -+++ b/.gitlab-ci.yml -@@ -1,5 +1,5 @@ - variables: -- WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v6' -+ WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v8' - - .build windows: - image: $WINDOWS_IMAGE -@@ -7,7 +7,7 @@ variables: - tags: - - 'docker' - - 'windows' -- - '1607' -+ - '1809' - variables: - # Uncomment the following key if need to pass custom args, as well with the - # $env:MESON_ARGS line in the `script:` blocks -@@ -48,6 +48,11 @@ msys2: - # have to replace them first. - # - $env:MESON_ARGS = $env:MESON_ARGS.replace("`n"," ") - -- - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64/bin;C:\msys64\mingw32/bin" -+ - $env:PATH += ";C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\msys64\mingw32\bin" -+ # XXX: Copied from https://gitlab.freedesktop.org/gstreamer/gst-ci/blob/master/gitlab/ci_template.yml#L487 -+ # For some reason docker build hangs if this is included in the image, needs more troubleshooting -+ - C:\msys64\usr\bin\bash -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || true" -+ - C:\msys64\usr\bin\bash -c "pacman -Syuu --noconfirm" -+ - C:\msys64\usr\bin\bash -c "pacman -Sy --noconfirm --needed mingw-w64-x86_64-toolchain ninja" - - C:\msys64\usr\bin\bash -c "meson build $env:MESON_ARGS && -- ninja -C build" -\ No newline at end of file -+ ninja -C build" --- -2.26.1.windows.1 - - -From c26f70e71117d87ef9d0b9e885730c8ca503d79f Mon Sep 17 00:00:00 2001 -From: Nirbheek Chauhan -Date: Tue, 7 Apr 2020 01:44:22 +0530 -Subject: [PATCH 31/32] meson: Only look for ml64 when building for Windows - 64-bit - -VS 2015 adds its VC bindir to PATH by default, so `ml` will get picked -up if you have VS 2017 installed and enter a VS 2017 x64 command -prompt. This will lead to build failures. ---- - src/meson.build | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/src/meson.build b/src/meson.build -index 19e71da..212bf22 100644 ---- a/src/meson.build -+++ b/src/meson.build -@@ -90,7 +90,14 @@ if cc.get_id() == 'msvc' - # FIXME: Add native support in Meson for this. - cl = find_program('cl') - if host_cpu_family.startswith('x86') -- assembler_args = [find_program('ml', 'ml64'), '/Fo', '@OUTPUT@', '/c', '@INPUT@'] -+ if host_cpu_family == 'x86' -+ ml = find_program('ml') -+ elif host_cpu_family == 'x86_64' -+ ml = find_program('ml64') -+ else -+ error('Unknown cpu_family: ' + host_cpu_family) -+ endif -+ assembler_args = [ml, '/Fo', '@OUTPUT@', '/c', '@INPUT@'] - if get_option('buildtype').startswith('debug') - assembler_args += ['/Zi', '/Zd'] - endif --- -2.26.1.windows.1 - - -From 2103c3181183a80287e85671b957f69c012d9a28 Mon Sep 17 00:00:00 2001 -From: Jordan Petridis -Date: Thu, 9 Apr 2020 21:13:22 +0300 -Subject: [PATCH 32/32] ci: udpate the windows docker image - -rebuild of the image cause the previous one couldn't -run 32bit binaries due to a secutiry patch apprently - -https://support.microsoft.com/en-us/help/4542617/you-might-encounter-issues-when-using-windows-server-containers-with-t ---- - .gitlab-ci.yml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml -index 4bd39f7..1125d20 100644 ---- a/.gitlab-ci.yml -+++ b/.gitlab-ci.yml -@@ -1,5 +1,5 @@ - variables: -- WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v8' -+ WINDOWS_IMAGE: 'registry.freedesktop.org/gstreamer/gst-ci/amd64/windows:v10' - - .build windows: - image: $WINDOWS_IMAGE --- -2.26.1.windows.1 - From 665160c11b5d104047cae2bf283c8be854ba1d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Oct 2021 17:15:14 +0100 Subject: [PATCH 37/53] libass: update to 0.15.2 Part-of: --- recipes/libass.recipe | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/recipes/libass.recipe b/recipes/libass.recipe index 41103b90e..13ec056a6 100644 --- a/recipes/libass.recipe +++ b/recipes/libass.recipe @@ -3,12 +3,12 @@ class Recipe(recipe.Recipe): name = 'libass' - version = '0.13.7' + version = '0.15.2' licenses = [{License.BSD_like: ['COPYING']}] stype = SourceType.TARBALL - url = 'https://github.com/libass/libass/releases/download/{0}/libass-{0}.tar.gz'.format(version) - tarball_checksum = '008a05a4ed341483d8399c8071d57a39853cf025412b32da277e76ad8226e158' - deps = ['freetype', 'fontconfig', 'libpng', 'fribidi'] + url = 'https://github.com/libass/libass/releases/download/{0}/libass-{0}.tar.xz'.format(version) + tarball_checksum = '1be2df9c4485a57d78bb18c0a8ed157bc87a5a8dd48c661961c625cb112832fd' + deps = ['freetype', 'fontconfig', 'libpng', 'fribidi', 'harfbuzz'] files_libs = ['libass'] files_devel = ['include/ass', 'lib/pkgconfig/libass.pc'] From a63bc7ef33112777dfea9f9e14d7284fc21a99af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Fri, 15 Oct 2021 17:27:38 +0100 Subject: [PATCH 38/53] ffmpeg: update to v4.4 Part-of: --- recipes/ffmpeg.recipe | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/ffmpeg.recipe b/recipes/ffmpeg.recipe index 0c290098c..ed44d5f54 100644 --- a/recipes/ffmpeg.recipe +++ b/recipes/ffmpeg.recipe @@ -3,11 +3,11 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'ffmpeg' - version = '4.3.1' + version = '4.4' licenses = [License.LGPLv2_1Plus] stype = SourceType.TARBALL url = 'https://ffmpeg.org/releases/%(name)s-%(version)s.tar.xz' - tarball_checksum = 'ad009240d46e307b4e03a213a0f49c11b650e445b1f8be0dda2a9212b34d2ffb' + tarball_checksum = '06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909' patches = [] btype = BuildType.MAKEFILE From 00fbc6ad4927e19461166e581437ac72d6fb0b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 14 Oct 2021 19:15:42 +0100 Subject: [PATCH 39/53] recipes: gst-plugins-bad: update for removal of ofa plugin See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1153 Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 335fd6dbe..8ab4f18b5 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -61,7 +61,6 @@ class Recipe(custom.GStreamer): 'mplex': 'disabled', 'musepack': 'disabled', 'neon': 'disabled', - 'ofa': 'disabled', 'openal': 'disabled', 'opencv': 'disabled', 'sndfile': 'disabled', From 58e5e7bbe1be3fd049a6f256631136f9acca0929 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 16 Oct 2021 17:05:40 +0100 Subject: [PATCH 40/53] libogg: update to 1.3.5 --- recipes/libogg.recipe | 7 ++-- recipes/libogg/0001-Fix-iOS-build.patch | 39 ------------------- .../0001-include-Use-stdint-on-mac-ios.patch | 25 ------------ 3 files changed, 3 insertions(+), 68 deletions(-) delete mode 100644 recipes/libogg/0001-Fix-iOS-build.patch delete mode 100644 recipes/libogg/0001-include-Use-stdint-on-mac-ios.patch diff --git a/recipes/libogg.recipe b/recipes/libogg.recipe index 7affaf4d5..635a71f71 100644 --- a/recipes/libogg.recipe +++ b/recipes/libogg.recipe @@ -4,13 +4,12 @@ from cerbero.utils import shell class Recipe(recipe.Recipe): name = 'libogg' - version = '1.3.4' + version = '1.3.5' stype = SourceType.TARBALL url = 'xiph://ogg/%(name)s-%(version)s.tar.xz' - tarball_checksum = 'c163bc12bc300c401b6aa35907ac682671ea376f13ae0969a220f7ddf71893fe' + tarball_checksum = 'c4d91be36fc8e54deae7575241e03f4211eb102afb3fc0775fbbc1b740016705' licenses = [{License.BSD_like: ['COPYING']}] - patches = ['libogg/0001-Fix-iOS-build.patch', - 'libogg/0001-include-Use-stdint-on-mac-ios.patch'] + patches = [] files_libs = ['libogg'] files_devel = ['include/ogg', 'lib/pkgconfig/ogg.pc', 'share/aclocal/ogg.m4'] diff --git a/recipes/libogg/0001-Fix-iOS-build.patch b/recipes/libogg/0001-Fix-iOS-build.patch deleted file mode 100644 index 4304b3cb3..000000000 --- a/recipes/libogg/0001-Fix-iOS-build.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b18e0655ea9d37a5e1c119735c8345778e196db9 Mon Sep 17 00:00:00 2001 -From: Thibault Saunier -Date: Fri, 25 Jan 2013 14:38:05 -0300 -Subject: [PATCH] Fix iOS build - ---- - src/Makefile.am | 2 +- - src/Makefile.in | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/Makefile.am b/src/Makefile.am -index d171fe7..de278b7 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -9,7 +9,7 @@ libogg_la_LDFLAGS = -no-undefined -version-info @LIB_CURRENT@:@LIB_REVISION@:@LI - - # build and run the self tests on 'make check' - --noinst_PROGRAMS = test_bitwise test_framing -+check_PROGRAMS = test_bitwise test_framing - - test_bitwise_SOURCES = bitwise.c - test_bitwise_CFLAGS = -D_V_SELFTEST -diff --git a/src/Makefile.in b/src/Makefile.in -index 04a6070..e1cad37 100644 ---- a/src/Makefile.in -+++ b/src/Makefile.in -@@ -89,7 +89,7 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - build_triplet = @build@ - host_triplet = @host@ --noinst_PROGRAMS = test_bitwise$(EXEEXT) test_framing$(EXEEXT) -+check_PROGRAMS = test_bitwise$(EXEEXT) test_framing$(EXEEXT) - subdir = src - ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 - am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ --- -2.27.0.windows.1 - diff --git a/recipes/libogg/0001-include-Use-stdint-on-mac-ios.patch b/recipes/libogg/0001-include-Use-stdint-on-mac-ios.patch deleted file mode 100644 index 6c55eca28..000000000 --- a/recipes/libogg/0001-include-Use-stdint-on-mac-ios.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 93ecf704a16f8bb4023e80e3c4f338c7a2fd4025 Mon Sep 17 00:00:00 2001 -From: Edward Hervey -Date: Fri, 6 Sep 2019 12:12:16 +0200 -Subject: [PATCH] include: Use stdint on mac/ios - ---- - include/ogg/os_types.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/include/ogg/os_types.h b/include/ogg/os_types.h -index eb8a322..6aeecae 100644 ---- a/include/ogg/os_types.h -+++ b/include/ogg/os_types.h -@@ -70,7 +70,7 @@ - - #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ - --# include -+# include - typedef int16_t ogg_int16_t; - typedef uint16_t ogg_uint16_t; - typedef int32_t ogg_int32_t; --- -2.21.0 - From f875214f74e19466f9f5298ef6555459399bff6c Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Wed, 13 Oct 2021 23:06:19 +0200 Subject: [PATCH 41/53] android: set ANDROID_NDK_HOME instead of ANDROID_NDK Part-of: --- config/android.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/android.config b/config/android.config index abd8aa4d6..aa50a0813 100644 --- a/config/android.config +++ b/config/android.config @@ -110,7 +110,7 @@ env['CXXFLAGS'] = '' env['OBJCFLAGS'] = '' # Android NDK path -env['ANDROID_NDK'] = toolchain_prefix +env['ANDROID_NDK_HOME'] = toolchain_prefix # 'universal' is set by cerbero itself when building under a universal regime # so that we can construct different paths to include/lib directories to where From a92243748207a49f088f707683bdf59efba74240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 14 Oct 2021 19:23:32 +0100 Subject: [PATCH 42/53] recipes: gst-plugins-bad, gst-plugins-ugly: update for explicit GPL opt-in See https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1084 Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 3 ++- recipes/gst-plugins-ugly-1.0.recipe | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 8ab4f18b5..815f619f2 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -8,7 +8,8 @@ class Recipe(custom.GStreamer): tarball_checksum = '5382f98a9af2c92e5c0ca4fcb3911025cafd9f89b3142b206eb7b92b812e0979' # Explicitly enable plugins that we provide dependencies for to ensure that # we error out if they weren't found. - meson_options = {# enabled plugins + meson_options = {'gpl': 'enabled', + # enabled plugins 'assrender': 'enabled', 'bz2': 'enabled', 'closedcaption': 'enabled', diff --git a/recipes/gst-plugins-ugly-1.0.recipe b/recipes/gst-plugins-ugly-1.0.recipe index 45e4b9bdc..765d35ae7 100644 --- a/recipes/gst-plugins-ugly-1.0.recipe +++ b/recipes/gst-plugins-ugly-1.0.recipe @@ -5,7 +5,9 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-ugly-1.0' btype = BuildType.MESON tarball_checksum = 'f2a0fcf9fa0e74fe2598b19d25ee03b65256accccd9562a2420100f230329fdf' - meson_options = {'a52dec': 'enabled', + meson_options = {'gpl': 'enabled', + # enabled plugins + 'a52dec': 'enabled', 'amrnb': 'enabled', 'amrwbdec': 'enabled', 'dvdread': 'enabled', From e7b897dfef487c78f6f15650116cc340e9969c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 19 Oct 2021 19:48:31 +0100 Subject: [PATCH 43/53] Remove mmssrc plugin and libmms Doubtful that anyone still needs that or there are even any streams left out there. MMS was deprecated in 2003 (in favour of RTSP) and support for it was dropped with Microsoft Media Services 2008. https://en.wikipedia.org/wiki/Microsoft_Media_Server https://sdp.ppona.com/news2008.html https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/821 Part-of: --- packages/gstreamer-1.0-net-restricted.package | 3 +- recipes/gst-plugins-bad-1.0.recipe | 6 +-- recipes/libmms.recipe | 17 ------- ...tation-of-strndup-for-platforms-that.patch | 44 ------------------- .../0005-Fix-build-on-OSX-leopard.patch | 28 ------------ 5 files changed, 2 insertions(+), 96 deletions(-) delete mode 100644 recipes/libmms.recipe delete mode 100644 recipes/libmms/0002-uri-Add-implementation-of-strndup-for-platforms-that.patch delete mode 100644 recipes/libmms/0005-Fix-build-on-OSX-leopard.patch diff --git a/packages/gstreamer-1.0-net-restricted.package b/packages/gstreamer-1.0-net-restricted.package index 5c9e4f4f5..967ad4b4d 100644 --- a/packages/gstreamer-1.0-net-restricted.package +++ b/packages/gstreamer-1.0-net-restricted.package @@ -11,7 +11,7 @@ class Package(custom.GStreamer, package.Package): uuid = '8cf57a89-3ba3-4db0-8b66-15e79b541ffe' deps = ['gstreamer-1.0-core', 'base-crypto'] - files = ['libmms:libs', 'librtmp:libs', + files = ['librtmp:libs', 'gst-plugins-ugly-1.0:plugins_net_restricted', 'gst-plugins-bad-1.0:plugins_net_restricted'] files_devel = ['gst-plugins-ugly-1.0:plugins_net_restricted_devel', @@ -19,5 +19,4 @@ class Package(custom.GStreamer, package.Package): def prepare(self): if self.config.variants.uwp: - self.files.remove('libmms:libs') self.files.remove('librtmp:libs') diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 815f619f2..6c7f4a697 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -21,7 +21,6 @@ class Recipe(custom.GStreamer): 'hls-crypto': 'openssl', 'kate': 'enabled', 'ladspa': 'auto', # lrdf is optional - 'libmms': 'enabled', 'nvcodec': 'enabled', 'openh264': 'enabled', 'openjpeg': 'enabled', @@ -71,7 +70,7 @@ class Recipe(custom.GStreamer): } deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'bzip2', 'libass', 'libkate', 'zlib', 'openh264', 'opus', 'librtmp', 'libxml2', - 'libsrtp', 'libdca', 'libmms', 'libdvdnav', 'libnice', + 'libsrtp', 'libdca', 'libdvdnav', 'libnice', 'soundtouch', 'vo-aacenc', 'librsvg', 'openjpeg', 'pango', 'spandsp', 'webrtc-audio-processing', 'sbc', 'ladspa', 'srt', 'zbar'] @@ -334,12 +333,10 @@ class Recipe(custom.GStreamer): ] files_plugins_net_restricted = [ - 'lib/gstreamer-1.0/libgstmms%(mext)s', 'lib/gstreamer-1.0/libgstrtmp%(mext)s', ] files_plugins_net_restricted_devel = [ - 'lib/gstreamer-1.0/libgstmms.a', 'lib/gstreamer-1.0/libgstmms.la', 'lib/gstreamer-1.0/libgstrtmp.a', 'lib/gstreamer-1.0/libgstrtmp.la', ] @@ -543,7 +540,6 @@ class Recipe(custom.GStreamer): self.disable_plugin('dtsdec', 'codecs_restricted', option='dts', dep='libdca') self.disable_plugin('kate', 'codecs', dep='libkate') self.disable_plugin('ladspa', 'effects', dep='ladspa') - self.disable_plugin('mms', 'net_restricted', option='libmms', dep='libmms') self.disable_plugin('openjpeg', 'codecs', dep='openjpeg') self.disable_plugin('rtmp', 'net_restricted', option='rtmp', dep='librtmp') self.disable_plugin('sbc', 'codecs', dep='sbc') diff --git a/recipes/libmms.recipe b/recipes/libmms.recipe deleted file mode 100644 index 23efb2030..000000000 --- a/recipes/libmms.recipe +++ /dev/null @@ -1,17 +0,0 @@ -# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python - -class Recipe(recipe.Recipe): - name = 'libmms' - version = '0.6.4' - stype = SourceType.TARBALL - url = 'sf://.tar.gz' - tarball_checksum = '3c05e05aebcbfcc044d9e8c2d4646cd8359be39a3f0ba8ce4e72a9094bee704f' - licenses = [License.LGPLv2_1Plus] - patches = ['libmms/0002-uri-Add-implementation-of-strndup-for-platforms-that.patch', - 'libmms/0005-Fix-build-on-OSX-leopard.patch'] - files_libs = ['libmms'] - files_devel = ['include/libmms', 'lib/pkgconfig/libmms.pc'] - - def prepare(self): - if self.config.platform != Platform.WINDOWS: - self.autoreconf = True diff --git a/recipes/libmms/0002-uri-Add-implementation-of-strndup-for-platforms-that.patch b/recipes/libmms/0002-uri-Add-implementation-of-strndup-for-platforms-that.patch deleted file mode 100644 index 79cc1a662..000000000 --- a/recipes/libmms/0002-uri-Add-implementation-of-strndup-for-platforms-that.patch +++ /dev/null @@ -1,44 +0,0 @@ -From a5857c5a7e5f24b520d2aa98a9deb770835e1f98 Mon Sep 17 00:00:00 2001 -From: Edward Hervey -Date: Mon, 18 May 2015 11:49:09 +0200 -Subject: [PATCH] uri: Add implementation of strndup for platforms that do not - have it - -Like mingw ---- - src/uri.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/src/uri.c b/src/uri.c -index a96b900..ff823eb 100644 ---- a/src/uri.c -+++ b/src/uri.c -@@ -26,6 +26,25 @@ - #define TRUE 1 - #endif - -+#ifndef strdup -+/** -+ * return a malloc'd copy of at most the specified -+ * number of bytes of a string -+ * @author glibc-Team -+ */ -+char *strndup (const char *s, size_t n) -+{ -+ size_t len = strnlen (s, n); -+ char *new = (char *) malloc (len + 1); -+ -+ if (new == NULL) -+ return NULL; -+ -+ new[len] = '\0'; -+ return (char *) memcpy (new, s, len); -+} -+#endif -+ - #define g_strdup strdup - #define g_strndup strndup - #define g_malloc malloc --- -2.1.0 - diff --git a/recipes/libmms/0005-Fix-build-on-OSX-leopard.patch b/recipes/libmms/0005-Fix-build-on-OSX-leopard.patch deleted file mode 100644 index 8386d7e91..000000000 --- a/recipes/libmms/0005-Fix-build-on-OSX-leopard.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 7c9c7fdee52e8632b1866ffc52f711b20f335831 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= -Date: Tue, 29 May 2012 13:07:02 +0200 -Subject: [PATCH 5/5] Fix build on OSX leopard - ---- - src/mms.h | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/mms.h b/src/mms.h -index 7e9a9c8..ea15fb9 100644 ---- a/src/mms.h -+++ b/src/mms.h -@@ -22,6 +22,11 @@ - * libmms public header - */ - -+#ifndef AI_NUMERICSERV -+#define AI_NUMERICSERV 0 -+#endif -+ -+ - #ifndef HAVE_MMS_H - #define HAVE_MMS_H - --- -2.1.4 - From 0e586bbe0777882a41f2658c6e22d8580a279259 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 21 Oct 2021 00:46:48 +0900 Subject: [PATCH 44/53] gst-plugins-bad: Fix for UWP build assrender was moved from codecs_gpl to codecs category Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 6c7f4a697..a51ccdfb5 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -534,7 +534,7 @@ class Recipe(custom.GStreamer): self.disable_plugin('winscreencap', 'capture') self.disable_plugin('winks', 'capture') # External deps that haven't been ported to UWP - self.disable_plugin('assrender', 'codecs_gpl', dep='libass') + self.disable_plugin('assrender', 'codecs', dep='libass') self.disable_plugin('closedcaption', 'effects', dep='pango') self.disable_plugin('dash', 'codecs', dep='libxml2') self.disable_plugin('dtsdec', 'codecs_restricted', option='dts', dep='libdca') From 7fb495325e3a42869f452f7ed64a3ce79ee2ee2c Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Tue, 26 Oct 2021 01:25:32 +0900 Subject: [PATCH 45/53] Add support for Visual Studio 2022 Trivial changes for Visual Studio 2022 (vs17) support Part-of: --- cerbero/ide/vs/env.py | 12 +++ recipes/libvpx.recipe | 1 + ...1-Add-support-for-Visual-Studio-2022.patch | 95 +++++++++++++++++++ 3 files changed, 108 insertions(+) create mode 100644 recipes/libvpx/0001-Add-support-for-Visual-Studio-2022.patch diff --git a/cerbero/ide/vs/env.py b/cerbero/ide/vs/env.py index dace2a842..f22e99ca4 100644 --- a/cerbero/ide/vs/env.py +++ b/cerbero/ide/vs/env.py @@ -54,6 +54,16 @@ ), r'VC\Auxiliary\Build\vcvarsall.bat' ), + 'vs17': ( + ( + r'Microsoft Visual Studio\2022\Community', + r'Microsoft Visual Studio\2022\Professional', + r'Microsoft Visual Studio\2022\Enterprise', + r'Microsoft Visual Studio\2022\BuildTools', + r'Microsoft Visual Studio\2022\Preview', + ), + r'VC\Auxiliary\Build\vcvarsall.bat' + ), } def get_program_files_dir(): @@ -72,6 +82,8 @@ def get_vs_year_version(vcver): return '2017' if vcver == 'vs16': return '2019' + if vcver == 'vs17': + return '2022' raise RuntimeError('Unknown toolset value {!r}'.format(vcver)) def _get_custom_vs_install(vs_version, vs_install_path): diff --git a/recipes/libvpx.recipe b/recipes/libvpx.recipe index dd1b96ade..8d9b864d9 100644 --- a/recipes/libvpx.recipe +++ b/recipes/libvpx.recipe @@ -41,6 +41,7 @@ class Recipe(recipe.Recipe): 'libvpx/0008-support-visual-studio-2019-vs16.patch', # From upstream git master, remove on bump 'libvpx/0001-configure-add-darwin20-support.patch', + 'libvpx/0001-Add-support-for-Visual-Studio-2022.patch', ] files_libs = ['libvpx'] diff --git a/recipes/libvpx/0001-Add-support-for-Visual-Studio-2022.patch b/recipes/libvpx/0001-Add-support-for-Visual-Studio-2022.patch new file mode 100644 index 000000000..b35df3ddc --- /dev/null +++ b/recipes/libvpx/0001-Add-support-for-Visual-Studio-2022.patch @@ -0,0 +1,95 @@ +From 613a3f961a59dfca6d6775c5668fb7220db60e8d Mon Sep 17 00:00:00 2001 +From: Seungha Yang +Date: Tue, 26 Oct 2021 01:01:07 +0900 +Subject: [PATCH] Add support for Visual Studio 2022 + +--- + build/make/gen_msvs_sln.sh | 5 +++-- + build/make/gen_msvs_vcxproj.sh | 5 ++++- + configure | 3 +++ + 3 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/build/make/gen_msvs_sln.sh b/build/make/gen_msvs_sln.sh +index d1adfd7..0b31285 100644 +--- a/build/make/gen_msvs_sln.sh ++++ b/build/make/gen_msvs_sln.sh +@@ -25,7 +25,7 @@ files. + Options: + --help Print this message + --out=outfile Redirect output to a file +- --ver=version Version (14-16) of visual studio to generate for ++ --ver=version Version (14-17) of visual studio to generate for + --target=isa-os-cc Target specifier + EOF + exit 1 +@@ -219,6 +219,7 @@ for opt in "$@"; do + 14) vs_year=2015 ;; + 15) vs_year=2017 ;; + 16) vs_year=2019 ;; ++ 17) vs_year=2022 ;; + *) die Unrecognized Visual Studio Version in $opt ;; + esac + ;; +@@ -232,7 +233,7 @@ done + outfile=${outfile:-/dev/stdout} + mkoutfile=${mkoutfile:-/dev/stdout} + case "${vs_ver}" in +- 1[4-6]) ++ 1[4-7]) + # VS has used Format Version 12.00 continuously since vs11. + sln_vers="12.00" + sln_vers_str="Visual Studio ${vs_year}" +diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh +index 4821ca8..1e58e85 100644 +--- a/build/make/gen_msvs_vcxproj.sh ++++ b/build/make/gen_msvs_vcxproj.sh +@@ -168,7 +168,7 @@ for opt in "$@"; do + --ver=*) + vs_ver="$optval" + case "$optval" in +- 1[4-6]) ++ 1[4-7]) + ;; + *) die Unrecognized Visual Studio Version in $opt + ;; +@@ -345,6 +345,9 @@ generate_vcxproj() { + if [ "$vs_ver" = "16" ]; then + tag_content PlatformToolset v142 + fi ++ if [ "$vs_ver" = "17" ]; then ++ tag_content PlatformToolset v143 ++ fi + tag_content CharacterSet Unicode + if [ "$config" = "Release" ]; then + tag_content WholeProgramOptimization true +diff --git a/configure b/configure +index f097266..d63d6f5 100644 +--- a/configure ++++ b/configure +@@ -104,6 +104,7 @@ all_platforms="${all_platforms} arm64-linux-gcc" + all_platforms="${all_platforms} arm64-win64-gcc" + all_platforms="${all_platforms} arm64-win64-vs15" + all_platforms="${all_platforms} arm64-win64-vs16" ++all_platforms="${all_platforms} arm64-win64-vs17" + all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8 + all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8 + all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8 +@@ -142,6 +143,7 @@ all_platforms="${all_platforms} x86-win32-gcc" + all_platforms="${all_platforms} x86-win32-vs14" + all_platforms="${all_platforms} x86-win32-vs15" + all_platforms="${all_platforms} x86-win32-vs16" ++all_platforms="${all_platforms} x86-win32-vs17" + all_platforms="${all_platforms} x86_64-android-gcc" + all_platforms="${all_platforms} x86_64-darwin9-gcc" + all_platforms="${all_platforms} x86_64-darwin10-gcc" +@@ -160,6 +162,7 @@ all_platforms="${all_platforms} x86_64-win64-gcc" + all_platforms="${all_platforms} x86_64-win64-vs14" + all_platforms="${all_platforms} x86_64-win64-vs15" + all_platforms="${all_platforms} x86_64-win64-vs16" ++all_platforms="${all_platforms} x86_64-win64-vs17" + all_platforms="${all_platforms} generic-gnu" + + # all_targets is a list of all targets that can be configured +-- +2.33.0.windows.2 + From c4036c98f76aa254c942c2905a59250c6a9adb52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 28 Oct 2021 19:13:19 +0100 Subject: [PATCH 46/53] shell-utils: decode output on subprocess error Fixes python exception when printing output of failed subprocess: File "/builds/gstreamer/cerbero/cerbero/build/recipe.py", line 326, in _get_la_deps_from_pc ret = shell.check_output(['pkg-config', '--libs-only-l', '--static', pcname], env=env, logfile=self.logfile) File "/builds/gstreamer/cerbero/cerbero/utils/shell.py", line 176, in check_output msg += '\nstderr in logfile {}'.format(logfile.name) TypeError: can't concat str to bytes Part-of: --- cerbero/utils/shell.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py index 961542d22..26a0b8fa4 100644 --- a/cerbero/utils/shell.py +++ b/cerbero/utils/shell.py @@ -169,7 +169,7 @@ def check_output(cmd, cmd_dir=None, fail=True, logfile=None, env=None, quiet=Fal try: o = subprocess.check_output(cmd, cwd=cmd_dir, env=env, stderr=stderr) except SUBPROCESS_EXCEPTIONS as e: - msg = getattr(e, 'output', '') + msg = getattr(e, 'output', '').decode(sys.stdout.encoding, errors='replace') if not fail: return msg if logfile: From 0b2add05b964d8a8c29934bcb5d1b70944dc83ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 3 Nov 2021 17:28:02 +0000 Subject: [PATCH 47/53] Build 1.19.3 release Part-of: --- cerbero/enums.py | 2 +- packages/custom.py | 2 +- recipes/custom.py | 4 ++-- recipes/gst-devtools-1.0.recipe | 2 +- recipes/gst-editing-services-1.0.recipe | 2 +- recipes/gst-libav-1.0.recipe | 2 +- recipes/gst-omx-1.0.recipe | 2 +- recipes/gst-plugins-bad-1.0.recipe | 2 +- recipes/gst-plugins-base-1.0.recipe | 2 +- recipes/gst-plugins-good-1.0.recipe | 2 +- recipes/gst-plugins-ugly-1.0.recipe | 2 +- recipes/gst-rtsp-server-1.0.recipe | 2 +- recipes/gstreamer-1.0.recipe | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cerbero/enums.py b/cerbero/enums.py index 72df32d20..fc3cb7490 100644 --- a/cerbero/enums.py +++ b/cerbero/enums.py @@ -20,7 +20,7 @@ # Safest place to define this since this file imports very few modules -CERBERO_VERSION = '1.19.2.1' +CERBERO_VERSION = '1.19.3' class Platform: ''' Enumeration of supported platforms ''' diff --git a/packages/custom.py b/packages/custom.py index 428f592be..78293e22e 100644 --- a/packages/custom.py +++ b/packages/custom.py @@ -6,7 +6,7 @@ class GStreamer: url = "http://gstreamer.freedesktop.org" - version = '1.19.2.1' + version = '1.19.3' vendor = 'GStreamer Project' licenses = [License.LGPLv2Plus] org = 'org.freedesktop.gstreamer' diff --git a/recipes/custom.py b/recipes/custom.py index 34a8b1f17..ce4ef4725 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -12,8 +12,8 @@ def running_on_cerbero_ci(): class GStreamer(recipe.Recipe): licenses = [License.LGPLv2Plus] - version = '1.19.2.1' - tagged_for_release = False + version = '1.19.3' + tagged_for_release = True # Decide what stype to use use_git = True diff --git a/recipes/gst-devtools-1.0.recipe b/recipes/gst-devtools-1.0.recipe index 9402072fe..cb87bf128 100644 --- a/recipes/gst-devtools-1.0.recipe +++ b/recipes/gst-devtools-1.0.recipe @@ -6,7 +6,7 @@ class Recipe(custom.GStreamer): name = 'gst-devtools-1.0' btype = BuildType.MESON meson_options = {'debug_viewer': 'disabled'} - tarball_checksum = '117e1a667d83f7abfb2b1c201a4badf52eea71aaa63df3fb0539a69fd6637e8b' + tarball_checksum = '63e8de258d2f01f6a43b7800af25e158b47e40933c8af5224eb0fd2e890cb4de' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'json-glib', 'gst-rtsp-server-1.0'] files_bins = ['gst-validate-1.0', 'gst-validate-transcoding-1.0', 'gst-validate-media-check-1.0', diff --git a/recipes/gst-editing-services-1.0.recipe b/recipes/gst-editing-services-1.0.recipe index 1a0394ff6..828e557fe 100644 --- a/recipes/gst-editing-services-1.0.recipe +++ b/recipes/gst-editing-services-1.0.recipe @@ -4,7 +4,7 @@ from cerbero.utils import shell class Recipe(custom.GStreamer): name = 'gst-editing-services-1.0' btype = BuildType.MESON - tarball_checksum = '8fc03e59776118d080be5b1c0e4611bebd8ce4a311a2f5be6cc6d364b769f900' + tarball_checksum = '6b3db725e4d057e09f59191ff0ffcce60785876c4380576a97b563b28ce2430b' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-good-1.0', 'gst-devtools-1.0'] files_bins = ['ges-launch-1.0'] diff --git a/recipes/gst-libav-1.0.recipe b/recipes/gst-libav-1.0.recipe index 96d8c6edb..fdd119cde 100644 --- a/recipes/gst-libav-1.0.recipe +++ b/recipes/gst-libav-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-libav-1.0' licenses = [License.LGPLv2Plus] btype = BuildType.MESON - tarball_checksum = 'fc4f85e894fc76b2655915ea4e52d7fe05932619e931a742a588d18d73df6467' + tarball_checksum = '6ad23508b337e91a4053321d7c49b19471b9859468d544c63148ac636472c98a' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'ffmpeg'] files_plugins_codecs_restricted = ['lib/gstreamer-1.0/libgstlibav%(mext)s'] diff --git a/recipes/gst-omx-1.0.recipe b/recipes/gst-omx-1.0.recipe index bedada5b8..3fe62637c 100644 --- a/recipes/gst-omx-1.0.recipe +++ b/recipes/gst-omx-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-omx-1.0' btype = BuildType.MESON - tarball_checksum = '33aa853872e3ea02d497a73e9d51879e26040c91db6e9f7776364d191cd0b2c6' + tarball_checksum = '9f626b81019d43fb4b8d14af813d18ec0a1bcda59a7d2bf70584a696d16d8775' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0'] files_plugins_codecs = ['lib/gstreamer-1.0/libgstomx%(mext)s'] diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index a51ccdfb5..7ef533af8 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -5,7 +5,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-bad-1.0' btype = BuildType.MESON licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['subprojects/gst-plugins-bad/ext/sctp/usrsctp/LICENSE.md']}] - tarball_checksum = '5382f98a9af2c92e5c0ca4fcb3911025cafd9f89b3142b206eb7b92b812e0979' + tarball_checksum = '50193a23b13713ccb32ee5d1852faeeaed29b91f8398285acdfd522fa3e16835' # Explicitly enable plugins that we provide dependencies for to ensure that # we error out if they weren't found. meson_options = {'gpl': 'enabled', diff --git a/recipes/gst-plugins-base-1.0.recipe b/recipes/gst-plugins-base-1.0.recipe index b92ee2ba4..5a4ead1c8 100644 --- a/recipes/gst-plugins-base-1.0.recipe +++ b/recipes/gst-plugins-base-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-base-1.0' btype = BuildType.MESON - tarball_checksum = 'cde304fd3c006b61a97894b5c4e6f4687edd52cab6767d536b09bdb78d31a513' + tarball_checksum = 'e277f198623a26c1b0a1e19734656392e9368bebf3677cd94262a1316a960827' meson_options = {# enabled plugins 'gl': 'enabled', 'gl-graphene': 'enabled', diff --git a/recipes/gst-plugins-good-1.0.recipe b/recipes/gst-plugins-good-1.0.recipe index d2870b85f..09e535b95 100644 --- a/recipes/gst-plugins-good-1.0.recipe +++ b/recipes/gst-plugins-good-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-good-1.0' btype = BuildType.MESON - tarball_checksum = '4be92e021144bc6dca5082d028275d4b6e69183c01b90791e0837173d58d4e2e' + tarball_checksum = '79ea32a77fa47e6596530e38113bf97c113fd95658087d9a91ffb8af47d11d07' meson_options = {# enabled plugins 'cairo': 'enabled', 'dv': 'enabled', diff --git a/recipes/gst-plugins-ugly-1.0.recipe b/recipes/gst-plugins-ugly-1.0.recipe index 765d35ae7..de1c70c12 100644 --- a/recipes/gst-plugins-ugly-1.0.recipe +++ b/recipes/gst-plugins-ugly-1.0.recipe @@ -4,7 +4,7 @@ class Recipe(custom.GStreamer): name = 'gst-plugins-ugly-1.0' btype = BuildType.MESON - tarball_checksum = 'f2a0fcf9fa0e74fe2598b19d25ee03b65256accccd9562a2420100f230329fdf' + tarball_checksum = 'd49a10a9e87c554f2630527a5d2f924c0f55de4300106e80341fe8f9737c06e9' meson_options = {'gpl': 'enabled', # enabled plugins 'a52dec': 'enabled', diff --git a/recipes/gst-rtsp-server-1.0.recipe b/recipes/gst-rtsp-server-1.0.recipe index 92f3e88ea..d5e8d5bb1 100644 --- a/recipes/gst-rtsp-server-1.0.recipe +++ b/recipes/gst-rtsp-server-1.0.recipe @@ -3,7 +3,7 @@ class Recipe(custom.GStreamer): name = 'gst-rtsp-server-1.0' btype = BuildType.MESON - tarball_checksum = '473dc705a645b9d99e42e54e8d32afdd856275f55c9f2fc840468316dae2d3bf' + tarball_checksum = '3ad9a06be30edd7ec342cb52749d705864f3d55c1cc0f720f35a9cfab4951d21' deps = ['gstreamer-1.0', 'gst-plugins-base-1.0', 'gst-plugins-bad-1.0'] files_devel = ['include/gstreamer-1.0/gst/rtsp-server', 'lib/pkgconfig/gstreamer-rtsp-server-1.0.pc'] diff --git a/recipes/gstreamer-1.0.recipe b/recipes/gstreamer-1.0.recipe index 14982deef..a0f3ccf69 100644 --- a/recipes/gstreamer-1.0.recipe +++ b/recipes/gstreamer-1.0.recipe @@ -4,7 +4,7 @@ import shutil class Recipe(custom.GStreamer): name = 'gstreamer-1.0' btype = BuildType.MESON - tarball_checksum = '6e5b7ba5931e5389c21d10986615f72859b2cc8830a5ba8b5253dad1ba7e6e0d' + tarball_checksum = '906d7d4bf92f941586c0cbce717d9cad6aac36994e16fa6f2f153e07e3221bca' deps = ['glib'] bash_completions = ['gst-inspect-1.0', 'gst-launch-1.0'] From 6600a95c10387eb4b7e8e3eacb706bda9b343360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 3 Nov 2021 17:46:31 +0000 Subject: [PATCH 48/53] gst-plugins-bad: fix up license path for tarballs Part-of: --- recipes/gst-plugins-bad-1.0.recipe | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes/gst-plugins-bad-1.0.recipe b/recipes/gst-plugins-bad-1.0.recipe index 7ef533af8..e5771a969 100644 --- a/recipes/gst-plugins-bad-1.0.recipe +++ b/recipes/gst-plugins-bad-1.0.recipe @@ -4,7 +4,11 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(custom.GStreamer): name = 'gst-plugins-bad-1.0' btype = BuildType.MESON - licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['subprojects/gst-plugins-bad/ext/sctp/usrsctp/LICENSE.md']}] + # License path/location is different in tarball vs. monorepo + if custom.GStreamer.stype == SourceType.TARBALL: + licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['ext/sctp/usrsctp/LICENSE.md']}] + else: + licenses = [{License.LGPLv2Plus: None, License.BSD_like: ['subprojects/gst-plugins-bad/ext/sctp/usrsctp/LICENSE.md']}] tarball_checksum = '50193a23b13713ccb32ee5d1852faeeaed29b91f8398285acdfd522fa3e16835' # Explicitly enable plugins that we provide dependencies for to ensure that # we error out if they weren't found. From 60701ab0a1c1c311f6a930468596dc547d9eb586 Mon Sep 17 00:00:00 2001 From: Jurica Bacurin Date: Mon, 16 May 2022 16:33:28 +0200 Subject: [PATCH 49/53] CL-2812 safe progress --- cerbero/utils/__init__.py | 2 +- recipes/custom.py | 15 ++++++++------- recipes/harfbuzz.recipe | 14 +++++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index e8a6a46ea..14b746008 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -359,7 +359,7 @@ def system_info(): elif platform == Platform.DARWIN: distro = Distro.OS_X ver = pplatform.mac_ver()[0] - if ver.startswith(('11.', '10.16')): + if ver.startswith(('12.', '11.', '10.16')): distro_version = DistroVersion.OS_X_BIG_SUR elif ver.startswith('10.15'): distro_version = DistroVersion.OS_X_CATALINA diff --git a/recipes/custom.py b/recipes/custom.py index ce4ef4725..9cfbc7b95 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -29,13 +29,14 @@ class GStreamer(recipe.Recipe): if use_git: stype = SourceType.GIT - remotes = {'origin': 'https://gitlab.freedesktop.org/gstreamer/gstreamer.git'} - if int(version.split('.')[1]) % 2 == 0: - # Even version, use the specific branch - commit = 'origin/' + '.'.join(version.split('.')[0:2]) - else: - # Odd version, use git main - commit = 'origin/main' + remotes = {'origin': 'https://github.com/pascomnet/gstreamer.git'} + commit = 'origin/webrtc-simulcast' + # if int(version.split('.')[1]) % 2 == 0: + # # Even version, use the specific branch + # commit = 'origin/' + '.'.join(version.split('.')[0:2]) + # else: + # # Odd version, use git main + # commit = 'origin/main' else: stype = SourceType.TARBALL url = 'https://gstreamer.freedesktop.org/src/%(name)s/%(name)s-%(version)s.tar.xz' diff --git a/recipes/harfbuzz.recipe b/recipes/harfbuzz.recipe index 73b6b0cb5..1716a7c22 100644 --- a/recipes/harfbuzz.recipe +++ b/recipes/harfbuzz.recipe @@ -4,11 +4,15 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'harfbuzz' - version = '2.6.7' - stype = SourceType.TARBALL + #version = '2.6.7' +# stype = SourceType.TARBALL btype = BuildType.MESON - url = 'https://github.com/%(name)s/%(name)s/releases/download/%(version)s/%(name)s-%(version)s.tar.xz' - tarball_checksum = '49e481d06cdff97bf68d99fa26bdf785331f411614485d892ea4c78eb479b218' +# url = 'https://github.com/%(name)s/%(name)s/releases/download/%(version)s/%(name)s-%(version)s.tar.xz' + version = '2.8.1' + stype = SourceType.GIT + remotes = {'origin': 'https://github.com/pascomnet/harfbuzz.git'} + commit = 'origin/2.8.1_pascom' +# tarball_checksum = '49e481d06cdff97bf68d99fa26bdf785331f411614485d892ea4c78eb479b218' licenses = [{License.BSD_like: ['COPYING']}] deps = ['fontconfig', 'cairo', 'glib'] meson_options = {'icu': 'disabled', @@ -20,7 +24,7 @@ class Recipe(recipe.Recipe): 'tests': 'disabled'} # https://github.com/harfbuzz/harfbuzz/pull/2458 - patches = ['harfbuzz/0001-meson-Export-symbols-for-a-DLL-when-not-building-sta.patch'] +# patches = ['harfbuzz/0001-meson-Export-symbols-for-a-DLL-when-not-building-sta.patch'] files_bins = ['hb-ot-shape-closure', 'hb-view', 'hb-shape'] files_libs = ['libharfbuzz'] From 1b1067966222c737e8652e3c346fae457c839094 Mon Sep 17 00:00:00 2001 From: Jurica Bacurin Date: Mon, 16 May 2022 16:33:28 +0200 Subject: [PATCH 50/53] CL-2812 safe progress --- cerbero/enums.py | 2 ++ cerbero/utils/__init__.py | 2 ++ config/cross-android-universal-arm.cbc | 17 +++++++++++++++++ recipes/custom.py | 6 ------ recipes/harfbuzz.recipe | 7 ------- 5 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 config/cross-android-universal-arm.cbc diff --git a/cerbero/enums.py b/cerbero/enums.py index fc3cb7490..cc37e9da3 100644 --- a/cerbero/enums.py +++ b/cerbero/enums.py @@ -142,6 +142,8 @@ class DistroVersion: OS_X_MOJAVE = 'osx_mojave' OS_X_CATALINA = 'osx_catalina' OS_X_BIG_SUR = 'osx_big_sur' + OS_X_MONTEREY = 'osx_monterey' + # further osx versions are generated automatically IOS_8_0 = 'ios_08_0' IOS_8_1 = 'ios_08_1' IOS_8_2 = 'ios_08_2' diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index 14b746008..571e24ef3 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -359,6 +359,8 @@ def system_info(): elif platform == Platform.DARWIN: distro = Distro.OS_X ver = pplatform.mac_ver()[0] + if ver.startswith(('12.')): + distro_version = DistroVersion.OS_X_MONTEREY if ver.startswith(('12.', '11.', '10.16')): distro_version = DistroVersion.OS_X_BIG_SUR elif ver.startswith('10.15'): diff --git a/config/cross-android-universal-arm.cbc b/config/cross-android-universal-arm.cbc new file mode 100644 index 000000000..5871c8a30 --- /dev/null +++ b/config/cross-android-universal-arm.cbc @@ -0,0 +1,17 @@ +import os +from cerbero.config import Platform, Architecture, Distro, DistroVersion + +# NOTE: These all get overridden in the arch-specific cbc files +target_platform = Platform.ANDROID +target_distro = Distro.ANDROID +target_distro_version = DistroVersion.ANDROID_JELLY_BEAN +target_arch = Architecture.UNIVERSAL + +universal_archs = { + # Path is relative to this file + Architecture.ARMv7: "cross-android-armv7.cbc", + Architecture.ARM64: "cross-android-arm64.cbc", + } + +#variants.override('nodebug') +allow_parallel_build = True diff --git a/recipes/custom.py b/recipes/custom.py index 9cfbc7b95..cc2e6eef3 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -31,12 +31,6 @@ class GStreamer(recipe.Recipe): stype = SourceType.GIT remotes = {'origin': 'https://github.com/pascomnet/gstreamer.git'} commit = 'origin/webrtc-simulcast' - # if int(version.split('.')[1]) % 2 == 0: - # # Even version, use the specific branch - # commit = 'origin/' + '.'.join(version.split('.')[0:2]) - # else: - # # Odd version, use git main - # commit = 'origin/main' else: stype = SourceType.TARBALL url = 'https://gstreamer.freedesktop.org/src/%(name)s/%(name)s-%(version)s.tar.xz' diff --git a/recipes/harfbuzz.recipe b/recipes/harfbuzz.recipe index 1716a7c22..008cad720 100644 --- a/recipes/harfbuzz.recipe +++ b/recipes/harfbuzz.recipe @@ -4,15 +4,11 @@ from cerbero.tools.libtool import LibtoolLibrary class Recipe(recipe.Recipe): name = 'harfbuzz' - #version = '2.6.7' -# stype = SourceType.TARBALL btype = BuildType.MESON -# url = 'https://github.com/%(name)s/%(name)s/releases/download/%(version)s/%(name)s-%(version)s.tar.xz' version = '2.8.1' stype = SourceType.GIT remotes = {'origin': 'https://github.com/pascomnet/harfbuzz.git'} commit = 'origin/2.8.1_pascom' -# tarball_checksum = '49e481d06cdff97bf68d99fa26bdf785331f411614485d892ea4c78eb479b218' licenses = [{License.BSD_like: ['COPYING']}] deps = ['fontconfig', 'cairo', 'glib'] meson_options = {'icu': 'disabled', @@ -23,9 +19,6 @@ class Recipe(recipe.Recipe): 'introspection': 'disabled', 'tests': 'disabled'} - # https://github.com/harfbuzz/harfbuzz/pull/2458 -# patches = ['harfbuzz/0001-meson-Export-symbols-for-a-DLL-when-not-building-sta.patch'] - files_bins = ['hb-ot-shape-closure', 'hb-view', 'hb-shape'] files_libs = ['libharfbuzz'] files_devel = ['include/harfbuzz/*.h', 'lib/pkgconfig/harfbuzz.pc'] From c0aa5006b67fe7a304c8da8b446e1af2d3a13cd2 Mon Sep 17 00:00:00 2001 From: Jurica Bacurin Date: Wed, 18 May 2022 10:24:21 +0200 Subject: [PATCH 51/53] CL-2812 fix adjustments --- cerbero/utils/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cerbero/utils/__init__.py b/cerbero/utils/__init__.py index 571e24ef3..eb598e28c 100644 --- a/cerbero/utils/__init__.py +++ b/cerbero/utils/__init__.py @@ -361,7 +361,7 @@ def system_info(): ver = pplatform.mac_ver()[0] if ver.startswith(('12.')): distro_version = DistroVersion.OS_X_MONTEREY - if ver.startswith(('12.', '11.', '10.16')): + elif ver.startswith(('11.', '10.16')): distro_version = DistroVersion.OS_X_BIG_SUR elif ver.startswith('10.15'): distro_version = DistroVersion.OS_X_CATALINA From 7204bd83c94a1542f79481cba7d2f3b0df99ec95 Mon Sep 17 00:00:00 2001 From: Jurica Bacurin Date: Fri, 20 May 2022 12:24:16 +0200 Subject: [PATCH 52/53] CL-2812 build from git --- recipes/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/custom.py b/recipes/custom.py index cc2e6eef3..068e458dd 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -13,7 +13,7 @@ def running_on_cerbero_ci(): class GStreamer(recipe.Recipe): licenses = [License.LGPLv2Plus] version = '1.19.3' - tagged_for_release = True + tagged_for_release = False # Decide what stype to use use_git = True From aaf50641506ae37b250b1a43065effd5f30d6b00 Mon Sep 17 00:00:00 2001 From: Jurica Bacurin Date: Fri, 27 May 2022 08:43:47 +0200 Subject: [PATCH 53/53] CL-2812 adjust version to match meson build --- recipes/custom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes/custom.py b/recipes/custom.py index 068e458dd..175a77087 100644 --- a/recipes/custom.py +++ b/recipes/custom.py @@ -12,7 +12,7 @@ def running_on_cerbero_ci(): class GStreamer(recipe.Recipe): licenses = [License.LGPLv2Plus] - version = '1.19.3' + version = '1.19.3.1' tagged_for_release = False # Decide what stype to use