100 lines · 4.0 KB · Text
RawDownload
#!/bin/sh # Copyright 2020-2021 Vircadia contributors.# Copyright 2022-2026 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_$DEBVERSIONif [ -d temp-make-deb ]; then    rm -r temp-make-debfimkdir -p $DEB_BUILD_ROOT # copy the files overcp $OVERTE/build/assignment-client/assignment-client $DEB_BUILD_ROOTcp $OVERTE/build/domain-server/domain-server $DEB_BUILD_ROOTcp $OVERTE/build/tools/oven/oven $DEB_BUILD_ROOT  # Oven is required for pre-baking assetscp $OVERTE/build/libraries/*/*.so $DEB_BUILD_ROOTchrpath -d $DEB_BUILD_ROOT/* # TODO: get Qt from Conan if building without system Qt # Hack: Create libnode.so from libnode.so.108# We don't fail on error, in case libnode is provided by the system already.ln -s $OVERTE/build/conanlibs/Release/libnode.so.* $OVERTE/build/conanlibs/Release/libnode.so || : # "or do nothing"cp $OVERTE/build/conanlibs/Release/*.so $DEB_BUILD_ROOT strip --strip-all $DEB_BUILD_ROOT/*cp $OVERTE/pkg-scripts/new-server $DEB_BUILD_ROOTcp -a $OVERTE/domain-server/resources $DEB_BUILD_ROOTfind $DEB_BUILD_ROOT/resources -name ".gitignore" -deletefind $DEB_BUILD_ROOT/resources -type f -executable -exec sh -c 'chmod -x {}' \;cp $OVERTE/README.md $DEB_BUILD_ROOTcp -a $OVERTE/build/assignment-client/plugins $DEB_BUILD_ROOTstrip --strip-all $DEB_BUILD_ROOT/plugins/*.sostrip --strip-all $DEB_BUILD_ROOT/plugins/*/*.so #begin the debian package constructioncd $DEB_BUILD_ROOTdh_make -p overte-server_$DEBVERSION -c apache -s --createorig -y cp $OVERTE/pkg-scripts/systemd/overte-agents@.service debiancp $OVERTE/pkg-scripts/systemd/overte-asset-server@.service debiancp $OVERTE/pkg-scripts/systemd/overte-audio-mixer@.service debiancp $OVERTE/pkg-scripts/systemd/overte-avatar-mixer@.service debiancp $OVERTE/pkg-scripts/systemd/overte-domain-server@.service debiancp $OVERTE/pkg-scripts/systemd/overte-entity-script-server@.service debiancp $OVERTE/pkg-scripts/systemd/overte-entity-server@.service debiancp $OVERTE/pkg-scripts/systemd/overte-message-mixer@.service debian cp $OVERTE/pkg-scripts/systemd/overte-domain-server@.service debiancp $OVERTE/pkg-scripts/systemd/overte-server@.target debian cp $OVERTE/pkg-scripts/server-compat debian/compatcp $OVERTE/pkg-scripts/server-control debian/controlcp $OVERTE/pkg-scripts/server-prerm debian/prermcp $OVERTE/pkg-scripts/server-postinst debian/postinstcp $OVERTE/pkg-scripts/server-postrm debian/postrmcp $OVERTE/LICENSE debian/copyright echo /etc/opt/overte > debian/dirsecho /var/lib/overte >> debian/dirs echo README.md > debian/docs echo assignment-client opt/overte > debian/installecho domain-server opt/overte >> debian/installecho oven opt/overte >> debian/installecho new-server opt/overte >> debian/installfor so in *.so*; do    echo $so opt/overte/lib >> debian/installdone#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#donefind 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' \; # We look for *.so.*.*.* as well, in case Qt is there.SOFILES=`ls *.so *.so.*.*.* | grep -Po '^(.+\.so(\.\d+)?)' | sed 's/\./\\\./g' | paste -d'|' -s` # 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/rulessed "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