From 9a2846b30341d58817c870cedf0a85ad05e824fd Mon Sep 17 00:00:00 2001 From: ahmedihabb2 Date: Mon, 27 Feb 2023 17:10:47 +0200 Subject: [PATCH 1/6] feat: Build with Python support for MacOS --- tools/metacall-environment-macos.sh | 37 ++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/tools/metacall-environment-macos.sh b/tools/metacall-environment-macos.sh index b684603f9..a019e4bcf 100755 --- a/tools/metacall-environment-macos.sh +++ b/tools/metacall-environment-macos.sh @@ -44,16 +44,35 @@ sub_swig() { # Python sub_python() { - echo "configuring python" - brew install python3 python3-pip + echo "configuring python" + brew install pyenv openssl + export PKG_CONFIG_PATH=$(brew --prefix openssl)/lib/pkgconfig + export PYTHON_CONFIGURE_OPTS="--enable-shared" + pyenv install 3.11.1 + pyenv global 3.11.1 + pyenv rehash + echo -e '\nif command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile + source ~/.bash_profile + which python3 pip3 install requests - pip3 install setuptools - pip3 install wheel - pip3 install rsa - pip3 install scipy - pip3 install numpy - pip3 install joblib - pip3 install scikit-learn + pip3 install setuptools + pip3 install wheel + pip3 install rsa + pip3 install scipy + pip3 install numpy + pip3 install joblib + pip3 install scikit-learn + # TODO: We should look for a better way to do this + FINDPYTHON="$HOME/work/core/core/cmake/FindPython.cmake" + echo "set(Python_INCLUDE_DIRS \"$HOME/.pyenv/versions/3.11.1/include/python3.11\")" >> $FINDPYTHON + echo "set(Python_LIBRARY \"$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib\")" >> $FINDPYTHON + echo "set(Python_EXECUTABLE \"$HOME/.pyenv/versions/3.11.1/bin/python3.11\")" >> $FINDPYTHON + echo "set(Python_ROOT \"$HOME/.pyenv/versions/3.11.1\")" >> $FINDPYTHON + echo "set(Python_VERSION \"3.11.1\")" >> $FINDPYTHON + echo "include(FindPackageHandleStandardArgs)" >> $FINDPYTHON + echo "find_package_handle_standard_args(Python DEFAULT_MSG Python_INCLUDE_DIRS Python_LIBRARY Python_EXECUTABLE Python_ROOT Python_VERSION)" >> $FINDPYTHON + echo "mark_as_advanced(Python_INCLUDE_DIRS Python_LIBRARY Python_EXECUTABLE Python_ROOT Python_VERSION)" >> $FINDPYTHON + } # NodeJS From 7e4ca15823744bfcb809e371092a21152b770550 Mon Sep 17 00:00:00 2001 From: ahmedihabb2 Date: Mon, 27 Feb 2023 20:56:42 +0200 Subject: [PATCH 2/6] set python paths --- .github/workflows/macos-test.yml | 17 +++++++++++------ tools/metacall-environment-macos.sh | 10 ---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/.github/workflows/macos-test.yml b/.github/workflows/macos-test.yml index a2ae0410e..3e48033b8 100644 --- a/.github/workflows/macos-test.yml +++ b/.github/workflows/macos-test.yml @@ -5,7 +5,7 @@ on: pull_request: push: tags: - - 'v*.*.*' + - "v*.*.*" branches: - master - develop @@ -18,11 +18,11 @@ jobs: strategy: matrix: buildtype: [debug] # TODO: [debug, release] - + env: LTTNG_UST_REGISTER_TIMEOUT: 0 NUGET_XMLDOC_MODE: skip - DOTNET_CLI_TELEMETRY_OPTOUT: 'true' + DOTNET_CLI_TELEMETRY_OPTOUT: "true" steps: - name: Check out the repository @@ -30,13 +30,13 @@ jobs: with: fetch-depth: 0 - - name: Uninstall NodeJS and NPM + - name: Uninstall NodeJS and NPM run: | npm uninstall npm -g rm -rf /usr/local/lib/node_modules/npm # TODO: This must go in metacall-environment-macos.sh as base dependencies - - name: Configure Clang + - name: Configure Clang run: | brew install llvm cmake git wget gnupg ca-certificates @@ -57,7 +57,12 @@ jobs: working-directory: ./build # TODO: Remove the disable option for fork safe once funchook problem is solved run: | - cmake -DOPTION_FORK_SAFE=OFF .. + cmake -DOPTION_FORK_SAFE=OFF \ + -DPython_INCLUDE_DIRS="$HOME/.pyenv/versions/3.11.1/include/python3.11" \ + -DPython_LIBRARY="$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib" \ + -DPython_EXECUTABLE="$HOME/.pyenv/versions/3.11.1/bin/python3.11" \ + -DPython_ROOT="$HOME/.pyenv/versions/3.11.1" \ + -DPython_VERSION="3.11.1" .. bash ../tools/metacall-build.sh $METACALL_BUILD_OPTIONS env: METACALL_BUILD_OPTIONS: ${{ matrix.buildtype }} tests diff --git a/tools/metacall-environment-macos.sh b/tools/metacall-environment-macos.sh index a019e4bcf..9c45e9228 100755 --- a/tools/metacall-environment-macos.sh +++ b/tools/metacall-environment-macos.sh @@ -62,16 +62,6 @@ sub_python() { pip3 install numpy pip3 install joblib pip3 install scikit-learn - # TODO: We should look for a better way to do this - FINDPYTHON="$HOME/work/core/core/cmake/FindPython.cmake" - echo "set(Python_INCLUDE_DIRS \"$HOME/.pyenv/versions/3.11.1/include/python3.11\")" >> $FINDPYTHON - echo "set(Python_LIBRARY \"$HOME/.pyenv/versions/3.11.1/lib/libpython3.11.dylib\")" >> $FINDPYTHON - echo "set(Python_EXECUTABLE \"$HOME/.pyenv/versions/3.11.1/bin/python3.11\")" >> $FINDPYTHON - echo "set(Python_ROOT \"$HOME/.pyenv/versions/3.11.1\")" >> $FINDPYTHON - echo "set(Python_VERSION \"3.11.1\")" >> $FINDPYTHON - echo "include(FindPackageHandleStandardArgs)" >> $FINDPYTHON - echo "find_package_handle_standard_args(Python DEFAULT_MSG Python_INCLUDE_DIRS Python_LIBRARY Python_EXECUTABLE Python_ROOT Python_VERSION)" >> $FINDPYTHON - echo "mark_as_advanced(Python_INCLUDE_DIRS Python_LIBRARY Python_EXECUTABLE Python_ROOT Python_VERSION)" >> $FINDPYTHON } From 47c988626d95b44c1b006207e4a39075ba60c702 Mon Sep 17 00:00:00 2001 From: ahmedihabb2 Date: Mon, 27 Feb 2023 21:08:03 +0200 Subject: [PATCH 3/6] fix build with python [skip ci] --- .github/workflows/macos-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos-test.yml b/.github/workflows/macos-test.yml index 3e48033b8..02c4ecde1 100644 --- a/.github/workflows/macos-test.yml +++ b/.github/workflows/macos-test.yml @@ -51,7 +51,7 @@ jobs: cd build bash ../tools/metacall-configure.sh $METACALL_CONFIGURE_OPTIONS env: - METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage + METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer python # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage - name: Build working-directory: ./build From d5f8d59f3af47c2fa1c6ed27b1e4bebb9efd1c7c Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Wed, 1 Mar 2023 11:08:14 -0500 Subject: [PATCH 4/6] Update metacall-environment-macos.sh --- tools/metacall-environment-macos.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tools/metacall-environment-macos.sh b/tools/metacall-environment-macos.sh index 9c45e9228..1d400057a 100755 --- a/tools/metacall-environment-macos.sh +++ b/tools/metacall-environment-macos.sh @@ -55,14 +55,13 @@ sub_python() { source ~/.bash_profile which python3 pip3 install requests - pip3 install setuptools - pip3 install wheel - pip3 install rsa - pip3 install scipy - pip3 install numpy - pip3 install joblib - pip3 install scikit-learn - + pip3 install setuptools + pip3 install wheel + pip3 install rsa + pip3 install scipy + pip3 install numpy + pip3 install joblib + pip3 install scikit-learn } # NodeJS From ab5c9f447edbc6cad66f466791aabcb8681196c0 Mon Sep 17 00:00:00 2001 From: ahmedihabb2 Date: Mon, 27 Mar 2023 03:29:44 +0200 Subject: [PATCH 5/6] Build metacall with Java support --- .github/workflows/macos-test.yml | 4 ++-- tools/metacall-environment-macos.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos-test.yml b/.github/workflows/macos-test.yml index 02c4ecde1..b66326574 100644 --- a/.github/workflows/macos-test.yml +++ b/.github/workflows/macos-test.yml @@ -43,7 +43,7 @@ jobs: - name: Set up the environment run: sh ./tools/metacall-environment-macos.sh $METACALL_INSTALL_OPTIONS env: - METACALL_INSTALL_OPTIONS: python nodejs # ruby netcore5 typescript file rpc wasm java c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage + METACALL_INSTALL_OPTIONS: python nodejs java # ruby netcore5 typescript file rpc wasm c cobol rust rapidjson funchook swig pack # clangformat v8rep51 coverage - name: Configure run: | @@ -51,7 +51,7 @@ jobs: cd build bash ../tools/metacall-configure.sh $METACALL_CONFIGURE_OPTIONS env: - METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer python # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage + METACALL_CONFIGURE_OPTIONS: ${{ matrix.buildtype }} scripts ports tests sanitizer python java # nodejs python java sanitizer ruby netcore5 typescript file rpc wasm java c cobol rust examples dynamic install pack benchmarks # v8 coverage - name: Build working-directory: ./build diff --git a/tools/metacall-environment-macos.sh b/tools/metacall-environment-macos.sh index 1d400057a..998589d8a 100755 --- a/tools/metacall-environment-macos.sh +++ b/tools/metacall-environment-macos.sh @@ -70,6 +70,12 @@ sub_nodejs(){ brew install node make npm curl python3 } +# Java +sub_java(){ + echo "configuring java" + brew install openjdk@19 +} + sub_install() { @@ -79,6 +85,9 @@ sub_install() if [ $INSTALL_NODEJS = 1 ]; then sub_nodejs fi + if [ $INSTALL_JAVA = 1 ]; then + sub_java + fi } sub_options(){ From 30fd78395e43178b2b4d8b9967805c8b55c85114 Mon Sep 17 00:00:00 2001 From: Vicente Eduardo Ferrer Garcia <7854099+viferga@users.noreply.github.com> Date: Mon, 27 Mar 2023 18:30:12 -0400 Subject: [PATCH 6/6] Update metacall-environment-macos.sh --- tools/metacall-environment-macos.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/tools/metacall-environment-macos.sh b/tools/metacall-environment-macos.sh index 998589d8a..e3051dff1 100755 --- a/tools/metacall-environment-macos.sh +++ b/tools/metacall-environment-macos.sh @@ -76,7 +76,6 @@ sub_java(){ brew install openjdk@19 } - sub_install() { if [ $INSTALL_PYTHON = 1 ]; then