diff --git a/scripts/build.sh b/scripts/build.sh index 8a012a7..76520c8 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -27,7 +27,7 @@ export GUILE_WARN_DEPRECATED='detailed' # Uses --no-grafts option in order to avoid conflicts between duplicated versions # Build -guix build metacall --fallback -L /metacall/nonguix -L /metacall/source +guix build metacall metacall-python-port --fallback -L /metacall/nonguix -L /metacall/source # Install echo 'metacall' >> /metacall/source/metacall.scm @@ -39,7 +39,7 @@ guix lint -L /metacall/nonguix -L /metacall/source metacall # Pack guix pack --no-grafts \ -S /gnu/bin=bin -S /gnu/etc=etc -S /gnu/lib=lib -S /gnu/include=include -S /gnu/share=share \ - -RR metacall nss-certs \ + -RR metacall metacall-python-port nss-certs \ -L /metacall/nonguix -L /metacall/source | tee build.log # Copy diff --git a/scripts/deps.sh b/scripts/deps.sh index e5430c4..3fd1529 100755 --- a/scripts/deps.sh +++ b/scripts/deps.sh @@ -31,11 +31,12 @@ cd /metacall/nonguix git checkout e0951349603581895e0ba61f0e7410368ea1902a # Fix nonguix version apk del git-deps -# Build (i386 workaround for NodeJS) -if [[ "${TARGETPLATFORM:-}" == "linux/386" ]]; then - guix install --fallback --without-tests=node node-lts - guix install --fallback --without-tests=node-lts libnode -fi +# TODO: +# # Build (i386 workaround for NodeJS) +# if [[ "${TARGETPLATFORM:-}" == "linux/386" ]]; then +# guix install --fallback --without-tests=node node-lts +# guix install --fallback --without-tests=node-lts libnode +# fi # Build guix build --fallback \ diff --git a/source/metacall.scm b/source/metacall.scm index 06c50b7..2a11ca4 100644 --- a/source/metacall.scm +++ b/source/metacall.scm @@ -29,6 +29,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (guix build-system node) + #:use-module (guix build-system python) #:use-module (guix build json) #:use-module (guix build union) #:use-module ((guix licenses) #:prefix license:) @@ -520,3 +521,20 @@ methods or procedures between programming languages. With METACALL you can transparently execute code from / to any programming language, for example, call Python code from NodeJS code.") (license license:asl2.0))) + +; MetaCall Python Port +; TODO: Can it be unified with metacall package? +; https://www.futurile.net/2024/07/23/guix-package-structure-build-system-phases/ +(define-public metacall-python-port + (package + (inherit metacall) + (name "metacall-python-port") + (build-system python-build-system) + (arguments + `(#:tests? #f + #:phases (modify-phases %standard-phases + (add-before 'build 'change-directory + (lambda _ + (chdir "source/ports/py_port"))) + (delete 'test)))) + (inputs (list metacall)))) diff --git a/tests/cli/Dockerfile b/tests/cli/Dockerfile index b86118a..27c46fa 100644 --- a/tests/cli/Dockerfile +++ b/tests/cli/Dockerfile @@ -53,10 +53,18 @@ RUN echo "Running tests ${CACHE_INVALIDATE}" \ | grep -e 'function add(a, b)' -e 'function mult(a, b)' \ && printf "load py sum.py\ninspect\nexit" \ | metacallcli \ - | grep -e 'function sum(a, b, c)' + | grep -e 'function sum(a, b, c)' \ + && metacallcli port-test.js \ + | grep "Node.js port works" \ + && metacallcli port-test.py \ + | grep "Python port works" -# | grep -e 'function sum(a, b, c)' \ +# TODO: C# Loader # && printf "load cs say.cs\ninspect\nexit" \ -# | metacallcli || cat /root/metacall.log +# | metacallcli + +# TODO: Ruby Port +# && metacallcli port-test.rb \ +# | grep "Ruby port works" ENTRYPOINT ["sh", "-c"] diff --git a/tests/scripts/port-test.js b/tests/scripts/port-test.js new file mode 100644 index 0000000..322a969 --- /dev/null +++ b/tests/scripts/port-test.js @@ -0,0 +1,25 @@ +#!/usr/bin/env node + +/* + * 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. + * + */ + +const { metacall } = require('metacall'); + +console.log("Node.js port works"); diff --git a/tests/scripts/port-test.py b/tests/scripts/port-test.py new file mode 100644 index 0000000..2873742 --- /dev/null +++ b/tests/scripts/port-test.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# +# 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. +# + +import metacall + +print("Python port works") diff --git a/tests/scripts/port-test.rb b/tests/scripts/port-test.rb new file mode 100644 index 0000000..3f75beb --- /dev/null +++ b/tests/scripts/port-test.rb @@ -0,0 +1,24 @@ +#!/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 'metacall' + +puts "Ruby port works"