Updated MAC build scripts
This commit is contained in:
parent
3533b9f64e
commit
572d9591f9
|
@ -4,67 +4,78 @@
|
|||
actual_path=$(pwd)
|
||||
|
||||
# Get the path of LogDoctor-git's folder and move in
|
||||
docdir="$(dirname $(realpath $0))"
|
||||
docdir="$(dirname $0)"
|
||||
cd "$docdir"
|
||||
|
||||
# Check cmake availability
|
||||
# Check CMake availability
|
||||
if [[ $(which cmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake not found in PATH, please add it or compilation won't socceed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check Qt availability
|
||||
if [[ $(which qmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Qt-clang not found in PATH, please add it or compilation won't socceed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check the existence of a previous executable file
|
||||
if [ -e /Applications/LogDoctor.app ]
|
||||
then
|
||||
while true;
|
||||
do
|
||||
echo "Warning: the path /Applications/LogDoctor.app already exists"
|
||||
printf "If you choose to continue, the actual content will be overwritten\nContinue? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
then
|
||||
while true;
|
||||
do
|
||||
echo "Warning: the path /Applications/LogDoctor.app already exists"
|
||||
printf "If you choose to continue, the actual content will be overwritten\nContinue? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y" | [yY][eE][sS])
|
||||
printf "\n"
|
||||
break
|
||||
;;
|
||||
*)
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
# Start the compilation process
|
||||
echo "Starting compilation process"
|
||||
|
||||
# Make a build folder
|
||||
if [ -d build ]
|
||||
then
|
||||
rm -r build
|
||||
fi
|
||||
mkdir build && cd build
|
||||
|
||||
# Prepare the cmake files
|
||||
cmake ../logdoctor -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Build the project
|
||||
cmake --build ./ --target all
|
||||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
# compiled succesfully
|
||||
echo "Done compiling"
|
||||
chmod 755 ./LogDoctor
|
||||
mv LogDoctor ../installation_stuff/LogDoctor.app/bin/
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# compiled succesfully
|
||||
chmod 755 ./LogDoctor.app/Contents/MacOS/LogDoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
|
@ -75,73 +86,86 @@ echo "Starting installation process"
|
|||
cd ../installation_stuff/
|
||||
|
||||
if [ -e ~/Lybrary/Preferences/LogDoctor ]
|
||||
then
|
||||
if [ -e ~/Lybrary/Preferences/LogDoctor/logdoctor.conf ]
|
||||
then
|
||||
if [ -e ~/Lybrary/Preferences/LogDoctor/logdoctor.conf ]
|
||||
then
|
||||
# A configuration file already exists
|
||||
while true;
|
||||
do
|
||||
echo "Warning: a configuration file already exists"
|
||||
printf "If you choose 'YES' the current file will be overwritten\nIf you choose 'NO' the current file will be kept\nOverwrite? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y")
|
||||
printf "\n"
|
||||
cp --no-preserve=all ./logdoctor.conf ~/Lybrary/Preferences/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
break
|
||||
;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
else
|
||||
mkdir -p ~/Lybrary/Preferences/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/Lybrary/Preferences/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp --no-preserve=all ./logdoctor.conf ~/Lybrary/Preferences/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
# A configuration file already exists
|
||||
while true;
|
||||
do
|
||||
echo "Warning: a configuration file already exists"
|
||||
printf "If you choose 'YES' the current file will be overwritten\nIf you choose 'NO' the current file will be kept\nOverwrite? [y/n] : "
|
||||
read agree
|
||||
case "$agree"
|
||||
in
|
||||
"y" | "Y" | [yY][eE][sS])
|
||||
printf "\n"
|
||||
cp ./logdoctor.conf ~/Lybrary/Preferences/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
break
|
||||
;;
|
||||
"n" | "N" | [nN][oO])
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Invalid answer"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e ~/Lybrary/Application Support/LogDoctor ]
|
||||
else
|
||||
mkdir -p ~/Lybrary/Application Support/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/Lybrary/Application Support/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/help ~/Lybrary/Application Support/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
else
|
||||
mkdir -p ~/Lybrary/Preferences/LogDoctor
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
echo "Error: failed to create directory: ~/Lybrary/Preferences/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp --no-preserve=all ./LogDoctor.app ./LogDoctor.app.copy
|
||||
sudo mv ./LogDoctor.app.copy /Applications/LogDoctor.app
|
||||
if [[ "$?" != "0" ]]
|
||||
cp ./logdoctor.conf ~/Lybrary/Preferences/LogDoctor/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
echo "Error: failed to copy configuration file"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -e ~/"Lybrary/Application Support/LogDoctor" ]
|
||||
then
|
||||
mkdir -p ~/"Lybrary/Application Support/LogDoctor"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: ~/Lybrary/Application Support/LogDoctor"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
if [ ! -e ~/"Lybrary/Application Support/LogDoctor/help" ]
|
||||
then
|
||||
rm -r ~/"Lybrary/Application Support/LogDoctor/help"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to remove old resources: ~/Lybrary/Application Support/LogDoctor/help"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
cp -r ./logdocdata/help ~/"Lybrary/Application Support/LogDoctor/"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp -r ./osx_bundle/* ../build/LogDoctor.app/Contents/
|
||||
sudo mv ../build/LogDoctor.app /Applications/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Installation finished
|
||||
|
|
|
@ -4,24 +4,33 @@
|
|||
actual_path=$(pwd)
|
||||
|
||||
# Get the path of LogDoctor-git's folder and move in
|
||||
docdir="$(dirname $(realpath $0))"
|
||||
docdir="$(dirname $0)"
|
||||
cd "$docdir"
|
||||
|
||||
# Check cmake availability
|
||||
if [[ $(which cmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake is not installed"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Cmake not found in PATH, please add it or compilation won't socceed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check Qt availability
|
||||
if [[ $(which qmake) =~ ^/ ]]
|
||||
then
|
||||
$()
|
||||
else
|
||||
echo "Error: Qt-clang not found in PATH, please add it or compilation won't socceed"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Check the existence of a previous executable file
|
||||
if [ ! -e /Applications/LogDoctor.app ]
|
||||
then
|
||||
echo "Warning: no previous installation detected, please run the installation script instead"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
echo "Warning: no previous installation detected, please run the installation script instead"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Start the compilation process
|
||||
echo "Starting compilation process"
|
||||
|
@ -32,25 +41,23 @@ mkdir build && cd build
|
|||
# Prepare the cmake files
|
||||
cmake ../logdoctor -DCMAKE_BUILD_TYPE=MinSizeRel
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# an error occured during preparation
|
||||
echo "Error: failed to prepare cmake files"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Build the project
|
||||
cmake --build ./ --target all
|
||||
if [[ "$?" == "0" ]]
|
||||
then
|
||||
# compiled succesfully
|
||||
echo "Done compiling"
|
||||
chmod 755 ./LogDoctor
|
||||
mv LogDoctor ../installation_stuff/LogDoctor.app/bin/
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
then
|
||||
# compiled succesfully
|
||||
chmod 755 ./LogDoctor.app/Contents/MacOS/LogDoctor
|
||||
else
|
||||
# an error occured during compilation
|
||||
echo "Error: failed to compile"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Compilation finished
|
||||
wait
|
||||
|
@ -62,29 +69,39 @@ cd ../installation_stuff/
|
|||
|
||||
|
||||
if [ ! -e ~/"Lybrary/Application Support/LogDoctor" ]
|
||||
then
|
||||
mkdir -p ~/"Lybrary/Application Support/LogDoctor"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
mkdir -p ~/"Lybrary/Application Support/LogDoctor"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to create directory: '~/Lybrary/Application Support/LogDoctor'"
|
||||
exit
|
||||
fi
|
||||
cp -r --no-preserve=all ./logdocdata/help ~/"Lybrary/Application Support/LogDoctor"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
echo "Error: failed to create directory: '~/Lybrary/Application Support/LogDoctor'"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cd ../build
|
||||
cp --no-preserve=all ./LogDoctor.app ./LogDoctor.app.copy
|
||||
sudo mv ./LogDoctor.app.copy /Applications/LogDoctor.app
|
||||
if [[ "$?" != "0" ]]
|
||||
fi
|
||||
if [ ! -e ~/"Lybrary/Application Support/LogDoctor/help" ]
|
||||
then
|
||||
rm -r ~/"Lybrary/Application Support/LogDoctor/help"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
echo "Error: failed to remove old resources: ~/Lybrary/Application Support/LogDoctor/help"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
cp -r ./logdocdata/help ~/"Lybrary/Application Support/LogDoctor"
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy LogDoctor's data"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
cp ./osx_bundle/* ../build/LogDoctor.app/Contents/
|
||||
sudo rm -r /Applications/LogDoctor.app
|
||||
sudo mv ../build/LogDoctor.app /Applications/
|
||||
if [[ "$?" != "0" ]]
|
||||
then
|
||||
echo "Error: failed to copy the executable"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
# Update finished
|
||||
|
|
Loading…
Reference in New Issue