run-upstream-build/main.sh

72 lines
1.7 KiB
Bash
Raw Normal View History

2024-07-27 20:12:37 +02:00
#! /bin/bash
set -e
. ./pika-build-config.sh
2024-07-27 20:48:07 +02:00
VERSION="$PIKA_PACKAGE_VERSION"
2024-07-27 20:12:37 +02:00
2024-07-27 21:09:38 +02:00
echo "$PIKA_BUILD_ARCH" > pika-build-arch
2024-07-31 16:15:03 +02:00
# Get source code
2024-07-31 16:14:33 +02:00
if [[ "$PIKA_PACKAGE_NAME" == *-dmo ]];
then
apt-get source "$PIKA_PACKAGE_NAME" -y
else
apt-get source "$PIKA_PACKAGE_NAME=$VERSION" -y
fi
2024-07-27 20:48:07 +02:00
2024-07-27 22:28:56 +02:00
if [ "$PIKA_REBUILD" = true ]
then
2024-07-27 20:48:07 +02:00
VERSION="$VERSION+$PIKA_REBUILD_VERSION"
fi
2024-07-27 20:12:37 +02:00
# Get build deps
2024-07-27 20:48:07 +02:00
#LOGNAME=root dh_make --createorig -y -l -p src-pkg-name_"$VERSION" || echo "dh-make: Ignoring Last Error"
2024-07-27 22:28:56 +02:00
# Enter build dir
2024-07-27 21:30:05 +02:00
cd $(find ./ -maxdepth 1 -name "$PIKA_PACKAGE_NAME*" -type d | head -1)
2024-07-27 22:28:56 +02:00
# DO PATCHING
2024-08-05 22:06:27 +02:00
if git clone --depth=1 https://git.pika-os.com/upstream-patches/"$PIKA_PACKAGE_NAME".git ../patches
2024-07-27 22:28:56 +02:00
then
if cat ./debian/source/format | grep 'quilt'
then
2024-08-05 22:32:16 +02:00
cp -rvf ../patches/patches ./debian/
2024-07-27 22:28:56 +02:00
cat ../series >> ./debian/patches/series
else
for i in $(cat ../series)
do
echo "Applying Patch: $i"
patch -Np1 -i ../patches/patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2"
2024-07-27 22:28:56 +02:00
done
fi
fi
# Reversion changelog
if [ "$PIKA_REBUILD" = true ]
then
CHANGELOG_DATE=$(date '+%a, %d %b %Y %H:%M:%S %z')
CHANGELOG_APPEND="$PIKA_PACKAGE_NAME ($VERSION) pika; urgency=medium\n\n * PikaOS 4 Rebuild.\n\n -- Ward Nakchbandi <hotrod.master@hotmail.com> $CHANGELOG_DATE\n"
2024-07-27 22:33:45 +02:00
sed -i "1s/^/$CHANGELOG_APPEND\n/" debian/changelog
2024-08-04 21:17:16 +02:00
if [ -f debian/control ]
then
sed -i "s#source:Version#binary:Version#g" debian/control
fi
if [ -f debian/control.in ]
then
sed -i "s#source:Version#binary:Version#g" debian/control.in
fi
2024-07-27 22:28:56 +02:00
fi
2024-08-03 18:17:35 +02:00
# Get build deps
apt-get build-dep ./ -y
2024-07-27 22:28:56 +02:00
# Build Binary Packages
dpkg-buildpackage --no-sign
2024-07-27 20:12:37 +02:00
# Move the debs to output
cd ../
mkdir -p ./output
mv ./*.deb ./output/