Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release-As: 101.0.0
- Loading branch information
Showing
73 changed files
with
4,449 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.github export-ignore | ||
.ocamlformat export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Esy | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
name: Build and test | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
steps: | ||
- name: Setup node.js | ||
uses: actions/setup-node@v2.1.2 | ||
with: | ||
node-version: '14' | ||
check-latest: true | ||
|
||
# Install `esy` to build the project | ||
- name: Setup environment | ||
run: | | ||
npm i -g esy | ||
- name: Checkout project | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Esy build | ||
uses: esy/github-action@d859489ca96411749931bceb4d733a2bdea922f9 | ||
with: | ||
cache-key: ${{ hashFiles('esy.lock/index.json') }} | ||
|
||
- name: Run tests | ||
run: | | ||
esy test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Opam | ||
on: | ||
- push | ||
- pull_request | ||
|
||
jobs: | ||
build: | ||
name: Build and test | ||
runs-on: ${{ matrix.os }} | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
ocaml-compiler: [4.12.0] | ||
|
||
steps: | ||
- name: Checkout project | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Setup OCaml ${{ matrix.ocaml-compiler }} | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-compiler }} | ||
|
||
- name: Install local dependencies | ||
run: opam install . --deps-only --with-test | ||
|
||
- name: Build project | ||
run: opam exec -- dune build | ||
|
||
- name: Run tests | ||
run: | | ||
opam exec -- dune runtest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
release-please: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
upload_url: ${{ steps.release.outputs.upload_url }} | ||
tag_name: ${{ steps.release.outputs.tag_name }} | ||
body: ${{ steps.release.outputs.body }} | ||
steps: | ||
- uses: GoogleCloudPlatform/release-please-action@v2.34.0 | ||
id: release | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: ocaml | ||
package-name: libbinaryen | ||
|
||
add-archive: | ||
needs: [release-please] | ||
if: ${{ needs.release-please.outputs.release_created }} | ||
name: Add archive to release | ||
runs-on: macos-latest | ||
outputs: | ||
browser_download_url: ${{ steps.upload.outputs.browser_download_url }} | ||
steps: | ||
- name: Install git-archive-all | ||
run: | | ||
brew install git-archive-all | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: 'recursive' | ||
|
||
- name: Build archive | ||
run: | | ||
git-archive-all --force-submodules libbinaryen.tar.gz | ||
- name: Upload Release Asset | ||
id: upload | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.release-please.outputs.upload_url }} | ||
asset_path: ./libbinaryen.tar.gz | ||
asset_name: libbinaryen-${{ needs.release-please.outputs.tag_name }}.tar.gz | ||
asset_content_type: application/gzip | ||
|
||
opam-release: | ||
needs: [release-please, add-archive] | ||
name: Publish to opam registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup bot user | ||
run: | | ||
git config --global user.email "bot@grain-lang.org" | ||
git config --global user.name "Grain Bot" | ||
# Some hacks to make sure opam doesn't pull the repo in a way we can't deal with | ||
- name: Setup opam repository | ||
run: | | ||
mkdir -p ~/.opam/plugins/opam-publish/repos/ | ||
git clone git://github.com/ocaml/opam-repository ~/.opam/plugins/opam-publish/repos/ocaml%opam-repository | ||
cd ~/.opam/plugins/opam-publish/repos/ocaml%opam-repository | ||
git remote add user https://${{ secrets.OPAM_RELEASE }}@github.com/grainbot/opam-repository | ||
# Set up our token because opam doesn't support env var tokens | ||
- name: Setup token | ||
run: | | ||
mkdir -p ~/.opam/plugins/opam-publish/ | ||
echo -n ${{ secrets.OPAM_RELEASE }} > ~/.opam/plugins/opam-publish/libbinaryen.token | ||
- name: Generate CHANGES file | ||
env: | ||
CHANGES: ${{ needs.release-please.outputs.body }} | ||
run: | | ||
echo -n "$CHANGES" > CHANGES.md | ||
- name: Setup OCaml | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: 4.12.0 | ||
|
||
- name: Install publish utils | ||
run: | | ||
opam install opam-publish | ||
- name: Publish to opam | ||
run: | | ||
opam publish --no-browser --msg-file=CHANGES.md ${{ needs.add-archive.outputs.browser_download_url }} | ||
npm-release: | ||
needs: [add-archive] | ||
name: Publish to npm registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "14" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Publish to npm | ||
run: npm publish ${{ needs.add-archive.outputs.browser_download_url }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_RELEASE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "binaryen"] | ||
path = binaryen | ||
url = https://github.com/WebAssembly/binaryen |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,50 @@ | ||
# libbinaryen | ||
libbinaryen packaged for OCaml | ||
|
||
Libbinaryen packaged for OCaml. | ||
|
||
This is just the low-level C library. If you are looking for OCaml *bindings* to Binaryen, check out [Binaryen.ml](https://github.com/grain-lang/binaryen.ml)! | ||
|
||
## Usage | ||
|
||
Inside your dune file, you can depend on `libbinaryen` as such: | ||
|
||
``` | ||
(library | ||
(name binaryen) | ||
(public_name binaryen) | ||
(libraries libbinaryen.c) | ||
(foreign_stubs | ||
(language c) | ||
(names binaryen_stubs) | ||
(flags :standard -O2 -Wall -Wextra)) | ||
(c_library_flags :standard -lstdc++ -lpthread)) | ||
``` | ||
|
||
## Library flags | ||
|
||
This package attempts to smooth over configuration frustrations by providing specific `library_flags` when built. | ||
|
||
### MacOS | ||
|
||
In order to support Mac M1, this package assumes you are using `clang++` on MacOS and applies the flags `-cc clang++` to the built library. | ||
|
||
### Windows | ||
|
||
On Windows, this package assumes libbinaryen is built under MinGW and applies the flags `-ccopt -- -ccopt -static` to the built library. | ||
|
||
## Contributing | ||
|
||
You'll need Node.js and [`esy`](https://esy.sh/docs/en/getting-started.html#install-esy) to build this project. | ||
You should be able to use Opam if you are more comfortable with it, but the core team does all development using esy. | ||
|
||
`dune` will take care of compiling Binaryen, so to build the project you'll only need to run: | ||
|
||
```bash | ||
esy | ||
``` | ||
|
||
This will take a while. Once it's done, you can run the tests: | ||
|
||
```bash | ||
esy test | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
(executable | ||
(name library_flags) | ||
(libraries dune.configurator)) | ||
|
||
(rule | ||
(targets library_flags.sexp) | ||
(action | ||
(run ./library_flags.exe))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module C = Configurator.V1 | ||
|
||
let () = | ||
C.main ~name:"library_flags" (fun c -> | ||
let default = [] in | ||
|
||
let library_flags = | ||
match C.ocaml_config_var c "system" with | ||
| Some "macosx" -> | ||
(* These flags preserve the original C++ error behavior. Ref https://github.com/ocaml/ocaml/issues/10423 *) | ||
[ "-cc"; "clang++" ] | ||
| Some "mingw64" -> [ "-ccopt"; "--"; "-ccopt"; "-static" ] | ||
| Some _ -> default | ||
| None -> default | ||
in | ||
|
||
C.Flags.write_sexp "library_flags.sexp" library_flags) |
Oops, something went wrong.