-
Notifications
You must be signed in to change notification settings - Fork 8
/
.makelib.sh
executable file
·141 lines (101 loc) · 2.38 KB
/
.makelib.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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
binname=libphwidgets.a
outlocation="./slib"
libname="PhWidgets"
libfullname="Photon Widgets"
echo "\023331;0m"
echo "\023333;4m"
print $(basename $0)
print " "
print "Making $libfullname library"
coption=-O3
compiler=qcc
print " "
print "> Compiling objects..."
if [ "$1" == "debug" ]
then
coption=-g
print " Warning: DEBUG compile configuration!"
fi
compilefail=0
for i in $(find ./src/ -name "*.cpp"); do
fname=$(basename $i);
fname="${fname%.*}.o";
while [ -f $fname ]; do
fname="~$fname";
done
print " Compile $fname";
$compiler -Vgcc_ntox86 -lang-c++ $coption -Wall -c $i -o $fname;
if [ $? -ne 0 ]; then
compilefail=2;
fi
done
if [ $compilefail == 1 ]; then
print " Compiled with warnings";
compilefail=0;
fi
print "Done <"
if [ $compilefail == 0 ]; then
print " "
print "> Making lib-file..."
if [ -d "$outlocation" ]; then
if [ -d "./old" ]; then
rm -r "./old"
fi
mkdir -p "./old"
mv "$outlocation" "./old"
fi
mkdir -p "$outlocation"
mkdir -p "$outlocation/$libname"
ar -x ./src/service/stdex/lib/libstdex.a
if(ar rsc "$outlocation/$libname/$binname" *.o)
then
print " Static library packed"
if(ranlib "$outlocation/$libname/$binname")
then
hcount=0;
for i in $(find ./src/ -name "*.h*"); do
hdir=$(dirname $i);
hdir=$(echo $hdir | sed -e "s/.\/src/.\/slib\/$libname\/include/g");
mkdir -p $hdir;
cp -f $i $hdir;
hcount=$((hcount+1));
done
for i in $(find ./src/ -type f ! -name "*.*"); do
hdir=$(dirname $i);
hdir=$(echo $hdir | sed -e "s/.\/src/.\/slib\/$libname\/include/g");
mkdir -p $hdir;
cp -f $i $hdir;
hcount=$((hcount+1));
done
cp "./etc/AbWidgetsWrap.cpp" "$outlocation/"
cp "./etc/.linklib.sh" "$outlocation/$libname/"
chmod a+rwx "$outlocation/$libname/.linklib.sh"
print " $hcount headers included"
print " Static library created"
print " Success!"
print "Done <"
else
rm -r "$outlocation"
print " Can't run static library"
print "Fail <"
echo "Press enter to continue..."
read
fi
else
rm -r "$outlocation"
print " Can't pack static library"
print "Fail <"
echo "Press enter to continue..."
read
fi
else
print "Some errors in compilation"
print "Fail <"
echo "Press enter to continue..."
read
fi
print " "
print "> Deleting temporary objects..."
rm -r *.o
print "Done <"
print " "