[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/RUBY PATCH 05/16] core: Build core functionality



From: Andrei Gogonea <andrei.gogonea09@xxxxxxxxx>

With these changes we only build the Ruby interpreter. In the following patches
we will add Ruby extensions and encodings as well. The original Ruby build
provides what is called 'miniruby' - the minimalistic variant of the Ruby
intepretor and which doesn't have any extensions. We used the same idea to
provide a minimalistic version for Unikraft when the mini configuration is
checked via menuconfig.

Signed-off-by: Andrei Gogonea <andrei.gogonea09@xxxxxxxxx>
Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
---
 Config.uk          |  16 +++-
 Makefile.uk        | 184 +++++++++++++++++++++++++++++++++++++++++++++
 include/stdalign.h |  10 +++
 3 files changed, 209 insertions(+), 1 deletion(-)
 create mode 100644 Makefile.uk
 create mode 100644 include/stdalign.h

diff --git a/Config.uk b/Config.uk
index a11be34..dd83267 100644
--- a/Config.uk
+++ b/Config.uk
@@ -1,10 +1,24 @@
 menuconfig LIBRUBY
        bool "Ruby"
        default n
-       select LIBNOLIBC if !HAVE_LIBC
        select LIBUKDEBUG
        select LIBUKALLOC
        select LIBUKSCHED
+       select LIBVFSCORE
+       select LIBSYSCALL_SHIM
+       select LIBUKMMAP
+       select UKSYSINFO
+       select LIBPOSIX_LIBDL
+       select LIBNEWLIBC
+       select LIBCOMPILER_RT
+       select LIBUNWIND
+       select LIBCXX
+       select CXX_THREADS
+       select LIBPTHREAD_EMBEDDED
+       select LIBLWIP
 
 if LIBRUBY
+config LIBRUBY_MINI
+       bool "Mini configuration"
+       default n
 endif
diff --git a/Makefile.uk b/Makefile.uk
new file mode 100644
index 0000000..98e738f
--- /dev/null
+++ b/Makefile.uk
@@ -0,0 +1,184 @@
+#  SPDX-License-Identifier: BSD-3-Clause
+#
+#  Ruby Makefile.uk
+#
+#  Authors: Andrei Gogonea <andrei.gogonea09@xxxxxxxxx>
+#           Costin Lupu <costin.lupu@xxxxxxxxx>
+#
+#  Copyright (c) 2019, University Politehnica of Bucharest. All rights 
reserved.
+#
+#  Redistribution and use in source and binary forms, with or without
+#  modification, are permitted provided that the following conditions
+#  are met:
+#
+#  1. Redistributions of source code must retain the above copyright
+#     notice, this list of conditions and the following disclaimer.
+#  2. Redistributions in binary form must reproduce the above copyright
+#     notice, this list of conditions and the following disclaimer in the
+#     documentation and/or other materials provided with the distribution.
+#  3. Neither the name of the copyright holder nor the names of its
+#     contributors may be used to endorse or promote products derived from
+#     this software without specific prior written permission.
+#
+#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+#  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+#  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+#  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+#  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+#  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+#  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+#  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+#  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+#  POSSIBILITY OF SUCH DAMAGE.
+#
+#  THIS HEADER MAY NOT BE EXTRACTED OR MODIFIED IN ANY WAY.
+#
+
+################################################################################
+# Library registration
+################################################################################
+$(eval $(call addlib_s,libruby,$(CONFIG_LIBRUBY)))
+
+################################################################################
+# Sources
+################################################################################
+LIBRUBY_VERSION=2_6
+LIBRUBY_ARCHIVE=ruby_$(LIBRUBY_VERSION).zip
+LIBRUBY_URL=https://github.com/ruby/ruby/archive/$(LIBRUBY_ARCHIVE)
+LIBRUBY_DIR=ruby-ruby_$(LIBRUBY_VERSION)
+LIBRUBY_PATCHDIR=$(LIBRUBY_BASE)/patches
+$(eval $(call fetch,libruby,$(LIBRUBY_URL),ruby_$(LIBRUBY_ARCHIVE)))
+$(eval $(call patch,libruby,$(LIBRUBY_PATCHDIR),$(LIBRUBY_DIR)))
+
+################################################################################
+# Global and common flags
+################################################################################
+# Suppress flags
+LIBRUBY_SUPPRESS_FLAGS = -Wno-cast-function-type -Wno-long-long \
+       -Wno-missing-field-initializers -Wno-overlength-strings \
+       -Wno-packed-bitfield-compat -Wno-tautological-compare \
+       -Wno-unused-parameter -Wno-unused-value -Wno-implicit-fallthrough \
+       -Wno-unused-but-set-variable
+LIBRUBY_SUPRESS_CFLAGS-y   += $(LIBRUBY_SUPPRESS_FLAGS) \
+       -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast
+LIBRUBY_SUPRESS_CXXFLAGS-y += $(LIBRUBY_SUPPRESS_FLAGS)
+LIBRUBY_CFLAGS-y           += $(LIBRUBY_SUPRESS_CFLAGS-y)
+LIBRUBY_CXXFLAGS-y         += $(LIBRUBY_SUPRESS_CXXFLAGS-y)
+
+################################################################################
+# Helpers
+################################################################################
+LIBRUBY_SRC=$(LIBRUBY_ORIGIN)/$(LIBRUBY_DIR)
+
+################################################################################
+# Global and common includes
+################################################################################
+LIBRUBY_CINCLUDES-y += -I$(LIBRUBY_BASE)/include \
+       -I$(LIBRUBY_BASE)/generated \
+       -I$(LIBRUBY_SRC) \
+       -I$(LIBRUBY_SRC)/include \
+       -I$(LIBRUBY_SRC)/enc/unicode/12.1.0
+
+################################################################################
+# Core
+################################################################################
+# As taken from original build:
+LIBRUBY_CFLAGS-y += -std=gnu99 -D_FORTIFY_SOURCE=2 \
+        -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard \
+       -DRUBY_EXPORT -DCANONICALIZATION_FOR_MATHN
+
+ifeq ($(CONFIG_LIBRUBY_MINI),y)
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dmydln.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/miniinit.c
+LIBRUBY_SRCS-y += $(LIBRUBY_BASE)/generated/miniprelude.c
+else
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dln.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/localeinit.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/loadpath.c
+LIBRUBY_SRCS-y += $(LIBRUBY_BASE)/generated/prelude.c
+endif
+
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/main.c
+LIBRUBY_MAIN_FLAGS-y += -Dmain=ruby_main
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/array.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/ast.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/bignum.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/class.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/compar.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/compile.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/complex.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/cont.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/debug.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/debug_counter.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dir.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dln_find.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/encoding.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enum.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enumerator.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/error.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/eval.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/file.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/gc.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/hash.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/inits.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/io.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/iseq.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/load.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/marshal.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/math.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/mjit.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/mjit_compile.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/node.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/numeric.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/object.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/pack.c
+LIBRUBY_SRCS-y += $(LIBRUBY_BASE)/generated/parse.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/proc.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/process.c
+LIBRUBY_PROCESS_FLAGS-y += -Wno-incompatible-pointer-types
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/random.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/range.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/rational.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/re.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regcomp.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regenc.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regerror.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regexec.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regparse.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/regsyntax.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/ruby.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/safe.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/signal.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/sprintf.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/st.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/strftime.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/string.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/struct.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/symbol.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/thread.c
+LIBRUBY_THREAD_FLAGS += -Wno-unused-function
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/time.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/transcode.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/transient_heap.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/util.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/variable.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/version.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/vm.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/vm_backtrace.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/vm_dump.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/vm_trace.c
+LIBRUBY_SRCS-$(CONFIG_ARCH_X86_64) += $(LIBRUBY_SRC)/coroutine/amd64/Context.S
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enc/ascii.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enc/us_ascii.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enc/unicode.c
+LIBRUBY_UNICODE_FLAGS-y += -I$(LIBRUBY_BASE)/generated/enc/unicode/12.1.0/
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/enc/utf_8.c
+LIBRUBY_SRCS-y += $(LIBRUBY_BASE)/generated/enc/trans/newline.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/./missing/setproctitle.c
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/addr2line.c
+
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dmyext.c
+
+LIBRUBY_SRCS-y += $(LIBRUBY_SRC)/dmyenc.c
+
diff --git a/include/stdalign.h b/include/stdalign.h
new file mode 100644
index 0000000..80c3e15
--- /dev/null
+++ b/include/stdalign.h
@@ -0,0 +1,10 @@
+#ifndef _STDALIGN_H
+#define _STDALIGN_H
+
+#define alignas _Alignas
+#define alignof _Alignof
+
+#define __alignas_is_defined 1
+#define __alignof_is_defined 1
+
+#endif
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.