-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfix-later.patch
65 lines (64 loc) · 2.05 KB
/
fix-later.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index 46cf6ef708c7..0727d0e6b767 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -1798,6 +1798,10 @@ let
NIX_LDFLAGS = "-lfribidi -lharfbuzz";
});
+ later = old.later.overrideAttrs (attrs: {
+ patches = [ ./patches/fix-later.patch ];
+ });
+
httpuv = old.httpuv.overrideAttrs (_: {
preConfigure = ''
patchShebangs configure
diff --git a/pkgs/development/r-modules/patches/fix-later.patch b/pkgs/development/r-modules/patches/fix-later.patch
new file mode 100644
index 000000000000..f05fbb665de8
--- /dev/null
+++ b/pkgs/development/r-modules/patches/fix-later.patch
@@ -0,0 +1,44 @@
+diff --git a/configure b/configure
+index aa9a93f..9a9c7ef 100755
+--- a/configure
++++ b/configure
+@@ -5,19 +5,26 @@ echo "Running configure script"
+ # Find compiler
+ CC=`"${R_HOME}"/bin/R CMD config CC`
+
+-# Detect whether -latomic is needed during linking. This is needed on some
+-# platforms, notably ARM (Raspberry Pi).
+-echo "#include <stdint.h>
+-uint64_t v;
+-int main() {
+- return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
+-}" | ${CC} -x c - -o /dev/null > /dev/null 2>&1
+-
+-if [ $? -eq 0 ]; then
+- echo "-latomic linker flag not needed."
+-else
+- echo "-latomic linker flag needed."
+- EXTRA_PKG_LIBS=-latomic
++# Detect platform and architecture
++OS=$(uname -s)
++ARCH=$(uname -m)
++
++# Check if the platform is Linux and the architecture is ARM64
++if [ "$OS" = "Linux" ] && [ "$ARCH" = "arm64" ]; then
++ # Detect whether -latomic is needed during linking. This is needed on some
++ # ARM platforms, notably Raspberry Pi.
++ echo "#include <stdint.h>
++ uint64_t v;
++ int main() {
++ return (int)__atomic_load_n(&v, __ATOMIC_ACQUIRE);
++ }" | ${CC} -x c - -o /dev/null > /dev/null 2>&1
++
++ if [ $? -eq 0 ]; then
++ echo "-latomic linker flag not needed."
++ else
++ echo "-latomic linker flag needed."
++ EXTRA_PKG_LIBS="-latomic"
++ fi
+ fi
+
+ case "$CC" in