[Git][ghc/ghc][wip/hadrian-cross-stage2] fixes

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Thu Oct 5 22:46:09 UTC 2023



Matthew Pickering pushed to branch wip/hadrian-cross-stage2 at Glasgow Haskell Compiler / GHC


Commits:
7770b1b8 by GHC GitLab CI at 2023-10-05T22:45:47+00:00
fixes

- - - - -


3 changed files:

- .gitlab/ci.sh
- distrib/configure.ac.in
- hadrian/src/Packages.hs


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -592,15 +592,15 @@ function test_hadrian() {
   if [[ "${CROSS_EMULATOR:-}" == "NOT_SET" ]]; then
     info "Cannot test cross-compiled build without CROSS_EMULATOR being set."
     return
-    # special case for JS backend
-#  elif [ -n "${CROSS_TARGET:-}" ]; then
-#    local instdir="$TOP/_build/install"
-#    local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
-#    install_bindist _build/bindist/ghc-*/ "$instdir"
-#    echo 'main = putStrLn "hello world"' > expected
-#    run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello
-#    ${CROSS_EMULATOR:-} ./hello > actual
-#    run diff expected actual
+  # If we have set CROSS_EMULATOR, then can't test using normal testsuite.
+  elif [ -n "${CROSS_EMULATOR:-}" ]; then
+    local instdir="$TOP/_build/install"
+    local test_compiler="$instdir/bin/${cross_prefix}ghc$exe"
+    install_bindist _build/bindist/ghc-*/ "$instdir"
+    echo 'main = putStrLn "hello world"' > expected
+    run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -o hello
+    ${CROSS_EMULATOR:-} ./hello > actual
+    run diff expected actual
   elif [[ -n "${REINSTALL_GHC:-}" ]]; then
     run_hadrian \
       test \


=====================================
distrib/configure.ac.in
=====================================
@@ -11,6 +11,11 @@ AC_PREREQ([2.69])
 
 AC_CONFIG_MACRO_DIRS([../m4])
 
+dnl this makes sure `./configure --target=<cross-compile-target>`
+dnl works as expected, since we're slightly modifying how Autoconf
+dnl interprets build/host/target and how this interacts with $CC tests
+test -n "$target_alias" && ac_tool_prefix=$target_alias-
+
 dnl--------------------------------------------------------------------
 dnl * Deal with arguments telling us gmp is somewhere odd
 dnl--------------------------------------------------------------------


=====================================
hadrian/src/Packages.hs
=====================================
@@ -170,7 +170,8 @@ setPath pkg path = pkg { pkgPath = path }
 crossPrefix :: Stage -> Action String
 crossPrefix st = do
     cross <- crossStage st
-    targetPlatform <- targetPlatformTriple <$> targetStage (succStage st)
+    -- NB: If you modify this then it needs to align with CrossCompilePrefix in configure.ac
+    targetPlatform <- setting TargetPlatformFull
     return $ if cross then targetPlatform ++ "-" else ""
 
 -- | Given a 'Context', compute the name of the program that is built in it



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7770b1b84d77be3149f974efc12e09acc85f0f60

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/7770b1b84d77be3149f974efc12e09acc85f0f60
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231005/06f17df7/attachment-0001.html>


More information about the ghc-commits mailing list