Skip to content

windows build #2

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 19 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,16 @@ jobs:
QTDIR32: '$(QtBaseDir)\5.10.1\msvc2017'
QTDIR64: '$(QtBaseDir)\5.10.1\msvc2017_64'
OBSPath: 'D:\obs-studio'
PangoPath: 'D:\pango-build'
steps:
- checkout: self
submodules: true

- script: ./ci/windows/prepare-meson.cmd
displayName: 'Install Meson'
env:
build_config: $(build_config)

- script: ./ci/windows/install-qt-win.cmd
displayName: 'Install Qt'
env:
Expand All @@ -43,6 +49,19 @@ jobs:
- script: ./ci/windows/download-obs-deps.cmd
displayName: 'Download OBS Studio dependencies'

- script: ./ci/windows/prepare-glib.cmd
displayName: 'Setup glib build'
env:
build_config: $(build_config)
PangoPath: $(PangoPath)
GitSource: $(Build.Repository.LocalPath)

- script: ./ci/windows/prepare-pango.cmd
displayName: 'Setup pango build'
env:
build_config: $(build_config)
PangoPath: $(PangoPath)

- task: Cache@2
displayName: Restore cached OBS Studio builds
inputs:
Expand Down
20 changes: 20 additions & 0 deletions ci/windows/glib-meson.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- meson.build 2020-08-21 00:58:11.522392129 +0900
+++ meson.build 2020-08-21 00:58:32.712591867 +0900
@@ -94,7 +94,7 @@
installed_tests_template_tap = files('template-tap.test.in')

# Don’t build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
-build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper()) or installed_tests_enabled
+build_tests = false

add_project_arguments('-D_GNU_SOURCE', language: 'c')

@@ -126,7 +126,7 @@
glib_conf.set_quoted('PACKAGE_TARNAME', 'glib')
glib_conf.set_quoted('PACKAGE_URL', '')
glib_conf.set_quoted('PACKAGE_VERSION', meson.project_version())
-glib_conf.set('ENABLE_NLS', 1)
+glib_conf.set('ENABLE_NLS', 0)

# used by the .rc.in files
glibconfig_conf.set('LT_CURRENT_MINUS_AGE', soversion)
115 changes: 115 additions & 0 deletions ci/windows/glib-nolibintl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
diff -ru glib-2.65.1-orig/glib/ggettext.c glib-2.65.1/glib/ggettext.c
--- glib-2.65.1-orig/glib/ggettext.c 2020-08-07 23:31:53.019354800 +0900
+++ glib-2.65.1/glib/ggettext.c 2020-08-21 11:27:44.678064916 +0900
@@ -95,22 +95,6 @@
static void
ensure_gettext_initialized (void)
{
- static gsize initialised;
-
- if (g_once_init_enter (&initialised))
- {
-#ifdef G_OS_WIN32
- gchar *tmp = _glib_get_locale_dir ();
- bindtextdomain (GETTEXT_PACKAGE, tmp);
- g_free (tmp);
-#else
- bindtextdomain (GETTEXT_PACKAGE, GLIB_LOCALE_DIR);
-#endif
-# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-# endif
- g_once_init_leave (&initialised, TRUE);
- }
}

/**
@@ -302,51 +286,7 @@
static gboolean
_g_dgettext_should_translate (void)
{
- static gsize translate = 0;
- enum {
- SHOULD_TRANSLATE = 1,
- SHOULD_NOT_TRANSLATE = 2
- };
-
- if (G_UNLIKELY (g_once_init_enter (&translate)))
- {
- gboolean should_translate = TRUE;
-
- const char *default_domain = textdomain (NULL);
- const char *translator_comment = gettext ("");
-#ifndef G_OS_WIN32
- const char *translate_locale = setlocale (LC_MESSAGES, NULL);
-#else
- const char *translate_locale = g_win32_getlocale ();
-#endif
- /* We should NOT translate only if all the following hold:
- * - user has called textdomain() and set textdomain to non-default
- * - default domain has no translations
- * - locale does not start with "en_" and is not "C"
- *
- * Rationale:
- * - If text domain is still the default domain, maybe user calls
- * it later. Continue with old behavior of translating.
- * - If locale starts with "en_", we can continue using the
- * translations even if the app doesn't have translations for
- * this locale. That is, en_UK and en_CA for example.
- * - If locale is "C", maybe user calls setlocale(LC_ALL,"") later.
- * Continue with old behavior of translating.
- */
- if (!default_domain || !translator_comment || !translate_locale ||
- (0 != strcmp (default_domain, "messages") &&
- '\0' == *translator_comment &&
- 0 != strncmp (translate_locale, "en_", 3) &&
- 0 != strcmp (translate_locale, "C")))
- should_translate = FALSE;
-
- g_once_init_leave (&translate,
- should_translate ?
- SHOULD_TRANSLATE :
- SHOULD_NOT_TRANSLATE);
- }
-
- return translate == SHOULD_TRANSLATE;
+ return 0;
}

/**
@@ -396,10 +336,7 @@
g_dgettext (const gchar *domain,
const gchar *msgid)
{
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
- return msgid;
-
- return dgettext (domain, msgid);
+ return msgid;
}

/**
@@ -423,10 +360,7 @@
const gchar *msgid,
gint category)
{
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
- return msgid;
-
- return dcgettext (domain, msgid, category);
+ return msgid;
}

/**
@@ -454,10 +388,7 @@
const gchar *msgid_plural,
gulong n)
{
- if (domain && G_UNLIKELY (!_g_dgettext_should_translate ()))
- return n == 1 ? msgid : msgid_plural;
-
- return dngettext (domain, msgid, msgid_plural, n);
+ return n == 1 ? msgid : msgid_plural;
}


37 changes: 37 additions & 0 deletions ci/windows/glib-nozlib.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--- gio/meson.build 2021-01-02 19:20:21.951615570 +0900
+++ gio/meson.build 2021-01-02 19:52:19.203530208 +0900
@@ -529,8 +529,6 @@
'gproxyaddressenumerator.c',
'gproxyresolver.c',
'gresolver.c',
- 'gresource.c',
- 'gresourcefile.c',
'gseekable.c',
'gsimpleasyncresult.c',
'gsimpleiostream.c',
@@ -573,8 +571,6 @@
'gvfs.c',
'gvolume.c',
'gvolumemonitor.c',
- 'gzlibcompressor.c',
- 'gzlibdecompressor.c',
'glistmodel.c',
'gliststore.c',
'../glib/gtrace.c',
@@ -669,7 +665,6 @@
'gproxyaddressenumerator.h',
'gproxyresolver.h',
'gresolver.h',
- 'gresource.h',
'gseekable.h',
'gsimpleasyncresult.h',
'gsimpleiostream.h',
@@ -707,8 +702,6 @@
'gvfs.h',
'gvolume.h',
'gvolumemonitor.h',
- 'gzlibcompressor.h',
- 'gzlibdecompressor.h',
'glistmodel.h',
'gliststore.h',
)
45 changes: 45 additions & 0 deletions ci/windows/prepare-glib.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
@echo off
SETLOCAL EnableDelayedExpansion

set PATH=C:\Program Files\Meson;%PATH%

mkdir %PangoPath%
cd /D %PangoPath%

echo downloading glib...
curl -L -o glib.tar.xz https://download.gnome.org/sources/glib/2.67/glib-2.67.1.tar.xz
7z x glib.tar.xz -so | 7z x -si -ttar -aoa > nul
rename glib-2.67.1 glib

echo downloading libffi...
curl -o libffi.tar.gz ftp://sourceware.org/pub/libffi/libffi-3.3.tar.gz
7z x libffi.tar.gz -so | 7z x -si -ttar -aoa > nul
rename libffi-3.3 libffi

echo checking and setup vs
vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath > VSinstallationPath.txt
set /p VSinstallationPath= < VSinstallationPath.txt
call "%VSinstallationPath%\VC\Auxiliary\Build\vcvarsall.bat" amd64

echo checking path...
path

echo configuring glib...
cd /D %PangoPath%\glib
patch -p0 < %GitSource%\ci\windows\glib-meson.patch
patch -p1 < %GitSource%\ci\windows\glib-nolibintl.patch
patch -p0 < %GitSource%\ci\windows\glib-nozlib.patch
set INCLUDE=%INCLUDE%;%DepsBasePath%\win64\include
set LIB=%LIB%;%DepsBasePath%\win64\bin\
echo INCLUDE=%INCLUDE%
echo LIB=%LIB%
meson setup build64 --backend vs2019 --default-library static

copy %PangoPath%\libffi\msvc_build\aarch64\aarch64_include\* build64\gobject\
copy %PangoPath%\libffi\src\aarch64\ffitarget.h build64\gobject\

echo dir build64
dir /S build64

echo compiling glib...
meson compile -C build64
7 changes: 7 additions & 0 deletions ci/windows/prepare-meson.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
SETLOCAL EnableDelayedExpansion

echo downloading and installing meson.msi...
curl -o meson.msi -kLO https://github.com/mesonbuild/meson/releases/download/0.55.0/meson-0.55.0-64.msi -f --retry 5
msiexec /i meson.msi /passive /qn /lv meson-install.log
type meson-install.log
18 changes: 18 additions & 0 deletions ci/windows/prepare-pango.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@echo off
SETLOCAL EnableDelayedExpansion

set PATH=C:\Program Files\Meson;%PATH%

mkdir %PangoPath%
cd /D %PangoPath%

echo downloading pango...
curl -L -o pango.tar.xz https://download.gnome.org/sources/pango/1.48/pango-1.48.0.tar.xz
7z x pango.tar.xz -so | 7z x -si -ttar -aoa > nul
rename pango-1.48.0 pango

echo configuring pango...
cd /D %PangoPath%\pango
mkdir build64
cd build64
meson ..