Merge pull request #41 from matter-labs/gramine-1.7

feat: gramine 1.7
This commit is contained in:
Harald Hoyer 2024-06-14 17:34:00 +02:00 committed by GitHub
commit eba8b34c29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 23 additions and 72 deletions

View file

@ -29,20 +29,20 @@ let
hash = "sha256-dgaHZlq0Glz/nECxBTwZVyvNqt7xGU5cuhteb4JGhuc=";
};
curl-wrap = fetchurl {
url = "https://curl.se/download/curl-8.4.0.tar.gz";
hash = "sha256-gW5BgJwEP/KF6MDwanWh+iUCEbv7LcCgN+7vOfGp5Cc=";
url = "https://curl.se/download/curl-8.7.1.tar.gz";
hash = "sha256-+RJJyH9o6gDPJ8RP36WnhCPkHnG31AjlkBqYltkFxJU=";
};
mbedtls-wrap = fetchurl {
url = "https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.5.0.tar.gz";
hash = "sha256-AjEfyL0DLYn/mu5TXd21VFgQjcDUxSgGOPxhGup8Xko=";
url = "https://github.com/ARMmbed/mbedtls/archive/mbedtls-3.5.2.tar.gz";
hash = "sha256-7t7MRos/jQUu8FqdQr9j8EyKHFDRxalMJRxoE2WixyM=";
};
uthash-wrap = fetchurl {
url = "https://github.com/troydhanson/uthash/archive/v2.1.0.tar.gz";
hash = "sha256-FSzNjmTQ9JU3cjLjlk0Gx+yLuMP70yF/ilcCYU+aZp4=";
};
glibc-wrap = fetchurl {
url = "https://ftp.gnu.org/gnu/glibc/glibc-2.38.tar.gz";
hash = "sha256-FuUeBFXiiPAzgLQ25B1ZJ8YJRavYbQyYUrhL5X3W7V4=";
url = "https://ftp.gnu.org/gnu/glibc/glibc-2.39.tar.gz";
hash = "sha256-l/hPO3WIzVQJOm9jibDBqB5w2ZcI10ljouPqt8fclC0=";
};
python = pkgs.python3;
@ -54,17 +54,18 @@ let
tomli
tomli-w
cryptography
voluptuous
];
in
python.pkgs.buildPythonPackage {
pname = "gramine";
version = "1.6";
version = "1.7";
src = pkgs.fetchFromGitHub {
owner = "gramineproject";
repo = "gramine";
rev = "v1.6";
hash = "sha256-LX7/XqxS8z0PomBDqe53sTTYgaXVmP23GSTJMpXRorM=";
rev = "v1.7";
hash = "sha256-QHgRGIx4jnTh0O3ihJbnuPwTdygJ03zpL2bdqAN9+sA=";
fetchSubmodules = true;
};
@ -80,16 +81,16 @@ python.pkgs.buildPythonPackage {
tar -zxf ${cjson-wrap}
cp -av packagefiles/cJSON/. cJSON-1.7.12
tar -zxf ${curl-wrap}
cp -av packagefiles/curl-8.4.0/. curl-8.4.0
mkdir mbedtls-mbedtls-3.5.0
tar -zxf ${mbedtls-wrap} -C mbedtls-mbedtls-3.5.0
cp -av packagefiles/mbedtls/. mbedtls-mbedtls-3.5.0
cp -av packagefiles/curl-8.7.1/. curl-8.7.1
mkdir mbedtls-mbedtls-3.5.2
tar -zxf ${mbedtls-wrap} -C mbedtls-mbedtls-3.5.2
cp -av packagefiles/mbedtls/. mbedtls-mbedtls-3.5.2
tar -zxf ${uthash-wrap}
cp -av packagefiles/uthash/. uthash-2.1.0
mkdir glibc-2.38-1
tar -zxf ${glibc-wrap} -C glibc-2.38-1
cp -av packagefiles/glibc-2.38/. glibc-2.38-1
sed -i -e 's#set -e#set -ex#g' glibc-2.38-1/compile.sh
mkdir glibc-2.39-1
tar -zxf ${glibc-wrap} -C glibc-2.39-1
cp -av packagefiles/glibc-2.39/. glibc-2.39-1
sed -i -e 's#set -e#set -ex#g' glibc-2.39-1/compile.sh
)'';
postPatch = ''

View file

@ -1,9 +0,0 @@
{ lib
, libuv
}:
libuv.overrideAttrs (prevAttrs: {
separateDebugInfo = false;
patches = (prevAttrs.patches or [ ]) ++ [
./no-eventfd.patch
];
})

View file

@ -1,36 +0,0 @@
diff --git a/src/unix/async.c b/src/unix/async.c
index 0ff2669e..2bb87863 100644
--- a/src/unix/async.c
+++ b/src/unix/async.c
@@ -35,6 +35,13 @@
#include <sched.h> /* sched_yield() */
#ifdef __linux__
+#define HAVE_EVENT_FD
+#endif
+
+// No eventfd for gramine
+#undef HAVE_EVENT_FD
+
+#ifdef HAVE_EVENT_FD
#include <sys/eventfd.h>
#endif
@@ -188,7 +195,7 @@ static void uv__async_send(uv_loop_t* loop) {
len = 1;
fd = loop->async_wfd;
-#if defined(__linux__)
+#if defined(HAVE_EVENT_FD)
if (fd == -1) {
static const uint64_t val = 1;
buf = &val;
@@ -219,7 +226,7 @@ static int uv__async_start(uv_loop_t* loop) {
if (loop->async_io_watcher.fd != -1)
return 0;
-#ifdef __linux__
+#ifdef HAVE_EVENT_FD
err = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
if (err < 0)
return UV__ERR(errno);

View file

@ -1,10 +1,5 @@
args@{ callPackage, lib, overrideCC, pkgs, buildPackages, fetchpatch, openssl, python3, nixsgx, nodejs_18, enableNpm ? false }:
let
callPackage' = p: a: callPackage p (a // { inherit (nixsgx) libuv; });
nodejs_libuv = nodejs_18.override { callPackage = callPackage'; };
nodejs_patched = nodejs_libuv.overrideAttrs (prevAttrs: {
{ nodejs_18, enableNpm ? false }:
nodejs_18.overrideAttrs (prevAttrs: {
inherit enableNpm;
configureFlags = prevAttrs.configureFlags ++ [ "--without-node-snapshot" ];
});
in
nodejs_patched
})