1
0
Fork 0
mirror of https://github.com/tailix/mrubyvisor.git synced 2024-11-11 13:50:47 -05:00

Build vendored dependencies

This commit is contained in:
Alex Kotov 2022-11-27 15:21:26 +04:00
parent 4c223012a8
commit 22d983f1fe
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
4 changed files with 63 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
/build_config.rb.lock
/dest/*
!/dest/.keep

33
Makefile Normal file
View file

@ -0,0 +1,33 @@
.PHONY: clean
CCPREFIX = /home/kotovalexarian/repos/global/tailix/cross/root/bin/x86_64-elf-
AR = $(CCPREFIX)ar
AS = $(CCPREFIX)as
CC = $(CCPREFIX)gcc
LD = $(CCPREFIX)ld
RANLIB = $(CCPREFIX)ranlib
RAKE = rake
ROOT = $(shell pwd)
DEST = $(ROOT)/dest
MRUBY_CONFIG = $(ROOT)/build_config.rb
MRUBY_NAME = mrubyvisor
clean:
rm -rf $(DEST)/*
dest/lib/libkernaux.a:
cd vendor/libkernaux && ./autogen.sh
cd vendor/libkernaux && ./configure --host='x86_64-elf' --prefix='$(DEST)' --enable-freestanding --with-drivers --with-libc AR='$(AR)' AS='$(AS)' CC='$(CC)' LD='$(LD)' RANLIB='$(RANLIB)'
cd vendor/libkernaux && make
cd vendor/libkernaux && make install
dest/lib/libmruby.a: dest/lib/libkernaux.a
cd vendor/mruby && $(RAKE) MRUBY_CONFIG='$(MRUBY_CONFIG)' CROSS_AR='$(AR)' CROSS_CC='$(CC)' CROSS_LD='$(LD)'
mkdir -p $(DEST)/include $(DEST)/lib
cp vendor/mruby/build/$(MRUBY_NAME)/lib/libmruby.a $(DEST)/lib
cp -r vendor/mruby/include/* $(DEST)/include
cp -r vendor/mruby/build/$(MRUBY_NAME)/include/* $(DEST)/include

26
build_config.rb Normal file
View file

@ -0,0 +1,26 @@
ROOT_DIR = File.expand_path(__dir__).freeze
DEST_DIR = File.join(ROOT_DIR, 'dest').freeze
MRuby::CrossBuild.new 'mrubyvisor' do |conf|
conf.toolchain :gcc
conf.cc.defines <<
'MRB_NO_BOXING' <<
'MRB_NO_FLOAT' <<
'MRB_NO_STDIO'
conf.cc.flags <<
'-Wall' <<
'-Wextra' <<
'-ffreestanding' <<
'-nostdlib' <<
'-fno-pic' <<
'-fno-stack-protector'
conf.cc.include_paths << File.join(DEST_DIR, 'include')
conf.linker.library_paths << File.join(DEST_DIR, 'lib')
conf.archiver.command = ENV['CROSS_AR']
conf.cc.command = ENV['CROSS_CC']
conf.linker.command = ENV['CROSS_LD']
end

0
dest/.keep Normal file
View file