This repository has been archived by the owner on Jun 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.sh
124 lines (109 loc) · 2.93 KB
/
setup.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
#!/bin/sh
rootdir=`pwd`
logfile=setup.log
installdir=$rootdir/vendor
repodir=$installdir/src
if [ ! -d $installdir ]; then
mkdir $installdir
fi
if [ ! -d $repodir ]; then
mkdir $repodir
fi
echo "============================================" >> $logfile
echo "start at" `date` >> $logfile
echo "============================================" >> $logfile
echo "rootdir: ${rootdir}"
echo "logfile: ${logfile}"
echo "repodir: ${repodir}"
echo "installdir: ${installdir}"
echo ""
download_github_repo() {
local owner="$1"
local name="$2"
local version="$3"
echo "downloading $name ..."
wget https://github.com/$owner/$name/archive/$version.zip -O $name-$version.zip
echo "extracting $name ..."
unzip $name-$version.zip >> $logfile
rm $name-$version.zip
mv $name-$version $name
}
setup_xmake_repo() {
xmake config --linkdirs=$installdir/lib --includedirs=$installdir/include --project=.
}
build_xmake_repo() {
xmake build --project=. >> $logfile
xmake install --installdir=$installdir --project=. >> $logfile
}
install_xmake() {
if [ ! -x "$(which xmake)" ]; then
echo "installing xmake ..."
curl -fsSL https://xmake.io/shget.text | bash
source ~/.xmake/profile
fi
}
install_nodejs() {
if [ ! -x "$(which node)" ]; then
echo "please install node.js"
fi
if [ ! -x "$(which npm)" ]; then
echo "please install npm"
fi
}
install_dependencies() {
echo "installing dependencies ..."
sudo apt-get -qq -y install build-essential unzip automake libtool pkg-config libsqlite3-dev libpng-dev libjpeg-dev libxml2-dev libfreetype6-dev libx11-dev
}
install_lcui() {
echo "============================================" >> $logfile
echo "install LCUI" >> $logfile
echo "============================================" >> $logfile
cd $repodir
if [ ! -d "LCUI" ]; then
download_github_repo "lc-soft" "LCUI" "develop"
cd LCUI
./autogen.sh >> $logfile
echo "configuring LCUI ..."
./configure --prefix=$installdir >> $logfile
else
cd LCUI
fi
echo "building LCUI ..."
make >> $logfile
make install >> $logfile
echo "LCUI have been installed"
cd $repodir
}
install_lcdesign() {
echo "============================================" >> $logfile
echo "install lc-design" >> $logfile
echo "============================================" >> $logfile
cd $repodir
if [ ! -d "lc-design" ]; then
download_github_repo "lc-ui" "lc-design" "develop"
cd lc-design
npm install --silent
setup_xmake_repo
else
cd lc-design
fi
echo "building lc-design ..."
build_xmake_repo
npm run build-css >> $logfile
npm run build-font >> $logfile
cp -r $installdir/share/assets ${rootdir}/app/
echo "lc-design have been installed"
cd $repodir
}
install_dependencies
install_xmake
install_nodejs
install_lcui
install_lcdesign
cd $rootdir
if [ ! -d "app/lib" ]; then
mkdir app/lib
fi
cp vendor/lib/*.so.* app/lib
cp vendor/lib/*.so app/lib
echo the building environment has been completed!