Skip to content

Add test for cross compilation of gi-gtk #2233

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
22e85ba
Add test for cross compilation of gi-gtk
hamishmack Jul 18, 2024
7f87291
Use pkgsBuildBuild instead of buildPackages in Cabal2Nix
hamishmack Jul 18, 2024
86f8105
Bump nix-tools haskellNix
hamishmack Jul 18, 2024
9bbfee5
Fix for macOS
hamishmack Jul 18, 2024
04274d5
update nix-tools-static.nix
Jul 18, 2024
ebc8694
ifdLevel 0
hamishmack Jul 18, 2024
5419edc
Update materialized files
hamishmack Jul 18, 2024
e1b041d
Update materialized files
hamishmack Jul 18, 2024
0afe5ed
ifdLevel 1
hamishmack Jul 18, 2024
d1cdadf
ifdLevel 2
hamishmack Jul 18, 2024
63e2f7f
ifdLevel 3
hamishmack Jul 18, 2024
c573254
Merge branch 'static-nix-tools' into hkm/test-gi-gtk
hamishmack Jul 18, 2024
26157e0
Fix buildModules and buildProject (to be like pkgsBuildBuild)
hamishmack Jul 18, 2024
b92a3ef
Merge branch 'static-nix-tools' into branch-2
hamishmack Jul 18, 2024
1128055
Disable windows crosss compile
hamishmack Jul 22, 2024
04cb488
Set HASKELL_GI paths
hamishmack Jul 22, 2024
94851ee
Set HASKELL_GI paths
hamishmack Jul 22, 2024
1c9ada0
Disable gi-gtk test for windows cross compile
hamishmack Jul 23, 2024
69d1e60
Make `pkg-config` work for haskell-gi setup executables
hamishmack Jul 23, 2024
1bf350c
Make `pkg-config` work for haskell-gi setup executables
hamishmack Jul 23, 2024
e576858
Merge remote-tracking branch 'origin/master' into hkm/test-gi-gtk
hamishmack Jul 26, 2024
8b14147
Revert fixes for musl (since we can't build static Gtk)
hamishmack Jul 26, 2024
c10b016
Bump cabal repository hashes
hamishmack Jul 26, 2024
8b81cd0
Test fixes
hamishmack Jul 26, 2024
ac4faa9
Test fixes
hamishmack Jul 26, 2024
a32706c
Test fixes
hamishmack Jul 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions overlays/musl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@ final: prev: prev.lib.optionalAttrs prev.stdenv.hostPlatform.isMusl ({

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

# Cups and tracker pull in systemd
gtk4 = (prev.gtk4.override {
cupsSupport = false;
trackerSupport = false;
gst_all_1 = { gst-plugins-bad = null; gst-plugins-base = null; };
}).overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ [ "-Dmedia-gstreamer=disabled" ];
});

icu = (prev.icu.overrideAttrs (old: { configureFlags = old.configureFlags ++ [ "--enable-static" "--disable-shared" ]; }));

# Fails on cross compile
Expand Down
6 changes: 3 additions & 3 deletions test/cabal.project.local
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ repository head.hackage.ghc.haskell.org
f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89
26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329
7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d
--sha256: sha256-gDLkCAZPa4xALm37iKVjDVnmBj0CwNKT1qzY/xiiPOY=
--sha256: sha256-j+maRnTnoCe341pX+uWMPUVqRbGDOA6w1WlnqfaO9Qc=

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

if !impl(ghc>=9.11) && !os(ghcjs)
active-repositories: hackage.haskell.org
Expand Down
1 change: 1 addition & 0 deletions test/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ let
plugin = callTest ./plugin {};
supported-languages = callTest ./supported-langauges {};
js-template-haskell = callTest ./js-template-haskell {};
gi-gtk = callTest ./gi-gtk { inherit util; };
unit = unitTests;
};

Expand Down
38 changes: 38 additions & 0 deletions test/gi-gtk/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Test building TH code that needs DLLs when cross compiling for windows
{ stdenv, lib, util, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name, evalPackages, buildPackages }:

with lib;

let
project = project' {
inherit compiler-nix-name evalPackages;
src = testSrc "gi-gtk";
cabalProjectLocal = builtins.readFile ../cabal.project.local + ''
if impl(ghc >=9.11)
constraints: filepath source
'';
};

packages = project.hsPkgs;

in recurseIntoAttrs rec {
meta.disabled = stdenv.hostPlatform.isGhcjs
# Gtk cross compilation seems to be broken in nixpkgs
|| stdenv.hostPlatform.isWindows
# We can't make static libraries for Gtk
|| stdenv.hostPlatform.isMusl
# Older versions of GHC fail for aarch64 with
# error: incompatible pointer to integer conversion assigning to 'ffi_arg' (aka 'unsigned long') from 'HsPtr' (aka 'void *') [-Wint-conversion]
|| builtins.elem compiler-nix-name ["ghc8107" "ghc902" "ghc928" "ghc948"] && stdenv.hostPlatform.isAarch64
# Cross compilation to aarch64 is also broken
|| stdenv.hostPlatform.isAarch64 && !stdenv.buildPlatform.isAarch64;

ifdInputs = {
inherit (project) plan-nix;
};

build = packages.test-gi-gtk.components.exes.test-gi-gtk;
check = haskellLib.check build;
build-profiled = packages.test-gi-gtk.components.exes.test-gi-gtk.profiled;
check-profiled = haskellLib.check build-profiled;
}
9 changes: 9 additions & 0 deletions test/gi-gtk/src/Main.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module Main where

import qualified GI.Gtk as Gtk (initCheck)

main :: IO ()
main = do
Gtk.initCheck
return ()

14 changes: 14 additions & 0 deletions test/gi-gtk/test-gi-gtk.cabal
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cabal-version: >=1.10
name: test-gi-gtk
version: 0.1.0.0
license: PublicDomain
author: Hamish Mackenzie
maintainer: [email protected]
build-type: Simple

executable test-gi-gtk
build-depends: base
, gi-gtk
main-is: Main.hs
hs-source-dirs: src
default-language: Haskell2010