-
Notifications
You must be signed in to change notification settings - Fork 0
/
build
101 lines (92 loc) · 2.14 KB
/
build
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/bin/bash
# hxCurl version 0.1 --- a binding of libCurl for haXe.
# Copyright ©2011 Frank M. Eriksson < http://knarf.se/ >
#
# This software is free software: you can redistribute it and/or modify
# it under the terms of the MIT license, please see file “COPYING” or
# http://opensource.org/licenses/mit-license.php
#
system=`uname`
targetd="dist/release"
mkdir -p dist
build_ndll()
{ # Build the neko ndll for the current platform
echo " → Building hxCurl"
mkdir -p "tmp/$system"
mkdir -p tmp
gcc -c -fPIC ndll/Source/curl_wrap.c -o tmp/curlw.o
gcc -lcurl -shared -Wl,-soname,libcurl_wrap.so \
-o tmp/libcurl_wrap.so tmp/curlw.o
sh -c "mv tmp/libcurl_wrap.so tmp/$system/curl_wrap.ndll" || exit 1
echo " Successfully created Neko FFI module 'curl_wrap.ndll'"
}
build_tools()
{ # build some useful tools
haxe tools/Builder/Compile.hxml
}
run_tests()
{ # assumes CWD is root of package
echo " → Building Unittests"
cd tests
haxe Compile.hxml
cp Server.js ../tmp/Server.js
cd ../tmp
cp $system/curl_wrap.ndll curl_wrap.ndll
echo " → Running Unittests"
node Server.js
cd ..
}
make_release()
{ #
echo " → Assembling the 'release.zip' package"
rm -rf $targetd $targetd.zip
mkdir -p $targetd
generate_documentation
mkdir -p $targetd/ndll/
mkdir -p $targetd/Source
cp -r tmp/$system $targetd/ndll/
cp -r ndll/Source $targetd/
cp -r curl $targetd/
cp haxelib.xml $targetd/haxelib.xml
cd dist
if command -v 7z &>/dev/null; then
7z a -tzip release.zip release > 7z.log
haxelib test release.zip
else
echo " Did not find 7z - release packacke won't be assembled"
echo " You can try to do it manually or install p7zip-full"
fi
cd ..
}
#
#
generate_documentation()
{ # Invoke gendoc script
sh -c "./gendoc"
}
make_clean()
{ # Invoke clean script
sh -c "./clean"
}
if [ $# -eq 0 ] || [ $1 == "all" ]
then
build_ndll
run_tests
make_release
elif [ $1 == "test" ]
then
run_tests
elif [ $1 == "doc" ]
then
generate_documentation
elif [ $1 == "release" ]
then
make_release
elif [ $1 == "clean" ]
then
make_clean
else
echo " → hxCurl Build script -- Usage: "
echo " ./build [all|test|doc|release|clean] "
echo ""
fi