Compare commits

..

2 Commits

Author SHA1 Message Date
7cbd24dd2f
Bundle a fuller installation of Perl/ExifTool
wperl is necessary to get rid of the console window,
which is merely one of several issues with the PAR Packer-based
ExifTool bundle used in the last commit.

The Perl installation could be heavily trimmed down,
but it seems to require a very manual process.
2022-08-11 16:11:07 +02:00
1a163bdb8b
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.
2022-08-11 16:10:04 +02:00
6 changed files with 41 additions and 11 deletions

View File

@ -61,9 +61,9 @@ Windows
'fiv' can be cross-compiled for Windows, provided that you install a bunch of 'fiv' can be cross-compiled for Windows, provided that you install a bunch of
dependencies listed at the beginning of 'msys2-cross-configure.sh', 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 about 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

View File

@ -188,9 +188,12 @@ info_spawn(GtkWidget *dialog, const char *path, GBytes *bytes_in)
// TODO(p): Add a fallback to internal capabilities. // TODO(p): Add a fallback to internal capabilities.
// The simplest is to specify the filename and the resolution. // The simplest is to specify the filename and the resolution.
GError *error = NULL; GError *error = NULL;
GSubprocess *subprocess = g_subprocess_new(flags, &error, "exiftool", GSubprocess *subprocess = g_subprocess_new(flags, &error,
"-tab", "-groupNames", "-duplicates", "-extractEmbedded", "--binary", #ifdef G_OS_WIN32
"-quiet", "--", path, NULL); "wperl",
#endif
"exiftool", "-tab", "-groupNames", "-duplicates", "-extractEmbedded",
"--binary", "-quiet", "--", path, NULL);
if (error) { if (error) {
info_redirect_error(dialog, error); info_redirect_error(dialog, error);
return; return;

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,12 @@ 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
version=$(curl -# https://exiftool.org/ver.txt)
name=exiftool-$version.tar.gz remotename=Image-ExifTool-$version.tar.gz
status Fetching "$remotename"
[ -f "$name" ] || curl -#o "$name" "https://exiftool.org/$remotename"
ln -sf "$name" exiftool.tar.gz
} }
verify() { verify() {
@ -48,6 +54,11 @@ 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 -xf exiftool.tar.gz
mv Image-ExifTool-*/exiftool bin
mv Image-ExifTool-*/lib/* lib/perl5/site_perl
rm -rf Image-ExifTool-*
} }
configure() { configure() {
@ -104,6 +115,7 @@ cd "$msys2_root"
dbsync dbsync
fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lcms2 \ fetch mingw-w64-x86_64-gtk3 mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-libraw mingw-w64-x86_64-libheif \ mingw-w64-x86_64-libraw mingw-w64-x86_64-libheif \
mingw-w64-x86_64-perl mingw-w64-x86_64-perl-win32-api \
mingw-w64-x86_64-libwinpthread-git # Because we don't do "provides"? mingw-w64-x86_64-libwinpthread-git # Because we don't do "provides"?
verify verify
extract extract

View File

@ -3,14 +3,19 @@ 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 binaries we directly or indirectly depend on.
cp -p "$msys2_root"/bin/*.dll . cp -p "$msys2_root"/bin/*.dll .
cp -p "$msys2_root"/bin/wperl.exe .
cp -p "$msys2_root"/bin/exiftool .
# 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 cp -pR "$msys2_root"/lib/perl5/ lib
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 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
@ -33,8 +38,7 @@ awk 'function whitelist(binary) {
orphans[$0]++ orphans[$0]++
while (("find . -type f -path \"./*.[Ee][Xx][Ee]\"" | getline) > 0) while (("find . -type f -path \"./*.[Ee][Xx][Ee]\"" | getline) > 0)
whitelist($0) whitelist($0)
while (("find ./lib/gdk-pixbuf-2.0 -type f " \ while (("find ./lib -type f -path \"./*.[Dd][Ll][Ll]\"" | getline) > 0)
"-path \"./*.[Dd][Ll][Ll]\"" | getline) > 0)
whitelist($0) whitelist($0)
for (library in orphans) for (library in orphans)
print library print library