|
| 1 | +ARCH_LIBDIR ?= /lib/$(shell $(CC) -dumpmachine) |
| 2 | +ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) |
| 3 | + |
| 4 | +ifeq ($(DEBUG),1) |
| 5 | +GRAMINE_LOG_LEVEL = debug |
| 6 | +else |
| 7 | +GRAMINE_LOG_LEVEL = error |
| 8 | +endif |
| 9 | + |
| 10 | +CURL_SRC = curl-src |
| 11 | +CURL_INS = curl-ins |
| 12 | + |
| 13 | +OPENSSL_SRC = openssl-src |
| 14 | +OPENSSL_INS = openssl-ins |
| 15 | + |
| 16 | +NGTCP2_SRC = ngtcp2-src |
| 17 | +NGTCP2_INS = ngtcp2-ins |
| 18 | + |
| 19 | +NGHTTP3_SRC = nghttp3-src |
| 20 | +NGHTTP3_INS = nghttp3-ins |
| 21 | + |
| 22 | +NGHTTP2_SRC = nghttp2-src |
| 23 | +NGHTTP2_INS = nghttp2-ins |
| 24 | + |
| 25 | +JANSSON_SRC = jansson-src |
| 26 | +JANSSON_INS = jansson-ins |
| 27 | + |
| 28 | +EUROSYS_EXP_DOWNLOAD_SIZE ?= 1G |
| 29 | + |
| 30 | +.PHONY: all |
| 31 | +all: curl curl.manifest nghttpx |
| 32 | +ifeq ($(SGX),1) |
| 33 | +all: curl.manifest.sgx curl.sig curl.token nghttpx |
| 34 | +endif |
| 35 | + |
| 36 | +curl.manifest: curl.manifest.template |
| 37 | + gramine-manifest \ |
| 38 | + -Dlog_level=$(GRAMINE_LOG_LEVEL) \ |
| 39 | + -Darch_libdir=$(ARCH_LIBDIR) \ |
| 40 | + -Dlibcurl_dir=$(ROOT_DIR)/$(CURL_INS)/lib/ \ |
| 41 | + -Dlibssl_dir=$(ROOT_DIR)/$(OPENSSL_INS)/lib64/ \ |
| 42 | + -Dlibnghttp3_dir=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/ \ |
| 43 | + -Dlibngtcp2_dir=$(ROOT_DIR)/$(NGTCP2_INS)/lib/ \ |
| 44 | + $< > $@ |
| 45 | + |
| 46 | +curl.manifest.sgx curl.sig: sgx_sign |
| 47 | + @: |
| 48 | + |
| 49 | +.INTERMEDIATE: sgx_sign |
| 50 | +sgx_sign: curl.manifest curl |
| 51 | + gramine-sgx-sign \ |
| 52 | + --manifest $< \ |
| 53 | + --output $<.sgx |
| 54 | + |
| 55 | +curl.token: curl.sig |
| 56 | + gramine-sgx-get-token \ |
| 57 | + --output curl.token --sig curl.sig |
| 58 | + |
| 59 | +$(OPENSSL_INS)/lib64/: |
| 60 | + git clone --depth 1 -b openssl-3.0.9+quic \ |
| 61 | + https://github.com/quictls/openssl $(OPENSSL_SRC) && \ |
| 62 | + cd $(OPENSSL_SRC) && ./config enable-tls1_3 \ |
| 63 | + --prefix=$(ROOT_DIR)/$(OPENSSL_INS) && make install |
| 64 | + |
| 65 | +$(NGHTTP3_INS)/lib: |
| 66 | + git clone -b v0.12.0 https://github.com/ngtcp2/nghttp3 $(NGHTTP3_SRC) && \ |
| 67 | + cd $(NGHTTP3_SRC) && autoreconf -i && ./configure --prefix=$(ROOT_DIR)/$(NGHTTP3_INS) --enable-lib-only && \ |
| 68 | + make install |
| 69 | + |
| 70 | +$(NGTCP2_INS)/lib: $(OPENSSL_INS)/lib64/ $(NGHTTP3_INS)/lib |
| 71 | + git clone -b v0.16.0 https://github.com/ngtcp2/ngtcp2 $(NGTCP2_SRC) && \ |
| 72 | + cd $(NGTCP2_SRC) && autoreconf -i && \ |
| 73 | + PKG_CONFIG_PATH=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/pkgconfig:$(ROOT_DIR)/$(OPENSSL_INS)/lib64/pkgconfig \ |
| 74 | + LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \ |
| 75 | + ./configure --prefix=$(ROOT_DIR)/$(NGTCP2_INS) --enable-lib-only && \ |
| 76 | + make install |
| 77 | + |
| 78 | +$(CURL_INS)/bin/curl: $(NGTCP2_INS)/lib |
| 79 | + git clone https://github.com/curl/curl $(CURL_SRC) && \ |
| 80 | + cd $(CURL_SRC) && git checkout 1eca27f && \ |
| 81 | + autoreconf -fi && LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \ |
| 82 | + ./configure --with-openssl=$(ROOT_DIR)/$(OPENSSL_INS) \ |
| 83 | + --with-nghttp3=$(ROOT_DIR)/$(NGHTTP3_INS) --with-ngtcp2=$(ROOT_DIR)/$(NGTCP2_INS) \ |
| 84 | + --prefix=$(ROOT_DIR)/$(CURL_INS) && \ |
| 85 | + make install |
| 86 | + |
| 87 | +$(JANSSON_INS)/lib: |
| 88 | + git clone https://github.com/akheron/jansson.git $(JANSSON_SRC) && \ |
| 89 | + cd $(JANSSON_SRC) && git checkout 2.10 && \ |
| 90 | + mkdir build && cd build && cmake ../ -DCMAKE_INSTALL_PREFIX=$(ROOT_DIR)/$(JANSSON_INS) && \ |
| 91 | + make install |
| 92 | + |
| 93 | +$(NGHTTP2_INS)/bin/nghttpx: $(NGTCP2_INS)/lib $(JANSSON_INS)/lib |
| 94 | + git clone https://github.com/nghttp2/nghttp2.git $(NGHTTP2_SRC) && \ |
| 95 | + cd $(NGHTTP2_SRC) && git checkout e7f5940 && \ |
| 96 | + autoreconf -fi && \ |
| 97 | + PKG_CONFIG_PATH=$(ROOT_DIR)/$(NGHTTP3_INS)/lib/pkgconfig:$(ROOT_DIR)/$(OPENSSL_INS)/lib64/pkgconfig:$(ROOT_DIR)/$(JANSSON_INS)/lib/pkgconfig:$(ROOT_DIR)/$(NGTCP2_INS)/lib/pkgconfig \ |
| 98 | + LDFLAGS="-Wl,-rpath,$(ROOT_DIR)/$(OPENSSL_INS)/lib64" \ |
| 99 | + CFLAGS=-I$(ROOT_DIR)/$(OPENSSL_INS)/include \ |
| 100 | + ./configure --enable-maintainer-mode --prefix=$(ROOT_DIR)/$(NGHTTP2_INS) \ |
| 101 | + --disable-shared --enable-app --enable-http3 --without-jemalloc \ |
| 102 | + --without-libxml2 --without-systemd && \ |
| 103 | + make install |
| 104 | + |
| 105 | +curl: $(CURL_INS)/bin/curl |
| 106 | + cp $< $@ |
| 107 | + touch out |
| 108 | + |
| 109 | +nghttpx: $(NGHTTP2_INS)/bin/nghttpx |
| 110 | + cp $< $@ |
| 111 | + |
| 112 | +.PHONY: clean |
| 113 | +clean: |
| 114 | + $(RM) *.token *.sig *.manifest.sgx *.manifest curl .lck nghttpx out |
| 115 | + |
| 116 | +.PHONY: distclean |
| 117 | +distclean: clean |
| 118 | + $(RM) -r $(CURL_SRC) $(CURL_INS) \ |
| 119 | + $(OPENSSL_SRC) $(OPENSSL_INS) $(NGTCP2_SRC) \ |
| 120 | + $(NGTCP2_INS) $(NGHTTP3_SRC) $(NGHTTP3_INS) \ |
| 121 | + $(NGHTTP2_SRC) $(NGHTTP2_INS) $(JANSSON_SRC) $(JANSSON_INS) |
| 122 | + |
| 123 | + |
| 124 | +eurosys-reproduce-curl-%-sgx: export SGX := 1 |
| 125 | + |
| 126 | +eurosys-reproduce-curl-gramine-%: export PATH := $(HOME)/.local/gramine/bin:$(PATH) |
| 127 | +eurosys-reproduce-curl-gramine-%: export PYTHONPATH := $(HOME)/.local/gramine/lib/python3.10/site-packages:$(PYTHONPATH) |
| 128 | +eurosys-reproduce-curl-gramine-%: export PKG_CONFIG_PATH := $(HOME)/.local/gramine/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH) |
| 129 | +eurosys-reproduce-curl-gramine-%: export SETTING := Gramine |
| 130 | + |
| 131 | +eurosys-reproduce-curl-rakis-%: export PATH := $(HOME)/.local/rakis/bin:$(PATH) |
| 132 | +eurosys-reproduce-curl-rakis-%: export PYTHONPATH := $(HOME)/.local/rakis/lib/python3.10/site-packages:$(PYTHONPATH) |
| 133 | +eurosys-reproduce-curl-rakis-%: export PKG_CONFIG_PATH := $(HOME)/.local/rakis/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH) |
| 134 | +eurosys-reproduce-curl-rakis-%: export SETTING := Rakis |
| 135 | + |
| 136 | +eurosys-reproduce-curl-native: export NATIVE := 1 |
| 137 | +eurosys-reproduce-curl-native: export PATH := $(HOME)/.local/rakis/bin:$(PATH) |
| 138 | +eurosys-reproduce-curl-native: export PYTHONPATH := $(HOME)/.local/rakis/lib/python3.10/site-packages:$(PYTHONPATH) |
| 139 | +eurosys-reproduce-curl-native: export PKG_CONFIG_PATH := $(HOME)/.local/rakis/lib/x86_64-linux-gnu/pkgconfig:$(PKG_CONFIG_PATH) |
| 140 | + |
| 141 | +eurosys-reproduce-curl-%: clean |
| 142 | + $(MAKE) eurosys-reproduce-run-curl |
| 143 | + |
| 144 | +eurosys-reproduce-run-curl: all |
| 145 | +ifeq ($(NATIVE),1) |
| 146 | + @echo "\n******************************************" |
| 147 | + @echo "[*] Running curl in NATIVE setting..." |
| 148 | + ./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z |
| 149 | + |
| 150 | +else ifeq ($(SGX),1) |
| 151 | + @echo "\n******************************************" |
| 152 | + @echo "[*] Running Curl in $(SETTING)-SGX setting..." |
| 153 | + gramine-sgx ./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z |
| 154 | + |
| 155 | +else |
| 156 | + @echo "\n******************************************" |
| 157 | + @echo "[*] Running Curl in $(SETTING)-Direct setting..." |
| 158 | + gramine-direct ./curl --http3-only https://10.50.0.2:9443/dump$(EUROSYS_EXP_DOWNLOAD_SIZE) --insecure -o out -w "@curl-format.txt" -Z |
| 159 | +endif |
0 commit comments