summaryrefslogtreecommitdiff
path: root/Ports
diff options
context:
space:
mode:
authorDante Catalfamo <dante.catalfamo@gmail.com>2021-08-20 00:38:31 -0400
committerAndreas Kling <kling@serenityos.org>2021-08-25 02:22:01 +0200
commit0f3f814945690cf03578698616e82c992b47f2af (patch)
tree4439e1922341b70582e55d1fba9d6ab0ccf32f85 /Ports
parent16ad297078d13d90cd54f272bbe92a8c586b0e96 (diff)
downloadserenity-0f3f814945690cf03578698616e82c992b47f2af.zip
Ports: Add port for mruby
Diffstat (limited to 'Ports')
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/mruby/package.sh25
-rw-r--r--Ports/mruby/patches/include-sys-select-h.patch10
-rw-r--r--Ports/mruby/patches/serenity-build-conf.patch19
4 files changed, 55 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index 61a3fb2962..fa2ba381f9 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 0000000000..934ce27bfd
--- /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 0000000000..2a143a6646
--- /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 <sys/wait.h>
+ #include <sys/time.h>
+ #include <unistd.h>
++ #include <sys/select.h>
+ 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 0000000000..5caa4744e7
--- /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