Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Cannot find wxc install directory when using cabal-dev #5

Closed
jodonoghue opened this Issue · 0 comments

1 participant

@jodonoghue
Owner

Issue reported by Eric Kow. See http://permalink.gmane.org/gmane.comp.lang.haskell.wxhaskell.devel/829

Users of cabal-dev may find that the wxc include dir does not have
wxc anywhere in its path, eg.
/home/moi/my-package/cabal-dev//lib//include
So instead we try looking for the wxc.h file itself.
] {
hunk ./wxcore/Setup.hs 1
-import Control.Monad (when)
+import Control.Monad (when, filterM)
import Data.List (foldl', intersperse, intercalate, nub, lookup, isPrefixOf, isInfixOf, find)
import Data.Maybe (fromJust)
import Distribution.PackageDescription hiding (includeDirs)
hunk ./wxcore/Setup.hs 37
-- It works by finding the wxc package's installation info, then finding the include directory
-- which contains wxc's headers (amongst the wxWidgets include dirs) and then going up a level.
-- It would be nice the path was park of InstalledPackageInfo, but it isn't.
-wxcInstallDir :: LocalBuildInfo -> FilePath
+wxcInstallDir :: LocalBuildInfo -> IO FilePath
wxcInstallDir lbi =
case searchByName (installedPkgs lbi) "wxc" of
hunk ./wxcore/Setup.hs 40

  • Unambiguous wxc_pkgs -> case find (isInfixOf "wxc") . includeDirs . head $ wxc_pkgs of
  • Just wxcIncludeDir -> takeDirectory wxcIncludeDir
  • Nothing -> error "wxcInstallDir: Couldn't find wxc include dir"
  • Unambiguous (wxc_pkg:_) -> do
  • wxc <- filterM (doesFileExist . (</> "wxc.h")) (includeDirs wxc_pkg)
  • case wxc of
  • [wxcIncludeDir] -> return (takeDirectory wxcIncludeDir)
  • [] -> error "wxcInstallDir: Couldn't find wxc include dir"
  • _ -> error "wxcInstallDir: I'm confused. I see more than one wxc include directory from the same package"
  •    Unambiguous [] -> error "wxcInstallDir: Cabal says wxc is installed, but gives no package info for it"
    _ -> error "wxcInstallDir: Couldn't find wxc package in installed packages"
    

    hunk ./wxcore/Setup.hs 56
    createDirectoryIfMissing True wxcoreDirectory

    lbi <- confHook simpleUserHooks (pkg0, pbi) flags

  • let wxcDirectory = wxcInstallDir lbi
  • wxcoreIncludeFile = wxcDirectory </> "include/wxc.h"
  • wxcDirectory <- wxcInstallDir lbi
  • let wxcoreIncludeFile = wxcDirectory </> "include/wxc.h"

    putStrLn "Generating class type definitions from .h files"
    system $ "wxdirect -t --wxc " ++ wxcDirectory ++ " -o " ++ wxcoreDirectory ++ " " ++ wxcoreIncludeFile
    }

@jodonoghue jodonoghue was assigned
@jodonoghue jodonoghue closed this
@Happy-Ferret Happy-Ferret referenced this issue from a commit in Happy-Ferret/wxHaskell
@jodonoghue Patch from Eric Kow:
Mon Apr 16 09:25:24 BST 2012  Eric Kow <eric.kow@gmail.com>
 * Try a little harder to find wxc install directory.

 Users of cabal-dev may find that the wxc include dir does not have
 wxc anywhere in its path, eg.
   /home/moi/my-package/cabal-dev//lib//include
 So instead we try looking for the wxc.h file itself.

Fixes jodonoghue/wxHaskell#5
fa88a6e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.