forked from Alexey-T/CudaText_up
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcudaup.sh
More file actions
executable file
·162 lines (151 loc) · 2.91 KB
/
cudaup.sh
File metadata and controls
executable file
·162 lines (151 loc) · 2.91 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
#!/bin/bash
#set -e
OS="linux"
CPU="$HOSTTYPE"
DoGet='false'
DoInstallLibs='false'
DoMake='false'
DoClean='false'
lazdir=$(which lazbuild 2> /dev/null) && \
lazdir=$(readlink -f "$lazdir") && \
lazdir=$(dirname "$lazdir")
usage="
Usage: $(basename $0) [OPTION...]
Options:
-g --get download sources
-p --packs install packages to Lazarus
-m --make compile CudaText
-l --lazdir <directiory> set Lazarus directory
-o --os <system> set target OS (win32/win64/linux/freebsd/darwin)
-c --cpu <arch> set target CPU (i386/x86_64/arm)
--clean cleaning src/*/*/lib/*-* directories from
compiled objects
-h --help show this message
"
[ $# -eq 0 ] && { echo "$usage"; exit 0; }
OPTIONS=hgpml:o:c:
LONGOPTS=clean,help,get,packs,make,lazdir:,os:,cpu:
! PARSED=$(getopt --options=$OPTIONS --longoptions=$LONGOPTS --name "$0" -- "$@")
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
echo "$usage"
exit 2
fi
eval set -- "$PARSED"
while true; do
case "$1" in
--clean)
DoClean=true
shift
;;
-g|--get)
DoGet=true
shift
;;
-m|--make)
DoMake=true
shift
;;
-h|--help)
echo "$usage"
exit 0
;;
-l|--lazdir)
lazdir="$2"
shift 2
;;
-c|--cpu)
CPU=$@
shift 2
;;
-o|--os)
OS=$2
shift 2
;;
-p|--packs)
DoInstallLibs=true
shift
;;
--)
shift
break
;;
esac
done
if [ -z "$lazdir" ]; then
echo "Couldn't find Lazarus directory"
echo "Use -l <path> option"
exit 1
fi
if [ ! -x "$lazdir/lazbuild" ]; then
echo "Couldn't find lazbuild"
echo "Use -l <path> option"
exit 1
fi
cd $(dirname "$0")
Repos=$(cat cudaup.repos)
Packets=$(cat cudaup.packets)
if [ $DoClean = 'true' ]
then
if [ -d src ]
then
rm -rf src/*/*/lib/*-*
fi
fi
if [ $DoGet = 'true' ]
then
mkdir -m=rw-rw-rw -pv 'src'
cd src
for i in $Repos
do
temp=${i/'https://github.com/Alexey-T/'/''}
[ ! -d "$temp/.git" ] && git clone "$i"
cd "$temp"
git pull origin master
cd ../
done
cd ../
fi
if [ $DoInstallLibs = 'true' ]
then
for i in $Packets
do
"$lazdir/lazbuild" -q --lazarusdir="$lazdir" "./src/$i"
"$lazdir/lazbuild" -q --lazarusdir="$lazdir" --add-package "./src/$i"
done
"$lazdir/lazbuild" -q --build-ide=
fi
if [ $DoMake = 'true' ]
then
inc=''
if [ $OS != 'linux' ]
then
inc="$inc --os=$OS"
fi
if [ $OS = 'win32' ]
then
CPU='i386'
fi
if [ $OS = 'win64' ]
then
CPU='x86_64'
fi
if [ $CPU != "$HOSTTYPE" ]
then
inc="$inc --cpu=$CPU"
fi
if [ $DoInstallLibs = 'false' ]
then
for i in $Packets
do
"$lazdir/lazbuild" $inc -q --lazarusdir="$lazdir" "./src/$i"
done
fi
"$lazdir/lazbuild" $inc -q --lazarusdir="$lazdir" "./src/CudaText/app/cudatext.lpi"
mkdir -pv "./bin/$OS-$CPU"
if [ $OS = 'win32' ] || [ $OS = 'win64' ]
then
cp ./src/CudaText/app/cudatext.exe ./bin/$OS-$CPU/cudatext.exe
else
cp ./src/CudaText/app/cudatext ./bin/$OS-$CPU/cudatext
fi
fi