Skip to content
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

android w/ ghc 8.10 #782

Draft
wants to merge 52 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
86407a5
First crack at bumping Nixpkgs
Ericson2314 Jan 22, 2022
6d5114a
New commit to Nixpkgs fork to unbreak eval
Ericson2314 Jan 24, 2022
5ab4f23
Need `includeNDK` for android apps now
Ericson2314 Jan 25, 2022
51665aa
Remove pins no longer needed now that `th-abstraction` is newer by de…
Ericson2314 Jan 25, 2022
fa0d585
Make ghc810 default
luigy Feb 20, 2022
2e4508d
fix eval
luigy Feb 20, 2022
587ba07
android: disable 32bit
luigy Feb 22, 2022
df66d64
Checkpoint
luigy May 9, 2022
3ae2912
android: allow specifying an adaptive-icon xml
plt-amy May 24, 2022
f6401bf
bump reflex-dom
plt-amy May 24, 2022
743ec78
bump reflex-dom
plt-amy May 25, 2022
fe6d678
bump reflex-dom
plt-amy May 25, 2022
b3580c5
bump reflex-dom
plt-amy Jun 2, 2022
e452125
Mandate java 1.8 compatibility
plt-amy Jun 6, 2022
dec99fb
track reflex-dom upstream
plt-amy Jun 6, 2022
fb75620
Merge remote-tracking branch 'origin/aliao/adaptive-icons' into aliao…
plt-amy Jun 6, 2022
8392ac9
android: fix mkidr → mkdir
plt-amy Jun 6, 2022
69eaf5f
android: Make default java sources overridable
ali-abrar Jun 6, 2022
cfdcc8c
Merge branch 'develop' into nixpkgs-21.05
Ericson2314 Jun 9, 2022
25ce7cc
text-jsstring: pin hashable version
ali-abrar Jul 6, 2022
f56a79d
Bump dependencies to fix ghc and ghcjs builds
ali-abrar Jul 6, 2022
4aef269
haskell-overlays: update reflex-ghci and reflex-vty
ali-abrar Jul 6, 2022
82f762e
splices: use forked ghc instead of patch
ali-abrar Jul 6, 2022
4f6a353
mobile: set isStatic for mobile platforms
ali-abrar Jul 7, 2022
bfa91d1
android: upgrade to build-tools 30.0.2, gradle v7, and gradle-plugin 4.2
ali-abrar Jul 13, 2022
3de2376
nixpkgs: update for ghcjs 8.10 hoogle fix
ali-abrar Jul 13, 2022
51eb8a6
Merge remote-tracking branch 'origin/develop' into nixpkgs-21.05
ali-abrar Jul 13, 2022
ff98b99
Update changelog to reflect ghc865 legacy support
ali-abrar Jul 13, 2022
aace759
haskell-overlays: remove now-unnecessary gi-* overlays; add some over…
ali-abrar Jul 13, 2022
ffc973c
Fix warnings: Replace stdenv.lib with lib
ali-abrar Jul 13, 2022
de5e113
ghcjs8_6: Overrides for building against nixpkgs-21.05
ali-abrar Jul 15, 2022
70699ce
ghcSplices-8_6: Apply autoreconf patch to fix compiler build
ali-abrar Jul 15, 2022
d574c2f
ghcSplices-8_6: override happy in boot packages
ali-abrar Jul 17, 2022
bb1a022
android: Actually copy the .aab release bundle when doing "gradle bun…
ali-abrar Jul 18, 2022
315b211
Merge remote-tracking branch 'origin/develop' into aliao/mobile-8_10-wip
ali-abrar Jul 18, 2022
7b14c43
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Jul 18, 2022
629e6ae
ghcSplices-8_10: Use upstream ghc-8.10.7-release instead of ghc-8.10
ali-abrar Jul 18, 2022
c9697ff
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Jul 18, 2022
8c68f23
android: Update ghc thunk to one that actually includes splices
ali-abrar Jul 19, 2022
d0c1509
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Jul 19, 2022
448d165
Temporarily disable armeabi-v7a
ali-abrar Jul 20, 2022
1cbf402
android: sdk version 30
ali-abrar Jul 20, 2022
56cdfae
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Jul 20, 2022
a23d267
Switch to gold on aarch32
cidkidnix Jul 25, 2022
b8d5443
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Jul 26, 2022
b33bd78
ghcjs8_10: Various FFI fixes
ali-abrar Aug 2, 2022
6f255c8
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Aug 2, 2022
d079f86
Merge branch 'aliao/mobile-8_10-wip' of https://github.com/reflex-frp…
ali-abrar Aug 2, 2022
b382919
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Aug 2, 2022
817ed49
Bump nixpkgs (update ghcjs8_10 source)
ali-abrar Aug 2, 2022
875d262
Merge branch 'aliao/mobile-8_10-wip' of github.com:reflex-frp/reflex-…
ali-abrar Aug 2, 2022
c260f67
Merge remote-tracking branch 'origin/nixpkgs-21.05' into aliao/mobile…
ali-abrar Aug 2, 2022
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
8 changes: 5 additions & 3 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ This project's release branch is `master`. This log is written from the perspect

## Unreleased

* Fix SIGBUS crashes on armv7a due unaligned writes ([!774](https://github.com/reflex-frp/reflex-platform/pull/774))
* Always use GHC 8.10.7, not GHC 8.10.4, for GHC 8.10.
Previously we were using mixed GHC 8.10 versions to avoid issues.

## Unreleased

* GHC 8.10 support is complete, with the remaining profiling builds
that worked for 8.6 (everything but GHCJS's) now also working for 8.10.
* *Breaking Change*: The `javaSources` argument of `android/default.nix` is now
a function that takes the default sources as arguments instead of a list that
is always appended to the default sources. It is now possible to override the
default java sources. See the documentation [here](android/default.nix).

* GHCJS 8.6 no longer uses older versions of some libraries with "text JS-string"

Expand Down
6 changes: 6 additions & 0 deletions android/build.gradle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ android {
jniLibs.srcDir 'lib'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
applicationId "${applicationId}"
minSdkVersion 21
Expand Down
22 changes: 17 additions & 5 deletions android/buildIcons.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
{ runCommand, imagemagick }:
{ src }:
{ runCommand, imagemagick, lib }:
{ src ? null # Base raster image for fixed-size icons (must be a path)
, adaptiveIcon ? null
# Path to a XML file containing the adaptive icon specification (SDK
# 26 and up).
}:
let
rasterInput =
if (src == null) && (adaptiveIcon == null)
then abort "Either src or adaptiveIcon must be specified!"
else src;
in
runCommand "android-icons" {
inherit src;
buildCommand = ''
buildCommand = lib.optionalString (src != null) ''
mkdir "$out"

launcherIconSize() {
Expand All @@ -20,8 +29,11 @@ runCommand "android-icons" {
for x in l m tv h xh xxh xxxh ; do
local dir="$out/drawable-''${x}dpi"
mkdir "$dir"
convert -resize "$(launcherIconSize "$x")" -flatten "$src" "$dir/ic_launcher.png"
convert -resize "$(launcherIconSize "$x")" -flatten "${rasterInput}" "$dir/ic_launcher.png"
done
'' + lib.optionalString (adaptiveIcon != null) ''
mkdir -p "$out/mipmap-anydpi-v26/"
cp "${adaptiveIcon}" "$out/mipmap-anydpi-v26/ic_launcher.xml"
'';
nativeBuildInputs = [
imagemagick
Expand Down
10 changes: 8 additions & 2 deletions android/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,14 @@ in rec {
# You need to patch soname in make files of libraries to link against
# unversioned libraries.

, javaSources ? []
# A list of additional Java source directories to include in the APK build
, javaSources ? (androidActivitySrc: mainWidgetSrc: [ androidActivitySrc mainWidgetSrc ])
# A function that is used to build the list of android source files. The
# arguments to this function are:
# * The default android-activity java source tree (from the [android-activity package](https://hackage.haskell.org/package/android-activity))
# * The default "main widget" java source tree (from [reflex-dom](https://github.com/reflex-frp/reflex-dom/blob/develop/reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java))
# Those arguments can be selectively ignored and replaced with alternate
# implementations. Additional Java source directories can also be added
# to the list for inclusion in the APK build

, universalApk ? true
# Set this to false to build one APK per target platform. This will
Expand Down
15 changes: 8 additions & 7 deletions android/impl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ in {
myNixpkgs = nixpkgsCross.android.aarch64;
myHaskellPackages = ghcAndroidAarch64;
};
"armeabi-v7a" = {
myNixpkgs = nixpkgsCross.android.aarch32;
myHaskellPackages = ghcAndroidAarch32;
};
# "armeabi-v7a" = {
# myNixpkgs = nixpkgsCross.android.aarch32;
# myHaskellPackages = ghcAndroidAarch32;
# };
};
abiVersions = attrNames appSOs;
in nixpkgs.runCommand "android-app" {
Expand All @@ -73,10 +73,11 @@ in {
});
javaSrc = nixpkgs.buildEnv {
name = applicationId + "-java";
paths = javaSources ++ [
paths = javaSources
# Sets up the main Activity using [android-activity](https://hackage.haskell.org/package/android-activity)
(ghcAndroidAarch64.android-activity.src + "/java") #TODO: Use output, not src
(ghcAndroidAarch64.reflex-dom.src + "/java")
];
# Sets up the main webview using [reflex-dom](https://github.com/reflex-frp/reflex-dom/blob/develop/reflex-dom/java/org/reflexfrp/reflexdom/MainWidget.java)
(ghcAndroidAarch64.reflex-dom.src + "/java");
};
src = ./src;
nativeBuildInputs = [ nixpkgs.rsync ];
Expand Down
18 changes: 9 additions & 9 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ nixpkgsFunc ? import ./nixpkgs
, system ? builtins.currentSystem
, config ? {}
, config ? { android_sdk.accept_license = true; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably not, but it was there when i got here

, enableLibraryProfiling ? false
, enableExposeAllUnfoldings ? true
, enableTraceReflexEvents ? false
Expand Down Expand Up @@ -204,7 +204,7 @@ let iosSupport = system == "x86_64-darwin";
sha256 = null;
});

ghcSavedSplices = ghcSavedSplices-8_6;
ghcSavedSplices = ghcSavedSplices-8_10;
ghcSavedSplices-8_6 = (makeRecursivelyOverridable nixpkgs.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = lib.foldr lib.composeExtensions (_: _: {}) (let
haskellOverlays = nixpkgs.haskell.overlays;
Expand Down Expand Up @@ -235,7 +235,7 @@ let iosSupport = system == "x86_64-darwin";
})
]);
};
ghcjs = ghcjs8_6;
ghcjs = ghcjs8_10;
ghcjs8_6 = (makeRecursivelyOverridable (nixpkgsCross.ghcjs.haskell.packages.ghcjs86.override (old: {
ghc = old.ghc.override {
bootPkgs = nixpkgsCross.ghcjs.buildPackages.haskell.packages.ghc865;
Expand All @@ -262,7 +262,7 @@ let iosSupport = system == "x86_64-darwin";
overrides = nixpkgsCross.wasm.haskell.overlays.combined;
});

ghc = ghc8_6;
ghc = ghc8_10;
ghcHEAD = (makeRecursivelyOverridable nixpkgs.haskell.packages.ghcHEAD).override {
overrides = nixpkgs.haskell.overlays.combined;
};
Expand All @@ -287,36 +287,36 @@ let iosSupport = system == "x86_64-darwin";
new));
};

ghcAndroidAarch64 = ghcAndroidAarch64-8_6;
ghcAndroidAarch64 = ghcAndroidAarch64-8_10;
ghcAndroidAarch64-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.android.aarch64.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = nixpkgsCross.android.aarch64.haskell.overlays.combined;
});
ghcAndroidAarch64-8_10 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.android.aarch64.haskell.packages.integer-simple.ghcSplices-8_10).override {
overrides = nixpkgsCross.android.aarch64.haskell.overlays.combined;
});
ghcAndroidAarch32 = ghcAndroidAarch32-8_6;
ghcAndroidAarch32 = ghcAndroidAarch32-8_10;
ghcAndroidAarch32-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.android.aarch32.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = nixpkgsCross.android.aarch32.haskell.overlays.combined;
});
ghcAndroidAarch32-8_10 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.android.aarch32.haskell.packages.integer-simple.ghcSplices-8_10).override {
overrides = nixpkgsCross.android.aarch32.haskell.overlays.combined;
});

ghcIosSimulator64 = ghcIosSimulator64-8_6;
ghcIosSimulator64 = ghcIosSimulator64-8_10;
ghcIosSimulator64-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.ios.simulator64.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = nixpkgsCross.ios.simulator64.haskell.overlays.combined;
});
ghcIosSimulator64-8_10 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.ios.simulator64.haskell.packages.integer-simple.ghcSplices-8_10).override {
overrides = nixpkgsCross.ios.simulator64.haskell.overlays.combined;
});
ghcIosAarch64 = ghcIosAarch64-8_6;
ghcIosAarch64 = ghcIosAarch64-8_10;
ghcIosAarch64-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.ios.aarch64.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = nixpkgsCross.ios.aarch64.haskell.overlays.combined;
});
ghcIosAarch64-8_10 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.ios.aarch64.haskell.packages.integer-simple.ghcSplices-8_10).override {
overrides = nixpkgsCross.ios.aarch64.haskell.overlays.combined;
});
ghcIosAarch32 = ghcIosAarch32-8_6;
ghcIosAarch32 = ghcIosAarch32-8_10;
ghcIosAarch32-8_6 = makeRecursivelyOverridableBHPToo ((makeRecursivelyOverridable nixpkgsCross.ios.aarch32.haskell.packages.integer-simple.ghcSplices-8_6).override {
overrides = nixpkgsCross.ios.aarch32.haskell.overlays.combined;
});
Expand Down
4 changes: 3 additions & 1 deletion haskell-overlays/reflex-packages/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ in
])) {})
(drv: {
# TODO: Get hlint working for cross-compilation
doCheck = stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false);
# doCheck = stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false);
doCheck = false; # stdenv.hostPlatform == stdenv.buildPlatform && !(ghc.isGhcjs or false);

# The headless browser run as part of the tests will exit without this
preBuild = (drv.preBuild or "") + ''
Expand Down Expand Up @@ -99,6 +100,7 @@ in
useTemplateHaskellFlag
])) {})
(drv: {
doCheck = false;
# Hack until https://github.com/NixOS/cabal2nix/pull/432 lands
libraryHaskellDepends = (drv.libraryHaskellDepends or [])
++ stdenv.lib.optionals (with stdenv.hostPlatform; isAndroid && is32bit) [
Expand Down
2 changes: 1 addition & 1 deletion haskell-overlays/reflex-packages/dep/reflex-dom/thunk.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ let fetch = { private ? false, fetchSubmodules ? false, owner, repo, rev, sha256
inherit owner repo rev sha256 fetchSubmodules private;
};
json = builtins.fromJSON (builtins.readFile ./github.json);
in fetch json
in fetch json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/libraries/bytestring/Data/ByteString/Builder/Prim/Internal.hs b/libraries/bytestring/Data/ByteString/Builder/Prim/Internal.hs
index fb52404..572b4b7 100644
--- a/libraries/bytestring/Data/ByteString/Builder/Prim/Internal.hs
+++ b/libraries/bytestring/Data/ByteString/Builder/Prim/Internal.hs
@@ -198,7 +198,19 @@ liftFixedToBounded = toB

{-# INLINE CONLIKE storableToF #-}
storableToF :: forall a. Storable a => FixedPrim a
+-- Not all architectures are forgiving of unaligned accesses; whitelist ones
+-- which are known not to trap (either to the kernel for emulation, or crash).
+#if defined(i386_HOST_ARCH) || defined(x86_64_HOST_ARCH) \
+ || ((defined(arm_HOST_ARCH) || defined(aarch64_HOST_ARCH)) \
+ && defined(__ARM_FEATURE_UNALIGNED)) \
+ || defined(powerpc_HOST_ARCH) || defined(powerpc64_HOST_ARCH) \
+ || defined(powerpc64le_HOST_ARCH)
storableToF = FP (sizeOf (undefined :: a)) (\x op -> poke (castPtr op) x)
+#else
+storableToF = FP (sizeOf (undefined :: a)) $ \x op ->
+ if ptrToWordPtr op `mod` fromIntegral (alignment (undefined :: a)) == 0 then poke (castPtr op) x
+ else with x $ \tp -> copyBytes op (castPtr tp) (sizeOf (undefined :: a))
+#endif

{-
{-# INLINE CONLIKE liftIOF #-}
23 changes: 19 additions & 4 deletions nixpkgs-overlays/mobile-ghc/default.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
{ lib }:
self: super: {
let
versionWildcard = versionList: let
versionListInc = lib.init versionList ++ [ (lib.last versionList + 1) ];
bottom = lib.concatStringsSep "." (map toString versionList);
top = lib.concatStringsSep "." (map toString versionListInc);
in version: lib.versionOlder version top && lib.versionAtLeast version bottom;
in self: super: {
haskell = super.haskell // {
compiler = super.haskell.compiler // lib.mapAttrs (n: v: v.overrideAttrs (drv: {
patches = (drv.patches or []) ++ lib.optionals self.stdenv.targetPlatform.useAndroidPrebuilt [
./8.6.y/android-patches/force-relocation.patch
];
patches = let
isAndroid = self.stdenv.targetPlatform.useAndroidPrebuilt;
isGhc86x = versionWildcard [ 8 6 ] v.version;
in
(drv.patches or []) ++
lib.optionals isAndroid [
./8.6.y/android-patches/force-relocation.patch
] ++
lib.optionals (isAndroid && isGhc86x) [
./8.6.y/android-patches/strict-align.patch
];
})) { inherit (super.haskell.compiler) ghc865 ghcSplices-8_6 ghc8107 ghcSplices-8_10; };
};
}