Opened 12 months ago

Closed 12 months ago

Last modified 11 months ago

#7841 closed feature request (worksforme)

Stage1Only conditional program/package building

Reported by: elliottt Owned by:
Priority: normal Milestone:
Component: Build System Version: 7.7
Keywords: Stage1Only Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

This patch includes changes to allow programs and packages to be disabled by stage when building GHC.

rule/build-package.mk

  • Add guards for "disable-$(dir)-$(stage)" around the rule body

rule/build-prog.mk

  • Add guards for "disabled-$(dir)-$(stage)" around the rule body

mk/build.mk.default

  • Add a set of package disabling definitions when $(Stage1Only) is set to "YES"

rts/ghc.mk

  • Add the all_rts target as a dependency for all, causing the rts to build when packages that depend on it are disabled

Attachments (1)

0001-Allow-packages-programs-to-be-disabled-during-a-buil.patch (4.6 KB) - added by elliottt 12 months ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 12 months ago by igloo

  • Difficulty set to Unknown
  • Status changed from new to patch

comment:2 Changed 12 months ago by igloo

  • Resolution set to worksforme
  • Status changed from patch to closed

Thanks for the patch.

However, we already have variables like libraries/base_dist-install_NOT_NEEDED and ghc_stage2_NOT_NEEDED which I think are designed to do the same thing as your disable-* variables.

The variables you set also look wrong to me, e.g. you define disable-libraries/array-2 but we never build the array package with stage 2.

comment:3 follow-up: Changed 12 months ago by elliottt

It looks like libraries/base_dist-install_NOT_NEEDED would prevent base from being built at all, instead of just with a specific stage of the compiler. This should be good enough for libraries that shouldn't be built at all for the target of the stage 1 compiler, but wouldn't defining it for a utility program like hsc2hs prevent it from being built with stage 0?

I hadn't noticed the guard on the call to build-package in libraries/array/ghc.mk, and just assumed that it would be built with the stage 2 compiler.

In the case where stage 2 doesn't get build, what causes the RTS to build, without all_rts being a dependency of all?

I'm very interested in getting some version of Stage1Only working, and am happy to do the work to implement it. Could you give me a little guidance so that I can submit a better patch?

Thanks!

comment:4 in reply to: ↑ 3 Changed 11 months ago by igloo

Replying to elliottt:

It looks like libraries/base_dist-install_NOT_NEEDED would prevent base from being built at all, instead of just with a specific stage of the compiler.

base is only built with one specific stage of the compiler.

For packages that are built with multiple stages, the distdir is different for each one. e.g. libraries/terminfo_dist-boot is built with stage 0, and libraries/terminfo_dist-install with stage 1.

In the case where stage 2 doesn't get build, what causes the RTS to build, without all_rts being a dependency of all?

Nothing currently; I'll fix that.

I'm very interested in getting some version of Stage1Only working, and am happy to do the work to implement it. Could you give me a little guidance so that I can submit a better patch?

One way (untested) would probably be to add a check ifneq "$(Stage1Only) $3" "YES 2" before calling the helpers in build-prog and build-package, as well as defining compiler_stage2_NOT_NEEDED=YES and ghc_stage2_NOT_NEEDED=YES.

An alternative would be to define lots of _NOT_NEEDED variables by iterating over PACKAGE_STAGE2. This would make the logic in the rules slightly simpler, but would probably be a little more verbose overall.

I think the second would probably be slightly nicer on balance.

comment:5 Changed 11 months ago by ian@…

commit 3d51be452cdff49aecee762c685af52ccb4ce74a

Author: Ian Lynagh <ian@well-typed.com>
Date:   Fri May 10 21:53:22 2013 +0100

    Make sure the RTS is built, even when no programs are being built with stage1
    
    Part of #7841

 rts/ghc.mk |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Note: See TracTickets for help on using tickets.