Skip to content

Commit

Permalink
initial patch set
Browse files Browse the repository at this point in the history
  • Loading branch information
angerman committed Jan 17, 2022
0 parents commit 8a0ee66
Show file tree
Hide file tree
Showing 10 changed files with 4,749 additions and 0 deletions.
20 changes: 20 additions & 0 deletions patches/Cabal-3.2.1.0.patch
@@ -0,0 +1,20 @@
diff --git a/Distribution/Simple/GHCJS.hs b/Distribution/Simple/GHCJS.hs
index 4ad5bb18c..5db4d27e7 100644
--- a/Distribution/Simple/GHCJS.hs
+++ b/Distribution/Simple/GHCJS.hs
@@ -317,13 +317,10 @@ checkPackageDbStack :: Verbosity -> PackageDBStack -> IO ()
checkPackageDbStack _ (GlobalPackageDB:rest)
| GlobalPackageDB `notElem` rest = return ()
checkPackageDbStack verbosity rest
- | GlobalPackageDB `notElem` rest =
- die' verbosity $ "With current ghc versions the global package db is always used "
- ++ "and must be listed first. This ghc limitation may be lifted in "
- ++ "future, see http://ghc.haskell.org/trac/ghc/ticket/5977"
-checkPackageDbStack verbosity _ =
+ | GlobalPackageDB `elem` rest =
die' verbosity $ "If the global package db is specified, it must be "
++ "specified first and cannot be specified multiple times"
+checkPackageDbStack _ _ = return ()

getInstalledPackages' :: Verbosity -> [PackageDB] -> ProgramDb
-> IO [(PackageDB, [InstalledPackageInfo])]
19 changes: 19 additions & 0 deletions patches/basement-0.0.12.patch
@@ -0,0 +1,19 @@
diff --git b/basement.cabal a/basement.cabal
index 72125e015..b7670c3ee 100644
--- b/basement.cabal
+++ a/basement.cabal
@@ -160,3 +160,5 @@ library
c-sources: cbits/foundation_mem.c
if impl(ghc < 8.2)
c-sources: cbits/basement_rts.c
+ if os(ghcjs)
+ js-sources: jsbits/basement.js
diff --git b/jsbits/basement.js a/jsbits/basement.js
new file mode 100644
index 000000000..3d9172147
--- /dev/null
+++ a/jsbits/basement.js
@@ -0,0 +1,3 @@
+function h$_foundation_memcmp(s1, o1, off1, s2, o2, off2, n) {
+ h$memcmp(s1, o1 + off2, s2, o2 + off2, n);
+}
42 changes: 42 additions & 0 deletions patches/clock-0.8.2.patch
@@ -0,0 +1,42 @@
diff --git b/clock.cabal a/clock.cabal
index 253033538..8a73b9640 100644
--- b/clock.cabal
+++ a/clock.cabal
@@ -84,6 +84,8 @@ library
if flag(llvm)
ghc-options: -fllvm -optlo-O3

+ if os(ghcjs)
+ js-sources: jsbits/gettime.js

test-suite test
default-language: Haskell2010
diff --git b/jsbits/gettime.js a/jsbits/gettime.js
new file mode 100644
index 000000000..a09f351b9
--- /dev/null
+++ a/jsbits/gettime.js
@@ -0,0 +1,23 @@
+function h$clock_gettime(when, p_d, p_o) {
+ /* XXX: guess if we have to write 64 bit values:
+ alloca is often used and will give us 16 bytes
+ if timespec contains two 64 bit values
+ but we really should fix this by not having hsc2hs values
+ from the build system leak here
+ */
+ var is64 = p_d.i3.length == 4 && p_o == 0;
+ var o = p_o >> 2,
+ t = Date.now ? Date.now() : new Date().getTime(),
+ tf = Math.floor(t / 1000),
+ tn = 1000000 * (t - (1000 * tf));
+ if(is64) {
+ p_d.i3[o] = tf|0;
+ p_d.i3[o+1] = 0;
+ p_d.i3[o+2] = tn|0;
+ p_d.i3[o+3] = 0;
+ } else {
+ p_d.i3[o] = tf|0;
+ p_d.i3[o+1] = tn|0;
+ }
+ return 0;
+}

0 comments on commit 8a0ee66

Please sign in to comment.