From 0f3f814945690cf03578698616e82c992b47f2af Mon Sep 17 00:00:00 2001 From: Dante Catalfamo Date: Fri, 20 Aug 2021 00:38:31 -0400 Subject: [PATCH] Ports: Add port for mruby --- Ports/AvailablePorts.md | 1 + Ports/mruby/package.sh | 25 +++++++++++++++++++ .../mruby/patches/include-sys-select-h.patch | 10 ++++++++ Ports/mruby/patches/serenity-build-conf.patch | 19 ++++++++++++++ 4 files changed, 55 insertions(+) create mode 100755 Ports/mruby/package.sh create mode 100644 Ports/mruby/patches/include-sys-select-h.patch create mode 100644 Ports/mruby/patches/serenity-build-conf.patch diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 61a3fb29623..fa2ba381f94 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -97,6 +97,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^ | [`milkytracker`](milkytracker/) | milkytracker | 1.03.00 | https://github.com/milkytracker/MilkyTracker | | [`mpc`](mpc/) | GNU Multiple Precision Complex Library (MPC) | 1.2.1 | http://www.multiprecision.org/mpc/ | | [`mpfr`](mpfr/) | GNU Multiple Precision Floating-Point Reliable Library (MPFR) | 4.1.0 | https://www.mpfr.org/ | +| [`mruby`](mruby/) | mruby | 3.0.0 | https://mruby.org/ | | [`mrsh`](mrsh/) | mrsh | d9763a3 | https://mrsh.sh/ | | [`mysthous`](mysthous/) | Hi-Res Adventure #1: Mystery House | 1.0 | https://www.scummvm.org/games/#games-hires1 | | [`nano`](nano/) | GNU nano | 5.8 | https://www.nano-editor.org/ | diff --git a/Ports/mruby/package.sh b/Ports/mruby/package.sh new file mode 100755 index 00000000000..934ce27bfdb --- /dev/null +++ b/Ports/mruby/package.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port=mruby +version=3.0.0 +files="https://github.com/mruby/mruby/archive/refs/tags/${version}.tar.gz mruby-${version}.tar.gz 95b798cdd931ef29d388e2b0b267cba4dc469e8722c37d4ef8ee5248bc9075b0" +auth_type="sha256" + +build_config="serenity" +build_dir="build/${build_config}" + +build() { + unset CC + unset AR + unset LD + unset CXX + export MRUBY_CONFIG="$build_config" + run rake +} + +install() { + run cp "${build_dir}/bin/mirb" "${SERENITY_INSTALL_ROOT}/bin/" + run cp "${build_dir}/bin/mrbc" "${SERENITY_INSTALL_ROOT}/bin/" + run cp "${build_dir}/bin/mruby" "${SERENITY_INSTALL_ROOT}/bin/" + run cp "${build_dir}/lib/libmruby.a" "${SERENITY_INSTALL_ROOT}/usr/lib/" + run cp "${build_dir}/lib/libmruby_core.a" "${SERENITY_INSTALL_ROOT}/usr/lib/" +} diff --git a/Ports/mruby/patches/include-sys-select-h.patch b/Ports/mruby/patches/include-sys-select-h.patch new file mode 100644 index 00000000000..2a143a66468 --- /dev/null +++ b/Ports/mruby/patches/include-sys-select-h.patch @@ -0,0 +1,10 @@ +--- mruby-3.0.0/mrbgems/mruby-io/src/io.c 2021-08-20 00:27:04.837317416 -0400 ++++ mruby-3.0.0.serenity/mrbgems/mruby-io/src/io.c 2021-08-20 00:28:51.960390750 -0400 +@@ -49,6 +49,7 @@ + #include + #include + #include ++ #include + typedef size_t fsize_t; + typedef time_t ftime_t; + typedef suseconds_t fsuseconds_t; diff --git a/Ports/mruby/patches/serenity-build-conf.patch b/Ports/mruby/patches/serenity-build-conf.patch new file mode 100644 index 00000000000..5caa4744e7e --- /dev/null +++ b/Ports/mruby/patches/serenity-build-conf.patch @@ -0,0 +1,19 @@ +--- /dev/null 2021-08-20 13:32:02.136545596 -0400 ++++ mruby-3.0.0/build_config/serenity.rb 2021-08-20 14:18:09.673875364 -0400 +@@ -0,0 +1,16 @@ ++MRuby::CrossBuild.new('serenity') do |conf| ++ conf.toolchain :gcc ++ ++ conf.archiver.command = "#{ENV['SERENITY_ARCH']}-pc-serenity-ar" ++ conf.linker.command = "#{ENV['SERENITY_ARCH']}-pc-serenity-g++" ++ ++ conf.cxx.command = "#{ENV['SERENITY_ARCH']}-pc-serenity-g++" ++ conf.cxx.defines << (ENV['SERENITY_ARCH'].include?('64') ? 'MRB_64BIT' : 'MRB_32BIT') ++ ++ conf.cc.command = "#{ENV['SERENITY_ARCH']}-pc-serenity-gcc" ++ conf.cc.defines << (ENV['SERENITY_ARCH'].include?('64') ? 'MRB_64BIT' : 'MRB_32BIT') ++ ++ conf.gembox 'full-core' ++ ++ conf.test_runner.command = 'env' ++end