diff --git a/.github/workflows/ghc-lib-ghc-9.0.2-ghc-8.10.7.yml b/.github/workflows/ghc-lib-ghc-9.0.2-ghc-8.10.7.yml new file mode 100644 index 00000000..951ebbf4 --- /dev/null +++ b/.github/workflows/ghc-lib-ghc-9.0.2-ghc-8.10.7.yml @@ -0,0 +1,38 @@ +name: ghc-lib-ghc-9.0.2-ghc-8.10.7 +on: + push: +jobs: + runhaskell: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu, macos, windows] + steps: + - uses: actions/checkout@v4 + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: 8.10.7 + cabal-version: 'latest' + - name: Install build tools (macOS) + run: brew install automake + if: matrix.os == 'macos' + - name: Configure msys2 (windows) + shell: bash + run: |- + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH + if: matrix.os == 'windows' + - name: Run CI.hs (windows) + shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' + run: |- + pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm + cabal run exe:ghc-lib-build-tool --constraint=any."happy==1.19.12" --constraint="any.alex>=3.2" -- --ghc-flavor ghc-9.0.2 + if: matrix.os == 'windows' + - name: Run CI.hs (unix) + shell: bash + run: cabal run exe:ghc-lib-build-tool --constraint="any.happy==1.19.12" --constraint="any.alex>=3.2" -- --ghc-flavor ghc-9.0.2 + if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/.github/workflows/ghc-lib-ghc-9.4.8-ghc-9.0.2.yml b/.github/workflows/ghc-lib-ghc-9.4.8-ghc-9.0.2.yml new file mode 100644 index 00000000..bf6874e6 --- /dev/null +++ b/.github/workflows/ghc-lib-ghc-9.4.8-ghc-9.0.2.yml @@ -0,0 +1,38 @@ +name: ghc-lib-ghc-9.4.8-ghc-9.0.2 +on: + push: +jobs: + runhaskell: + name: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-13, windows-latest] + steps: + - uses: actions/checkout@v4 + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: 9.0.2 + cabal-version: 'latest' + - name: Install build tools (macOS) + run: brew install automake + if: matrix.os == 'macos' + - name: Configure msys2 (windows) + shell: bash + run: |- + echo "MSYSTEM=CLANG64" >> $GITHUB_ENV + echo "/c/mingw64/usr/bin" >> $GITHUB_PATH + echo "/c/msys64/usr/bin" >> $GITHUB_PATH + if: matrix.os == 'windows' + - name: Run CI.hs (windows) + shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}' + run: |- + pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm + cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.4.8 + if: matrix.os == 'windows' + - name: Run CI.hs (unix) + shell: bash + run: cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.4.8 + if: matrix.os == 'ubuntu' || matrix.os == 'macos' diff --git a/ghc-lib-gen/src/Ghclibgen.hs b/ghc-lib-gen/src/Ghclibgen.hs index e3acab38..c0450ddd 100644 --- a/ghc-lib-gen/src/Ghclibgen.hs +++ b/ghc-lib-gen/src/Ghclibgen.hs @@ -313,6 +313,7 @@ cabalPackageDb ghcNumericVersion = do case Map.lookup "Project Unit Id" ghcInfoMap of Just projectUnitId -> projectUnitId -- e.g. ghc-9.10.1-2e29 Nothing -> "ghc-" ++ ghcNumericVersion + systemOutput_ $ "bash -c 'ls " ++ cabalStoreDir ++ "'" pure $ cabalStoreDir ++ "/" ++ ghcDir ++ "/package.db" ghcPackageDb :: String -> IO String @@ -356,18 +357,18 @@ setupModuleDepsPlaceholders _ = do createDirectoryIfMissing True dir copyFile file new_p -calcModuleDeps :: [FilePath] -> [FilePath] -> [FilePath] -> GhcFlavor -> FilePath -> FilePath -> String -> String -calcModuleDeps includeDirs _hsSrcDirs hsSrcIncludes ghcFlavor _ghcPackageDb cabalPackageDb ghcMakeModeOutputFile = do - let cmd' = unwords $ +calcModuleDeps :: [FilePath] -> [FilePath] -> [FilePath] -> GhcFlavor -> String -> String -> String +calcModuleDeps includeDirs _hsSrcDirs hsSrcIncludes ghcFlavor ghcPackagePath ghcMakeModeOutputFile = do + let cmd = unwords $ [ "ghc", "-M"] ++ - [ "-clear-package-db", "-global-package-db", "-user-package-db", "-package-db" ] ++ cabalPackageDb ++ [ "-dep-suffix ''", "-dep-makefile " ++ ghcMakeModeOutputFile ] ++ [ optP | optP <- [ "-optP -DGHCI", "-optP -DSTAGE=2" ], series < GHC_8_10 ] ++ [ "-optP -DGHC_IN_GHCI" | series < GHC_9_2 ] ++ includeDirs ++ [ pkg | pkg <- [ "-package base" ] ++ [ "-package exceptions" | series == GHC_9_0 ] ++ [ "-package semaphore-compat" | series >= GHC_9_8 ] ] ++ hsSrcIncludes ++ [ rootModulePath ] - in cmd + cmd' = "bash -c \"" ++ ghcPackagePath ++ " " ++ cmd ++ "\"" + in cmd' where series = ghcSeries ghcFlavor rootModulePath = placeholderModulesDir "Main.hs" @@ -395,20 +396,25 @@ readGhcMakeModeOutputFile file hsSrcDirs = do return $ nubSort modules +ghcPackagePath' :: IO String +ghcPackagePath' = do + ghcNumericVersion <- ghcNumericVersion + ghcPackageDb <- ghcPackageDb ghcNumericVersion + cabalPackageDb <- cabalPackageDb ghcNumericVersion + ghcPackagePath ghcPackageDb cabalPackageDb ghcNumericVersion + calcParserModules :: GhcFlavor -> IO [String] calcParserModules ghcFlavor = do let rootModulePath = placeholderModulesDir "Main.hs" series = ghcSeries ghcFlavor mainFile = "../ghc-lib-gen/ghc-lib-parser" show series "Main.hs" - ghcNumericVersion <- ghcNumericVersion - ghcPackageDb <- ghcPackageDb ghcNumericVersion - cabalPackageDb <- cabalPackageDb ghcNumericVersion copyFile mainFile rootModulePath lib <- mapM readCabalFile (cabalFileLibraries ghcFlavor) + ghcPackagePath <- ghcPackagePath' let includeDirs = map ("-I" ++ ) (ghcLibParserIncludeDirs ghcFlavor) hsSrcDirs = placeholderModulesDir : ghcLibParserHsSrcDirs True ghcFlavor lib hsSrcIncludes = map ("-i" ++ ) hsSrcDirs - cmd' = calcModuleDeps includeDirs hsSrcDirs hsSrcIncludes ghcFlavor ghcPackageDb cabalPackageDb ".parser-depends" + cmd' = calcModuleDeps includeDirs hsSrcDirs hsSrcIncludes ghcFlavor ghcPackagePath ".parser-depends" putStrLn "# Generating 'ghc/.parser-depends'..." putStrLn $ "\n\n# Running: " ++ cmd' system_ cmd' @@ -419,16 +425,13 @@ calcLibModules ghcFlavor = do let rootModulePath = placeholderModulesDir "Main.hs" series = ghcSeries ghcFlavor mainFile = "../ghc-lib-gen/ghc-lib" show series "Main.hs" - ghcNumericVersion <- ghcNumericVersion - ghcPackageDb <- ghcPackageDb ghcNumericVersion - cabalPackageDb <- cabalPackageDb ghcNumericVersion copyFile mainFile rootModulePath lib <- mapM readCabalFile (cabalFileLibraries ghcFlavor) ghcPackagePath <- ghcPackagePath' let includeDirs = map ("-I" ++ ) (ghcLibIncludeDirs ghcFlavor) hsSrcDirs = placeholderModulesDir : ghcLibHsSrcDirs True ghcFlavor lib hsSrcIncludes = map ("-i" ++ ) hsSrcDirs - cmd' = calcModuleDeps includeDirs hsSrcDirs hsSrcIncludes ghcFlavor ghcPackageDb cabalPackageDb ".lib-depends" + cmd' = calcModuleDeps includeDirs hsSrcDirs hsSrcIncludes ghcFlavor ghcPackagePath ".lib-depends" putStrLn "# Generating 'ghc/.lib-depends'..." putStrLn $ "\n\n# Running: " ++ cmd' system_ cmd'