Hi,
I've built txiki.js for windows, here are some thoughts and data points which others might find useful. This could also be a basis for a readme file or wiki page, or some patches.
curlOn windows, the TLS backend in curl can be either schannel (windows store) where Windows manages the certificates, or a third party TLS lib, like OpenSSL. The latter requires certificates in files/bundles.
A single [lib]curl binary may support more than one backend.
using mingw in MSYS2The MSYS2 mingw libcurl is configured to use a certificate bundle in a dir relative to the curl dll (DLL-DIR/../ssl/certs/), and so if one builds tjs.exe using the MSYS2 mingw packages then a sequence similar to this could make the bundle portable:
# MSYS2: build txiki.js and then package it at ./dist/ with dll deps and certs make \ && rm -rf dist \ && mkdir -p dist/bin \ && cp -a build/tjs.exe dist/bin/ \ && cp -a $(ldd build/tjs.exe | awk '/mingw/ { print $3 }') dist/bin/ \ && mkdir -p dist/ssl/certs \ && cp -a /$MSYSTEM/ssl/certs/* dist/ssl/certs/
It's possible that the curl dll also support schannel and/or configurable certs path (maybe using env vars), but I've not looked into it.
cross compiling using MXEI've managed to build tjs.exe
using MXE - https://github.com/mxe/mxe on debian. MXE builds a mingw toolchain from source and has recipes for many third party packages (e.g. including curl and libffi). It can also be configured to default to static libs and linkage, which helps with creating a single tjs.exe
without dependencies. It also helps that the curl recipe in MXE doesn't seem to need a certs bundle file for https to work out of the box with tjs.exe
(defaults to schannel?).
However, using MXE, especially for a one-off build, can be a long process, as building the mingw toolchain and then curl (and its many dependencies) can take quite a while. However, it one already has an MXE setup then it's a viable option.
I did have to work around two issues though: capital includes names in wasm3 (see below), and the curl dependencies were not picked automatically by cmake, so I added them manually at CMakeLists.txt.
cross compiling using debian mingwAnother approach is to use mingw from the distro. I've used debian 11.5 live DVD with the script below to build a 32/64 portable txiki.js package.
This does not build curl because it can be complex, and instead downloads the official reproducible curl-for-windows binary - https://github.com/curl/curl-for-win . All the other deps (quickjs, libuv, wasm3, libffi) are built from the txiki.js git repo and linked statically.
Some data points:
Attached are the build script, and the resulting 64 bits package from current git master, built on debian 11.5 live DVD in a VM (the package inclues the script too at info/
).
To use the script on a freshly booted Debian 11 live DVD: save it e.g. build-tjs.sh
and chmod +x build-tjs.sh
, then ./build-tjs.sh
to build the 64 bits package, or BITS=32 ./build-tjs.sh
for 32 bits (it first installs the required packages). zipped package path is reported at the end of the build.
txiki.debian-mingw-build-script.zip
txiki.js.x86_64-w64-mingw32.zip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4