ponyprog/create_rpm_package.sh
2020-01-22 01:32:46 +01:00

41 lines
807 B
Bash
Executable File

#!/bin/bash
CMD=$(type -p cmake)
if [ ! -x "$CMD" ]; then
# not found exit
echo "please install cmake and restart this script"
exit 1
fi
# CMD=$(type -p rpmbuild)
#
# if [ ! -x "$CMD" ]; then
# # not found exit
# echo "please install rpmbuild and restart this script"
# exit 1
# fi
CPU_NUM=$(nproc --all)
echo "cpu cores: $CPU_NUM"
DIRECTORY="build-rpm"
if [ ! -d "$DIRECTORY" ]; then
# Control will enter here if $DIRECTORY exists.
mkdir "$DIRECTORY"
fi
# because of removing of all files in directory
if [ -d "$DIRECTORY" ]; then
cd "$DIRECTORY"
rm * -rf
cmake -DUSE_DEBUGGER=OFF -DUSE_QT5=ON -DUDEV_INSTALL_DIR="/usr/lib/udev/rules.d" ..
make -j$CPU_NUM
strip -s ponyprog
make package-binary-rpm
cd ..
mv ./$DIRECTORY/ponyprog*.rpm .
fi