-
Notifications
You must be signed in to change notification settings - Fork 0
Library Support
This page should outline the idea of making (common) libraries available to Emscripten users.
Provide commonly used libraries at a centralized location, so additional external libraries might be build without having to patch their build system for Emscripten.
Since Emscripten has not support for dynamic libraries and/or their file format a solution should not rely on the dynamic library infrastructure.
On Debian systems installing a library usually is done via dpkg or apt tools. Arguments necessary for linking with a library are commonly provided by invoking pkg-config.
These mechanism could be adopted for Emscripten in a simplified manner.
empkg-get <package name> <package name> ...
- Downloads the
<package name>/versionsfile from https://github.com/abergmeier/emscripten-libs for every package. - Finds the highest/latest version.
- Checks whether the directory
EM_CACHE/build/<package name>/<version>is available and warns for overwrite if it is. - On success downloads (and overwrites) the version to
EM_CACHE/build/<package name>/<version>.
empkg-build [--ensure] <package name> [--ensure] <package name>
- If
--ensureargument is directly in front of a package name, try to invokeempkg-getfirst and fail if it fails. - If a valid build timestamp is found return successfully.
- Invoke
EM_CACHE/build/<package name>/<version>/.emscripten/buildfor building. - If building succeeds, create new build timestamp file.
empkg-config [--cflags] [--libs] [--ensure] <package name> [--ensure] <package name>
- If
--ensureargument is directly in front of apackage name, try to invokeempkg-buildfirst and fail if it fails. - Returns the contents of
EM_CACHE/build/<package name>/<version>/.emscripten/cflagsorEM_CACHE/build/<package name>/<version>/.emscripten/libs
The versions file is a JSON version of the pkg-config format with additional source information.
Entries in the upper section are derived by the version sections.
[ { "version": "1.2.7",
"src" : "https://github.com/madler/zlib/archive/v1.2.7.zip"
},
{ "version": "1.2.6.1",
"src" : "https://github.com/madler/zlib/archive/v1.2.6.1.zip"
}
]
- Less to no work for users
- Higher chances for pushing patches upstream
- Maintainance necessary
- Might not fit every usage scenario
- Library has to be available via sourcecode