Ticket #7700 (closed feature request: fixed)

Opened 4 months ago

Last modified 4 months ago

iOS patch no 3: enable/disable terminfo more precisely by os

Reported by: StephenBlackheath Owned by: igloo
Priority: normal Milestone: 7.8.1
Component: Compiler Version: 7.7
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Difficulty: Unknown
Test Case: Blocked By:
Blocking: #7724 Related Tickets:

Description

When cross compiling to iOS, HostOS = darwin and TargetOS = ios. darwin has termios but ios doesn't. So we need termios built in stage 0 but not stage 1, but the makefiles don't currently allow for that.

This patch makes it so termios is selected by the right OS for the right stage. I've refactored how Windows is handled here, so e.g. the termios selection should work correctly for both native windows and a Linux -> mingw32 cross compile (though I haven't tested it). Linux -> Windows mirrors darwin -> ios, in that it's termios -> no termios.

Attachments

ios-patch-3a-disable-terminfo-by-os.patch Download (2.5 KB) - added by StephenBlackheath 4 months ago.
iOS patch 3 rev a: disable terminfo by OS
ios-patch-3b-disable-terminfo-by-os.patch Download (2.8 KB) - added by StephenBlackheath 4 months ago.
iOS patch 3 rev b: disable terminfo by os - fixes a makefile loop introduced in 3a (affecting ios only)
ios-patch-3c-disable-terminfo-by-os.patch Download (2.8 KB) - added by StephenBlackheath 4 months ago.
iOS patch 3 rev c: disable terminfo by os - oops - slight mistake
ios-patch-3d-disable-terminfo-by-os.patch Download (3.5 KB) - added by StephenBlackheath 4 months ago.
iOS patch 3 rev d: disable terminfo by os - OK now I have the bugs out.
ios-patch-3e-disable-terminfo-by-os.patch Download (3.5 KB) - added by StephenBlackheath 4 months ago.
iOS patch 3 rev e: disable terminfo by os - finally I think I have it right this time
add-PACKAGES_STAGE0-entries-to-BUILD_DIRS.patch Download (0.6 KB) - added by StephenBlackheath 4 months ago.
Add PACKAGES_STAGE0 entries to BUILD_DIRS

Change History

Changed 4 months ago by StephenBlackheath

iOS patch 3 rev a: disable terminfo by OS

Changed 4 months ago by StephenBlackheath

  • status changed from new to patch

Thanks for the previous commits and apologies for forgetting a ;;

I hope this makes sense. The reason why I can't just leave out $(eval $(call addPackage,terminfo)) like the existing code does with Windows is that if we do that, then the terminfo never gets included at all. That's because it doesn't get added to PACKAGES_STAGE1 so the code below never includes the module. That's no good to us because we need it built in stage 0.

ifneq "$(CLEANING)" "YES"
BUILD_DIRS += \
   $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
endif

Changed 4 months ago by StephenBlackheath

iOS patch 3 rev b: disable terminfo by os - fixes a makefile loop introduced in 3a (affecting ios only)

Changed 4 months ago by StephenBlackheath

iOS patch 3 rev c: disable terminfo by os - oops - slight mistake

Changed 4 months ago by StephenBlackheath

  • status changed from patch to infoneeded

Changed 4 months ago by StephenBlackheath

iOS patch 3 rev d: disable terminfo by os - OK now I have the bugs out.

Changed 4 months ago by StephenBlackheath

iOS patch 3 rev e: disable terminfo by os - finally I think I have it right this time

Changed 4 months ago by StephenBlackheath

  • status changed from infoneeded to patch

That was tricky. With 3e I tested a native linux build and an ios cross build to the start of the stage2 compiler, so I'm very confident now. So, please review.

Changed 4 months ago by simonmar

  • difficulty set to Unknown

Things have got complicated in this bit of the build system with lots of exceptions, I think it needs a good refactoring. We should specify the stages for each package separately, perhaps.

Changed 4 months ago by StephenBlackheath

  • type changed from bug to feature request

Changed 4 months ago by StephenBlackheath

  • blocking 7724 added

Changed 4 months ago by igloo

  • owner set to igloo

Changed 4 months ago by ian@…

commit dd9da49ceda5bd0d6c860604ace0ca9829199fe5

Author: Ian Lynagh <ian@well-typed.com>
Date:   Fri Mar 1 22:29:19 2013 +0000

    Fix when terminfo is built; fixes #7700
    
    We now use the 'host' to determine whether stage0 builds terminfo,
    and 'target' to determine whether stage1 does.
    
    We don't build it if the platform is either Windows or ios.

 ghc.mk           |    6 +++++-
 mk/project.mk.in |    7 +++++++
 2 files changed, 12 insertions(+), 1 deletions(-)

Changed 4 months ago by igloo

  • status changed from patch to closed
  • resolution set to fixed
  • milestone set to 7.8.1

Thanks for the patch. I've refactored that area of the build system, as Simon suggested, and I think it has the behaviour you want now. Please let me know if not.

Changed 4 months ago by StephenBlackheath

  • owner igloo deleted
  • status changed from closed to new
  • resolution fixed deleted

Your changes don't quite fix it for darwin -> iOS, because of this sequence of events:

  1. On a darwin -> iOS, PACKAGES_STAGE0 gets terminfo but PACKAGES_STAGE1 doesn't.
  1. This line works for everything in PACKAGES_STAGE1, but there's no similar line for PACKAGES_STAGE0 BUILD_DIRS += $(patsubst %, libraries/%, $(PACKAGES_STAGE1))
  1. So libraries/terminfo never gets added to BUILD_DIRS.

The output is this:

Configuring ghc-pkg-6.9...
ghc-cabal: At least the following dependencies are missing:
terminfo ==0.3.2.5
make[1]: *** [utils/ghc-pkg/dist/package-data.mk] Error 1
make: *** [all] Error 2

I attach a patch to fix it. When working on it before I suspected some order dependence in the inclusion of the build dirs, and I haven't sanity tested a complete build yet.

Changed 4 months ago by StephenBlackheath

Add PACKAGES_STAGE0 entries to BUILD_DIRS

Changed 4 months ago by StephenBlackheath

  • status changed from new to patch

Changed 4 months ago by igloo

  • owner set to igloo

Changed 4 months ago by StephenBlackheath

I completed a darwin -> iOS cross build successfully with this patch, so there's a good chance the potential slight change in ordering of BUILD_DIRS is OK.

Changed 4 months ago by ian@…

commit 056997a285a368f5f78905b4b325a3258484f71d

Author: Ian Lynagh <ian@well-typed.com>
Date:   Sun Mar 3 13:35:41 2013 +0000

    Add PACKAGES_STAGE0 to build-dirs too; fixes #7700
    
    This is sometimes needed when cross-compiling, as some packages may be
    built in stage 0 but not stage 1.
    
    In order to make everything work out, this also removes the requirement
    that the build-dirs are in dependency order

 ghc.mk           |   16 ++++++++--------
 rules/haddock.mk |    5 ++++-
 2 files changed, 12 insertions(+), 9 deletions(-)

Changed 4 months ago by igloo

  • status changed from patch to closed
  • resolution set to fixed

There was a potential dependency problem with the haddock rules, but I've fixed that, and added the STAGE0 packages to BUILD_DIRS.

Note: See TracTickets for help on using tickets.