Opened 2 years ago

Closed 2 years ago

#7700 closed feature request (fixed)

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 Test Case:
Blocked By: Blocking: #7724
Related Tickets: Differential Revisions:

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 (6)

ios-patch-3a-disable-terminfo-by-os.patch (2.5 KB) - added by StephenBlackheath 2 years ago.
iOS patch 3 rev a: disable terminfo by OS
ios-patch-3b-disable-terminfo-by-os.patch (2.8 KB) - added by StephenBlackheath 2 years 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 (2.8 KB) - added by StephenBlackheath 2 years ago.
iOS patch 3 rev c: disable terminfo by os - oops - slight mistake
ios-patch-3d-disable-terminfo-by-os.patch (3.5 KB) - added by StephenBlackheath 2 years 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 (3.5 KB) - added by StephenBlackheath 2 years 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 (599 bytes) - added by StephenBlackheath 2 years ago.
Add PACKAGES_STAGE0 entries to BUILD_DIRS

Download all attachments as: .zip

Change History (21)

Changed 2 years ago by StephenBlackheath

iOS patch 3 rev a: disable terminfo by OS

comment:1 Changed 2 years 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 2 years ago by StephenBlackheath

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

Changed 2 years ago by StephenBlackheath

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

comment:2 Changed 2 years ago by StephenBlackheath

  • Status changed from patch to infoneeded

Changed 2 years ago by StephenBlackheath

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

Changed 2 years ago by StephenBlackheath

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

comment:3 Changed 2 years 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.

comment:4 Changed 2 years 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.

comment:5 Changed 2 years ago by StephenBlackheath

  • Type changed from bug to feature request

comment:6 Changed 2 years ago by StephenBlackheath

  • Blocking 7724 added

comment:7 Changed 2 years ago by igloo

  • Owner set to igloo

comment:8 Changed 2 years ago by ian@…

commit dd9da49ceda5bd0d6c860604ace0ca9829199fe5

Author: Ian Lynagh <[email protected]>
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(-)

comment:9 Changed 2 years ago by igloo

  • Milestone set to 7.8.1
  • Resolution set to fixed
  • Status changed from patch to closed

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.

comment:10 Changed 2 years ago by StephenBlackheath

  • Owner igloo deleted
  • Resolution fixed deleted
  • Status changed from closed to new

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 2 years ago by StephenBlackheath

Add PACKAGES_STAGE0 entries to BUILD_DIRS

comment:11 Changed 2 years ago by StephenBlackheath

  • Status changed from new to patch

comment:12 Changed 2 years ago by igloo

  • Owner set to igloo

comment:13 Changed 2 years 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.

comment:14 Changed 2 years ago by ian@…

commit 056997a285a368f5f78905b4b325a3258484f71d

Author: Ian Lynagh <[email protected]>
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(-)

comment:15 Changed 2 years ago by igloo

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

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.