Added "plugins" folder required for audio codecs. Created make-rpm-server script to help automate. RPM deps slimmed down.

This commit is contained in:
Heather Anderson 2020-02-01 05:55:54 +00:00
parent 65602f7801
commit d2a2687e6c
4 changed files with 105 additions and 43 deletions

View file

@ -16,8 +16,39 @@ Ubuntu:
is located at ../..
Amazon Linux 2:
ATHENA=~/Athena rpmbuild --target x86_64 -bb ./athena-server.spec
./athena-server.spec
This command takes an ATHENA environment variable set to the base folder and attempts to build
an .rpm file. The result will be in ~/rpmbuild/RPMS. The version number is currently
hardcoded inside of the athena-server.spec file
This script will retrieve the current git commit date and hash and assemble a version from it.
It will attempt construct a .deb file in the pkg-scripts folder, assuming the Athena base folder
is located at ../..
Results:
The following directory structure is created for binaries:
/opt/athena - executables
/opt/athena/lib - private shared libraries required for executables
/opt/athena/resources - files required by domain-server administrative website
/opt/athena/plugins - files required by assignment-client, mainly for audio codecs
The following systemd services are installed in /usr/lib/systemd/system:
athena-assignment-client.service
athena-domain-server.service
athena-server.target - used to launch/shutdown the two prior services
athena-assignment-client@.service
athena-domain-server@.service
athena-server@.target - used to launch/shutdown the two prior services
The top three services in this list are the "normal" services that launch Athena
in the typical fashion. The bottom three services are "template" services designed
to permit multiple services to be installed and running on a single machine.
The script "/opt/athena/new-server serverName basePort" will do the necessary
setup for a new domain with the specified server name and port. Upon installation
the package will create and launch a domain named "default" at base port 40100.
The domain name here has nothing to do with the name people will use to find your
domain and has nothing to do with "place names", it is only used to locate the files
used to configure and run the domain on your server.
The server stores its files in the following locations:
/var/lib/athena/.local - "unnamed" services (the default location for Athena servers)
/var/lib/athena/serverName - "named" (template) domains
/etc/opt/athena - environment variables when launching named domains

View file

@ -1,7 +1,10 @@
#ATHENA=~/Athena rpmbuild --target x86_64 -bb athena-server.spec
%define version %{lua:print(os.getenv("VERSION"))}
%define depends %{lua:print(os.getenv("DEPENDS"))}
Name: athena-server
Version: 0.86.0_K1_20200128_486c7bde5bedf152e70fc63281f14da26ecec738
Release: 2%{?dist}
Version: %{version}
Release: 1%{?dist}
Summary: Project Athena metaverse platform, based on the High Fidelity Engine.
License: ASL 2.0
@ -10,7 +13,7 @@ Source0: https://github.com/daleglass/athena-builder/blob/master/athena_b
#BuildRequires: systemd-rpm-macros
BuildRequires: chrpath
Requires: alsa-lib, cups, glib2, gtk3, libdrm, libinput, libjpeg-turbo, libtiff, libxkbcommon, libxkbcommon-x11, mesa-libEGL, mesa-libGL, mesa-libgbm, pcre2, pcre2-utf16, sqlite, xkeyboard-config, zlib, at-spi2-core, dbus, fontconfig, harfbuzz, libICE, libSM, libicu, libmng, libpng, libproxy, libxcb, openssl, pcre, pulseaudio-libs, unixODBC, xcb-util-image, xcb-util-keysyms, xcb-util-renderutil, xcb-util-wm, libxcb, nss, jsoncpp, libxslt, libvpx, libicu, libxml2, opus, libicu, libwebp, libXtst
Requires: %{depends}
BuildArch: x86_64
AutoReq: no
AutoProv: no
@ -31,7 +34,9 @@ rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/opt/athena
install -m 0755 -t $RPM_BUILD_ROOT/opt/athena $ATHENA/build/assignment-client/assignment-client
install -m 0755 -t $RPM_BUILD_ROOT/opt/athena $ATHENA/build/domain-server/domain-server
install -m 0755 -t $RPM_BUILD_ROOT/opt/athena $ATHENA/build/tools/oven/oven
#install -m 0755 -t $RPM_BUILD_ROOT/opt/athena $ATHENA/build/ice-server/ice-server
strip --strip-all $RPM_BUILD_ROOT/opt/athena/*
chrpath -d $RPM_BUILD_ROOT/opt/athena/*
install -m 0755 -t $RPM_BUILD_ROOT/opt/athena $ATHENA/source/pkg-scripts/new-server
install -d $RPM_BUILD_ROOT/opt/athena/lib
@ -45,21 +50,28 @@ install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/lib $ATHENA/qt5-install/lib/libQt5
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/lib $ATHENA/qt5-install/lib/libQt5Qml.so.*.*.*
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/lib $ATHENA/qt5-install/lib/libQt5ScriptTools.so.*.*.*
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/lib $ATHENA/build/ext/makefiles/quazip/project/lib/libquazip5.so.*.*.*
install -d $RPM_BUILD_ROOT/opt/athena/systemd
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-assignment-client.service
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-assignment-client@.service
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-domain-server.service
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-domain-server@.service
#install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-ice-server.service
#install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-ice-server@.service
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-server.target
install -m 0644 -t $RPM_BUILD_ROOT/opt/athena/systemd $ATHENA/source/pkg-scripts/athena-server@.target
install -d $RPM_BUILD_ROOT/usr/lib/systemd/system
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-assignment-client.service
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-assignment-client@.service
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-domain-server.service
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-domain-server@.service
#install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-ice-server.service
#install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-ice-server@.service
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-server.target
install -m 0644 -t $RPM_BUILD_ROOT/usr/lib/systemd/system $ATHENA/source/pkg-scripts/athena-server@.target
cp -a $ATHENA/source/domain-server/resources $RPM_BUILD_ROOT/opt/athena
cp -a $ATHENA/build/assignment-client/plugins $RPM_BUILD_ROOT/opt/athena
chrpath -d $RPM_BUILD_ROOT/opt/athena/plugins/*.so
chrpath -d $RPM_BUILD_ROOT/opt/athena/plugins/*/*.so
strip --strip-all $RPM_BUILD_ROOT/opt/athena/plugins/*.so
strip --strip-all $RPM_BUILD_ROOT/opt/athena/plugins/*/*.so
find $RPM_BUILD_ROOT/opt/athena/resources -name ".gitignore" -delete
%files
%license $ATHENA/source/LICENSE
/opt/athena
/usr/lib/systemd/system
%changelog
@ -70,32 +82,6 @@ cp -a $ATHENA/source/domain-server/resources $RPM_BUILD_ROOT/opt/athena
getent passwd athena >/dev/numm 2>&1 || useradd -r -c "Project Athena" -d /var/lib/athena -U -M athena
#getent group athena >/dev/null 2>&1 || groupadd -r athena
# create system scripts
if [ ! -e "/usr/lib/systemd/system/athena-assignment-client.service" ]; then
ln -s /opt/athena/systemd/athena-assignment-client.service /usr/lib/systemd/system/athena-assignment-client.service
fi
if [ ! -e "/usr/lib/systemd/system/athena-assignment-client@.service" ]; then
ln -s /opt/athena/systemd/athena-assignment-client@.service /usr/lib/systemd/system/athena-assignment-client@.service
fi
if [ ! -e "/usr/lib/systemd/system/athena-domain-server.service" ]; then
ln -s /opt/athena/systemd/athena-domain-server.service /usr/lib/systemd/system/athena-domain-server.service
fi
if [ ! -e "/usr/lib/systemd/system/athena-domain-server@.service" ]; then
ln -s /opt/athena/systemd/athena-domain-server@.service /usr/lib/systemd/system/athena-domain-server@.service
fi
#if [ ! -e "/usr/lib/systemd/system/athena-ice-server.service" ]; then
# ln -s /opt/athena/systemd/athena-ice-server.service /usr/lib/systemd/system/athena-ice-server.service
#fi
#if [ ! -e "/usr/lib/systemd/system/athena-ice-server@.service" ]; then
# ln -s /opt/athena/systemd/athena-ice-server@.service /usr/lib/systemd/system/athena-ice-server@.service
#fi
if [ ! -e "/usr/lib/systemd/system/athena-server.target" ]; then
ln -s /opt/athena/systemd/athena-server.target /usr/lib/systemd/system/athena-server.target
fi
if [ ! -e "/usr/lib/systemd/system/athena-server@.target" ]; then
ln -s /opt/athena/systemd/athena-server@.target /usr/lib/systemd/system/athena-server@.target
fi
# create data folder
mkdir -p /etc/opt/athena
mkdir -p /var/lib/athena && chown athena:athena /var/lib/athena && chmod 775 /var/lib/athena
@ -103,6 +89,8 @@ mkdir -p /var/lib/athena && chown athena:athena /var/lib/athena && chmod 775 /va
ldconfig -n /opt/athena/lib
if [ ! -d "/var/lib/athena/default" ]; then
/opt/athena/new-server default 40100
systemctl enable athena-server@default.target
systemctl start athena-server@default.target
fi
%systemd_post athena-assignment-client.service

View file

@ -14,6 +14,7 @@ mkdir -p $DEB_BUILD_ROOT
# copy the files over
cp $ATHENA/build/assignment-client/assignment-client $DEB_BUILD_ROOT
cp $ATHENA/build/domain-server/domain-server $DEB_BUILD_ROOT
cp $ATHENA/build/tools/oven/oven $DEB_BUILD_ROOT
#cp $ATHENA/build/ice-server/ice-server $DEB_BUILD_ROOT
chrpath -d $DEB_BUILD_ROOT/*
cp $ATHENA/qt5-install/lib/libQt5Network.so.*.*.* $DEB_BUILD_ROOT
@ -32,6 +33,9 @@ cp -a $ATHENA/source/domain-server/resources $DEB_BUILD_ROOT
find $DEB_BUILD_ROOT/resources -name ".gitignore" -delete
cp $ATHENA/source/README.md $DEB_BUILD_ROOT
cp $ATHENA/source/README_hifi.md $DEB_BUILD_ROOT
cp -a $ATHENA/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
@ -59,6 +63,7 @@ echo README_hifi.md >> debian/docs
echo assignment-client opt/athena > debian/install
echo domain-server opt/athena >> debian/install
echo oven opt/athena >> debian/install
#echo ice-server opt/athena >> debian/install
echo new-server opt/athena >> debian/install
for so in *.so.*.*.*; do
@ -71,6 +76,7 @@ done
# echo $target opt/athena/systemd >> debian/install
#done
find resources -type f -exec sh -c 'echo {} opt/athena/$(dirname "{}") >> debian/install' \;
find plugins -type f -exec sh -c 'echo {} opt/athena/$(dirname "{}") >> debian/install' \;
#echo usr/lib/systemd/system/athena-assignment-client.service opt/athena/systemd/athena-assignment-client.service > debian/athena-server.links
#echo usr/lib/systemd/system/athena-assignment-client@.service opt/athena/systemd/athena-assignment-client@.service >> debian/athena-server.links
@ -81,7 +87,7 @@ find resources -type f -exec sh -c 'echo {} opt/athena/$(dirname "{}") >> debian
#echo usr/lib/systemd/system/athena-server.target opt/athena/systemd/athena-server.target >> debian/athena-server.links
#echo usr/lib/systemd/system/athena-server@.target opt/athena/systemd/athena-server@.target >> debian/athena-server.links
DEPENDS=`find * -maxdepth 0 -type f -executable -exec sh -c 'objdump -p {} | grep NEEDED' \; | awk '{print $2}' | sort | uniq | grep -v ^libQt5 | grep -v ^libquazip | xargs -n 1 -I {} sh -c 'dpkg -S {} | head -n 1' | cut -d ':' -f 1 | sort | uniq | paste -d',' -s`
DEPENDS=`find * -type f -executable -exec sh -c 'objdump -p {} | grep NEEDED' \; | awk '{print $2}' | sort | uniq | grep -v ^libQt5 | grep -v ^libquazip | xargs -n 1 -I {} sh -c 'dpkg -S {} | head -n 1' | cut -d ':' -f 1 | sort | uniq | paste -d',' -s`
cp $ATHENA/source/pkg-scripts/server-rules debian/rules
sed "s/{DEPENDS}/$DEPENDS/" $ATHENA/source/pkg-scripts/server-control > debian/control

37
pkg-scripts/make-rpm-server Executable file
View file

@ -0,0 +1,37 @@
#!/bin/sh
ATHENA=`realpath ../..`
GITDATE=`git log -n 1 --format=raw | grep author | cut -d' ' -f 4 | xargs -I {} date -d @{} +"%Y%m%d"`
GITCOMMIT=`git rev-parse HEAD | cut -c 1-7`
VERSION=0.86.0_K1_${GITDATE}_${GITCOMMIT}
DEPENDS=mesa-libGL,`ls \
$ATHENA/build/assignment-client/assignment-client \
$ATHENA/build/domain-server/domain-server \
$ATHENA/build/tools/oven/oven \
$ATHENA/qt5-install/lib/libQt5Network.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Core.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Widgets.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Gui.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Script.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Quick.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5WebSockets.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5Qml.so.*.*.* \
$ATHENA/qt5-install/lib/libQt5ScriptTools.so.*.*.* \
$ATHENA/build/ext/makefiles/quazip/project/lib/libquazip5.so.*.*.* \
$ATHENA/build/assignment-client/plugins/*.so \
$ATHENA/build/assignment-client/plugins/*/*.so \
| xargs -I {} sh -c 'objdump -p {} | grep NEEDED' \
| awk '{print $2}' \
| sort | uniq \
| grep -v ^libQt5 | grep -v ^libquazip | grep -v ^libGL \
| xargs -I {} sh -c "ldconfig -p | grep {} | tr ' ' '\n' | grep /" \
| xargs rpm -qf --queryformat "%{NAME}\n" \
| sort | uniq \
| paste -d',' -s`
sudo yum install chrpath
export VERSION DEPENDS ATHENA
rpmbuild --target x86_64 -bb ./athena-server.spec
mv ~/rpmbuild/RPMS/x86_64/*.rpm .