Skip to content

Commit

Permalink
Merge pull request #89 from qzhuyan/dev/william/compile-msquic-2.0
Browse files Browse the repository at this point in the history
msquic 2.0
  • Loading branch information
qzhuyan authored May 12, 2022
2 parents 868d5af + 3c31600 commit fb9619a
Show file tree
Hide file tree
Showing 43 changed files with 1,509 additions and 1,117 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/hex_pub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
push:
tags:
- '*'

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2

- name: Publish to Hex.pm
uses: erlangpack/github-action@v1
env:
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
20 changes: 15 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
retention-days: 1

- name: build rel tar file
if: startsWith(github.ref, 'refs/tags/v')
if: startsWith(github.ref, 'refs/tags/')
run: |
export PATH="/usr/local/opt/erlang@${{ matrix.otp }}/bin:$PATH"
make tar
Expand All @@ -66,9 +66,7 @@ jobs:
strategy:
matrix:
otp:
- 22.3.4.9
- 23.2
- 24.0.2
[22.3.4.9, 23.3.4.5, 24.3.3]
build_type:
- RelWithDebInfo
- Debug
Expand Down Expand Up @@ -115,6 +113,18 @@ jobs:
fi
make ci
- name: gdb bt
if: failure()
run: |
which gdb || sudo apt install gdb
corefile=$(find _build/test -name core)
if [ -n $corefile ]; then
gdb -ex bt $(erl -noshell -eval 'io:format(code:root_dir()),halt()')/erts-*/bin/beam.smp "${corefile}"
else
echo "No coredump found"
fi
- name: Archive CT Logs
uses: actions/upload-artifact@v2
if: failure()
Expand Down Expand Up @@ -161,7 +171,7 @@ jobs:
if: startsWith(github.event.ref, 'refs/tags/')
strategy:
matrix:
otp: [22.3.4.9, 23.2, 24.0.2]
otp: [22.3.4.9, 23.3.4.5, 24.3.3]
os:
- linux
arch:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ _checkouts/

# nif dynamic linked lib
priv/*.so
priv/*lttng.*
priv/*.dylib

# language server caches
Expand Down
28 changes: 28 additions & 0 deletions BUILD.ubuntu20.04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# BUILD on ubuntu 20.04

## Install build chain

```sh
sudo apt-add-repository ppa:lttng/stable-2.13
sudo apt-get update
sudo apt-get install -y lttng-tools lttng-modules-dkms babeltrace liblttng-ust-dev build-essential cmake
```

## Install OTP
```
wget https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_24.3.3-1~ubuntu~focal_amd64.deb
sudo apt install ./esl-erlang_24.3.3-1~ubuntu~focal_amd64.deb
```

## Fetch rebar3

``` bash
wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3
export PATH=$PATH:./
```

## then

```bash
make
```
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ project(quicer)
SET(Erlang_EI_INCLUDE_DIRS ${Erlang_OTP_LIB_DIR}/${Erlang_EI_DIR}/include)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/priv/)

# For cerl picking up the OTP_ROOT
if (DEFINED ENV{Erlang_OTP_ROOT_DIR})
SET(Erlang_OTP_ROOT_DIR $ENV{Erlang_OTP_ROOT_DIR})
else()
EXECUTE_PROCESS(
COMMAND erl -noshell -eval "io:format(\"~s\", [code:root_dir()])" -s erlang halt
OUTPUT_VARIABLE Erlang_OTP_ROOT_DIR
)
endif()

if (DEFINED ENV{CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
Expand All @@ -30,6 +35,12 @@ if (DEFINED ENV{QUICER_USE_SNK})
add_compile_options(-DQUICER_USE_SNK)
endif()

if (DEFINED ENV{QUICER_USE_SANITIZERS})
set(QUIC_ENABLE_SANITIZERS "ON")
add_compile_options(-O1 -fno-omit-frame-pointer -fsanitize=address,leak,undefined)
add_link_options(-O1 -fno-omit-frame-pointer -fsanitize=address,leak,undefined)
endif()

set(QUIC_BUILD_TEST "OFF")
set(QUIC_BUILD_TOOLS "OFF")
set(QUIC_BUILD_PERF "OFF")
Expand Down
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ all: compile
.PHONY: default
default: build-nif

.PHONY: default
.PHONY: build-nif
build-nif:
./get-msquic.sh v1.8.0
./get-msquic.sh v2.0.2
cmake -B c_build
make -j $(JOBS) -C c_build

Expand Down Expand Up @@ -61,11 +61,19 @@ check: clang-format

.PHONY: clang-format
clang-format:
clang-format-10 --Werror --dry-run c_src/*
clang-format-11 --Werror --dry-run c_src/*

.PHONY: ci
ci: test dialyzer

.PHONY: tar
tar:
$(REBAR) tar

.PHONY: doc
doc:
rebar3 as doc ex_doc

.PHONY: publish
publish:
rebar3 as doc hex publish
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ Port = 4567,
LOptions = [ {cert, "cert.pem"}
, {key, "key.pem"}
, {alpn, ["sample"]}
, {peer_bidi_stream_count, 1}
],
{ok, L} = quicer:listen(Port, LOptions),
{ok, Conn} = quicer:accept(L, [], 5000),
{ok, Conn} = quicer:accept(L, [], 120000),
{ok, Conn} = quicer:handshake(Conn),
{ok, Stm} = quicer:accept_stream(Conn, []),
receive {quic, <<"ping">>, Stm, _, _, _} -> ok end,
Expand Down
Loading

0 comments on commit fb9619a

Please sign in to comment.