id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
1270	Cairo register wrong library in extra-ghci-libraries on Windows	guest	paolo	"Cairo's setup script (Gtk2HsSetup.hs) attempts to guess Cairo dll name and does it incorrectly. Original guess function looks like that:

fixLibs :: [FilePath] -> [String] -> [String]
fixLibs dlls = concatMap $ \ lib ->
    case filter ((""lib"" ++ lib) `isPrefixOf`) dlls of
                dll:_ -> [dropExtension dll]
                _     -> if lib == ""z"" then [] else [lib]

this may cause (and actually cause on my system) Cairo to select libcairo-script-interpreter-2.dll or libcairo-gobject-2.dll instead of libcairo-2.dll. As the result Cairo can't be used from ghci and several depended libraries can't be installed (""unknown symbol"" error). The simpliest way to fix this fuction is to sort libraries by name length, like this:


fixLibs :: [FilePath] -> [String] -> [String]
fixLibs dlls = concatMap $ \ lib ->
    case sortBy (compare `on` length) $ filter ((""lib"" ++ lib) `isPrefixOf`) dlls of
                dll:_ -> [dropExtension dll]
                _     -> if lib == ""z"" then [] else [lib]

I also suggest to log list of libraries added as extralibs during setup. This will help to debug in case of futher problems.

(Cairo version is 0.12.3.1)"	defect	closed	normal		Cairo bindings		fixed		schernichkin@…
