Skip to content

Commit 8719163

Browse files
hamishmackAuto Update Bot
and
Auto Update Bot
authored
Add test for cross compilation of gi-gtk (#2233)
* Add test for cross compilation of gi-gtk It looks like this will need #2232 * Use pkgsBuildBuild instead of buildPackages in Cabal2Nix * Bump nix-tools haskellNix * Fix for macOS * update nix-tools-static.nix * ifdLevel 0 * Update materialized files * Update materialized files * ifdLevel 1 * ifdLevel 2 * ifdLevel 3 * Fix buildModules and buildProject (to be like pkgsBuildBuild) * Disable windows crosss compile * Set HASKELL_GI paths * Set HASKELL_GI paths * Disable gi-gtk test for windows cross compile * Make `pkg-config` work for haskell-gi setup executables * Make `pkg-config` work for haskell-gi setup executables * Revert fixes for musl (since we can't build static Gtk) * Bump cabal repository hashes * Test fixes * Test fixes * Test fixes --------- Co-authored-by: Auto Update Bot <[email protected]>
1 parent 2b63e7a commit 8719163

File tree

6 files changed

+74
-3
lines changed

6 files changed

+74
-3
lines changed

overlays/musl.nix

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isMusl ({
4141

4242
openssl = prev.openssl.override { static = true; };
4343

44+
# Cups and tracker pull in systemd
45+
gtk4 = (prev.gtk4.override {
46+
cupsSupport = false;
47+
trackerSupport = false;
48+
gst_all_1 = { gst-plugins-bad = null; gst-plugins-base = null; };
49+
}).overrideAttrs (oldAttrs: {
50+
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dmedia-gstreamer=disabled" ];
51+
});
52+
4453
icu = (prev.icu.overrideAttrs (old: { configureFlags = old.configureFlags ++ [ "--enable-static" "--disable-shared" ]; }));
4554

4655
# Fails on cross compile

test/cabal.project.local

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ repository head.hackage.ghc.haskell.org
2222
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
2323
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
2424
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
25-
--sha256: sha256-gDLkCAZPa4xALm37iKVjDVnmBj0CwNKT1qzY/xiiPOY=
25+
--sha256: sha256-j+maRnTnoCe341pX+uWMPUVqRbGDOA6w1WlnqfaO9Qc=
2626

2727
repository ghcjs-overlay
28-
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/8ef1977ba226b9dea0a5f43824c2e3507280d306
28+
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/d37efd733666d090bf1c83bf7d5f9cb71b1dacc1
2929
secure: True
3030
root-keys:
3131
key-threshold: 0
32-
--sha256: sha256-jcOUSw6rtBdLXx5/yx1EMKaYfvVWJgpTVe567jA81Ls=
32+
--sha256: sha256-6I5mu1QFdvWFm6jWOUMKGm3VHvB7vSqiBjjHgAZJReo=
3333

3434
if !impl(ghc>=9.11) && !os(ghcjs)
3535
active-repositories: hackage.haskell.org

test/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ let
233233
plugin = callTest ./plugin {};
234234
supported-languages = callTest ./supported-langauges {};
235235
js-template-haskell = callTest ./js-template-haskell {};
236+
gi-gtk = callTest ./gi-gtk { inherit util; };
236237
unit = unitTests;
237238
};
238239

test/gi-gtk/default.nix

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Test building TH code that needs DLLs when cross compiling for windows
2+
{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:
3+
4+
with lib;
5+
6+
let
7+
project = project' {
8+
inherit compiler-nix-name evalPackages;
9+
src = testSrc "gi-gtk";
10+
cabalProjectLocal = builtins.readFile ../cabal.project.local + ''
11+
if impl(ghc >=9.11)
12+
constraints: filepath source
13+
'';
14+
};
15+
16+
packages = project.hsPkgs;
17+
18+
in recurseIntoAttrs rec {
19+
meta.disabled = stdenv.hostPlatform.isGhcjs
20+
# Gtk cross compilation seems to be broken in nixpkgs
21+
|| stdenv.hostPlatform.isWindows
22+
# We can't make static libraries for Gtk
23+
|| stdenv.hostPlatform.isMusl
24+
# Older versions of GHC fail for aarch64 with
25+
# error: incompatible pointer to integer conversion assigning to 'ffi_arg' (aka 'unsigned long') from 'HsPtr' (aka 'void *') [-Wint-conversion]
26+
|| builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc928" "ghc948"] && stdenv.hostPlatform.isAarch64
27+
# Cross compilation to aarch64 is also broken
28+
|| stdenv.hostPlatform.isAarch64 && !stdenv.buildPlatform.isAarch64;
29+
30+
ifdInputs = {
31+
inherit (project) plan-nix;
32+
};
33+
34+
build = packages.test-gi-gtk.components.exes.test-gi-gtk;
35+
check = haskellLib.check build;
36+
build-profiled = packages.test-gi-gtk.components.exes.test-gi-gtk.profiled;
37+
check-profiled = haskellLib.check build-profiled;
38+
}

test/gi-gtk/src/Main.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module Main where
2+
3+
import qualified GI.Gtk as Gtk (initCheck)
4+
5+
main :: IO ()
6+
main = do
7+
Gtk.initCheck
8+
return ()
9+

test/gi-gtk/test-gi-gtk.cabal

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cabal-version: >=1.10
2+
name: test-gi-gtk
3+
version: 0.1.0.0
4+
license: PublicDomain
5+
author: Hamish Mackenzie
6+
maintainer: [email protected]
7+
build-type: Simple
8+
9+
executable test-gi-gtk
10+
build-depends: base
11+
, gi-gtk
12+
main-is: Main.hs
13+
hs-source-dirs: src
14+
default-language: Haskell2010

0 commit comments

Comments
 (0)