diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4e4d0d3 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,89 @@ +name: build-wxHaskell + +on: + push: + pull_request: + branches: [master] + +jobs: + build: + strategy: + fail-fast: false + matrix: + ghc: ["9.4.8"] + os: [ ubuntu-latest, macOS-latest ] + + runs-on: ${{ matrix.os }} + + steps: + - run: git config --global core.autocrlf input + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + + - name: Install wxWidgets on Ubuntu / macOS + run: | + if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then + sudo apt-get install -y libwxgtk3.0-gtk3-dev libwxgtk-media3.0-gtk3-dev + elif [[ "${{ matrix.os }}" == "macOS-latest" ]]; then + brew install wxwidgets + fi + + - name: Configure project + run: | + echo "$SHELL" + echo "$PATH" + cabal configure + cabal build all --dry-run + + - name: Build + run: | + echo "$SHELL" + echo "$PATH" + cabal build all + + build-on-windows: + strategy: + fail-fast: false + matrix: + ghc: ["9.4.8"] + os: [ windows-latest ] + + runs-on: ${{ matrix.os }} + + steps: + - run: git config --global core.autocrlf input + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + + - name: Install wxWidgets on Windows + uses: msys2/setup-msys2@v2 + with: + msystem: CLANG64 + install: >- + mingw-w64-clang-x86_64-clang + mingw-w64-clang-x86_64-wxwidgets3.2-msw + + - shell: msys2 {0} + name: Configure project + run: | + export PATH=$PATH:"/c/ghcup/msys64/bin":"/c/ghcup/usr/bin":"/c/ghcup/bin" + echo "$SHELL" + echo "$PATH" + cabal configure + cabal build all --dry-run + + - shell: msys2 {0} + name: Build + run: | + export PATH=$PATH:"/c/ghcup/msys64/bin":"/c/ghcup/usr/bin":"/c/ghcup/bin" + echo "$SHELL" + echo "$PATH" + cabal build all diff --git a/wxc/Setup.hs b/wxc/Setup.hs index 72b8101..d2425bb 100644 --- a/wxc/Setup.hs +++ b/wxc/Setup.hs @@ -320,8 +320,8 @@ bitnessMismatch = getDynamicLibraryName :: FilePath -> IO (Maybe String) getDynamicLibraryName path = - listToMaybe . filter isLibrary <$> getDirectoryContents path - `E.onException` return Nothing + (listToMaybe . filter isLibrary <$> getDirectoryContents path) + `E.catch` (\(_::E.SomeException) -> return Nothing) where isLibrary x = any (`isPrefixOf` x) ["libwx_base", "wxbase"] && any (`isInfixOf` x) [".dll", ".dylib", ".so."] @@ -330,7 +330,7 @@ bitnessMismatch = -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- A list of wxWidgets versions that can be handled by this version of wxHaskell -wxCompatibleVersions = ["3.2"] -- Preferred version first +wxCompatibleVersions = ["3.2", "3.0"] -- Preferred version first checkWxVersion :: IO String checkWxVersion = @@ -356,7 +356,7 @@ readWxConfig wxVersion = #if defined(freebsd_HOST_OS) || defined (netbsd_HOST_OS) putStrLn "defined(freebsd_HOST_OS) || defined (netbsd_HOST_OS)" -- find GL/glx.h on non-Linux systems - let glIncludeDirs = readProcess "pkg-config" ["--cflags", "gl"] "" `E.onException` return "" + let glIncludeDirs = readProcess "pkg-config" ["--cflags", "gl"] "" `E.catch` (\(_::E.SomeException) -> return "") #else let glIncludeDirs = return "" #endif @@ -380,7 +380,7 @@ readWxConfig wxVersion = wx_config :: [String] -> IO String wx_config parms = do let runExecutable failureAction = - readProcess "wx-config" parms "" `E.onException` failureAction + readProcess "wx-config" parms "" `E.catch` (\(_::E.SomeException) -> failureAction) b <- isWindowsMsys if b