Skip to content

Commit 724013f

Browse files
committed
Merge remote-tracking branch 'origin/master' into static-nix-tools
2 parents a5a2bec + de29feb commit 724013f

File tree

12 files changed

+143
-11
lines changed

12 files changed

+143
-11
lines changed

flake.lock

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

overlays/mingw_w64.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ let
5353
# Not sure why this `unset` helps. It might avoids some kind of overflow issue. We see `wine` fail to start when building `cardano-wallet-cli` test `unit`.
5454
unset pkgsHostTargetAsString
5555
unset LINK_DLL_FOLDERS
56-
WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${wine}/bin/wine64 $REMOTE_ISERV/${interpreter.exeName} tmp $PORT $ISERV_ARGS &
56+
WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${wine}/bin/wine64 $REMOTE_ISERV/${interpreter.exeName} tmp $PORT --no-load-call $ISERV_ARGS &
5757
(>&2 echo "---| ${interpreter.exeName} should have started on $PORT")
5858
RISERV_PID="$!"
59-
ISERV_TARGET=WINE ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT" $PROXY_ARGS
59+
ISERV_TARGET=WINE ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT" --no-load-call $PROXY_ARGS
6060
(>&2 echo "---> killing ${interpreter.exeName}...")
6161
kill $RISERV_PID
6262
'';

test/default.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ let
211211
githash = haskell-nix.callPackage ./githash { inherit compiler-nix-name evalPackages; testSrc = testSrcWithGitDir; };
212212
c-ffi = callTest ./c-ffi { inherit util; };
213213
th-dlls = callTest ./th-dlls { inherit util; };
214+
th-dlls-minimal = callTest ./th-dlls-minimal { inherit util; };
214215
external-static-plugin = callTest ./external-static-plugin {};
215216
exe-dlls = callTest ./exe-dlls { inherit util; };
216217
exe-lib-dlls = callTest ./exe-lib-dlls { inherit util; };

test/th-dlls-minimal/apps/Main.hs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{-# LANGUAGE TemplateHaskell #-}
2+
module Main where
3+
4+
import Language.Haskell.TH
5+
6+
main :: IO ()
7+
main = putStrLn "Hello, Haskell!"
8+
9+
[d|y = 0|]

test/th-dlls-minimal/cabal.project

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
packages:
2+
./.
3+
./test-lib

test/th-dlls-minimal/default.nix

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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 = externalInterpreter: project' {
8+
inherit compiler-nix-name evalPackages;
9+
src = testSrc "th-dlls-minimal";
10+
cabalProjectLocal = builtins.readFile ../cabal.project.local;
11+
modules = [
12+
({pkgs, ...}: {
13+
packages.test-lib.components.library.libs = mkForce [
14+
(pkgs.stdenv.mkDerivation {
15+
name = "test-clib";
16+
version = "1.0";
17+
src = testSrc "th-dlls-minimal/test-clib";
18+
})
19+
];
20+
})
21+
({pkgs, ...}: lib.optionalAttrs externalInterpreter {
22+
packages.th-dlls-minimal.components.library.ghcOptions = [ "-fexternal-interpreter" ];
23+
})];
24+
};
25+
26+
packages = (project false).hsPkgs;
27+
packages-ei = (project true).hsPkgs;
28+
29+
in recurseIntoAttrs {
30+
# This test is just for windows currently (the full th-dlls test runs on other platforms)
31+
meta.disabled = !stdenv.hostPlatform.isWindows;
32+
33+
ifdInputs = {
34+
inherit (project true) plan-nix;
35+
};
36+
37+
build = packages.th-dlls-minimal.components.library;
38+
build-profiled = packages.th-dlls-minimal.components.library.profiled;
39+
just-template-haskell = packages.th-dlls-minimal.components.exes.just-template-haskell;
40+
build-ei = packages-ei.th-dlls-minimal.components.library;
41+
build-profiled-ei = packages-ei.th-dlls-minimal.components.library.profiled;
42+
just-template-haskell-ei = packages-ei.th-dlls-minimal.components.exes.just-template-haskell;
43+
}

test/th-dlls-minimal/src/Lib.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{-# LANGUAGE TemplateHaskell #-}
2+
module Lib where
3+
4+
import Control.Monad.IO.Class (liftIO)
5+
import Language.Haskell.TH.Syntax (Exp(..), Lit(..))
6+
import MyLib (someFunc)
7+
8+
a = $(liftIO (LitE . IntegerL . fromIntegral <$> someFunc))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
test.o: test.c
2+
$(CC) -o test.o -c test.c
3+
4+
test.a: test.o
5+
$(AR) -rs test-clib.a test.o
6+
7+
test.dll: test.o
8+
$(CC) -o test-clib.dll -shared test.o
9+
10+
.PHONY: install
11+
install: test.a test.dll
12+
mkdir $(out)/bin
13+
mkdir $(out)/lib
14+
mv test-clib.dll $(out)/bin
15+
mv test-clib.a $(out)/lib
16+

test/th-dlls-minimal/test-clib/test.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
int f()
2+
{
3+
return 42;
4+
}
5+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{-# LANGUAGE ForeignFunctionInterface #-}
2+
module MyLib (someFunc) where
3+
4+
import Foreign.C.Types (CInt(..))
5+
6+
foreign import ccall "f" c_f :: IO CInt
7+
8+
someFunc :: IO CInt
9+
someFunc = do
10+
putStrLn "someFunc called"
11+
c_f
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
cabal-version: >=1.10
2+
name: test-lib
3+
version: 0.1.0.0
4+
license: PublicDomain
5+
author: Hamish Mackenzie
6+
maintainer: [email protected]
7+
build-type: Simple
8+
9+
library
10+
build-depends: base
11+
exposed-modules: MyLib
12+
hs-source-dirs: src
13+
extra-libraries: test-clib
14+
default-language: Haskell2010
15+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
cabal-version: >=1.10
2+
name: th-dlls-minimal
3+
version: 0.1.0.0
4+
license: PublicDomain
5+
author: Hamish Mackenzie
6+
maintainer: [email protected]
7+
build-type: Simple
8+
9+
library
10+
build-depends: base
11+
, template-haskell
12+
, test-lib
13+
exposed-modules: Lib
14+
hs-source-dirs: src
15+
default-language: Haskell2010
16+
17+
executable just-template-haskell
18+
build-depends: base, template-haskell
19+
hs-source-dirs: apps
20+
default-language: Haskell2010
21+
main-is: Main.hs

0 commit comments

Comments
 (0)