Resolve a few issues with MSYS2 cross-builds

- Fix launching of subprocesses (missing gspawn helpers).
 - Discard unused GSettings schemas.
 - Make the program find its user guide.
 - Bundle a somewhat suboptimal version of ExifTool.
This commit is contained in:
Přemysl Eric Janouch 2022-08-11 11:36:31 +02:00
parent cf19f82875
commit 1a163bdb8b
Signed by: p
GPG Key ID: A0420B94F92B9493
5 changed files with 26 additions and 5 deletions

View File

@ -63,7 +63,7 @@ dependencies listed at the beginning of 'msys2-cross-configure.sh',
plus rsvg-convert from librsvg2, and icotool from icoutils. plus rsvg-convert from librsvg2, and icotool from icoutils.
Beware that the build will take up close to a gigabyte of disk space. Beware that the build will take up close to a gigabyte of disk space.
$ sh msys2-cross-configure.sh builddir $ sh -e msys2-cross-configure.sh builddir
$ meson install -C builddir $ meson install -C builddir
If everything succeeds, you will find a portable build of the application If everything succeeds, you will find a portable build of the application

8
fiv.c
View File

@ -1166,7 +1166,13 @@ static void
show_help_contents(void) show_help_contents(void)
{ {
gchar *filename = g_strdup_printf("%s.html", PROJECT_NAME); gchar *filename = g_strdup_printf("%s.html", PROJECT_NAME);
#ifdef G_OS_WIN32
gchar *prefix = g_win32_get_package_installation_directory_of_module(NULL);
gchar *path = g_build_filename(prefix, PROJECT_DOCDIR, filename, NULL);
g_free(prefix);
#else
gchar *path = g_build_filename(PROJECT_DOCDIR, filename, NULL); gchar *path = g_build_filename(PROJECT_DOCDIR, filename, NULL);
#endif
g_free(filename); g_free(filename);
GError *error = NULL; GError *error = NULL;
gchar *uri = g_filename_to_uri(path, NULL, &error); gchar *uri = g_filename_to_uri(path, NULL, &error);
@ -1945,7 +1951,7 @@ output_thumbnail(gchar **uris, gboolean extract, const char *size_arg)
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
_setmode(fileno(stdout), _O_BINARY); _setmode(fileno(stdout), _O_BINARY);
#endif // G_OS_WIN32 #endif
GError *error = NULL; GError *error = NULL;
GFile *file = g_file_new_for_uri(uris[0]); GFile *file = g_file_new_for_uri(uris[0]);

View File

@ -77,6 +77,10 @@ conf.set_quoted('PROJECT_NAME', meson.project_name())
conf.set_quoted('PROJECT_VERSION', meson.project_version()) conf.set_quoted('PROJECT_VERSION', meson.project_version())
conf.set_quoted('PROJECT_NS', application_ns) conf.set_quoted('PROJECT_NS', application_ns)
conf.set_quoted('PROJECT_DOCDIR', get_option('prefix') / docdir) conf.set_quoted('PROJECT_DOCDIR', get_option('prefix') / docdir)
if host_machine.system() == 'windows'
conf.set_quoted('PROJECT_DOCDIR', docdir)
endif
conf.set('HAVE_JPEG_QS', libjpegqs.found()) conf.set('HAVE_JPEG_QS', libjpegqs.found())
conf.set('HAVE_LCMS2', lcms2.found()) conf.set('HAVE_LCMS2', lcms2.found())
conf.set('HAVE_LIBRAW', libraw.found()) conf.set('HAVE_LIBRAW', libraw.found())
@ -86,6 +90,7 @@ conf.set('HAVE_XCURSOR', xcursor.found())
conf.set('HAVE_LIBHEIF', libheif.found()) conf.set('HAVE_LIBHEIF', libheif.found())
conf.set('HAVE_LIBTIFF', libtiff.found()) conf.set('HAVE_LIBTIFF', libtiff.found())
conf.set('HAVE_GDKPIXBUF', gdkpixbuf.found()) conf.set('HAVE_GDKPIXBUF', gdkpixbuf.found())
configure_file( configure_file(
output : 'config.h', output : 'config.h',
configuration : conf, configuration : conf,

View File

@ -33,6 +33,11 @@ fetch() {
status Fetching "$name" status Fetching "$name"
[ -f "packages/$name" ] || curl -#o "packages/$name" "$repository/$name" [ -f "packages/$name" ] || curl -#o "packages/$name" "$repository/$name"
done done
name=exiftool-$(curl -# https://exiftool.org/ver.txt).zip
status Fetching "$name"
[ -f "$name" ] || curl -#o "$name" "https://exiftool.org/$name"
ln -sf "$name" exiftool.zip
} }
verify() { verify() {
@ -48,6 +53,8 @@ extract() {
for i in packages/* for i in packages/*
do bsdtar -xf "$i" --strip-components 1 mingw64 do bsdtar -xf "$i" --strip-components 1 mingw64
done done
bsdtar -xOf exiftool.zip > bin/exiftool.exe
} }
configure() { configure() {

View File

@ -3,14 +3,17 @@ export LC_ALL=C
cd "$MESON_INSTALL_DESTDIR_PREFIX" cd "$MESON_INSTALL_DESTDIR_PREFIX"
msys2_root=$1 msys2_root=$1
# Copy libraries we depend on, and a few files required by GTK+. # Copy libraries we depend on, and a few files required by GLib/GTK+.
cp -p "$msys2_root"/bin/exiftool.exe .
cp -p "$msys2_root"/bin/*.dll . cp -p "$msys2_root"/bin/*.dll .
# The console helper is only useful for debug builds.
cp -p "$msys2_root"/bin/gspawn-*-helper*.exe .
cp -pR "$msys2_root"/etc/ . cp -pR "$msys2_root"/etc/ .
mkdir -p lib mkdir -p lib
cp -pR "$msys2_root"/lib/gdk-pixbuf-2.0/ lib cp -pR "$msys2_root"/lib/gdk-pixbuf-2.0/ lib
mkdir -p share/glib-2.0 mkdir -p share/glib-2.0/schemas
cp -pR "$msys2_root"/share/glib-2.0/schemas/ share/glib-2.0 cp -pR "$msys2_root"/share/glib-2.0/schemas/*.Settings.* share/glib-2.0/schemas
mkdir -p share mkdir -p share
cp -pR "$msys2_root"/share/mime/ share cp -pR "$msys2_root"/share/mime/ share
mkdir -p share/icons mkdir -p share/icons