diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest-native.bb b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest-native.bb new file mode 100644 index 00000000..8392611f --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest-native.bb @@ -0,0 +1,14 @@ +require ${BPN}.inc + +inherit native + +DEPENDS += " \ + libuv-native \ +" + +SRC_URI += "file://0004-Native-Do-not-build-X11-dependent-zest-libzest.so.patch" + +do_install() { + install -d ${D}${bindir} + install -m 755 ${B}/mruby/build/host/bin/mrbc ${D}${bindir}/mrbc-zest +} diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.bb b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.bb new file mode 100644 index 00000000..49ed698f --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.bb @@ -0,0 +1,58 @@ +require ${BPN}.inc + +REQUIRED_DISTRO_FEATURES = "x11 opengl" + +inherit autotools-brokensep distro_features_check + +SRC_URI += " \ + file://0005-mruby-Use-native-mrbc.patch \ + file://0006-mruby-regexp-pcre-link-against-libpcre.patch \ +" + +DEPENDS += " \ + ${BPN}-native \ + virtual/libx11 \ + virtual/egl \ + virtual/libgles2 \ + libuv \ + libpcre \ +" + +# This is by far the worst hack I've ever done but the ruby/rake mixed with +# autotools (don't forget git submodules) does not allow a cleaner approach. +# But we are lucky: there is only one autoconf target (yet). If that happens +# we need to try running autotoools multiple times in a dynamically +# linked forlder. Let's hope that will not be necessary... + +AUTOTOOLS_SCRIPT_PATH = "${S}/mruby/build/mrbgems/mruby-file-stat" + +do_configure_prepend() { + # taken from https://github.com/zynaddsubfx/zyn-fusion-build/blob/master/build-rpi3.rb + sed -i -- 's/GL2/GLES2/g' ${WORKDIR}/git/src/mruby-widget-lib/src/gem.c + sed -i -- 's/MRUBY_NANOVG_GL2/MRUBY_NANOVG_GLES2/g' ${WORKDIR}/git/build_config.rb + sed -i '/idiot/d' ${WORKDIR}/git/deps/mruby-nanovg/src/nvg_impl.h + + # Fetch ruby gems. Although unexpected it starts building happily and + # breaks so ignore that. + cd mruby + MRUBY_CONFIG=../build_config.rb ruby minirake --pull-gems || true + + # ensure config.h is created at the right place... + cd build/mrbgems/mruby-file-stat/src +} + +do_install() { + oe_runmake pack + + install -d ${D}/opt/zyn-fusion + install -m 755 ${B}/package/zest ${D}/opt/zyn-fusion/zyn-fusion + cp -a ${B}/package/{libzest.so,font,schema} ${D}/opt/zyn-fusion/ + + install -d ${D}/opt/zyn-fusion/qml + touch ${D}/opt/zyn-fusion/qml/MainWindow.qml + + install -d ${D}${bindir} + ln -s /opt/zyn-fusion/zyn-fusion ${D}${bindir} +} + +FILES_${PN} += "/opt/zyn-fusion/*" diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.inc b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.inc new file mode 100644 index 00000000..0d45867a --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest.inc @@ -0,0 +1,20 @@ +SUMMARY = "Zyn-Fusion User Interface" +LICENSE = "LGPLv2.1+" +LIC_FILES_CHKSUM = "file://LICENSE;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI = " \ + gitsm://github.com/mruby-zest/mruby-zest-build.git \ + file://0001-mruby-Align-build-to-our-needs.patch \ + file://0002-mruby-zest-Align-build-to-our-needs.patch \ + file://0003-src-osc-bridge-Align-build-to-our-needs.patch \ +" +SRCREV = "b312953ba991b15d1076ba819ca5a44ed4386b28" +PV = "3.02+git${SRCPV}" +S = "${WORKDIR}/git" + +DEPENDS += " \ + ruby-native \ + bison-native \ +" + +CLEANBROKEN = "1" diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0001-mruby-Align-build-to-our-needs.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0001-mruby-Align-build-to-our-needs.patch new file mode 100644 index 00000000..7cccec53 --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0001-mruby-Align-build-to-our-needs.patch @@ -0,0 +1,78 @@ +From 84ec8305a0e4c67277929a812e6796d9f054cb02 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Wed, 12 Sep 2018 21:23:52 +0200 +Subject: [PATCH 1/2] mruby: Align build to our needs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* Add build flags + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Andreas Müller +--- + build_config.rb | 11 +++++++++-- + mruby/tasks/toolchains/gcc.rake | 2 +- + 3 files changed, 30 insertions(+), 19 deletions(-) + +diff --git a/build_config.rb b/build_config.rb +index f2c053e..5abc53c 100644 +--- a/build_config.rb ++++ b/build_config.rb +@@ -38,7 +38,6 @@ build_type.new(build_name) do |conf| + enable_debug + + conf.cc.defines = %w(MRUBY_NANOVG_GL2 MRB_ENABLE_DEBUG_HOOK) +- conf.cc.flags << '-O3' + + #No default gems + # Use standard print/puts/p +@@ -102,15 +101,19 @@ build_type.new(build_name) do |conf| + cc.flags << "-mstackrealign" if windows + cc.flags << "-mwindows" if windows + cc.flags << "-Wno-declaration-after-statement" ++ cc.flags << ENV['CFLAGS'] ++ cc.command = ENV['CC'] + cc.defines << "DEMO_MODE=#{demo_mode ? '1':'0'}" + end + + conf.linker do |linker| ++ linker.command = ENV['CC'] ++ linker.flags = [ENV['LDFLAGS'] || []] + #linker.library_paths << "#{`pwd`.strip}/../deps/nanovg/build/" + #linker.library_paths << "#{`pwd`.strip}/../deps/rtosc/build/" + linker.library_paths << "#{`pwd`.strip}/../src/osc-bridge/" + linker.libraries << 'osc-bridge' +- linker.flags_after_libraries << "#{`pwd`.strip}/../deps/libuv.a" ++ linker.flags_after_libraries << "-luv" + linker.flags_after_libraries << "#{`pwd`.strip}/../deps/pugl/build/libpugl-0.a" + linker.flags_after_libraries << "#{`pwd`.strip}/../deps/libnanovg.a" + if(!windows) +@@ -124,6 +127,10 @@ build_type.new(build_name) do |conf| + linker.flags_after_libraries << "-lglu32 -lgdi32 -lopengl32" + end + end ++ # Archiver settings ++ conf.archiver do |archiver| ++ archiver.command = ENV['AR'] ++ end + + #Custom Gems + conf.gem 'src/mruby-qml-spawn' +diff --git a/mruby/tasks/toolchains/gcc.rake b/mruby/tasks/toolchains/gcc.rake +index f370c0ab..a2ab5ed4 100644 +--- a/mruby/tasks/toolchains/gcc.rake ++++ b/mruby/tasks/toolchains/gcc.rake +@@ -22,7 +22,7 @@ MRuby::Toolchain.new(:gcc) do |conf, _params| + end + + conf.linker do |linker| +- linker.command = ENV['LD'] || 'gcc' ++ linker.command = ENV['CC'] + linker.flags = [ENV['LDFLAGS'] || %w()] + linker.libraries = %w(m) + linker.library_paths = [] +-- +2.14.4 + diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0002-mruby-zest-Align-build-to-our-needs.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0002-mruby-zest-Align-build-to-our-needs.patch new file mode 100644 index 00000000..b193c7f1 --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0002-mruby-zest-Align-build-to-our-needs.patch @@ -0,0 +1,48 @@ +From 368ece5a84a3972ae7e2635e4fa53a1dce0383f8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Wed, 12 Sep 2018 21:19:55 +0200 +Subject: [PATCH] mruby-zest: Align build to our needs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* Add build flags +* Link against shared libuv - it is not build here + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Andreas Müller +--- + Makefile | 8 ++++---- + 2 files changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index c0d8cc1..7ce309a 100644 +--- a/Makefile ++++ b/Makefile +@@ -5,18 +5,18 @@ UV_URL = http://dist.libuv.org/dist/v1.9.1/$(UV_FILE) + + all: + ruby ./rebuild-fcache.rb +- cd deps/nanovg/src && $(CC) nanovg.c -c -fPIC ++ cd deps/nanovg/src && $(CC) $(CFLAGS) nanovg.c -c -fPIC + $(AR) rc deps/libnanovg.a deps/nanovg/src/*.o + # cd deps/pugl && python2 ./waf configure --no-cairo --static + cd deps/pugl && python2 ./waf configure --no-cairo --static --debug + cd deps/pugl && python2 ./waf +- cd src/osc-bridge && CFLAGS="-I ../../deps/$(UV_DIR)/include " make lib ++ cd src/osc-bridge && make lib + cd mruby && MRUBY_CONFIG=../build_config.rb rake + $(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \ + ./deps/libnanovg.a \ + src/osc-bridge/libosc-bridge.a \ +- ./deps/$(UV_DIR)/.libs/libuv.a -lm -lX11 -lGL -lpthread +- $(CC) test-libversion.c deps/pugl/build/libpugl-0.a -ldl -o zest -lX11 -lGL -lpthread -I deps/pugl -std=gnu99 ++ $(LDFLAGS) -lpcre -luv -lm -lX11 -lGL -lpthread ++ $(CC) $(CFLAGS) test-libversion.c deps/pugl/build/libpugl-0.a -ldl -o zest $(LDFLAGS) -lX11 -lGL -lpthread -I deps/pugl -std=gnu99 + + osx: + ruby ./rebuild-fcache.rb +-- +2.14.4 + diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0003-src-osc-bridge-Align-build-to-our-needs.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0003-src-osc-bridge-Align-build-to-our-needs.patch new file mode 100644 index 00000000..7f3be45c --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0003-src-osc-bridge-Align-build-to-our-needs.patch @@ -0,0 +1,33 @@ +From 7480845b43717d9eb1f8f31dafe9725f920d4f41 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Wed, 12 Sep 2018 21:27:38 +0200 +Subject: [PATCH] src/osc-bridge: Align build to our needs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* Add build flags + +Upstream-Status: Inappropriate [embedded specific] + +Signed-off-by: Andreas Müller +--- + src/osc-bridge/Makefile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/osc-bridge/Makefile b/src/osc-bridge/Makefile +index 14d1377..f11ae86 100644 +--- a/src/osc-bridge/Makefile ++++ b/src/osc-bridge/Makefile +@@ -10,7 +10,7 @@ remote-test: $(SRC) test/basic-remote.c + $(CC) $(CFLAGS) $(CFLAGS_) -o remote-test $(SRC) test/basic-remote.c -luv -g -O0 + + lib: $(SRC) +- $(CC) $(CFLAGS) $(CFLAGS_) -O3 -g -fPIC -c $(SRC) ++ $(CC) $(CFLAGS) $(CFLAGS_) -g -fPIC -c $(SRC) + $(AR) rcs libosc-bridge.a bridge.o cache.o parse-schema.o schema.o rtosc.o + + clean: +-- +2.14.4 + diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0004-Native-Do-not-build-X11-dependent-zest-libzest.so.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0004-Native-Do-not-build-X11-dependent-zest-libzest.so.patch new file mode 100644 index 00000000..0ed04f2d --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0004-Native-Do-not-build-X11-dependent-zest-libzest.so.patch @@ -0,0 +1,32 @@ +From 6ff4dcce6aa865f96af7273e875c722edbceb83e Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Thu, 13 Sep 2018 21:27:40 +0200 +Subject: [PATCH] Native: Do not build X11 dependent zest/libzest.so +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Andreas Müller +--- + Makefile | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/Makefile b/Makefile +index 7ce309a..9d38910 100644 +--- a/Makefile ++++ b/Makefile +@@ -12,11 +12,6 @@ all: + cd deps/pugl && python2 ./waf + cd src/osc-bridge && make lib + cd mruby && MRUBY_CONFIG=../build_config.rb rake +- $(CC) -shared -o libzest.so `find mruby/build/host -type f | grep -e "\.o$$" | grep -v bin` ./deps/libnanovg.a \ +- ./deps/libnanovg.a \ +- src/osc-bridge/libosc-bridge.a \ +- $(LDFLAGS) -lpcre -luv -lm -lX11 -lGL -lpthread +- $(CC) $(CFLAGS) test-libversion.c deps/pugl/build/libpugl-0.a -ldl -o zest $(LDFLAGS) -lX11 -lGL -lpthread -I deps/pugl -std=gnu99 + + osx: + ruby ./rebuild-fcache.rb +-- +2.14.4 + diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0005-mruby-Use-native-mrbc.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0005-mruby-Use-native-mrbc.patch new file mode 100644 index 00000000..b908c1b2 --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0005-mruby-Use-native-mrbc.patch @@ -0,0 +1,29 @@ +From 06d98e715c26db56406de45649771ff58c8710ae Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Wed, 12 Sep 2018 21:25:07 +0200 +Subject: [PATCH 2/2] mruby: Use native mrbc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Andreas Müller +--- + mruby/tasks/mruby_build_commands.rake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mruby/tasks/mruby_build_commands.rake b/mruby/tasks/mruby_build_commands.rake +index 694b4a24..a207ef76 100644 +--- a/mruby/tasks/mruby_build_commands.rake ++++ b/mruby/tasks/mruby_build_commands.rake +@@ -286,7 +286,7 @@ module MRuby + end + + def run(out, infiles, funcname) +- @command ||= @build.mrbcfile ++ @command ||= "mrbc-zest" + infiles = [infiles].flatten + infiles.each do |f| + _pp "MRBC", f.relative_path, nil, :indent => 2 +-- +2.14.4 + diff --git a/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0006-mruby-regexp-pcre-link-against-libpcre.patch b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0006-mruby-regexp-pcre-link-against-libpcre.patch new file mode 100644 index 00000000..7d49eb3e --- /dev/null +++ b/recipes-misc/recipes-multimedia/zynaddsubfx/mruby-zest/0006-mruby-regexp-pcre-link-against-libpcre.patch @@ -0,0 +1,70 @@ +From ac178e85df514d0c72d7c62a0242aaf4b5a91cb3 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Andreas=20M=C3=BCller?= +Date: Thu, 13 Sep 2018 22:41:52 +0200 +Subject: [PATCH] mruby-regexp-pcre: link against libpcre +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Andreas Müller +--- + deps/mruby-regexp-pcre/mrbgem.rake | 38 +------------------------------------- + 1 file changed, 1 insertion(+), 37 deletions(-) + +diff --git a/deps/mruby-regexp-pcre/mrbgem.rake b/deps/mruby-regexp-pcre/mrbgem.rake +index 6211152..c82cb86 100644 +--- a/deps/mruby-regexp-pcre/mrbgem.rake ++++ b/deps/mruby-regexp-pcre/mrbgem.rake +@@ -3,7 +3,7 @@ MRuby::Gem::Specification.new('mruby-regexp-pcre') do |spec| + spec.authors = 'Internet Initiative Japan Inc.' + + ## For dynamic link +- #spec.linker.libraries << ['pcre'] ++ spec.linker.libraries << ['pcre'] + + ## For static link library + # How to use: +@@ -22,40 +22,4 @@ MRuby::Gem::Specification.new('mruby-regexp-pcre') do |spec| + # $ cd $(mruby.rootdir) + # $ make + +- pcre_dirname = 'pcre' +- pcre_src = "#{spec.dir}/#{pcre_dirname}" +- spec.cc.include_paths << "#{pcre_src}" +- spec.cc.flags << '-DHAVE_CONFIG_H' +- spec.cc.flags << '-DPCRE_STATIC' if /mingw|mswin/ =~ RUBY_PLATFORM +- +- spec.objs += %W( +- #{pcre_src}/pcre_byte_order.c +- #{pcre_src}/pcre_compile.c +- #{pcre_src}/pcre_config.c +- #{pcre_src}/pcre_dfa_exec.c +- #{pcre_src}/pcre_exec.c +- #{pcre_src}/pcre_fullinfo.c +- #{pcre_src}/pcre_get.c +- #{pcre_src}/pcre_globals.c +- #{pcre_src}/pcre_jit_compile.c +- #{pcre_src}/pcre_maketables.c +- #{pcre_src}/pcre_newline.c +- #{pcre_src}/pcre_ord2utf8.c +- #{pcre_src}/pcre_refcount.c +- #{pcre_src}/pcre_string_utils.c +- #{pcre_src}/pcre_study.c +- #{pcre_src}/pcre_tables.c +- #{pcre_src}/pcre_ucd.c +- #{pcre_src}/pcre_valid_utf8.c +- #{pcre_src}/pcre_version.c +- #{pcre_src}/pcre_xclass.c +- #{pcre_src}/pcre_chartables.c +- ).map { |f| f.relative_path_from(dir).pathmap("#{build_dir}/%X#{spec.exts.object}" ) } +- +- desc "generate configuration files for mruby-regexp-pcre" +- task :regexp_pcre_config do +- FileUtils.cp "#{pcre_src}/config.h.generic", "#{pcre_src}/config.h" +- FileUtils.cp "#{pcre_src}/pcre.h.generic", "#{pcre_src}/pcre.h" +- FileUtils.cp "#{pcre_src}/pcre_chartables.c.dist", "#{pcre_src}/pcre_chartables.c" +- end + end +-- +2.14.4 +