[pan: 5/16] More work on creating windows install script
- From: Dominique Dumont <ddumont src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pan: 5/16] More work on creating windows install script
- Date: Mon, 25 Apr 2022 17:36:04 +0000 (UTC)
commit 4bbcd5bc594db59681c511c386c96f6ec5e09449
Author: Thomas Tanner <thosrtanner googlemail com>
Date: Sun Apr 3 16:26:23 2022 +0100
More work on creating windows install script
README.mingw64_msys2 | 52 +++++++++++++++---
wininstall.py | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 189 insertions(+), 8 deletions(-)
---
diff --git a/README.mingw64_msys2 b/README.mingw64_msys2
index 5c970ff..0e7283d 100644
--- a/README.mingw64_msys2
+++ b/README.mingw64_msys2
@@ -11,16 +11,57 @@ Install msys2 as per instructions. You will also need to install
$ pacman -S mingw-w64-x86_64-gtk2
$ pacman -S mingw-w64-x86_64-gtk3
-$ pacman -S pcre mingw-w64-x86_64-gtk3 mingw-w64-x86_64-gmime
+$ pacman -S pcre mingw-w64-x86_64-gmime
+
+For spellcheck
+$ pacman -S mingw-w64-x86_64-gtkspell mingw-w64-x86_64-enchant
+
Then you can create an msys2 x64 window and run
`autogen` or `autogen --with-gtk2`
+--with-gtkspell for spellcheck
+
+--with-yelp-tools for user manual
+
+--with-gmime-crypto for cryptography
+--enable-libnotify for notifications
+--enable-gkr for gnome keyring
+
and `make`.
Personally I think the gtk2 version looks a *lot* better
+
+
+
+
+
+
+
+-----------------------------------
+oddly, when running autogen.sh --with-gtk2 --with-gtkspell I get
+
+
+Configuration:
+
+ Prefix: /mingw64
+ Source code location: .
+ Compiler: g++
+ With D-Bus: no
+ With GMime crypto: yes
+ With GtkSpell: no
+ With GTK 3: no
+ With WebKitGTK: no
+ With GnuTLS: no
+ With libnotify:
+ With password storage:
+ With yelp-tools: yes
+ With user manual: no
+
+------------------------------------------------------------
+
If you want to make a standalone pan, you will need to do the following:
(I should probably make a script to do this)
@@ -51,19 +92,14 @@ gtk-theme-name=win32
If you want other themes, you can install them in share/themes in the target directory.
-This version of pan will run, but so far not been able to see images
-
-need to copy libjpeg-8.dll. How would I know that??? (ldd on all the dll files)
-do I need the .a files from gfk-pixbuf? (old pan suggests not)
-
To add:
* [[http://gtkspell.sourceforge.net][GtkSpell 3]] 2.0.16 or higher for spellchecker support
(GtkSpell 2.0.7 or higher when using GTK 2)
- * mingw-w64-gtkspell(3) which?
+ * [check install]
* [[http://www.abisource.com/projects/enchant/][Enchant]] 2.2.3 or higher for spellchecker support
(Enchant 1.6.0 or higher when using GTK 2)
- * mingw-w64-enchant
+ * [check install]
- [[http://www.galago-project.org/news/index.php][libnotify]] 0.4.1 or higher for notifications
diff --git a/wininstall.py b/wininstall.py
new file mode 100644
index 0000000..51b4217
--- /dev/null
+++ b/wininstall.py
@@ -0,0 +1,145 @@
+#!python3
+
+"""
+These aren't necessary if you want a windows theme
+
+1. Copy Icon themes
+1.1. `cp -r /mingw64/share/icons/* ./share/icons/
+1. Copy default themes
+1.1. `cp -r /mingw64/share/themes/* ./share/themes/
+1. Copy settins schemas
+1.1. `cp /mingw64/share/glib-2.0/schemas/* ./share/glib-2.0/schemas/`
+1.1. `glib-compile-schemas.exe ./share/glib-2.0/schemas/`
+
+See https://www.gtk.org/docs/installations/windows/ also
+
+"""
+
+import os
+import re
+import shutil
+import subprocess
+import sys
+
+def usage():
+ print("""wininstall.py [<target dir>|--help]
+
+Installs built pan to specified target directory
+""")
+ exit(1)
+
+def copy_executable(executable: str, target_dir: str) -> set:
+ """Copy executable and work out what dlls we need.
+
+ Args:
+ executable: Executable file to copy
+ target_dir: Where to copy it!
+
+ Returns:
+ Set of dlls required by executable
+ """
+
+ print(f"Copying {executable} to {target_dir}")
+ shutil.copy2(executable, target_dir)
+
+ dlls=set()
+
+ if os.path.splitext(executable)[1] not in (".dll", ".exe"):
+ return dlls
+ # Get all the dlls we need in the root
+ output = subprocess.run(
+ ["ldd", executable], capture_output=True, text=True, check=True
+ )
+ for line in output.stdout.splitlines():
+ dll = re.search(r'(/mingw64.*\.dll)', line)
+ if dll:
+ dlls.add(dll.group())
+
+ return dlls
+
+
+dlls = set()
+
+def copy_wrapper(source: str, target: str, *, follow_symlinks: bool = True):
+ got_dlls = copy_executable(source, os.path.dirname(target))
+ global dlls
+ dlls |= got_dlls
+ return target
+
+def main():
+ if len(sys.argv) != 2 or sys.argv[1] == "--help":
+ usage()
+ target_dir = sys.argv[1]
+ if os.path.exists(target_dir) and not os.path.isdir(target_dir):
+ raise RuntimeError(f"{target_dir} is not a directory")
+ os.makedirs(target_dir, exist_ok=True)
+
+ # Copy executable to target dir
+ executable = "pan/gui/pan.exe"
+ global dlls
+ dlls = copy_executable(executable, target_dir)
+
+ gdk_pixbuf = "lib/gdk-pixbuf-2.0"
+ shutil.copytree(os.path.join(os.environ["MSYSTEM_PREFIX"], gdk_pixbuf),
+ os.path.join(target_dir, gdk_pixbuf),
+ copy_function=copy_wrapper,
+ ignore=shutil.ignore_patterns("*.a"),
+ dirs_exist_ok=True)
+
+ # Deal with magically autoloaded stuff
+
+ # gtk2 def, gtk3 poss.
+ #------------------------------------------------------------------------
+ # We (apparently) need this to run shells (and its not enough)
+ dlls |= copy_executable(
+ os.path.join(os.environ["MSYSTEM_PREFIX"], "bin/gspawn-win64-helper.exe"),
+ target_dir
+ )
+
+ # gtk2
+ #------------------------------------------------------------------------
+ gtk2_libs="lib/gtk-2.0/2.10.0/engines"
+ shutil.copytree(os.path.join(os.environ["MSYSTEM_PREFIX"], gtk2_libs),
+ os.path.join(target_dir, gtk2_libs),
+ copy_function=copy_wrapper,
+ ignore=shutil.ignore_patterns("*.a"),
+ dirs_exist_ok=True)
+
+ # At this point we have a version of pan which runs but looks like it is
+ # on windows 95
+
+ # None of these appear to be necessary so why do we have them?
+ # However, the release pan version has very slightly nicer fonts, so need
+ # further check (though it might be this version or something)
+ # add etc/fonts?
+ # add etc/gtk-2.0
+ # add etc/pango
+
+ # for enchant:
+ # lib/enchant
+ # share/enchant
+ # share/myspell
+
+ # all gtk versions
+ #------------------------------------------------------------------------
+ themes="share/themes"
+ shutil.copytree(os.path.join(os.environ["MSYSTEM_PREFIX"], themes),
+ os.path.join(target_dir, themes),
+ copy_function=copy_wrapper,
+ ignore=shutil.ignore_patterns("*.a"),
+ dirs_exist_ok=True)
+
+
+ # Now we copy all the dlls we depend on. Unfortunately, they all have
+ # unix like names, so we need to replace all of them
+ for dll in sorted(dlls):
+ dll = dll.replace(
+ f'/{os.environ["MSYSTEM"].lower()}',
+ os.environ["MSYSTEM_PREFIX"],
+ 1
+ )
+ copy_executable(dll, target_dir)
+
+
+if __name__ == "__main__":
+ main()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]