Initial commit
This commit is contained in:
commit
42ec914844
|
@ -0,0 +1,3 @@
|
|||
[submodule "usrsctp"]
|
||||
path = usrsctp
|
||||
url = git@github.com:sctplab/usrsctp.git
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
root=$(dirname "$0")
|
||||
|
||||
# install nimterop, if not already installed
|
||||
if ! [ -x "$(command -v toast)" ]; then
|
||||
nimble install -y nimterop@0.6.11
|
||||
fi
|
||||
|
||||
# run make on usrsctp sources
|
||||
cd "${root}/usrsctp" && ./bootstrap && ./configure && make && cd "${root}"
|
||||
|
||||
# add prelude
|
||||
cat "${root}/prelude.nim" > "${root}/usrsctp.nim"
|
||||
|
||||
# dividing line
|
||||
echo >> "${root}/usrsctp.nim"
|
||||
|
||||
# assemble list of C files to be compiled
|
||||
for file in `find ${root}/usrsctp/usrsctplib -name '*.c'`; do
|
||||
compile="${compile} --compile=${file}"
|
||||
done
|
||||
|
||||
# generate nim wrapper with nimterop
|
||||
toast \
|
||||
$compile \
|
||||
--pnim \
|
||||
--preprocess \
|
||||
--noHeader \
|
||||
--defines=NGTCP2_STATICLIB \
|
||||
--replace=sockaddr=SockAddr \
|
||||
--replace=SockAddr_storage=Sockaddr_storage \
|
||||
--replace=socklen_t=SockLen \
|
||||
--includeDirs="${root}/usrsctp/usrsctplib" \
|
||||
"${root}/usrsctp/usrsctplib/usrsctp.h" >> "${root}/usrsctp.nim"
|
|
@ -0,0 +1,15 @@
|
|||
import os
|
||||
import strformat
|
||||
|
||||
# Socket definitions
|
||||
import nativesockets
|
||||
|
||||
when defined(windows):
|
||||
{.passl: "-lws2_32".}
|
||||
|
||||
# C include directories
|
||||
const root = currentSourcePath.parentDir
|
||||
const sourceInclude = root/"sources"/"lib"/"includes"
|
||||
const buildInclude = root/"build"/"lib"/"includes"
|
||||
|
||||
{.passc: fmt"-I{sourceInclude} -I{buildInclude}".}
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 01cc4e042e2235b29d9d489d89728a6f9ac063ed
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue