Adawebpack
Ada WASM Runtime and Bindings for Web API
Install / Use
/learn @godunko/AdawebpackREADME
AdaWebPack
AdaWebPack includes GNAT-LLVM compiler for WebAssembly target, GNAT Run Time Library and AdaWebPack bindings for Web API.
How to install
Prebuild packages are available on Release page.
You will also need wasm-ld, the Web asssembly linker. You will find this:
- on Fedora Linux through the
lldpackage; - on Ubuntu through the
lld-16package; - on other Linux systems look for a similarly-named package.
How to build
-
Setup GNAT using Alire.
-
Clone GNAT-LLVM. Latest known good revision of GNAT-LLVM compatible with GNAT FSF is
66e36d929524972353600db5d604d0189cf0308f.git clone https://github.com/AdaCore/gnat-llvm git -C gnat-llvm checkout 66e36d929524972353600db5d604d0189cf0308f -
Clone bb-runtimes. Use
gnat-fsf-14branch.git clone -b gnat-fsf-14 https://github.com/Fabien-Chouteau/bb-runtimes gnat-llvm/llvm-interface/bb-runtimes -
Clone GCC sources. Use, for instance,
releases/gcc-14.1.0commit.git clone --single-branch --branch=releases/gcc-14 --shallow-since=01-04-2024 https://github.com/gcc-mirror/gcc gnat-llvm/llvm-interface/gcc git -C gnat-llvm/llvm-interface/gcc checkout releases/gcc-14.1.0 -
Setup GNAT-LLVM development environment, see details in GNAT-LLVM README. Note, you need to use externally build LLVM with enabled 'lld' project and 'WebAssembly' target, so, if you build it your-self,
cmakecommand line should contain among other switches:cmake ... -DLLVM_ENABLE_PROJECTS='...;clang;lld' -DLLVM_TARGETS_TO_BUILD="...;WebAssembly"On Ubuntu it is possible to install prebuild LLVM/CLang packages (use LLVM/CLang 16). However, alternatives need to be updated using the provided script:
sudo utilities/update-alternatives-clang.sh 16 100Or install a LLVM 16 binary release (
llvm-16,lld-16andclang-16are required). -
Checkout AdaWebPack repository into
gnat-llvm/llvm-interfaceasadawebpack_srcand create link for Makefile.target.cd gnat-llvm/llvm-interface git clone https://github.com/godunko/adawebpack.git adawebpack_src ln -s adawebpack_src/source/rtl/Makefile.target cd - -
Create a link to RTS source code
cd gnat-llvm/llvm-interface ln -s bb-runtimes/gnat_rts_sources/include/rts-sources/ cd - -
Create a link to GNAT source code (or copy it)
cd gnat-llvm/llvm-interface ln -s gcc/gcc/ada gnat_src cd - -
Apply patch to GNAT-LLVM repository
cd gnat-llvm/llvm-interface patch -p1 < adawebpack_src/patches/gnat-llvm.patch patch -p1 < adawebpack_src/patches/llvm_wrapper2.patch cd - -
Use
make wasmto build compiler and Run Time Librarycd gnat-llvm/llvm-interface make wasm cd - -
When
makefinishes, you will find toolchain ingnat-llvm/llvm-interface/bin.cd gnat-llvm/llvm-interface export PATH=$PWD/bin:$PATH cd - -
Now you can build examples:
cd gnat-llvm/llvm-interface/adawebpack_src make build_examples cd -You will most likely need to run the examples through an HTTP server; otherwise, the browser will report a security error and/or refuse to load the page. An easy way to obtain an HTTP server is by via Python 3 with
python3 -m http.server.
Usage with Docker
It could be handy to use docker.
- Find latest build on our Fedora COPR repository.
- Build a container image (make sure to replace
curlargument with latest RPM URL)docker build --tag wgprbuild - <<EOF FROM registry.fedoraproject.org/fedora-minimal:40 RUN microdnf --assumeyes install \ gprbuild \ clang16 \ llvm16 \ lld \ libgnat \ ca-certificates && \ curl -O \ https://download.copr.fedorainfracloud.org/results/reznik/adawebpack/fedora-40-x86_64/07674186-adawebpack/adawebpack-24.0.0-git.fc40.x86_64.rpm && \ rpm -i adawebpack*.rpm && \ rm -f adawebpack*.rpm && \ /usr/share/adawebpack/update-alternatives-clang.sh 16 99 && \ microdnf clean all EOF - Write a
bashwrapper script to replacegprbuildlike this:#!/bin/bash exec docker run --rm --tmpfs /tmp/ --user $UID --volume $HOME:$HOME --workdir $PWD wgprbuild gprbuild "$@"
Unsupported features
-
nested subprograms are not supported
-
exceptions support is limited to local exceptions propagation and last chance handler
-
tasks and protected objects are not supported
License
Web API bindings is licensed under BSD3 license.
GNAT Runtime Library is licensed under GPL3 license with GCC Runtime Library Exception.
Related Skills
node-connect
351.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
110.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
351.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
351.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
