2021-10-10 23:15:27 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
# For clean build, remove $SHADOW folder
|
|
|
|
# To trigger qmake, remove $SHADOW/*/Makefile
|
|
|
|
|
2021-10-10 23:15:27 +03:00
|
|
|
##########
|
|
|
|
# Configuration
|
|
|
|
##########
|
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
export APP_NAME=$(grep "Name" $(find . -regextype egrep -regex "\.\/rpm\/[a-z0-9_-]*\.(yaml|spec)" -print | head -1) | awk '{print $2}')
|
2022-08-10 00:23:24 +03:00
|
|
|
export SFOS_VER=4.4.0.58
|
2021-10-10 23:15:27 +03:00
|
|
|
|
|
|
|
##########
|
2022-08-10 00:33:53 +03:00
|
|
|
# Paths and versions
|
2021-10-10 23:15:27 +03:00
|
|
|
##########
|
|
|
|
|
|
|
|
export ORIG_PATH=$PATH
|
|
|
|
export PROJECT=$PWD
|
|
|
|
export PRO_FILE=$PROJECT/$APP_NAME.pro
|
|
|
|
export SHADOW=$PROJECT/shadow
|
|
|
|
export RPM_DEST_DIR=$PROJECT/RPMS
|
|
|
|
|
2022-08-10 00:33:53 +03:00
|
|
|
export APP_VER=$(grep "Version" $(find . -regextype egrep -regex "\.\/rpm\/[a-z0-9_-]*\.(yaml|spec)" -print | head -1) | awk '{print $2}')
|
|
|
|
export APP_REL=$(grep "Release" $(find . -regextype egrep -regex "\.\/rpm\/[a-z0-9_-]*\.(yaml|spec)" -print | head -1) | awk '{print $2}')
|
|
|
|
|
2021-10-10 23:15:27 +03:00
|
|
|
##########
|
|
|
|
# Build function. Ran once per architecture
|
|
|
|
##########
|
|
|
|
|
|
|
|
function build() {
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ ! -d "$HOME/SailfishOS/mersdk/targets/SailfishOS-$SFOS_VER-$ARCH.default" ]
|
|
|
|
then
|
|
|
|
echo Invalid build target.
|
|
|
|
echo $HOME/SailfishOS/mersdk/targets/SailfishOS-$SFOS_VER-$ARCH.default
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
export PATH="$HOME/SailfishOS/bin:$HOME/SailfishOS/mersdk/targets/SailfishOS-$SFOS_VER-$ARCH.default/usr/lib/qt5/bin:$HOME/.config/SailfishSDK/libsfdk/build-target-tools/Sailfish SDK Build Engine/SailfishOS-$SFOS_VER-$ARCH.default:$ORIG_PATH"
|
2021-10-10 23:15:27 +03:00
|
|
|
export SFDK_OPTIONS="-c target=SailfishOS-$SFOS_VER-$ARCH"
|
2021-10-11 01:15:09 +03:00
|
|
|
sfdk config --global --push no-fix-version
|
2021-10-10 23:15:27 +03:00
|
|
|
cd $PROJECT
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ ! -d "$SHADOW" ]
|
|
|
|
then
|
|
|
|
mkdir $SHADOW
|
|
|
|
fi
|
2021-10-10 23:15:27 +03:00
|
|
|
cd $SHADOW
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ ! -d "$ARCH" ]
|
|
|
|
then
|
|
|
|
mkdir $ARCH
|
|
|
|
fi
|
2021-10-10 23:15:27 +03:00
|
|
|
cd $ARCH
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ ! -f "Makefile" ]
|
2021-10-10 23:15:27 +03:00
|
|
|
then
|
|
|
|
sfdk qmake $PROJECT -recursive
|
|
|
|
fi
|
|
|
|
sfdk make
|
|
|
|
sfdk package
|
2021-10-11 01:15:09 +03:00
|
|
|
# perl-rename -v 's/\+.{29}//g' RPMS/*.rpm
|
2021-10-10 23:15:27 +03:00
|
|
|
cp -f -v RPMS/*.rpm $RPM_DEST_DIR/
|
|
|
|
cd $PROJECT
|
|
|
|
}
|
|
|
|
|
|
|
|
##########
|
|
|
|
# Build the packages
|
|
|
|
##########
|
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
RPM_NOARCH=0
|
|
|
|
if [ $(grep "^BuildArch:\W*noarch$" $(find . -regextype egrep -regex "\.\/rpm\/[a-z0-9_-]*\.(yaml|spec)" -print) | wc -l) -gt 0 ]
|
|
|
|
then
|
|
|
|
RPM_NOARCH=1
|
|
|
|
fi
|
2021-10-10 23:15:27 +03:00
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ ! -d "$RPM_DEST_DIR" ]
|
|
|
|
then
|
|
|
|
mkdir $RPM_DEST_DIR
|
|
|
|
fi
|
2021-10-10 23:15:27 +03:00
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ $RPM_NOARCH -eq 0 ]
|
|
|
|
then
|
|
|
|
export ARCH=aarch64
|
|
|
|
build
|
2021-10-10 23:15:27 +03:00
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
export ARCH=armv7hl
|
|
|
|
build
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Use i486 for noarch build
|
2021-10-10 23:15:27 +03:00
|
|
|
export ARCH=i486
|
|
|
|
build
|
|
|
|
|
|
|
|
##########
|
|
|
|
# Run the validator only once
|
|
|
|
##########
|
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ $RPM_NOARCH -gt 0 ]
|
|
|
|
then
|
|
|
|
RPM_ARCH=noarch
|
|
|
|
else
|
|
|
|
RPM_ARCH=$ARCH
|
|
|
|
fi
|
|
|
|
|
|
|
|
export RPM_FILE=$(ls RPMS/*$RPM_ARCH.rpm | head -1)
|
2021-10-10 23:15:27 +03:00
|
|
|
|
2021-11-24 22:39:20 +03:00
|
|
|
if [ -f "$RPM_FILE" ]
|
|
|
|
then
|
|
|
|
$HOME/SailfishOS/bin/sfdk engine exec rpmvalidation -t SailfishOS-$SFOS_VER-$ARCH.default $(ls RPMS/*$RPM_ARCH.rpm | head -1)
|
2022-08-10 00:33:53 +03:00
|
|
|
echo
|
|
|
|
echo "Changelog:"
|
|
|
|
echo
|
|
|
|
echo ${APP_VER}-${APP_REL}
|
|
|
|
sed '/^$/Q' rpm/${APP_NAME}.changes | tail +2 | cut -c3-
|
|
|
|
echo
|
2021-11-24 22:39:20 +03:00
|
|
|
else
|
|
|
|
echo "RPM package not found, not validating."
|
|
|
|
fi
|