]> xenbits.xensource.com Git - unikraft/libs/ruby.git/commitdiff
Makefile.uk: Add rule for creating root filesystem
authorCostin Lupu <costin.lupu@cs.pub.ro>
Mon, 16 Dec 2019 13:47:51 +0000 (15:47 +0200)
committerCostin Lupu <costin.lupu@cs.pub.ro>
Mon, 16 Dec 2019 13:54:35 +0000 (15:54 +0200)
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@cs.pub.ro>
Reviewed-by: Stefan Teodorescu <stefanl.teodorescu@gmail.com>
Makefile.uk
gems-examples/Gemfile-irb [new file with mode: 0644]

index ef258bec4471b1156821ddf43a3130477eccb43f..9abef23a31e2607abf7961bce8eb6f032bdfe4ef 100644 (file)
@@ -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 (file)
index 0000000..1ac39d0
--- /dev/null
@@ -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