Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable threads on dependencies of cairo.so #1676

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions recipes/recipes_emscripten/cairo/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
set -ex

export CFLAGS="${CFLAGS} -DCAIRO_NO_MUTEX=1"
export LDFLAGS="$(LDFLAGS) -sUSE_FREETYPE=1 -sUSE_PTHREADS=0"
PTHREAD_CFLAGS=" "
SylvainCorlay marked this conversation as resolved.
Show resolved Hide resolved

sed -i '712,732d' meson.build

meson_config_args=(
-Dfontconfig=enabled
Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/cairo/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ source:
sha256: 243a0736b978a33dee29f9cca7521733b78a65b5418206fef7bd1c3d4cf10b64

build:
number: 3
number: 4

requirements:
build:
Expand Down
5 changes: 5 additions & 0 deletions recipes/recipes_emscripten/fontconfig/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/bash

export LDFLAGS="$(LDFLAGS) -sUSE_FREETYPE=1 -sUSE_PTHREADS=0"

SylvainCorlay marked this conversation as resolved.
Show resolved Hide resolved
# Disable pthreads
sed -i '292,296d' meson.build

meson_setup_args=(
-Dtests=disabled
-Ddefault_library=static
Expand Down
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/fontconfig/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source:
sha256: f5f359d6332861bd497570848fcb42520964a9e83d5e3abe397b6b6db9bcaaf4

build:
number: 0
number: 1

requirements:
build:
Expand Down
30 changes: 30 additions & 0 deletions recipes/recipes_emscripten/harfbuzz/0001-Disable-threads.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
From 91a2b3f1aaa8cdcbe3717ba55efdad2e41e4e86e Mon Sep 17 00:00:00 2001
From: Sylvain Corlay <[email protected]>
Date: Sat, 18 Jan 2025 11:03:02 +0100
Subject: [PATCH] Disable threads

---
meson.build | 7 -------
1 file changed, 7 deletions(-)

diff --git a/meson.build b/meson.build
index f3e43b595..ed5ee6448 100644
--- a/meson.build
+++ b/meson.build
@@ -366,13 +366,6 @@ endif

# threads
thread_dep = null_dep
-if host_machine.system() != 'windows'
- thread_dep = dependency('threads', required: false)
-
- if thread_dep.found()
- conf.set('HAVE_PTHREAD', 1)
- endif
-endif

conf.set_quoted('PACKAGE_NAME', 'HarfBuzz')
conf.set_quoted('PACKAGE_VERSION', meson.project_version())
--
2.39.3 (Apple Git-145)

2 changes: 2 additions & 0 deletions recipes/recipes_emscripten/harfbuzz/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

set -ex

export LDFLAGS="$(LDFLAGS) -sUSE_PTHREADS=0"

SylvainCorlay marked this conversation as resolved.
Show resolved Hide resolved
meson_config_args=(
-Dglib=enabled
-Dicu=enabled
Expand Down
4 changes: 3 additions & 1 deletion recipes/recipes_emscripten/harfbuzz/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ package:
source:
url: https://github.com/${{ name }}/${{ name }}/archive/${{ version }}.tar.gz
sha256: 11749926914fd488e08e744538f19329332487a6243eec39ef3c63efa154a578
patches:
- 0001-Disable-threads.patch

build:
number: 0
number: 1

requirements:
build:
Expand Down
5 changes: 4 additions & 1 deletion recipes/recipes_emscripten/pango/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ set -eux
# so this executable must come from the build environment.
ln -s $BUILD_PREFIX/bin/glib-mkenums $PREFIX/bin/glib-mkenums

export LDFLAGS="$(LDFLAGS) -sUSE_FREETYPE=1 -sUSE_PTHREADS=0"
export PTHREAD_CFLAGS=" "

SylvainCorlay marked this conversation as resolved.
Show resolved Hide resolved
meson_config_args=(
-Dintrospection=disabled # requires gobject-introspection as run-time dep
-Dfontconfig=enabled
Expand Down Expand Up @@ -35,4 +38,4 @@ ninja -C builddir install -j ${CPU_COUNT}
rm $PREFIX/bin/glib-mkenums

# These worker files do not get installed by the meson install command
cp builddir/utils/*.worker.js $PREFIX/bin/
cp builddir/utils/*.js $PREFIX/bin/
4 changes: 2 additions & 2 deletions recipes/recipes_emscripten/pango/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ source:
sha256: 8a9eed75021ee734d7fc0fdf3a65c3bba51dfefe4ae51a9b414a60c70b2d1ed8

build:
number: 1
number: 2

requirements:
build:
Expand Down Expand Up @@ -65,4 +65,4 @@ about:
extra:
recipe-maintainers:
- IsabelParedes
- anutosh491
- anutosh491
49 changes: 49 additions & 0 deletions recipes/recipes_emscripten/pixman/0001-Disable-threads.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
From 48870c7f63324b0c2a1990a4cdd31815d83c6404 Mon Sep 17 00:00:00 2001
From: Sylvain Corlay <[email protected]>
Date: Sat, 18 Jan 2025 10:55:25 +0100
Subject: [PATCH] Disable threads

---
meson.build | 24 +-----------------------
1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/meson.build b/meson.build
index 9cf1bf0..80c7498 100644
--- a/meson.build
+++ b/meson.build
@@ -450,31 +450,9 @@ if dep_png.found()
config.set('HAVE_LIBPNG', 1)
endif
dep_m = cc.find_library('m', required : false)
-dep_threads = dependency('threads')

-# MSVC-style compilers do not come with pthreads, so we must link
-# to it explicitly, currently pthreads-win32 is supported
pthreads_found = false
-
-if dep_threads.found() and cc.has_header('pthread.h')
- if cc.get_argument_syntax() == 'msvc'
- pthread_lib = null_dep
- foreach pthread_type : ['VC3', 'VSE3', 'VCE3', 'VC2', 'VSE2', 'VCE2']
- if not pthread_lib.found()
- pthread_lib = cc.find_library('pthread@0@'.format(pthread_type), required : false)
- endif
- endforeach
- if pthread_lib.found()
- pthreads_found = true
- dep_threads = pthread_lib
- endif
- else
- pthreads_found = true
- endif
-else
- # Avoid linking with -pthread if we don't actually have pthreads
- dep_threads = null_dep
-endif
+dep_threads = null_dep

if pthreads_found
config.set('HAVE_PTHREADS', 1)
--
2.39.3 (Apple Git-145)

2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/pixman/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ meson setup builddir \
--cross-file=$RECIPE_DIR/emscripten.meson.cross

ninja -v -C builddir -j ${CPU_COUNT}
ninja -C builddir install -j ${CPU_COUNT}
ninja -C builddir install -j ${CPU_COUNT}
4 changes: 3 additions & 1 deletion recipes/recipes_emscripten/pixman/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ package:
source:
url: http://cairographics.org/releases/pixman-${{ version }}.tar.gz
sha256: 89a4c1e1e45e0b23dffe708202cb2eaffde0fe3727d7692b2e1739fec78a7dac
patches:
- 0001-Disable-threads.patch

build:
number: 0
number: 1

requirements:
build:
Expand Down
Loading