-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·59 lines (59 loc) · 1.84 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
55
56
57
58
59
#!/bin/bash
if [ ! `which qmake-qt5` ]; then
echo "You must first install qt5-devel"
echo "...on fedora:"
echo " sudo dnf -y install make gcc-c++ gdb qt5*-devel"
echo " #if you get package conflicts, try:"
echo " sudo dnf -y upgrade --refresh && sudo dnf -y install make gcc-c++ gdb qt5*-devel"
echo " #or:"
echo " sudo dnf -y upgrade --refresh && sudo dnf -y install make gcc-c++ gdb qt5-devel"
exit 1
fi
package_name="outputinspector"
makefile_name="Makefile"
# pro_name="outputinspector.pro"
# remove Makefile, since in .gitignore, and generated by pro file:
rm Makefile
if [ ! -f "$makefile_name" ]; then
echo "creating Makefile..."
# normally pro file can be specified as param after options, but not needed since detected:
qmake-qt5 -o $makefile_name
else
echo "using existing $makefile_name"
fi
build_config="Debug"
release_flag="QT_NO_DEBUG"
echo "detecting configuration by checking $makefile_name for $release_flag..."
if grep -q $release_flag "$makefile_name"; then
build_config="Release"
fi
echo "detected configuration: $build_config"
pro_dir=`pwd`
build_dir_rel="../build-$package_name-Desktop-$build_config"
if [ ! -d "$build_dir_rel" ]; then
mkdir "$build_dir_rel"
fi
if [ -f "$build_dir_rel/$package_name" ]; then
mv -f "$build_dir_rel/$package_name" "$build_dir_rel/$package_name.old"
fi
make
#doesn't work for some reason:
#cd $build_dir_rel
#echo "in `pwd`..."
#make $pro_dir
if [ -f "$package_name" ]; then
mv -f $package_name "$build_dir_rel/"
fi
build_artifact="moc_predefs.h"
if [ -f "$build_artifact" ]; then
mv -f "$build_artifact" "$build_dir_rel/"
fi
if [ -f "$build_dir_rel/$package_name" ]; then
echo "successfully built $build_dir_rel/$package_name"
echo "You can now run:"
echo " sudo ./install.sh"
echo " #to install $package_name"
else
echo "failed to build $build_dir_rel/$package_name"
fi
#cd $pro_dir