-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·54 lines (45 loc) · 1.19 KB
/
build.sh
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
#!/bin/sh
echo -e "\033[32;1;4mBuilding libtorr.a\033[0m"
ninja
if [ "$1" != "release" ]
then
echo -e "\033[32;1;4mBuilding and running tests\033[0m"
cd ./tests/
./build_tests.sh
cd ..
fi
if [ "$1" == "release" ]
then
cp ./source ./include -r
find "./include" -type f -name "*.cpp" -print0 | while read -d $'\0' file
do
rm $file
done
mkdir release
mv libtorr.a release
mv ./include/ ./release/
echo -e "\033[32;1;4mRelease built\033[0m"
echo -e "\033[34;1minclude/ and libtorr.a found in ./release/\033[0m"
fi
# TODO: single file header
#if [ "$1" == "release" ]
#then
# find "./source" -type f -name "*.hpp" -print0 | while read -d $'\0' file
# do
# tail -n +2 "$file" >> torr.hpp
# done
# find "./source" -type f -name "*.hpp" -print0 | while read -d $'\0' file
# do
# file="${file//\//\\\/}"
# file=${file:11}
# echo $file
# sed -i '/^#include <'$file'>/d' torr.hpp
# done
# sed -i '/^#include "/d' torr.hpp
# sed '/^#include/d' torr.hpp > temp
# mv temp torr.hpp
# sed '/^#pragma/d' torr.hpp > temp
# echo '#pragma once' | cat - temp > torr.hpp
# rm temp
#fi
ninja -t clean