@@ -52,11 +52,12 @@ def run(self):
5252 import subprocess as sp
5353 from typing import List , Optional
5454
55- dependencies = ["pango" , "cmake" , "gtk2" , "glib2" , "tk" , "toolchain" ]
55+ dependencies = ["pango" , "cmake" , "gtk2" , "glib2" , "tk" , "toolchain" , "libffi" ]
5656
5757 for dep in dependencies :
5858 printf ("Installing dependency {}..." .format (dep ), end = " " )
59- sp .call (["pacman" , "--needed" , "--noconfirm" , "-S" , "mingw-w64-x86_64-{}" .format (dep )], stdout = sp .PIPE )
59+ sp .call (["pacman" , "--needed" , "--noconfirm" , "-S" , "mingw-w64-x86_64-{}" .format (dep )],
60+ stdout = sp .PIPE , stderr = sp .PIPE )
6061 printf ("Done." )
6162 sp .call (["cmake" , "." , "-G" , "MinGW Makefiles" ])
6263 sp .call (["mingw32-make" ])
@@ -157,12 +158,23 @@ def copy_to_target(self, target: str):
157158 shutil .copyfile (p , os .path .join (target , os .path .basename (p )))
158159
159160 specials = {
160- "libpixmap.dll" : "/ lib/gtk-2.0/2.10.0/engines/" ,
161- "libwimp.dll" : "/ lib/gtk-2.0/2.10.0/engines/" ,
162- "loaders.cache" : "/ lib/gdk-pixbuf-2.0/2.10.0/" } # loaders.cache is used to specify abspaths to the loaders
161+ "libpixmap.dll" : "lib/gtk-2.0/2.10.0/engines/" ,
162+ "libwimp.dll" : "lib/gtk-2.0/2.10.0/engines/" ,
163+ "loaders.cache" : "lib/gdk-pixbuf-2.0/2.10.0/" } # loaders.cache is used to specify abspaths to the loaders
163164 specials .update ({"libpixbufloader-{}.dll" .format (fmt ): "/lib/gdk-pixbuf-2.0/2.10.0/loaders/"
164165 for fmt in ["ani" , "bmp" , "gif" , "icns" , "ico" , "jpeg" , "png" , "pnm" , "qtif" , "svg" , "tga" , "tiff" , "xbm" , "xpm" ]})
165166 DependencyWalker ("libgttk.dll" , specials = specials ).copy_to_target ("gttk" )
167+
168+ # If loaders.cache is not found, it must be generated
169+ cache_file = os .path .join ("gttk" , specials ["loaders.cache" ], "loaders.cache" )
170+ if not os .path .exists (cache_file ) or os .path .getsize (cache_file ) < 1024 : # Minimum expected file size
171+ print ("Creating loaders.cache file..." )
172+ with open ("loaders.cache" , "wb" ) as fo :
173+ sp .call (["gdk-pixbuf-query-loaders" ], stdout = fo )
174+ shutil .copyfile ("loaders.cache" , cache_file )
175+ with open (cache_file ) as fi :
176+ print ("gdk-pixbuf-query-loaders gave {} lines of output" .format (len (fi .readlines ())))
177+
166178 kwargs = {"package_data" : {"gttk" : ["*.dll" , "pkgIndex.tcl" , "gttk.tcl" ] + ["{}/{}" .format (dir .strip ("/" ), base ) for base , dir in specials .items ()]}}
167179
168180else :
0 commit comments