3
0
Fork 0
mirror of https://github.com/JulianGro/overte.git synced 2025-04-17 19:17:34 +02:00
overte-JulianGro/pkg-scripts/make-deb-server
Julian Groß 710a674d5d
Update Debian packaging for Conan.
Looking at the code, it was always pretty hacky and more or less worked coincidentally. So for now, the "fix" is also a hack.
2025-02-27 12:32:02 +01:00

98 lines
3.8 KiB
Bash
Executable file

#!/bin/sh
# Copyright 2020-2021 Vircadia contributors.
# Copyright 2022-2025 Overte e.V.
# SPDX-License-Identifier: Apache-2.0
if [ "$OVERTE" = "" ]; then
OVERTE=`realpath ..`
fi
sudo apt-get install chrpath binutils dh-make
DEB_BUILD_ROOT=temp-make-deb/overte-server_$DEBVERSION
if [ -d temp-make-deb ]; then
rm -r temp-make-deb
fi
mkdir -p $DEB_BUILD_ROOT
# copy the files over
cp $OVERTE/build/assignment-client/assignment-client $DEB_BUILD_ROOT
cp $OVERTE/build/domain-server/domain-server $DEB_BUILD_ROOT
cp $OVERTE/build/tools/oven/oven $DEB_BUILD_ROOT # Oven is required for pre-baking assets
cp $OVERTE/build/libraries/*/*.so $DEB_BUILD_ROOT
chrpath -d $DEB_BUILD_ROOT/*
# TODO: get Qt from Conan if building without system Qt
# hack: we get libnode.so.108 from conan-libs folder, because the dpkg command at the end of this file cannot always find libnode
cp $OVERTE/build/conanlibs/Release/libnode.so.108 $DEB_BUILD_ROOT
# hack: we get libttb.so.12 from conan-libs folder, because the dpkg command at the end of this file cannot always find libtbb12
cp $OVERTE/build/conanlibs/Release/libttb.so.12 $DEB_BUILD_ROOT
strip --strip-all $DEB_BUILD_ROOT/*
cp $OVERTE/pkg-scripts/new-server $DEB_BUILD_ROOT
cp -a $OVERTE/domain-server/resources $DEB_BUILD_ROOT
find $DEB_BUILD_ROOT/resources -name ".gitignore" -delete
find $DEB_BUILD_ROOT/resources -type f -executable -exec sh -c 'chmod -x {}' \;
cp $OVERTE/README.md $DEB_BUILD_ROOT
cp -a $OVERTE/build/assignment-client/plugins $DEB_BUILD_ROOT
strip --strip-all $DEB_BUILD_ROOT/plugins/*.so
strip --strip-all $DEB_BUILD_ROOT/plugins/*/*.so
#begin the debian package construction
cd $DEB_BUILD_ROOT
dh_make -p overte-server_$DEBVERSION -c apache -s --createorig -y
cp $OVERTE/pkg-scripts/overte-assignment-client.service debian
cp $OVERTE/pkg-scripts/overte-assignment-client@.service debian
cp $OVERTE/pkg-scripts/overte-domain-server.service debian
cp $OVERTE/pkg-scripts/overte-domain-server@.service debian
cp $OVERTE/pkg-scripts/overte-server.target debian
cp $OVERTE/pkg-scripts/overte-server@.target debian
cp $OVERTE/pkg-scripts/server-compat debian/compat
cp $OVERTE/pkg-scripts/server-control debian/control
cp $OVERTE/pkg-scripts/server-prerm debian/prerm
cp $OVERTE/pkg-scripts/server-postinst debian/postinst
cp $OVERTE/pkg-scripts/server-postrm debian/postrm
cp $OVERTE/LICENSE debian/copyright
echo /etc/opt/overte > debian/dirs
echo /var/lib/overte >> debian/dirs
echo README.md > debian/docs
echo assignment-client opt/overte > debian/install
echo domain-server opt/overte >> debian/install
echo oven opt/overte >> debian/install
echo new-server opt/overte >> debian/install
for so in *.so*; do
echo $so opt/overte/lib >> debian/install
done
#for service in *.service; do
# echo $service opt/overte/systemd >> debian/install
#done
#for target in *.target; do
# echo $target opt/overte/systemd >> debian/install
#done
find resources -type f -exec sh -c 'echo {} opt/overte/$(dirname "{}") >> debian/install' \;
find plugins -type f -exec sh -c 'echo {} opt/overte/$(dirname "{}") >> debian/install' \;
if [ ! "$OVERTE_USE_SYSTEM_QT" ]; then
SOFILES=`ls *.so *.so.*.*.* | grep -Po '^(.+\.so(\.\d+)?)' | sed 's/\./\\\./g' | paste -d'|' -s`
else
SOFILES=`ls *.so | grep -Po '^(.+\.so(\.\d+)?)' | sed 's/\./\\\./g' | paste -d'|' -s`
fi
# dpkg -S can only find packages which are already installed on the system.
DEPENDS=`find * -path debian -prune -o -type f -executable -exec sh -c 'objdump -p {} | grep NEEDED' \; \
| awk '{print $2}' | sort | uniq | egrep -v "^($SOFILES)$" \
| xargs -n 1 -I {} sh -c 'dpkg -S {} | head -n 1' | cut -d ':' -f 1 | sort | uniq | paste -d',' -s`
cp $OVERTE/pkg-scripts/server-rules debian/rules
sed "s/{DEPENDS}/$DEPENDS/" $OVERTE/pkg-scripts/server-control > debian/control
dpkg-buildpackage -us -uc
mv $OVERTE/pkg-scripts/temp-make-deb/*.deb $OVERTE/pkg-scripts/ # move package out of temp-make-deb