Skip to content

Commit 099daec

Browse files
hasufellGHC GitLab CI
authored andcommitted
Fix rts for javascript target
1 parent fca42ec commit 099daec

File tree

2 files changed

+800
-467
lines changed

2 files changed

+800
-467
lines changed

rts/configure.ac

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,3 +520,113 @@ cat $srcdir/rts.buildinfo.in \
520520
|| exit 1
521521
rm -f external-symbols.flags
522522
]
523+
524+
dnl --------------------------------------------------------------
525+
dnl Generate derived constants
526+
dnl --------------------------------------------------------------
527+
528+
AC_ARG_VAR([NM], [Path to the nm program])
529+
AC_PATH_PROG([NM], nm)
530+
if test -z "$NM"; then
531+
AC_MSG_ERROR([Cannot find nm])
532+
fi
533+
534+
AC_ARG_VAR([OBJDUMP], [Path to the objdump program])
535+
AC_PATH_PROG([OBJDUMP], objdump)
536+
if test -z "$OBJDUMP"; then
537+
AC_MSG_ERROR([Cannot find objdump])
538+
fi
539+
540+
AC_ARG_VAR([DERIVE_CONSTANTS], [Path to the deriveConstants program])
541+
AC_PATH_PROG([DERIVE_CONSTANTS], deriveConstants)
542+
AS_IF([test "x$DERIVE_CONSTANTS" = x], [AC_MSG_ERROR([deriveConstants executable not found. Please install deriveConstantsor set DERIVE_CONSTANTS environment variable.])])
543+
544+
AC_ARG_VAR([GENAPPLY], [Path to the genapply program])
545+
AC_PATH_PROG([GENAPPLY], genapply)
546+
AS_IF([test "x$GENAPPLY" = x], [AC_MSG_ERROR([genapply executable not found. Please install genapply or set GENAPPLY environment variable.])])
547+
548+
AC_CHECK_PROGS([PYTHON], [python3 python python2])
549+
AS_IF([test "x$PYTHON" = x], [AC_MSG_ERROR([Python interpreter not found. Please install Python or set PYTHON environment variable.])])
550+
551+
AC_MSG_CHECKING([for DerivedConstants.h])
552+
dnl NOTE: dnl pass `-fcommon` to force symbols into the common section. If they end
553+
dnl up in the ro data section `nm` won't list their size, and thus derivedConstants
554+
dnl will fail. Recent clang (e.g. 16) will by default use `-fno-common`.
555+
dnl
556+
dnl FIXME: using a relative path here is TERRIBLE; Cabal should provide some
557+
dnl env var for _build-dependencies_ headers!
558+
dnl
559+
560+
if $DERIVE_CONSTANTS \
561+
--gen-header \
562+
-o include/DerivedConstants.h \
563+
--target-os "$HostOS_CPP" \
564+
--gcc-program "$CC" \
565+
--nm-program "$NM" \
566+
--objdump-program "$OBJDUMP" \
567+
--tmpdir "$(mktemp -d)" \
568+
--gcc-flag "-fcommon" \
569+
--gcc-flag "-I$srcdir" \
570+
--gcc-flag "-I$srcdir/include" \
571+
--gcc-flag "-Iinclude" \
572+
--gcc-flag "-I$srcdir/../rts-headers/include" ; then
573+
AC_MSG_RESULT([created])
574+
else
575+
AC_MSG_RESULT([failed to create])
576+
AC_MSG_ERROR([Failed to run $DERIVE_CONSTANTS --gen-header ...])
577+
fi
578+
579+
AC_MSG_CHECKING([for AutoApply.cmm])
580+
if $GENAPPLY include/DerivedConstants.h > AutoApply.cmm; then
581+
AC_MSG_RESULT([created])
582+
else
583+
AC_MSG_RESULT([failed to create])
584+
AC_MSG_ERROR([Failed to run $GENAPPLY include/DerivedConstants.h > AutoApply.cmm])
585+
fi
586+
587+
AC_MSG_CHECKING([for AutoApply_V16.cmm])
588+
if $GENAPPLY include/DerivedConstants.h -V16 > AutoApply_V16.cmm; then
589+
AC_MSG_RESULT([created])
590+
else
591+
AC_MSG_RESULT([failed to create])
592+
AC_MSG_ERROR([Failed to run $GENAPPLY include/DerivedConstants.h -V16 > AutoApply_V16.cmm])
593+
fi
594+
595+
AC_MSG_CHECKING([for AutoApply_V32.cmm])
596+
if $GENAPPLY include/DerivedConstants.h -V32 > AutoApply_V32.cmm; then
597+
AC_MSG_RESULT([created])
598+
else
599+
AC_MSG_RESULT([failed to create])
600+
AC_MSG_ERROR([Failed to run $GENAPPLY include/DerivedConstants.h -V32 > AutoApply_V32.cmm])
601+
fi
602+
603+
AC_MSG_CHECKING([for AutoApply_V64.cmm])
604+
if $GENAPPLY include/DerivedConstants.h -V64 > AutoApply_V64.cmm; then
605+
AC_MSG_RESULT([created])
606+
else
607+
AC_MSG_RESULT([failed to create])
608+
AC_MSG_ERROR([Failed to run $GENAPPLY include/DerivedConstants.h -V64 > AutoApply_V64.cmm])
609+
fi
610+
611+
AC_MSG_CHECKING([for include/rts/EventLogConstants.h])
612+
if mkdir -p include/rts && $PYTHON $srcdir/gen_event_types.py --event-types-defines include/rts/EventLogConstants.h; then
613+
AC_MSG_RESULT([created])
614+
else
615+
AC_MSG_RESULT([failed to create])
616+
AC_MSG_ERROR([Failed to run $PYTHON gen_event_types.py])
617+
fi
618+
619+
AC_MSG_CHECKING([for include/rts/EventTypes.h])
620+
if mkdir -p include/rts && $PYTHON $srcdir/gen_event_types.py --event-types-array include/rts/EventTypes.h; then
621+
AC_MSG_RESULT([created])
622+
else
623+
AC_MSG_RESULT([failed to create])
624+
AC_MSG_ERROR([Failed to run $PYTHON gen_event_types.py])
625+
fi
626+
627+
628+
dnl --------------------------------------------------------------
629+
dnl ** Write config files
630+
dnl --------------------------------------------------------------
631+
632+
AC_OUTPUT

0 commit comments

Comments
 (0)