aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-08-11 11:36:31 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-08-11 16:10:04 +0200
commit1a163bdb8b4878f456fb04b33978a92f3fcd8e91 (patch)
tree52d44049003bc1a338244282f8f77a1b4eaf6f47
parentcf19f8287547c523f65879b9e9477950c81a9eed (diff)
downloadfiv-1a163bdb8b4878f456fb04b33978a92f3fcd8e91.tar.gz
fiv-1a163bdb8b4878f456fb04b33978a92f3fcd8e91.tar.xz
fiv-1a163bdb8b4878f456fb04b33978a92f3fcd8e91.zip
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.
-rw-r--r--README.adoc2
-rw-r--r--fiv.c8
-rw-r--r--meson.build5
-rwxr-xr-xmsys2-cross-configure.sh7
-rwxr-xr-xmsys2-cross-install.sh9
5 files changed, 26 insertions, 5 deletions
diff --git a/README.adoc b/README.adoc
index 031b110..2dc1464 100644
--- a/README.adoc
+++ b/README.adoc
@@ -63,7 +63,7 @@ dependencies listed at the beginning of 'msys2-cross-configure.sh',
plus rsvg-convert from librsvg2, and icotool from icoutils.
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
If everything succeeds, you will find a portable build of the application
diff --git a/fiv.c b/fiv.c
index 92047bc..670661e 100644
--- a/fiv.c
+++ b/fiv.c
@@ -1166,7 +1166,13 @@ static void
show_help_contents(void)
{
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);
+#endif
g_free(filename);
GError *error = NULL;
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
_setmode(fileno(stdout), _O_BINARY);
-#endif // G_OS_WIN32
+#endif
GError *error = NULL;
GFile *file = g_file_new_for_uri(uris[0]);
diff --git a/meson.build b/meson.build
index d646a2a..93c982c 100644
--- a/meson.build
+++ b/meson.build
@@ -77,6 +77,10 @@ conf.set_quoted('PROJECT_NAME', meson.project_name())
conf.set_quoted('PROJECT_VERSION', meson.project_version())
conf.set_quoted('PROJECT_NS', application_ns)
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_LCMS2', lcms2.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_LIBTIFF', libtiff.found())
conf.set('HAVE_GDKPIXBUF', gdkpixbuf.found())
+
configure_file(
output : 'config.h',
configuration : conf,
diff --git a/msys2-cross-configure.sh b/msys2-cross-configure.sh
index 602548e..848749a 100755
--- a/msys2-cross-configure.sh
+++ b/msys2-cross-configure.sh
@@ -33,6 +33,11 @@ fetch() {
status Fetching "$name"
[ -f "packages/$name" ] || curl -#o "packages/$name" "$repository/$name"
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() {
@@ -48,6 +53,8 @@ extract() {
for i in packages/*
do bsdtar -xf "$i" --strip-components 1 mingw64
done
+
+ bsdtar -xOf exiftool.zip > bin/exiftool.exe
}
configure() {
diff --git a/msys2-cross-install.sh b/msys2-cross-install.sh
index f349e86..b98a227 100755
--- a/msys2-cross-install.sh
+++ b/msys2-cross-install.sh
@@ -3,14 +3,17 @@ export LC_ALL=C
cd "$MESON_INSTALL_DESTDIR_PREFIX"
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 .
+# The console helper is only useful for debug builds.
+cp -p "$msys2_root"/bin/gspawn-*-helper*.exe .
cp -pR "$msys2_root"/etc/ .
mkdir -p lib
cp -pR "$msys2_root"/lib/gdk-pixbuf-2.0/ lib
-mkdir -p share/glib-2.0
-cp -pR "$msys2_root"/share/glib-2.0/schemas/ share/glib-2.0
+mkdir -p share/glib-2.0/schemas
+cp -pR "$msys2_root"/share/glib-2.0/schemas/*.Settings.* share/glib-2.0/schemas
mkdir -p share
cp -pR "$msys2_root"/share/mime/ share
mkdir -p share/icons