-
Notifications
You must be signed in to change notification settings - Fork 0
Library Support
This page should outline the idea of making prebuilt (common) libraries available to Emscripten users.
Provide commonly used libraries at a centralized location.
- Less work for users
- Less compile time for users
- Libraries patched to compile for Emscripten
- Higher chances for pushing patches upstream
- Might not fit every usage scenario
- Library has to be available via sourcecode
- Create a solution, which matches most use cases
- Handle library license
- Which version of LLVM to use?
- How to handle multiple compiler flags?
- How to handle dependencies?
- Can hardly use build systems making use of ld
- How and what changes break API/ABI compatibility?
- How are headers handled?
Format inspired by deb package format.
On the server, libraries are stored in a publicly available manner (accessible via e.g. http
or ftp
).
/package.json
: Contains information about all libraries available in the library repo.
For a first version it would be enough to host the sourcecodes and patches for various libraries.
As a second installment the repos also should contain the built libraries. This implicates a rebuilt on every API/ABI change (TODO: Figure out how to handle this properly). Also there needs to be a build server, which is able to handle the task.
To make life easier for users, the build scripts need to auto-download the needed libraries, so they can be compiled in.
/require.json
: Contains the information, which libraries are needed.
For a first version, the git repositories for needed libraries are downloaded and then built (via SCons!?). Afterwards the libraries and headers are available.
To improve on having to compile the libraries, the already built libraries should be downloaded from the server.
Server file for which libraries are available and where from. Includes various versions.
[ {
package_version: '0.1',
name: 'libarchive',
license: 'http://opensource.org/licenses/BSD-3-Clause',
versions: [ {
version: '3.1.1'
depends: [],
metadata: {
},
repo: 'http://emscripten.org/lib/libarchive.git',
tag: 'emscripten_built_version_3.1.1'
},
{
version: '3.1.0'
metadata: {
},
repo: 'http://emscripten.org/lib/libarchive.git',
tag: 'emscripten_built_version_3.1.0'
} ]
} ]
Every library lies in a git repository (http://emscripten.org/lib/libarchive.git
), where built Emscripten variants are marked by a tag (emscripten_built_version_3.1.0
).
The client side information, what archive to use. Might be downloaded at pre-stages of build or at pre-stages of runtime (late binding).
[ {
package_version: '0.1',
name: 'libarchive',
version: '3.1.1',
license: 'BSD 3-Clause',
url: 'http://emscripten.org/lib' // where package.json is to be found
} ]
This file is matched against the package.json
. If a package is available, which matches all criteria of require.json
, it gets downloaded and used. If not, an exception is thrown.