Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-29 Thread Helmut Grohne
On Tue, Aug 29, 2017 at 10:44:51PM +0100, James Clarke wrote:
> I believe is this because haskell-devscripts-minimal is arch:all, so any
> architecture information does not propagate through. If my understanding is
> correct, making haskell-devscripts-minimal an arch:any package and using a
> :native Build-Depends on haskell-devscripts-minimal would fix this, but I'm
> sure Helmut can clarify?

All of that is correct. Still I don't see that as a good solution for
several reasons:

 * After doing so, every package that uses haskell-devscripts-minimal
   (or haskell-devscripts) will have to annotate its build dependency
   with :native. There are lots of reverse dependencies. I am still
   hoping for a way that causes less churn in the archive.

 * The obvious alternative is to just mark it Multi-Arch: foreign. This
   is not a new idea indeed #769377. Unfortunately it is wrong, because
   the tools in there are architecture-dependent (via exposing ghc
   stuff). From what I learned with pkg-config, cmake and others, I
   guess we'll mark it M-A:foreign anyway and document how to avoid
   issues with architecture-awareness, but this certainly needs more
   work.

 * We'll likely need ghc-for-build and ghc-for-host for a proper
   solution. Since ghc depends on gcc, we also need gcc-for-build and
   gcc-for-host. The latter was blocked by waiting for
   binutils-for-build and binutils-for-host until very recently. Making
   that work for gcc will be a little more work. Any volunteers? ;)

Helmut



Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-29 Thread John Paul Adrian Glaubitz

On 08/29/2017 11:44 PM, James Clarke wrote:

I believe is this because haskell-devscripts-minimal is arch:all, so any
architecture information does not propagate through. If my understanding is
correct, making haskell-devscripts-minimal an arch:any package and using a
:native Build-Depends on haskell-devscripts-minimal would fix this, but I'm
sure Helmut can clarify?


I was discussing this issue at DebConf and I had the idea to try changing the
dependency of haskell-devscripts-minimal on GHC from "ghc" to "ghc:native",
but, unfortunately, dpkg doesn't support these qualifiers in the Depends field.

Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-29 Thread James Clarke
On 29 Aug 2017, at 22:16, John Paul Adrian Glaubitz 
 wrote:
> On 08/29/2017 11:12 PM, Gianfranco Costamagna wrote:
>>> Here's an updated patch for 8.0.2-9.
>> committed (I don't even know how to test it properly) on git, but obviously 
>> not uploaded.
> 
> Thanks! You can easily test it by performing a regular GHC testbuild on a 
> porterbox as
> well as a cross-build by just passing "--host=armhf" on the sbuild command 
> line.
> 
> Unfortunately, as previously explained, one still has to preinstall 
> haskell-devscripts-minimal
> in the build chroot used for cross-compiling (this is a limitation of dpkg 
> that I will
> file a bug report for), but at least bootstrapping GHC for a new architecture 
> is much
> easier now.

I believe is this because haskell-devscripts-minimal is arch:all, so any
architecture information does not propagate through. If my understanding is
correct, making haskell-devscripts-minimal an arch:any package and using a
:native Build-Depends on haskell-devscripts-minimal would fix this, but I'm
sure Helmut can clarify?

James



Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-29 Thread John Paul Adrian Glaubitz

Hi Gianfranco!

On 08/29/2017 11:12 PM, Gianfranco Costamagna wrote:

Here's an updated patch for 8.0.2-9.


committed (I don't even know how to test it properly) on git, but obviously not 
uploaded.


Thanks! You can easily test it by performing a regular GHC testbuild on a 
porterbox as
well as a cross-build by just passing "--host=armhf" on the sbuild command line.

Unfortunately, as previously explained, one still has to preinstall 
haskell-devscripts-minimal
in the build chroot used for cross-compiling (this is a limitation of dpkg that 
I will
file a bug report for), but at least bootstrapping GHC for a new architecture 
is much
easier now.


(I don't think it is worth an upload)


No problem.


Please forward the patches upstream whenever possible!


Most of the patches are already upstreamed, I think there is only one that 
might be
missing. I'll have another look.

Thanks,
Adrian

--
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-29 Thread Gianfranco Costamagna
Hello,


>Here's an updated patch for 8.0.2-9.


committed (I don't even know how to test it properly) on git, but obviously not 
uploaded.
(I don't think it is worth an upload)

Please forward the patches upstream whenever possible!
thanks

G.



Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-28 Thread John Paul Adrian Glaubitz
On 08/03/2017 12:06 AM, John Paul Adrian Glaubitz wrote:
> Attaching an updated patch which has been tested to not break native builds.

Here's an updated patch for 8.0.2-9.

The patch still has the drawback that haskell-devscripts-minimal has to be
installed manually because it always tries to pull in the host version of
GHC which, of course, doesn't work when that is the version of GHC that one
is actually trying to bootstrap.

I tried fixing that by changing the dependency of haskell-devscripts-minimal
from "ghc" to "ghc:native". Unfortunately, dpkg doesn't seem to support
":native" in dependencies but only in build dependencies.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff -Nru ghc-8.0.2/debian/control ghc-8.0.2/debian/control
--- ghc-8.0.2/debian/control	2017-08-26 19:04:25.0 +0200
+++ ghc-8.0.2/debian/control	2017-08-27 01:45:53.0 +0200
@@ -6,17 +6,17 @@
 Standards-Version: 3.9.8
 Build-Depends:
   debhelper (>= 10),
-  haskell-devscripts-minimal,
+  haskell-devscripts-minimal ,
   devscripts,
   grep-dctrl,
   pkg-config,
-  ghc (>= 7.8),
+  ghc:native (>= 7.8),
   libgmp-dev,
   llvm-3.7 [arm64 armel armhf],
   libffi-dev,
   binutils [arm64 armel armhf],
   libncurses5-dev,
-  python-sphinx,
+  python-sphinx ,
   dpkg-dev (>= 1.16.1.1)
 Build-Depends-Indep:
   hscolour,
diff -Nru ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch
--- ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch	1970-01-01 01:00:00.0 +0100
+++ ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch	2017-08-27 01:45:53.0 +0200
@@ -0,0 +1,31 @@
+Description: Don't use cross-compile prefix for stage2 cross-builds
+Origin: http://git.haskell.org/ghc.git/commitdiff/f2685df3b10e13f142736f28835e9064334bc143
+Note: Can be dropped for 8.2.0
+Last-Update: 2017-08-02
+
+--- ghc-8.0.2.orig/mk/config.mk.in
 ghc-8.0.2/mk/config.mk.in
+@@ -518,11 +518,6 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_U
+ 
+ WhatGccIsCalled   = @WhatGccIsCalled@
+ GccVersion= @GccVersion@
+-ifeq "$(phase)" "0"
+-CrossCompilePrefix=
+-else
+-CrossCompilePrefix= @CrossCompilePrefix@
+-endif
+ # TargetPlatformFull retains the string passed to configure so we have it in
+ # the necessary format to pass to libffi's configure.
+ TargetPlatformFull= @TargetPlatformFull@
+@@ -557,6 +552,11 @@ CrossCompiling= @CrossCompiling@
+ # See Note [Stage1Only vs stage=1]
+ Stage1Only = NO
+ 
++# Installed tools prefix:
++#we add prefix to crosscompiler GHC only (ghc-stage1),
++#not cross-built GHC (not ghc-stage2).
++CrossCompilePrefix= $(if $(filter YES,$(Stage1Only)),@CrossCompilePrefix@,)
++
+ # Install stage 2 by default, or stage 1 in the cross compiler
+ # case. Can be changed to 3
+ INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
diff -Nru ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch
--- ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch	1970-01-01 01:00:00.0 +0100
+++ ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch	2017-08-27 01:45:53.0 +0200
@@ -0,0 +1,80 @@
+Description: Build unlit and hp2ps twice
+Author: Thomas Miedema 
+John Paul Adrian Glaubitz 
+
+Index: ghc-8.0.1/utils/ghc-pkg/ghc.mk
+===
+--- ghc-8.0.1.orig/utils/ghc-pkg/ghc.mk
 ghc-8.0.1/utils/ghc-pkg/ghc.mk
+@@ -27,7 +27,7 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # Note [Why build certain utils twice?]
+ #
+ # We build certain utils twice: once with stage0, and once with stage1.
+-# Examples are ghc-pkg and hsc2hs.
++# Examples are ghc-pkg, hsc2hs, hp2ps and unlit.
+ #
+ # These tools are needed during the bootstrapping process, so we have to use
+ # stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
+@@ -38,6 +38,11 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # dynamically linked. But the stage0 copies are either statically linked, or
+ # linked against libraries on the build machine.
+ #
++# Another reason why we can't install the stage0 copies is that they are
++# built to run on the build(=host) platform, but when installing a
++# "cross-compiled stage2 compiler" we need copies that run on the target
++# platform.
++#
+ # Therefore we build fresh copies, using the stage1 compiler, and install them
+ # when you run 'make install'. They are not used for any other purpose.
+ 
+Index: ghc-8.0.1/utils/hp2ps/ghc.mk
+===
+--- ghc-8.0.1.orig/utils/hp2ps/ghc.mk
 ghc-8.0.1/utils/hp2ps/ghc.mk
+@@ -17,10 +17,23 @@ 

Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-08-02 Thread John Paul Adrian Glaubitz
Attaching an updated patch which has been tested to not break native builds.

The patch modifies debian/rules such that for cross-builds, the recommended
build options for GHC are used (i.e. -O0 and building with the embedded libffi).

In order to cross-build GHC for a given architecture, one can now simply use
sbuild with the --host= and --profile= parameters:

sbuild -d sid --host=m68k --profile=cross ghc*dsc

Only caveat is that haskell-devscripts-minimal has to be manually pre-installed
in the build chroot because of the known issue with arch:all packages [1].

Upstream has also added lots of changes to improve cross-builds even more [2],
so we can expect to be smoother with GHC 8.2.0. The biggest thing that is still
lacking for cross-compiled versions of GHC is the missing documentation and
Haddock.

Adrian

> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=818115
> [2] http://git.haskell.org/ghc.git?a=search=HEAD=commit=cross

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
diff -Nru ghc-8.0.2/debian/control ghc-8.0.2/debian/control
--- ghc-8.0.2/debian/control	2017-06-25 21:52:22.0 +0200
+++ ghc-8.0.2/debian/control	2017-08-02 20:55:14.0 +0200
@@ -6,17 +6,17 @@
 Standards-Version: 3.9.8
 Build-Depends:
   debhelper (>= 10),
-  haskell-devscripts-minimal,
+  haskell-devscripts-minimal ,
   devscripts,
   grep-dctrl,
   pkg-config,
-  ghc (>= 7.8),
+  ghc:native (>= 7.8),
   libgmp-dev,
   llvm-3.7 [arm64 armel armhf],
-  libffi-dev,
+  libffi-dev ,
   binutils [arm64 armel armhf],
   libncurses5-dev,
-  python-sphinx,
+  python-sphinx ,
   dpkg-dev (>= 1.16.1.1)
 Build-Depends-Indep:
   hscolour,
diff -Nru ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch
--- ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch	1970-01-01 01:00:00.0 +0100
+++ ghc-8.0.2/debian/patches/avoid-CrossCompilerPrefix-stage2.patch	2017-08-02 21:44:17.0 +0200
@@ -0,0 +1,31 @@
+Description: Don't use cross-compile prefix for stage2 cross-builds
+Origin: http://git.haskell.org/ghc.git/commitdiff/f2685df3b10e13f142736f28835e9064334bc143
+Note: Can be dropped for 8.2.0
+Last-Update: 2017-08-02
+
+--- ghc-8.0.2.orig/mk/config.mk.in
 ghc-8.0.2/mk/config.mk.in
+@@ -518,11 +518,6 @@ SUPPORTS_THIS_UNIT_ID = @SUPPORTS_THIS_U
+ 
+ WhatGccIsCalled   = @WhatGccIsCalled@
+ GccVersion= @GccVersion@
+-ifeq "$(phase)" "0"
+-CrossCompilePrefix=
+-else
+-CrossCompilePrefix= @CrossCompilePrefix@
+-endif
+ # TargetPlatformFull retains the string passed to configure so we have it in
+ # the necessary format to pass to libffi's configure.
+ TargetPlatformFull= @TargetPlatformFull@
+@@ -557,6 +552,11 @@ CrossCompiling= @CrossCompiling@
+ # See Note [Stage1Only vs stage=1]
+ Stage1Only = NO
+ 
++# Installed tools prefix:
++#we add prefix to crosscompiler GHC only (ghc-stage1),
++#not cross-built GHC (not ghc-stage2).
++CrossCompilePrefix= $(if $(filter YES,$(Stage1Only)),@CrossCompilePrefix@,)
++
+ # Install stage 2 by default, or stage 1 in the cross compiler
+ # case. Can be changed to 3
+ INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
diff -Nru ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch
--- ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch	1970-01-01 01:00:00.0 +0100
+++ ghc-8.0.2/debian/patches/build-unlit-and-hp2ps-twice.patch	2017-08-02 12:42:15.0 +0200
@@ -0,0 +1,80 @@
+Description: Build unlit and hp2ps twice
+Author: Thomas Miedema 
+John Paul Adrian Glaubitz 
+
+Index: ghc-8.0.1/utils/ghc-pkg/ghc.mk
+===
+--- ghc-8.0.1.orig/utils/ghc-pkg/ghc.mk
 ghc-8.0.1/utils/ghc-pkg/ghc.mk
+@@ -27,7 +27,7 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # Note [Why build certain utils twice?]
+ #
+ # We build certain utils twice: once with stage0, and once with stage1.
+-# Examples are ghc-pkg and hsc2hs.
++# Examples are ghc-pkg, hsc2hs, hp2ps and unlit.
+ #
+ # These tools are needed during the bootstrapping process, so we have to use
+ # stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
+@@ -38,6 +38,11 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # dynamically linked. But the stage0 copies are either statically linked, or
+ # linked against libraries on the build machine.
+ #
++# Another reason why we can't install the stage0 copies is that they are
++# built to run on the build(=host) platform, but when installing a
++# "cross-compiled stage2 compiler" we need copies that run on the target
++# platform.
++#
+ # Therefore we build fresh copies, using the stage1 

Bug#853285: closed by Clint Adams <cl...@debian.org> (Bug#853285: fixed in ghc 8.0.2-3)

2017-07-20 Thread John Paul Adrian Glaubitz
Control: reopen -1

Since the patch was reverted in the GHC package, let's reopen this
bug report.  I have a very fast Kaby Lake machine now available, so
I will be able to do plenty of test builds to improve the patch.

I will attach an updated patch to this bug report as soon I have it.

Cheers,
Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913