File debian.rules of Package teams-for-linux

#!/usr/bin/make -f
# -*- makefile -*-

# for commands pushd popd
export SHELL=/bin/bash

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1

export sourcedir=/usr/src/packages/SOURCES
export pkgdir_head=/usr/src/packages/BUILD/debian
export pkgdir=$(pkgdir_head)/tmp
export icon=$(pkgdir)/usr/share/icons/hicolor/scalable/apps/teams-for-linux.svg
export launcher=$(pkgdir)/usr/bin/teams-for-linux

%:
	echo
	echo "----- Entering section % -----"
	echo
	dh $@
	echo
	echo "----- Exiting section % -----"
	echo
    
override_dh_auto_configure:
	echo
	echo "--- Start override_dh_auto_configure: ---"
	echo
	echo "--- List files ---"
	find /usr/src/packages
	echo "--- End list files ---"
	echo
	# keep:
	# resources/app.asar
	# ressources/assets
	# appstream data
	#
	# remove bundled copy of electron
	rm -vf teams-for-linux
	rm -vf chrome-sandbox
	rm -vf chrome_100_percent.pak
	rm -vf chrome_200_percent.pak
	rm -vf resources.pak
	rm -vf icudtl.dat
	rm -vf libEGL.so
	rm -vf libGLESv2.so
	rm -vf libffmpeg.so
	rm -vf libvk_swiftshader.so
	rm -vf snapshot_blob.bin
	rm -vf v8_context_snapshot.bin
	rm -vrf locales
	rm -vrf swiftshader
	rm -vf vk_swiftshader_icd.json
	#
	asar e resources/app.asar resources
	rm resources/app.asar
	# pushd maybe not as useful in debian.rules makefile
	# since every new line defaults to /usr/src/packages/BUILD/
	pushd resources; dirs -v -l
	#
	# Remove packaged package contents that are unused
	rm resources/node_modules/ajv/.tonic_example.js
	rm resources/node_modules/conf/node_modules/ajv/.runkit_example.js
	rm -f resources/node_modules/conf/node_modules/semver/bin/semver.js
	rm resources/node_modules/mkdirp/bin/cmd.js
	rm -rf resources/node_modules/ajv/scripts/
	#
	#Remove development garbage
	find resources -name '*.orig' -type f -print -delete
	find resources -name '*.bak' -type f -print -delete
	find resources -name '*~' -type f -print -delete
	find resources -name '.*.el' -type f -print -delete
	find resources -name '.eslint*' -type f -print -delete
	find resources -name '.editorconfig' -type f -print -delete
	find resources -name '.gitmodules' -type f -print -delete
	find resources -name '.npmignore' -type f -print -delete
	find resources -name '.tm_properties' -type f -print -delete
	find resources -name '.travis.yml' -type f -print -delete
	find resources -name '.yarn-integrity' -type f -print -delete
	find resources -name '.jshintrc' -type f -print -delete
	find resources -name '.github' -print0 |xargs -r0 -- rm -rvf
	find resources -name '.vscode' -print0 |xargs -r0 -- rm -rvf
	find resources -name '.npmrc' -print0 |xargs -r0 -- rm -rvf
	find resources -name '.nvmrc' -print0 |xargs -r0 -- rm -rvf
	find resources -name '.anylint' -print0 |xargs -r0 -- rm -rvf
	# popd maybe not as useful in debian.rules makefile
	# since every new line defaults to /usr/src/packages/BUILD/
	popd; dirs -v -l
	echo "--- End override_dh_auto_configure: ---"
	echo

override_dh_auto_install:
	echo
	echo "--- Start override_after_dh_auto_install: ---"
	echo
	install -dm755 "$(pkgdir)/usr/share/teams-for-linux" \
	        "$(pkgdir)/usr/bin"
	cp -dr --no-preserve=ownership resources/* \
	   "$(pkgdir)/usr/share/teams-for-linux"
	echo
	find "$(pkgdir)/usr/share/teams-for-linux/node_modules" \
	     -type f -exec chmod 644 {} \;
	echo
	install -Dm644 resources/com.github.IsmaelMartinez.teams_for_linux.appdata.xml \
	        $(pkgdir)/usr/share/metainfo/com.github.IsmaelMartinez.teams_for_linux.appdata.xml
	echo
	install -Dm644 $(sourcedir)/"teams-for-linux.desktop.in" \
	        "$(pkgdir)/usr/share/applications/teams-for-linux.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/teams-for-linux.png"; \
	done
	# Add firejail profile
	install -Dm644 $(sourcedir)/"teams-for-linux-firefox.profile" \
	    "$(pkgdir)/etc/firejail/teams-for-linux-firefox.profile"
	echo
	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
	mkdir -p "$(pkgdir)/usr/bin"
	echo "#!/bin/sh" > $(launcher)
	echo >> $(launcher)
	echo "#" >> $(launcher)
	echo "# Without firejail:" >> $(launcher)
	echo "exec electron \"/usr/share/teams-for-linux\"  \\\"\$$@\\\"" >> $(launcher)
	echo "#" >> $(launcher)
	echo "# With firejail:" >> $(launcher)
	echo "# exec firejail --profile=/etc/firejail/teams-for-linux-firefox.profile electron \"/usr/share/teams-for-linux\"  \\\"\$$@\\\"" >> $(launcher)
	chmod 755 "$(launcher)"
	echo
	echo "--- List files ---"
	find $(pkgdir)
	echo "--- End list files ---"
	echo
	echo "--- End override_dh_auto_install: ---"
	echo
openSUSE Build Service is sponsored by