-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompileandrun
executable file
·77 lines (62 loc) · 1.64 KB
/
compileandrun
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
#!/bin/bash
cd "$(dirname "$0")/../"
pth="$PWD/System"
echo "Sync start."
rm -rf "$PWD/System"
mkdir -p "$PWD/System"
cp -r "$PWD/Source/" "$PWD/System/"
rm -rf "$PWD/System/.git"
rm -rf "$PWD/System/.gitattributes"
rm -rf "$PWD/System/.gitignore"
rm -rf "$PWD/System/README.md"
rm -rf "$PWD/System/compileandrun"
echo "Sync done."
# .sh
LIST=$(find "$pth" -name *.sh -depth)
echo "$LIST" | while read line
do
cd "$(dirname "$line")"
echo "PROCESSING: $line"
shc -r -f "$line" 2>/dev/null
gcc "$line.x.c" -o "$line"
name=$(echo "$line" | cut -f 1 -d '.')
mv "$name.sh" "$name" 2>/dev/null
done
find "$pth" -name *.sh.x.c -depth -exec rm {} \;
# .framework
LIST=$(find "$pth" -name *.sh -depth)
echo "$LIST" | while read line
do
name=$(echo "$line" | cut -f 1 -d '.')
chmod +x "$name.framework/exec.sh" 2>/dev/null
mv "$name.framework/exec.sh" "$name.framework/exec" 2>/dev/null
done
# .init
LIST=$(find "$pth" -name *.sh -depth)
echo "$LIST" | while read line
do
name=$(echo "$line" | cut -f 1 -d '.')
chmod +x "$name.init/exec.sh" 2>/dev/null
mv "$name.init/exec.sh" "$name.init/exec" 2>/dev/null
done
# .hxe
LIST=$(find "$pth" -name *.hxe -depth)
echo "$LIST" | while read line
do
cd "$(dirname "$line")"
echo "PROCESSING: $line"
shc -r -f "$line" 2>/dev/null
gcc "$line.x.c" -o "$line"
name=$(echo "$line" | cut -f 1 -d '.')
mv "$name.sh" "$name" 2>/dev/null
done
find "$pth" -name *.hxe.x.c -depth -exec rm {} \;
find "$pth" -name *.sh.x -depth -exec rm {} \;
cd "$pth"
if [[ "$1" == "norun" ]]; then
exit 0
elif [[ "$1" == "pkg" ]]; then
zip -rq "image.zip" . -x ".*" -x "__MACOSX"
exit 0
fi
"$PWD/boot/init" "$1" "$2" "$3" "$4" "$5" "$6"