File PKGBUILD of Package teams-for-linux
# Maintainer: tbd
_sourcedir=/usr/src/packages/SOURCES
pkgname=teams-for-linux
pkgver=1.4.18
pkgrel=1
pkgdesc="Unofficial Microsoft Teams client for Linux using Electron."
arch=("aarch64" "armv7h" "i686" "x86_64")
url="https://github.com/IsmaelMartinez/${pkgname}"
license=("GPL3")
depends=("gtk3" "libxss" "nss")
makedepends=("node-gyp" "yarn" "nodejs" "cpio" "asar")
source=(
"${pkgname}-${pkgver}.tar.gz::https://github.com/IsmaelMartinez/${pkgname}/archive/v${pkgver}.tar.gz"
"${pkgname}.desktop"
)
sha512sums=("SKIP" "SKIP")
build() {
echo "Sources are in:"
echo " /usr/src/packages/SOURCES"
echo
ls -al /usr/src/packages/SOURCES
echo
echo "\${srcdir}=${srcdir}"
#ls -al "${srcdir}"
echo
echo
echo "Current dir:"
pwd
echo "ls -al"
ls -al
cd "${srcdir}/${pkgname}-${pkgver}"
echo
echo "Current dir:"
pwd
echo
echo
echo
echo
#echo "--- List files ---"
#find .
#echo "--- End list files ---"
echo
echo
echo
echo
#
# keep:
# app.asar
# ressources/assets
# appstream data
# remove bundled copy of electron
echo "ls -al"
ls -al
rm ${pkgname}
rm chrome-sandbox
rm chrome_100_percent.pak
rm chrome_200_percent.pak
rm resources.pak
rm icudtl.dat
rm libEGL.so
rm libGLESv2.so
rm libffmpeg.so
rm libvk_swiftshader.so
rm snapshot_blob.bin
rm v8_context_snapshot.bin
rm -rf locales
rm -rf swiftshader
rm vk_swiftshader_icd.json
asar e resources/app.asar resources
rm resources/app.asar
pushd resources
# Remove packaged package contents that are unused
rm node_modules/ajv/.tonic_example.js
rm node_modules/conf/node_modules/ajv/.runkit_example.js
rm -f node_modules/conf/node_modules/semver/bin/semver.js
rm node_modules/mkdirp/bin/cmd.js
rm -rf node_modules/ajv/scripts/
#Remove development garbage
find -name '*.orig' -type f -print -delete
find -name '*.bak' -type f -print -delete
find -name '*~' -type f -print -delete
find -name '.*.el' -type f -print -delete
find -name '.eslint*' -type f -print -delete
find -name '.editorconfig' -type f -print -delete
find -name '.gitmodules' -type f -print -delete
find -name '.npmignore' -type f -print -delete
find -name '.tm_properties' -type f -print -delete
find -name '.travis.yml' -type f -print -delete
find -name '.yarn-integrity' -type f -print -delete
find -name '.jshintrc' -type f -print -delete
find -name '.github' -print0 |xargs -r0 -- rm -rvf
find -name '.vscode' -print0 |xargs -r0 -- rm -rvf
find -name '.npmrc' -print0 |xargs -r0 -- rm -rvf
find -name '.nvmrc' -print0 |xargs -r0 -- rm -rvf
find -name '.anylint' -print0 |xargs -r0 -- rm -rvf
popd
}
package() {
# teams-for-linux.svg
export icon=${pkgdir}/usr/share/icons/hicolor/scalable/apps/${pkgname}.svg
echo
echo "Sources are in:"
echo " /usr/src/packages/SOURCES"
echo
ls -al /usr/src/packages/SOURCES
echo
echo
echo "\${_sourcedir}=${_sourcedir}"
#ls -al "${_sourcedir}"
echo
echo "Current dir:"
pwd
echo "ls -al"
ls -al
echo
cd "${srcdir}/${pkgname}-${pkgver}"
install -dm755 "${pkgdir}/usr/bin"
install -dm755 "${pkgdir}/usr/share/${pkgname}" \
"${pkgdir}/usr/bin"
cp -dr --no-preserve=ownership resources/* \
"${pkgdir}/usr/share/${pkgname}"
find "${pkgdir}/usr/share/${pkgname}/node_modules" \
-type f -exec chmod 644 {} \;
install -Dm644 resources/com.github.IsmaelMartinez.teams_for_linux.appdata.xml \
${pkgdir}/usr/share/metainfo/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
install -Dm644 ${_sourcedir}/"${pkgname}.desktop.in" \
"${pkgdir}/usr/share/applications/${pkgname}.desktop"
for size in 1024x1024 512x512 256x256 128x128 96x96 64x64 48x48 32x32 24x24 16x16; do
install -Dm644 "${_sourcedir}/${size}.png" \
"${pkgdir}/usr/share/icons/hicolor/${size}/apps/${pkgname}.png"
done
# Add firejail profile
install -Dm644 ${_sourcedir}/"${pkgname}-firefox.profile" \
"${pkgdir}/etc/firejail/${pkgname}-firefox.profile"
# Check if this is needed:
install -Dm644 resources/com.github.IsmaelMartinez.teams_for_linux.appdata.xml \
${pkgdir}/usr/share/metainfo/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
mkdir -p "${pkgdir}/usr/share/icons/hicolor/scalable/apps/"
echo "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"256\" height=\"256\" viewBox=\"0 0 67.7 67.7\">" > ${icon}
echo " <defs>" >> ${icon}
echo " <path id=\"a\" fill-opacity=\".2\" fill-rule=\"nonzero\" d=\"M277.7 145H258a32.1 32.1 0 0 0 29 18.3v-9.1c0-5-4.2-9.2-9.2-9.2z\"/>" >> ${icon}
echo " </defs>" >> ${icon}
echo " <g fill-rule=\"evenodd\" stroke-linejoin=\"round\" stroke-miterlimit=\"1.4\" clip-rule=\"evenodd\" transform=\"translate(-29.2 -11.1) scale(.22436)\">" >> ${icon}
echo " <circle cx=\"286.9\" cy=\"131.3\" r=\"32.1\" fill=\"#7b83eb\"/>" >> ${icon}
echo " <path fill-opacity=\".1\" fill-rule=\"nonzero\" d=\"M284.6 138.1h-29v.7l.2.6a32.3 32.3 0 0 0 38 23.2v-15.3c0-5-4.2-9.2-9.2-9.2z\"/>" >> ${icon}
echo " <use xlink:href=\"#a\" fill-opacity=\".2\" fill-rule=\"nonzero\"/>" >> ${icon}
echo " <circle cx=\"359.1\" cy=\"141.6\" r=\"24.1\" fill=\"#5059c9\"/>" >> ${icon}
echo " <g fill-rule=\"nonzero\">" >> ${icon}
echo " <path fill=\"#5059c9\" d=\"M379.7 172.5h-54c-2.5 0-4.5 2-4.5 4.4v55.7a35.3 35.3 0 0 0 27.3 35A34.4 34.4 0 0 0 390 234v-51c0-5.7-4.7-10.4-10.3-10.4z\"/>" >> ${icon}
echo " <path fill=\"#7b83eb\" d=\"M341.9 182.8v65.4a55 55 0 0 1-110 0v-65.4c0-5.7 4.6-10.3 10.3-10.3h89.4c5.6 0 10.3 4.6 10.3 10.3z\"/>" >> ${icon}
echo " <use xlink:href=\"#a\" fill-opacity=\".2\"/>" >> ${icon}
echo " <path fill-opacity=\".1\" d=\"M293.8 172.5v87.1c0 4.3-3 8-7.2 8.9-.6.2-1.3.3-2 .3H236a57.5 57.5 0 0 1-4-20.7v-65.3c0-5.7 4.6-10.3 10.3-10.3z\"/>" >> ${icon}
echo " <path fill-opacity=\".2\" d=\"M286.9 172.5v94a7 7 0 0 1-.3 2 9.1 9.1 0 0 1-8.9 7.1h-38.4a49.3 49.3 0 0 1-5.7-13.7 56.6 56.6 0 0 1-1.7-13.8v-65.3c0-5.7 4.6-10.3 10.3-10.3zm0 0v80.2c0 5-4.2 9.2-9.2 9.2h-44.1a56.6 56.6 0 0 1-1.7-13.8v-65.3c0-5.7 4.6-10.3 10.3-10.3zm-44.7 0c-5.7 0-10.3 4.6-10.3 10.3v65.3c0 4.7.6 9.3 1.7 13.8h37.3c5 0 9-4.2 9.1-9.2v-80.2Z\"/>" >> ${icon}
echo " <path fill=\"#4b53bc\" d=\"M179.2 145h91.6c5 0 9.2 4.1 9.2 9.2v91.6c0 5-4.1 9.2-9.2 9.2h-91.6c-5 0-9.2-4.1-9.2-9.2v-91.6c0-5 4.1-9.2 9.2-9.2z\"/>" >> ${icon}
echo " <path fill=\"#fff\" d=\"M252.4 179.2h-20.6v55.1h-13.5v-55.1h-20.7v-13.5h54.8z\"/>" >> ${icon}
echo " </g>" >> ${icon}
echo " <path fill=\"none\" d=\"M170 90h220v220H170Z\"/>" >> ${icon}
echo " </g>" >> ${icon}
echo "</svg>" >> ${icon}
echo
echo
echo
echo
echo "--- List files that will be packaged ---"
find ${pkgdir} | sed "a|${pkgdir}||g"
echo "--- End list files that will be packaged ---"
echo
echo
echo
echo
}