diff --git a/Makefile b/Makefile index 53b6b28..9d435ff 100644 --- a/Makefile +++ b/Makefile @@ -129,6 +129,7 @@ test: @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_linux_test:node -f tests/node/Dockerfile . @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_linux_test:typescript -f tests/typescript/Dockerfile . # TODO: +# @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_linux_test:ruby -f tests/ruby/Dockerfile . # @docker build --build-arg CACHE_INVALIDATE=${CACHE_INVALIDATE} -t metacall/distributable_linux_test:tsx -f tests/tsx/Dockerfile . @echo "Done" diff --git a/source/metacall.scm b/source/metacall.scm index 642eace..5674b6f 100644 --- a/source/metacall.scm +++ b/source/metacall.scm @@ -445,7 +445,9 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; Set all environment variables for subsequent packages (search-paths - (list (search-path-specification + (list + ; MetaCall + (search-path-specification (variable "LOADER_LIBRARY_PATH") (files '("lib"))) (search-path-specification @@ -461,6 +463,10 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc (variable "CONFIGURATION_PATH") (file-type 'regular) (files '("configurations/global.json"))) + ; Python + (search-path-specification + (variable "PYTHONTZPATH") + (files (list "share/zoneinfo"))) ; PYTHONPATH is incompatible with Guix Python ; but we require it for tarball installation (search-path-specification @@ -468,14 +474,31 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc (files (list (string-append "lib/python" (version-major+minor (package-version python-3)) - "/site-packages")))))) - - ; TODO: Implement the rest of paths for development - ; C_INCLUDE_PATH - ; CPLUS_INCLUDE_PATH - ; LIBRARY_PATH - - (native-search-paths search-paths) + "/site-packages")))) + ; NodeJS + (search-path-specification + (variable "NODE_PATH") + (files '("lib/node_modules"))) + ; Ruby + (search-path-specification + (variable "GEM_PATH") + (files (list (string-append "lib/ruby/vendor_ruby")))) + (search-path-specification + (variable "GEM_HOME") + (files (list (string-append "lib/ruby/vendor_ruby")))) + (search-path-specification + (variable "BUNDLE_PATH") + (files (list (string-append "lib/ruby/vendor_ruby")))) + ; GCC + (search-path-specification + (variable "C_INCLUDE_PATH") + (files '("include"))) + (search-path-specification + (variable "CPLUS_INCLUDE_PATH") + (files '("include/c++" "include"))) + (search-path-specification + (variable "LIBRARY_PATH") + (files '("lib" "lib64"))))) ; TODO: ; @@ -487,6 +510,8 @@ for any host, on any OS. TypeScript compiles to readable, standards-based JavaSc ; (file-type 'regular) ; (files '(glibc-dynamic-linker))) + (native-search-paths search-paths) + (home-page "https://metacall.io/") (synopsis "Inter-language foreign function interface call library") (description "METACALL is a library that allows calling functions, diff --git a/tests/python/Dockerfile b/tests/python/Dockerfile index 7a83ac3..6a660d9 100644 --- a/tests/python/Dockerfile +++ b/tests/python/Dockerfile @@ -43,7 +43,6 @@ ARG CACHE_INVALIDATE RUN echo "Running tests ${CACHE_INVALIDATE}" \ && source /gnu/etc/profile \ - && rm /gnu/store/4r7k7ipiaqkdf4lmnxwmbz0wx2yzygzc-python-3.10.7/lib/python3.10/site-packages/sitecustomize.py \ && pip3 install metacall \ && export LOADER_SCRIPT_PATH="/scripts/" \ && printf 'load py script.py\ninspect\ncall test()\nexit' | metacallcli \ diff --git a/tests/ruby/Dockerfile b/tests/ruby/Dockerfile new file mode 100644 index 0000000..ed673a4 --- /dev/null +++ b/tests/ruby/Dockerfile @@ -0,0 +1,54 @@ +# +# MetaCall Distributable by Parra Studios +# Distributable infrastructure for MetaCall. +# +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +FROM busybox:1.31.1 AS ruby_test + +# Image descriptor +LABEL copyright.name="Vicente Eduardo Ferrer Garcia" \ + copyright.address="vic798@gmail.com" \ + maintainer.name="Vicente Eduardo Ferrer Garcia" \ + maintainer.address="vic798@gmail.com" \ + vendor="MetaCall Inc." \ + version="0.1" + +COPY out/tarball.tar.gz / + +RUN cd / \ + && tar --no-same-owner --no-same-permissions -xzf tarball.tar.gz \ + && rm tarball.tar.gz + +COPY tests/ruby/script.rb /scripts/ +COPY tests/ruby/Gemfile /scripts/ + +WORKDIR /scripts + +ARG CACHE_INVALIDATE + +RUN echo "Running tests ${CACHE_INVALIDATE}" \ + && source /gnu/etc/profile \ + && gem install open-uri \ + && bundle install --verbose \ + && bundle config path \ + && export LOADER_SCRIPT_PATH="/scripts/" \ + && metacallcli script.rb + # \ + # | grep \ + # -e 'Hello World' + +ENTRYPOINT ["sh", "-c"] diff --git a/tests/ruby/Gemfile b/tests/ruby/Gemfile new file mode 100644 index 0000000..8a0ca57 --- /dev/null +++ b/tests/ruby/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'xml-simple' diff --git a/tests/ruby/script.rb b/tests/ruby/script.rb new file mode 100644 index 0000000..4eabaa0 --- /dev/null +++ b/tests/ruby/script.rb @@ -0,0 +1,31 @@ +#!/usr/bin/env ruby + +# +# MetaCall Distributable by Parra Studios +# Distributable infrastructure for MetaCall. +# +# Copyright (C) 2016 - 2024 Vicente Eduardo Ferrer Garcia +# +# Licensed under the Apache License, Version 2.0 (the 'License'); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'open-uri' + +URI.open('http://www.ruby-lang.org/') {|f| + f.each_line {|line| p line} +} + +# TODO: Ruby cannot find gems installed by bundle +#require 'xmlsimple' +#result = XmlSimple.xml_in(html) +#p result