-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathezscr.nimble
64 lines (52 loc) · 1.92 KB
/
ezscr.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Package
version = "4.3.0"
author = "Thiago Navarro"
description = "Portable and easy Nimscript runner. Nim compiler not needed"
license = "mit"
srcDir = "src"
bin = @["ezscr"]
installExt = @["nim"]
binDir = "build"
# Dependencies
requires "nim >= 1.6.4"
requires "nimscripter"
requires "cligen"
requires "yaml"
requires "util"
from std/strformat import fmt
from std/os import `/`
from std/hashes import hash
const
encodedCounter = hash(CompileTime & CompileDate) and 0x7FFFFFFF
args = fmt"-d:encodedCounter={encodedCounter}"
echo fmt"{encodedCounter=}"
let
nimLibPath = "/data/os/config/.choosenim/toolchains/nim-#head/lib/" # **PLACE HERE YOU NIM LIB DIR**
winArgs = fmt"-d:stdLibPath={nimLibPath}"
task buildRelease, "Builds the release version":
echo "Compiling for the current platform"
exec fmt"nimble -d:danger --opt:speed {args} build"
exec fmt"strip {binDir / bin[0]}"
task buildWinRelease, "Builds the release version for Windows":
echo "Compiling x64 for windows"
exec fmt"nimble -d:danger --opt:speed -d:mingw {winArgs} {args} build"
exec fmt"strip {binDir / bin[0]}.exe"
withDir binDir:
mvFile fmt"{bin[0]}.exe", fmt"{bin[0]}_x64.exe"
# task buildReleaseX86, "Builds the release version x86":
# echo "Compiling x86 for the current platform"
# exec fmt"nimble -d:danger --cpu:i386 --opt:speed {args} build"
# exec fmt"strip {binDir / bin[0]}"
# withDir binDir:
# mvFile bin[0], fmt"{bin[0]}_x86"
task buildWinReleaseX86, "Builds the release version x86 for Windows":
echo "Compiling x86 for windows"
exec fmt"nimble -d:danger --cpu:i386 --opt:speed -d:mingw {winArgs} {args} build"
exec fmt"strip {binDir / bin[0]}.exe"
withDir binDir:
mvFile fmt"{bin[0]}.exe", fmt"{bin[0]}_x86.exe"
task buildAllRelease, "Builds the release version for Windows and Linux":
buildReleaseTask()
buildWinReleaseTask()
# buildReleaseX86Task()
buildWinReleaseX86Task()