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

[Minios-devel] [UNIKRAFT/RUBY PATCH v3 4/6] Makefile.uk: Add rule for creating root filesystem



The Ruby interpreter needs a filesystem where to keep its libraries. This patch
creates a root filesystem and installs the Ruby libraries in `/lib/ruby/2.6.0/`
directory. For creating the filesystem the following command has to be run:

$ make ruby-rootfs path=<directory>

Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx>
Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@xxxxxxxxx>
---
 Makefile.uk               | 29 +++++++++++++++++++++++++++++
 gems-examples/Gemfile-irb |  8 ++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 gems-examples/Gemfile-irb

diff --git a/Makefile.uk b/Makefile.uk
index ef258be..9abef23 100644
--- a/Makefile.uk
+++ b/Makefile.uk
@@ -50,6 +50,7 @@ LIBRUBY_MAJOR=2
 LIBRUBY_MINOR=6
 LIBRUBY_REVISION=0
 LIBRUBY_VERSION=$(LIBRUBY_MAJOR)_$(LIBRUBY_MINOR)
+LIBRUBY_VERSION_LONG=$(LIBRUBY_MAJOR).$(LIBRUBY_MINOR).$(LIBRUBY_REVISION)
 LIBRUBY_ARCHIVE=ruby_$(LIBRUBY_VERSION).zip
 LIBRUBY_URL=https://github.com/ruby/ruby/archive/$(LIBRUBY_ARCHIVE)
 LIBRUBY_DIR=ruby-ruby_$(LIBRUBY_VERSION)
@@ -604,3 +605,31 @@ $(LIBRUBY_TEST_BUILD)/.prepared: 
$(LIBRUBY_TEST_PREPARED_DEPS)
 UK_PREPARE += $(LIBRUBY_TEST_BUILD)/.prepared
 endif
 
+################################################################################
+# Root filesystem
+################################################################################
+# Root filesystem path
+RUBY_ROOTFS = $(APP_BASE)/$(path)
+
+# Configure origin
+$(RUBY_ROOTFS)/.configured: $(LIBRUBY_BUILD)/.origin
+       mkdir -p $(RUBY_ROOTFS) &>/dev/null
+       cd $(LIBRUBY_SRC) && \
+               autoconf && \
+               ./configure --prefix=$(shell realpath $(APP_BASE)/$(path)) 
$(LIBRUBY_CONFIGURE_COMMON_PARAMS) && \
+               touch $@ && touch $(LIBRUBY_BUILD)/.configured
+
+# Build Ruby
+$(RUBY_ROOTFS)/.build: $(RUBY_ROOTFS)/.configured
+       cd $(LIBRUBY_SRC) && make -j$(JOBS) && touch $@ && touch 
$(LIBRUBY_BUILD)/.build
+
+# Install Ruby
+$(RUBY_ROOTFS)/.done: $(RUBY_ROOTFS)/.build
+       cd $(LIBRUBY_SRC) && make install
+       cp -r $(LIBRUBY_SRC)/.ext 
$(RUBY_ROOTFS)/lib/ruby/$(LIBRUBY_VERSION_LONG)/
+       cp -r $(LIBRUBY_SRC)/test 
$(RUBY_ROOTFS)/lib/ruby/$(LIBRUBY_VERSION_LONG)/
+       cp $(LIBRUBY_BASE)/gems-examples/Gemfile-irb 
$(RUBY_ROOTFS)/lib/ruby/$(LIBRUBY_VERSION_LONG)/Gemfile
+       touch $@
+
+.PHONY: ruby-rootfs
+ruby-rootfs: $(RUBY_ROOTFS)/.done
diff --git a/gems-examples/Gemfile-irb b/gems-examples/Gemfile-irb
new file mode 100644
index 0000000..1ac39d0
--- /dev/null
+++ b/gems-examples/Gemfile-irb
@@ -0,0 +1,8 @@
+# frozen_string_literal: true
+
+source "https://rubygems.org";
+
+git_source(:github) {|repo_name| "https://github.com/#{repo_name}"; }
+
+# gem "rails"
+gem 'irb', require: false
-- 
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®.