-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnat_traversal.nimble
37 lines (31 loc) · 1.22 KB
/
nat_traversal.nimble
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
mode = ScriptMode.Verbose
packageName = "nat_traversal"
version = "0.0.1"
author = "Status Research & Development GmbH"
description = "miniupnpc and libnatpmp wrapper"
license = "Apache License 2.0 or MIT"
installDirs = @["vendor"]
### Dependencies
requires "nim >= 1.6.0",
"results"
proc compileStaticLibraries() =
var cc = getEnv("CC", "")
if cc.len == 0:
cc = "gcc"
putEnv("CC", cc)
withDir "vendor/miniupnp/miniupnpc":
when defined(windows):
exec("mingw32-make -f Makefile.mingw libminiupnpc.a")
else:
exec("make build/libminiupnpc.a")
withDir "vendor/libnatpmp-upstream":
when defined(windows):
# We really need to override CC on the Make command line, here, because of:
# https://github.com/miniupnp/libnatpmp/blob/4536032ae32268a45c073a4d5e91bbab4534773a/Makefile#L51
exec("mingw32-make OS=mingw CC=\"" & cc & "\" CFLAGS=\"-Wall -Os -DWIN32 -DNATPMP_STATICLIB -DENABLE_STRNATPMPERR -DNATPMP_MAX_RETRIES=4\" libnatpmp.a")
else:
exec("make CFLAGS=\"-Wall -Os -DENABLE_STRNATPMPERR -DNATPMP_MAX_RETRIES=4\" libnatpmp.a")
task buildBundledLibs, "build bundled libraries":
compileStaticLibraries()
before install:
compileStaticLibraries()