# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup github 1.0 PortGroup java 1.0 github.setup emscripten-core emscripten 3.1.31 revision 0 categories lang devel license MIT NCSA maintainers {mcalhoun @MarcusCalhoun-Lopez} openmaintainer homepage https://emscripten.org description open source compiler toolchain to WebAssembly long_description Emscripten is a complete Open Source compiler toolchain to WebAssembly. checksums rmd160 8a8d8f454e1a53f78529e0f43e72804f47cd993b \ sha256 da1c1dade4c6b561f0482805f035cf9964f39493d8582cea5d1a26a23acca0ef \ size 28649584 set python_branch 3.11 configure.python ${prefix}/bin/python${python_branch} set python_version [string map {. {}} ${python_branch}] set install_loc ${destroot}${prefix}/libexec/${name} if {${subport} eq ${name}} { depends_lib-append port:python${python_version} depends_build-append bin:npm:npm9 # for building cache libraries depends_build-append port:git \ path:bin/cmake:cmake # clang-devel is being used since emscripten requires Clang >= 16 depends_run-append port:binaryen \ port:clang-devel \ bin:node:nodejs18 destroot.env-append PYTHON=${configure.python} \ PATH=${frameworks_dir}/Python.framework/Versions/${python_branch}/bin:$env(PATH) configure { # replicate # cd ${worksrcpath} && ./emcc --generate-config # edit resulting .emscripten xinstall -m 0644 ${filespath}/emscripten ${worksrcpath}/.emscripten reinplace "s|__MACPORTS_LLVM_ROOT__|${prefix}/libexec/llvm-devel/bin|g" ${worksrcpath}/.emscripten reinplace "s|__MACPORTS_BINARYEN_ROOT__|${prefix}|g" ${worksrcpath}/.emscripten reinplace "s|__MACPORTS_NODE_JS__|${prefix}/bin/node|g" ${worksrcpath}/.emscripten reinplace "s|__MACPORTS_JAVA__|${java.home}/bin/java|g" ${worksrcpath}/.emscripten system -W ${worksrcpath} "${configure.python} tools/create_entry_points.py" } build {} # N.B. the install script calls npm, which downloads (and sometimes builds) external libraries. # This should happen in the fetch and build phases, but it is not clear how to force npm to do this. # # Please check node_modules/ws/builderror.log for silent errors after destroot phase. destroot.destdir DESTDIR=${install_loc} # see https://docs.npmjs.com/cli/v7/commands/npm-install destroot.env-append NODE_ENV=production post-destroot { # install the config file xinstall -m 0644 ${worksrcpath}/.emscripten ${install_loc} # put certain binaries where they can be found foreach bin {em++ em-config emar embuilder emcc emcmake emconfigure emmake emranlib emrun emscons emsize} { ln -s ${prefix}/libexec/${name}/${bin} ${destroot}${prefix}/bin/ ln -s ${prefix}/libexec/${name}/${bin}.py ${destroot}${prefix}/bin/ } # generate cache libraries # options: SYSTEM USER MINIMAL ALL # # This process also seems to download and build, which should not happen in the destroot phase. # system -W ${install_loc} "env PATH=${frameworks_dir}/Python.framework/Versions/${python_branch}/bin:$env(PATH) ${configure.python} embuilder.py build MINIMAL" # do not generate new cache libraries # this must be done *after* running embuilder.py reinplace "s|# FROZEN_CACHE|FROZEN_CACHE|g" ${install_loc}/.emscripten } } #subport ${name}-man { # man files have to be built separately #} #subport ${name}-docs { #}