Skip to content

Commit 5fbb796

Browse files
committed
windows build: meson, glib, and pango
1 parent f767bda commit 5fbb796

6 files changed

+212
-0
lines changed

azure-pipelines.yml

+19
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ jobs:
2323
QTDIR32: '$(QtBaseDir)\5.10.1\msvc2017'
2424
QTDIR64: '$(QtBaseDir)\5.10.1\msvc2017_64'
2525
OBSPath: 'D:\obs-studio'
26+
PangoPath: 'D:\pango-build'
2627
steps:
2728
- checkout: self
2829
submodules: true
2930

31+
- script: ./ci/windows/prepare-meson.cmd
32+
displayName: 'Install Meson'
33+
env:
34+
build_config: $(build_config)
35+
3036
- script: ./ci/windows/install-qt-win.cmd
3137
displayName: 'Install Qt'
3238
env:
@@ -43,6 +49,19 @@ jobs:
4349
- script: ./ci/windows/download-obs-deps.cmd
4450
displayName: 'Download OBS Studio dependencies'
4551

52+
- script: ./ci/windows/prepare-glib.cmd
53+
displayName: 'Setup glib build'
54+
env:
55+
build_config: $(build_config)
56+
PangoPath: $(PangoPath)
57+
GitSource: $(Build.Repository.LocalPath)
58+
59+
- script: ./ci/windows/prepare-pango.cmd
60+
displayName: 'Setup pango build'
61+
env:
62+
build_config: $(build_config)
63+
PangoPath: $(PangoPath)
64+
4665
- task: Cache@2
4766
displayName: Restore cached OBS Studio builds
4867
inputs:

ci/windows/glib-meson.patch

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- meson.build 2020-08-21 00:58:11.522392129 +0900
2+
+++ meson.build 2020-08-21 00:58:32.712591867 +0900
3+
@@ -94,7 +94,7 @@
4+
installed_tests_template_tap = files('template-tap.test.in')
5+
6+
# Don’t build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
7+
-build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) or installed_tests_enabled
8+
+build_tests = false
9+
10+
add_project_arguments('-D_GNU_SOURCE', language: 'c')
11+

ci/windows/glib-nolibintl.patch

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
diff -ru glib-2.65.1-orig/glib/ggettext.c glib-2.65.1/glib/ggettext.c
2+
--- glib-2.65.1-orig/glib/ggettext.c 2020-08-07 23:31:53.019354800 +0900
3+
+++ glib-2.65.1/glib/ggettext.c 2020-08-21 11:27:44.678064916 +0900
4+
@@ -95,22 +95,6 @@
5+
static void
6+
ensure_gettext_initialized (void)
7+
{
8+
- static gsize initialised;
9+
-
10+
- if (g_once_init_enter (&initialised))
11+
- {
12+
-#ifdef G_OS_WIN32
13+
- gchar *tmp = _glib_get_locale_dir ();
14+
- bindtextdomain (GETTEXT_PACKAGE, tmp);
15+
- g_free (tmp);
16+
-#else
17+
- bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
18+
-#endif
19+
-# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
20+
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
21+
-# endif
22+
- g_once_init_leave (&initialised, TRUE);
23+
- }
24+
}
25+
26+
/**
27+
@@ -302,51 +286,7 @@
28+
static gboolean
29+
_g_dgettext_should_translate (void)
30+
{
31+
- static gsize translate = 0;
32+
- enum {
33+
- SHOULD_TRANSLATE = 1,
34+
- SHOULD_NOT_TRANSLATE = 2
35+
- };
36+
-
37+
- if (G_UNLIKELY (g_once_init_enter (&translate)))
38+
- {
39+
- gboolean should_translate = TRUE;
40+
-
41+
- const char *default_domain = textdomain (NULL);
42+
- const char *translator_comment = gettext ("");
43+
-#ifndef G_OS_WIN32
44+
- const char *translate_locale = setlocale (LC_MESSAGES, NULL);
45+
-#else
46+
- const char *translate_locale = g_win32_getlocale ();
47+
-#endif
48+
- /* We should NOT translate only if all the following hold:
49+
- * - user has called textdomain() and set textdomain to non-default
50+
- * - default domain has no translations
51+
- * - locale does not start with "en_" and is not "C"
52+
- *
53+
- * Rationale:
54+
- * - If text domain is still the default domain, maybe user calls
55+
- * it later. Continue with old behavior of translating.
56+
- * - If locale starts with "en_", we can continue using the
57+
- * translations even if the app doesn't have translations for
58+
- * this locale. That is, en_UK and en_CA for example.
59+
- * - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
60+
- * Continue with old behavior of translating.
61+
- */
62+
- if (!default_domain || !translator_comment || !translate_locale ||
63+
- (0 != strcmp (default_domain, "messages") &&
64+
- '\0' == *translator_comment &&
65+
- 0 != strncmp (translate_locale, "en_", 3) &&
66+
- 0 != strcmp (translate_locale, "C")))
67+
- should_translate = FALSE;
68+
-
69+
- g_once_init_leave (&translate,
70+
- should_translate ?
71+
- SHOULD_TRANSLATE :
72+
- SHOULD_NOT_TRANSLATE);
73+
- }
74+
-
75+
- return translate == SHOULD_TRANSLATE;
76+
+ return 0;
77+
}
78+
79+
/**
80+
@@ -396,10 +336,7 @@
81+
g_dgettext (const gchar *domain,
82+
const gchar *msgid)
83+
{
84+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
85+
- return msgid;
86+
-
87+
- return dgettext (domain, msgid);
88+
+ return msgid;
89+
}
90+
91+
/**
92+
@@ -423,10 +360,7 @@
93+
const gchar *msgid,
94+
gint category)
95+
{
96+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
97+
- return msgid;
98+
-
99+
- return dcgettext (domain, msgid, category);
100+
+ return msgid;
101+
}
102+
103+
/**
104+
@@ -454,10 +388,7 @@
105+
const gchar *msgid_plural,
106+
gulong n)
107+
{
108+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
109+
- return n == 1 ? msgid : msgid_plural;
110+
-
111+
- return dngettext (domain, msgid, msgid_plural, n);
112+
+ return n == 1 ? msgid : msgid_plural;
113+
}
114+
115+

ci/windows/prepare-glib.cmd

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
3+
4+
set PATH=C:\Program Files\Meson;%PATH%
5+
6+
mkdir %PangoPath%
7+
cd /D %PangoPath%
8+
9+
echo downloading glib...
10+
curl -o glib.tar.xz ftp://ftp.gnome.org/pub/gnome/sources/glib/2.65/glib-2.65.1.tar.xz
11+
7z x glib.tar.xz -so | 7z x -si -ttar -aoa > nul
12+
rename glib-2.65.1 glib
13+
14+
echo downloading libffi...
15+
curl -o libffi.tar.gz ftp://sourceware.org/pub/libffi/libffi-3.3.tar.gz
16+
7z x libffi.tar.gz -so | 7z x -si -ttar -aoa > nul
17+
rename libffi-3.3 libffi
18+
19+
echo checking and setup vs
20+
vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath > VSinstallationPath.txt
21+
set /p VSinstallationPath= < VSinstallationPath.txt
22+
call "%VSinstallationPath%\VC\Auxiliary\Build\vcvarsall.bat" amd64
23+
24+
echo checking path...
25+
path
26+
27+
echo configuring glib...
28+
cd /D %PangoPath%\glib
29+
patch -p0 < %GitSource%\ci\windows\glib-meson.patch
30+
patch -p1 < %GitSource%\ci\windows\glib-nolibintl.patch
31+
set INCLUDE=%INCLUDE%;%DepsBasePath%\win64\include
32+
set LIB=%LIB%;%DepsBasePath%\win64\bin\
33+
meson setup build64 --backend vs2019 --default-library static
34+
35+
copy %PangoPath%\libffi\msvc_build\aarch64\aarch64_include\* build64\gobject\
36+
copy %PangoPath%\libffi\src\aarch64\ffitarget.h build64\gobject\
37+
38+
echo dir build64
39+
dir /S build64
40+
41+
echo compiling glib...
42+
meson compile -C build64

ci/windows/prepare-meson.cmd

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
3+
4+
echo downloading and installing meson.msi...
5+
curl -o meson.msi -kLO https://github.com/mesonbuild/meson/releases/download/0.55.0/meson-0.55.0-64.msi -f --retry 5
6+
msiexec /i meson.msi /passive /qn /lv meson-install.log
7+
type meson-install.log

ci/windows/prepare-pango.cmd

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
@echo off
2+
SETLOCAL EnableDelayedExpansion
3+
4+
set PATH=C:\Program Files\Meson;%PATH%
5+
6+
mkdir %PangoPath%
7+
cd /D %PangoPath%
8+
9+
echo downloading pango...
10+
curl -o pango.tar.xz http://ftp.gnome.org/pub/GNOME/sources/pango/1.46/pango-1.46.0.tar.xz
11+
7z x pango.tar.xz -so | 7z x -si -ttar -aoa > nul
12+
rename pango-1.46.0 pango
13+
14+
echo configuring pango...
15+
cd /D %PangoPath%\pango
16+
mkdir build64
17+
cd build64
18+
meson ..

0 commit comments

Comments
 (0)