Commit b1aaed69 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller 🐠
Browse files

pixman: build with meson

Part-of: <gstreamer/cerbero!492>
parent 0376602f
......@@ -3,16 +3,25 @@
from cerbero.utils import messages as m
import shutil
from cerbero.tools.libtool import LibtoolLibrary
class Recipe(recipe.Recipe):
name = 'pixman'
version = '0.40.0'
stype = SourceType.TARBALL
btype = BuildType.MESON
url = 'https://cairographics.org/releases/pixman-%(version)s.tar.gz'
tarball_checksum = '6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc'
meson_options = {'openmp': 'disabled',
'gtk': 'disabled',
'libpng': 'disabled',
'tests' : 'disabled'}
licenses = [{License.MIT: ['COPYING']}]
autoreconf = True
patches = ['pixman/0001-Fix-build-on-Android.patch',
'pixman/0002-Enable-CPU-detection-on-Android.patch'
patches = [
# https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/36
'pixman/0001-meson-add-option-to-skip-building-of-tests-and-demos.patch',
# https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/37
'pixman/0002-meson-add-cpu-features-path-option-for-Android.patch'
]
files_libs = ['libpixman-1']
......@@ -23,12 +32,13 @@ class Recipe(recipe.Recipe):
# More info : https://github.com/Homebrew/homebrew/issues/41056
if self.config.target_platform in [ Platform.DARWIN, Platform.IOS ] and \
self.config.target_arch in [ Architecture.X86, Architecture.X86_64 ]:
self.configure_options = '--disable-mmx'
self.meson_options['mmx'] = 'disabled'
if self.config.target_platform == Platform.IOS:
self.append_env('CFLAGS', '-DPIXMAN_NO_TLS')
if self.config.target_platform == Platform.ANDROID:
# FIXME: Fails to link because of undefined __builtin_* symbols
self.configure_options = '--disable-arm-iwmmxt'
self.meson_options['iwmmxt'] = 'disabled'
self.meson_options['cpu-features-path'] = os.path.join(self.config.toolchain_prefix, 'sources', 'android', 'cpufeatures')
# Prevent symbol conflicts
self.append_env('CFLAGS',
'-Dandroid_getCpuFamily=pixman_android_getCpuFamily',
......@@ -40,15 +50,10 @@ class Recipe(recipe.Recipe):
'-Dandroid_setCpu=pixman_android_setCpu',
'-Dandroid_setCpuArm=pixman_android_setCpuArm')
async def configure(self):
if self.config.target_platform == Platform.ANDROID:
cpufeatures_path = os.path.join(self.config.toolchain_prefix, 'sources', 'android', 'cpufeatures')
o = os.path.join(cpufeatures_path, 'cpu-features.h')
f = os.path.join(self.make_dir, 'pixman')
m.action("copying %s to %s" % (o, f), logfile=self.logfile)
shutil.copy(o, f)
o = os.path.join(cpufeatures_path, 'cpu-features.c')
f = os.path.join(self.make_dir, 'pixman')
m.action("copying %s to %s" % (o, f), logfile=self.logfile)
shutil.copy(o, f)
await super(recipe.Recipe, self).configure()
def post_install(self):
pixman_deps = []
# Meson does not generate la files
LibtoolLibrary('pixman-1', None, None, None,
self.config.libdir, self.config.target_platform,
deps=pixman_deps).save()
super().post_install()
From 2c169eb7e40e7fd5f131be38c1a75b1713c38915 Mon Sep 17 00:00:00 2001
From: Andoni Morales Alastruey <ylatuya@gmail.com>
Date: Mon, 28 Oct 2013 18:19:29 +0100
Subject: [PATCH 1/3] Fix build in Android
---
configure.ac | 1 +
pixman/pixman-utils.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/configure.ac b/configure.ac
index 156edfb..ba04952 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1005,6 +1005,7 @@ AC_MSG_CHECKING(for pthreads)
PIXMAN_CHECK_PTHREAD([CFLAGS="-pthread"; LDFLAGS="-pthread"])
PIXMAN_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LIBS="-lpthread"])
PIXMAN_CHECK_PTHREAD([CFLAGS="-D_REENTRANT"; LDFLAGS="-lroot"])
+PIXMAN_CHECK_PTHREAD([CFLAGS=""; LDFLAGS="-lc"])
if test $support_for_pthreads = yes; then
AC_DEFINE([HAVE_PTHREADS], [], [Whether pthreads is supported])
diff --git a/pixman/pixman-utils.c b/pixman/pixman-utils.c
index 4a3a835..972f141 100644
--- a/pixman/pixman-utils.c
+++ b/pixman/pixman-utils.c
@@ -27,6 +27,7 @@
#endif
#include <stdio.h>
#include <stdlib.h>
+#include <limits.h>
#include "pixman-private.h"
--
2.14.3
From 77b6675d8340085a1434ad5672f77d44728a7782 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Sat, 30 May 2020 11:42:22 +0100
Subject: [PATCH 1/2] meson: add option to skip building of tests and demos
---
meson.build | 7 +++++--
meson_options.txt | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index 1cec227..a247183 100644
--- a/meson.build
+++ b/meson.build
@@ -528,8 +528,11 @@ version_conf.set('PIXMAN_VERSION_MICRO', split[2])
add_project_arguments('-DHAVE_CONFIG_H', language : ['c'])
subdir('pixman')
-subdir('test')
-subdir('demos')
+
+if not get_option('tests').disabled()
+ subdir('test')
+ subdir('demos')
+endif
pkg = import('pkgconfig')
pkg.generate(
diff --git a/meson_options.txt b/meson_options.txt
index 79ff4a3..781e258 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -101,3 +101,8 @@ option(
type : 'feature',
description : 'Use libpng'
)
+option(
+ 'tests',
+ type : 'feature',
+ description : 'Build tests and demos'
+)
--
2.26.1
From 358d3881468c0c75cafa0247b01d28845d45d26e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= <sebastian.droege@collabora.co.uk>
Date: Wed, 22 Aug 2012 15:10:56 +0200
Subject: [PATCH 2/3] Enable CPU detection on Android
---
configure.ac | 5 +++++
pixman/Makefile.am | 5 +++++
2 files changed, 10 insertions(+)
diff --git a/configure.ac b/configure.ac
index ba04952..89aad98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -529,8 +529,13 @@ case $host_os in
SSE2_LDFLAGS="$HWCAP_LDFLAGS"
fi
;;
+ linux-android*)
+ is_android="yes"
+ ;;
esac
+AM_CONDITIONAL(IS_ANDROID, test "x$is_android" = "xyes")
+
AC_SUBST(LS_CFLAGS)
AC_SUBST(IWMMXT_CFLAGS)
AC_SUBST(MMX_CFLAGS)
diff --git a/pixman/Makefile.am b/pixman/Makefile.am
index 581b6f6..0e0fbeb 100644
--- a/pixman/Makefile.am
+++ b/pixman/Makefile.am
@@ -114,6 +114,11 @@ libpixman-iwmmxt.la: libpixman_iwmmxt_la-pixman-mmx.lo $(libpixman_iwmmxt_la_DEP
$(AM_V_CCLD)$(libpixman_iwmmxt_la_LINK) libpixman_iwmmxt_la-pixman-mmx.lo $(libpixman_iwmmxt_la_LIBADD) $(LIBS)
endif
+if IS_ANDROID
+libpixman_1_la_SOURCES += cpu-features.c
+noinst_HEADERS = cpu-features.h
+endif
+
# mips dspr2 code
if USE_MIPS_DSPR2
noinst_LTLIBRARIES += libpixman-mips-dspr2.la
--
2.14.3
From a63652174985ba4f65a1c249c15e675fdb7a20d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= <tim@centricular.com>
Date: Sat, 30 May 2020 13:24:46 +0100
Subject: [PATCH 2/2] meson: add cpu-features-path option for Android
Add option to include cpu-features.[ch] from a given path
into the build for platforms that don't provide this out
of the box. This is needed on Android.
We copy the files into the build directory instead of using
them directly from the original location, for better build
hygiene, and so that they are automatically included as part
of CI build artifacts and such.
Need to bump meson dep for fs module.
---
meson.build | 2 +-
meson_options.txt | 5 +++++
pixman/meson.build | 23 ++++++++++++++++++++++-
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index a247183..e8e80e8 100644
--- a/meson.build
+++ b/meson.build
@@ -23,7 +23,7 @@ project(
['c'],
version : '0.40.0',
license : 'MIT',
- meson_version : '>= 0.50.0',
+ meson_version : '>= 0.53.0',
default_options : ['buildtype=debugoptimized'],
)
diff --git a/meson_options.txt b/meson_options.txt
index 781e258..355a8f5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -74,6 +74,11 @@ option(
type : 'feature',
description : 'Use GNU style inline assembler',
)
+option(
+ 'cpu-features-path',
+ type : 'string',
+ description : 'Path to platform-specific cpu-features.[ch] for systems that do not provide it (e.g. Android)',
+)
option(
'openmp',
type : 'feature',
diff --git a/pixman/meson.build b/pixman/meson.build
index f48357f..34330d2 100644
--- a/pixman/meson.build
+++ b/pixman/meson.build
@@ -102,6 +102,27 @@ pixman_files = files(
'pixman-utils.c',
)
+# Android cpu-features
+cpu_features_path = get_option('cpu-features-path')
+cpu_features_sources = []
+if cpu_features_path != ''
+ cpu_features_h_path = join_paths(cpu_features_path, 'cpu-features.h')
+ cpu_features_c_path = join_paths(cpu_features_path, 'cpu-features.c')
+ fs = import('fs')
+ if not fs.exists(cpu_features_c_path) or not fs.exists(cpu_features_h_path)
+ error('Expected cpu-features.[ch] in directory ' + cpu_features_path)
+ endif
+ # copy into build directory
+ cpu_features_h = configure_file(output: 'cpu-features.h',
+ input: cpu_features_h_path,
+ copy: true)
+ cpu_features_c = configure_file(output: 'cpu-features.c',
+ input: cpu_features_c_path,
+ copy: true)
+ message('Using cpu-features.[ch] from ' + cpu_features_path)
+ cpu_features_sources = [cpu_features_c, cpu_features_h]
+endif
+
# We cannot use 'link_with' or 'link_whole' because meson wont do the right
# thing for static archives.
_obs = []
@@ -111,7 +132,7 @@ endforeach
libpixman = library(
'pixman-1',
- [pixman_files, config_h, version_h],
+ [pixman_files, config_h, version_h, cpu_features_sources],
objects : _obs,
c_args : libpixman_extra_cargs,
dependencies : [dep_m, dep_threads],
--
2.26.1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment