+
+ifdef CONFIG_CXX_THREADS
+CONFIG_FLAGS
+=
-D __linux__ -D _LIBCPP_HAS_THREAD_API_PTHREAD -D CLOCK_MONOTONIC
+else
+CONFIG_FLAGS
+=
-D _LIBCPP_HAS_NO_THREADS -D _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+endif
+
+LIBCXX_CFLAGS-y += $(CONFIG_FLAGS)
+LIBCXX_CXXFLAGS-y += $(CONFIG_FLAGS)
+
+LIBCXX_SRCS-y += $(LIBCXX_BASE)/glue.c
+################################################################################
+# Library sources
+################################################################################
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/valarray.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/algorithm.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/regex.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/ios.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/system_error.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/typeinfo.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/iostream.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/string.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/locale.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/stdexcept.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/optional.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/strstream.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/memory.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/chrono.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/random.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/variant.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/experimental/memory_resource.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/utility.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/charconv.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/vector.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/bind.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/new.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/thread.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/any.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/shared_mutex.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/functional.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/future.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/exception.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/mutex.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/condition_variable.cpp
+LIBCXX_SRCS-y += $(LIBCXX_SRC)/src/hash.cpp
diff --git a/glue.c b/glue.c
new file mode 100644
index 0000000..f5ec86a
--- /dev/null
+++ b/glue.c
@@ -0,0 +1,19 @@
+#include <nl_types.h>
+
+int catclose(nl_catd catalog)
+{
+ return 0;
+}
+
+nl_catd catopen(const char *name, int flag)
+{
+ return 0;
+}
+
+char *catgets(nl_catd catalog, int set_number, int message_number,
+ const char *message)
+{
+ return 0;
+}
+
+void* __dso_handle = (void*) &__dso_handle;
diff --git a/include/cmath b/include/cmath
new file mode 100644
index 0000000..569dabc
--- /dev/null
+++ b/include/cmath
@@ -0,0 +1,2 @@
+#include <math.h>
+#include_next <cmath>
diff --git a/include/math.h b/include/math.h
new file mode 100644
index 0000000..e300379
--- /dev/null
+++ b/include/math.h
@@ -0,0 +1,59 @@
+extern long double atanl(long double);
+extern long double cosl (long double);
+extern long double sinl(long double);
+extern long double tanl(long double);
+extern long double tanhl(long double);
+extern long double frexpl(long double, int *);
+extern long double modfl(long double, long double *);
+extern long double ceill(long double);
+extern long double fabsl(long double);
+extern long double floorl(long double);
+extern long double log1pl(long double);
+extern long double expm1l(long double);
+extern long double acosl(long double);
+extern long double asinl(long double);
+extern long double atan2l(long double, long double);
+extern long double coshl(long double);
+extern long double sinhl(long double);
+extern long double expl(long double);
+extern long double ldexpl(long double, int);
+extern long double logl(long double);
+extern long double log10l(long double);
+extern long double powl(long double, long double);
+extern long double fmodl(long double, long double);
+extern long double copysignl(long double, long double);
+extern long double nanl(const char *);
+extern int ilogbl(long double);
+extern long double asinhl(long double);
+extern long double cbrtl(long double);
+extern long double nextafterl(long double, long double);
+extern float nexttowardf(float, long double);
+extern double nexttoward(double, long double);
+extern long double nexttowardl(long double, long double);
+extern long double logbl(long double);
+extern long double log2l(long double);
+extern long double rintl(long double);
+extern long double scalbnl(long double, int);
+extern long double exp2l(long double);
+extern long double scalblnl(long double, long);
+extern long double tgammal(long double);
+extern long double nearbyintl(long double);
+extern long int lrintl(long double);
+extern long long int llrintl(long double);
+extern long double roundl(long double);
+extern long lroundl(long double);
+extern long long int llroundl(long double);
+extern long double truncl(long double);
+extern long double remquol(long double, long double, int *);
+extern long double fdiml(long double, long double);
+extern long double fmaxl(long double, long double);
+extern long double fminl(long double, long double);
+extern long double fmal(long double, long double, long double);
+extern long double acoshl(long double);
+extern long double atanhl(long double);
+extern long double remainderl(long double, long double);
+extern long double lgammal(long double);
+extern long double erfl(long double);
+extern long double erfcl(long double);
+
+#include_next <math.h>
diff --git a/include/nl_types.h b/include/nl_types.h
new file mode 100644
index 0000000..4f57f40
--- /dev/null
+++ b/include/nl_types.h
@@ -0,0 +1,30 @@
+// -*- C++ -*-
+//===-------------------- support/android/wchar_support.c ------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _NL_TYPES_H
+#define _NL_TYPES_H 1
+
+#define NL_SETD 1
+#define NL_CAT_LOCALE 1
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void* nl_catd;
+typedef int nl_item;
+nl_catd catopen(const char*, int);
+char* catgets(nl_catd, int, int, const char*);
+int catclose(nl_catd);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+#endif /* nl_types.h */
diff --git a/include/stdlib.h b/include/stdlib.h
new file mode 100644
index 0000000..b5e21ff
--- /dev/null
+++ b/include/stdlib.h
@@ -0,0 +1,10 @@
+#include <xlocale.h>
+//extern long double strtold (const char*, char**);
+//extern long double strtold(char const*, char**);
+extern long double strtold (const char *__restrict, char **__restrict);
+extern long double strtold_l (const char *__restrict, char **__restrict,
+
locale_t);
+
+#include_next <stdlib.h>
+
+
diff --git a/patches/0001-Change-from-long-double-function-to-double.patch b/patches/0001-Change-from-long-double-function-to-double.patch
new file mode 100644
index 0000000..5420f04
--- /dev/null
+++ b/patches/0001-Change-from-long-double-function-to-double.patch
@@ -0,0 +1,40 @@
+From d8d29b3dc00ff53e4813533a4154ce7249c4d415 Mon Sep 17 00:00:00 2001
+From: Vlad-Andrei Badoiu <
vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+Date: Thu, 28 Mar 2019 18:57:17 +0200
+Subject: [PATCH 1/1] Change from long double function to double
+
+Signed-off-by: Vlad-Andrei Badoiu <
vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+---
+ include/locale | 2 +-
+ src/string.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/include/locale b/include/locale
+index e240799..f7a3f09 100644
+--- a/include/locale
++++ b/include/locale
+@@ -817,7 +817,7 @@ double __do_strtod<double>(const char* __a, char** __p2) {
+ template <>
+ inline _LIBCPP_INLINE_VISIBILITY
+ long double __do_strtod<long double>(const char* __a, char** __p2) {
+- return strtold_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
++ return strtod_l(__a, __p2, _LIBCPP_GET_C_LOCALE);
+ }
+
+ template <class _Tp>
+diff --git a/src/string.cpp b/src/string.cpp
+index d7ebdd3..9e7a85c 100644
+--- a/src/string.cpp
++++ b/src/string.cpp
+@@ -217,7 +217,7 @@ inline
+ long double
+ as_float( const string& func, const string& s, size_t* idx )
+ {
+- return as_float_helper<long double>( func, s, idx, strtold );
++ return as_float_helper<long double>( func, s, idx, strtod );
+ }
+
+ template<>
+--
+2.20.1
+
diff --git a/patches/0001-Update-default-config-to-work-with-Unikraft.patch b/patches/0001-Update-default-config-to-work-with-Unikraft.patch
new file mode 100644
index 0000000..ef6e30d
--- /dev/null
+++ b/patches/0001-Update-default-config-to-work-with-Unikraft.patch
@@ -0,0 +1,40 @@
+From fc82b5790a71200eff14098b3eb937f7196834e2 Mon Sep 17 00:00:00 2001
+From: Vlad-Andrei Badoiu <
vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+Date: Thu, 28 Mar 2019 16:15:25 +0200
+Subject: [PATCH 1/1] Update default config to work with Unikraft
+
+Signed-off-by: Vlad-Andrei Badoiu <
vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
+---
+ include/__config | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/include/__config b/include/__config
+index 738d891..df61ab1 100644
+--- a/include/__config
++++ b/include/__config
+@@ -23,6 +23,22 @@
+
+ #ifdef __cplusplus
+
++#include <uk/config.h>
++
++#ifdef CONFIG_CXX_THREADS
++#if !defined(__linux__)
++#define __linux__
++#endif
++#else
++#if !defined(_LIBCPP_HAS_NO_THREADS)
++#define _LIBCPP_HAS_NO_THREADS
++#endif
++#endif
++
++#if !defined(_LIBCPP_BUILDING_LIBRARY)
++#define _LIBCPP_BUILDING_LIBRARY
++#endif
++
+ #ifdef __GNUC__
+ # define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+ // The _GNUC_VER_NEW macro better represents the new GCC versioning scheme