Skip to content

Commit 799bea2

Browse files
committed
windows build: meson, glib, and pango
1 parent f767bda commit 799bea2

6 files changed

+180
-0
lines changed

azure-pipelines.yml

+19
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,29 @@ 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+
36+
- script: ./ci/windows/prepare-glib.cmd
37+
displayName: 'Setup glib build'
38+
env:
39+
build_config: $(build_config)
40+
PangoPath: $(PangoPath)
41+
GitSource: $(Build.Repository.LocalPath)
42+
43+
- script: ./ci/windows/prepare-pango.cmd
44+
displayName: 'Setup pango build'
45+
env:
46+
build_config: $(build_config)
47+
PangoPath: $(PangoPath)
48+
3049
- script: ./ci/windows/install-qt-win.cmd
3150
displayName: 'Install Qt'
3251
env:

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

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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 01:26:02.490096103 +0900
4+
@@ -302,51 +302,7 @@
5+
static gboolean
6+
_g_dgettext_should_translate (void)
7+
{
8+
- static gsize translate = 0;
9+
- enum {
10+
- SHOULD_TRANSLATE = 1,
11+
- SHOULD_NOT_TRANSLATE = 2
12+
- };
13+
-
14+
- if (G_UNLIKELY (g_once_init_enter (&translate)))
15+
- {
16+
- gboolean should_translate = TRUE;
17+
-
18+
- const char *default_domain = textdomain (NULL);
19+
- const char *translator_comment = gettext ("");
20+
-#ifndef G_OS_WIN32
21+
- const char *translate_locale = setlocale (LC_MESSAGES, NULL);
22+
-#else
23+
- const char *translate_locale = g_win32_getlocale ();
24+
-#endif
25+
- /* We should NOT translate only if all the following hold:
26+
- * - user has called textdomain() and set textdomain to non-default
27+
- * - default domain has no translations
28+
- * - locale does not start with "en_" and is not "C"
29+
- *
30+
- * Rationale:
31+
- * - If text domain is still the default domain, maybe user calls
32+
- * it later. Continue with old behavior of translating.
33+
- * - If locale starts with "en_", we can continue using the
34+
- * translations even if the app doesn't have translations for
35+
- * this locale. That is, en_UK and en_CA for example.
36+
- * - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
37+
- * Continue with old behavior of translating.
38+
- */
39+
- if (!default_domain || !translator_comment || !translate_locale ||
40+
- (0 != strcmp (default_domain, "messages") &&
41+
- '\0' == *translator_comment &&
42+
- 0 != strncmp (translate_locale, "en_", 3) &&
43+
- 0 != strcmp (translate_locale, "C")))
44+
- should_translate = FALSE;
45+
-
46+
- g_once_init_leave (&translate,
47+
- should_translate ?
48+
- SHOULD_TRANSLATE :
49+
- SHOULD_NOT_TRANSLATE);
50+
- }
51+
-
52+
- return translate == SHOULD_TRANSLATE;
53+
+ return false;
54+
}
55+
56+
/**
57+
@@ -396,10 +352,7 @@
58+
g_dgettext (const gchar *domain,
59+
const gchar *msgid)
60+
{
61+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
62+
- return msgid;
63+
-
64+
- return dgettext (domain, msgid);
65+
+ return msgid;
66+
}
67+
68+
/**
69+
@@ -423,10 +376,7 @@
70+
const gchar *msgid,
71+
gint category)
72+
{
73+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
74+
- return msgid;
75+
-
76+
- return dcgettext (domain, msgid, category);
77+
+ return msgid;
78+
}
79+
80+
/**
81+
@@ -454,10 +404,7 @@
82+
const gchar *msgid_plural,
83+
gulong n)
84+
{
85+
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
86+
- return n == 1 ? msgid : msgid_plural;
87+
-
88+
- return dngettext (domain, msgid, msgid_plural, n);
89+
+ return n == 1 ? msgid : msgid_plural;
90+
}
91+
92+

ci/windows/prepare-glib.cmd

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
15+
echo checking and setup vs
16+
vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath > VSinstallationPath.txt
17+
set /p VSinstallationPath= < VSinstallationPath.txt
18+
call "%VSinstallationPath%\VC\Auxiliary\Build\vcvarsall.bat" amd64
19+
20+
echo checking path...
21+
path
22+
23+
echo configuring glib...
24+
cd /D %PangoPath%\glib
25+
patch -p0 < %GitSource%\ci\windows\glib-meson.patch
26+
patch -p1 < %GitSource%\ci\windows\glib-nolibintl.patch
27+
meson setup build64 --backend vs2019 --default-library static
28+
29+
echo dir build64
30+
dir /S build64
31+
32+
echo compiling glib...
33+
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)